Commit 6cb57575 authored by Chunchi Che's avatar Chunchi Che

Merge branch 'feat/ui/chat' into 'main'

add chat ui

See merge request !46
parents 68c94d96 b1f7376c
Pipeline #18796 passed with stages
in 3 minutes and 32 seconds
...@@ -2,12 +2,14 @@ import React, { useEffect } from "react"; ...@@ -2,12 +2,14 @@ import React, { useEffect } from "react";
import { useAppSelector } from "../../../hook"; import { useAppSelector } from "../../../hook";
import { selectMeHint, selectOpHint } from "../../../reducers/duel/hintSlice"; import { selectMeHint, selectOpHint } from "../../../reducers/duel/hintSlice";
import { selectCurrentPhase } from "../../../reducers/duel/phaseSlice"; import { selectCurrentPhase } from "../../../reducers/duel/phaseSlice";
import { selectChat } from "../../../reducers/chatSlice";
import { notification } from "antd"; import { notification } from "antd";
const HintNotification = () => { const HintNotification = () => {
const meHint = useAppSelector(selectMeHint); const meHint = useAppSelector(selectMeHint);
const opHint = useAppSelector(selectOpHint); const opHint = useAppSelector(selectOpHint);
const currentPhase = useAppSelector(selectCurrentPhase); const currentPhase = useAppSelector(selectCurrentPhase);
const chat = useAppSelector(selectChat);
const [api, contextHolder] = notification.useNotification(); const [api, contextHolder] = notification.useNotification();
useEffect(() => { useEffect(() => {
...@@ -32,10 +34,21 @@ const HintNotification = () => { ...@@ -32,10 +34,21 @@ const HintNotification = () => {
if (currentPhase) { if (currentPhase) {
api.info({ api.info({
message: `<当前阶段>${currentPhase}`, message: `<当前阶段>${currentPhase}`,
placement: "topRight",
}); });
} }
}, [currentPhase]); }, [currentPhase]);
useEffect(() => {
if (chat !== "") {
api.info({
message: "Chat",
description: chat,
placement: "topLeft",
});
}
}, [chat]);
return <>{contextHolder}</>; return <>{contextHolder}</>;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment