Commit 71744c0f authored by chechunchi's avatar chechunchi

optimize notification style

parent 9fba97a3
Pipeline #21543 passed with stages
in 17 minutes and 51 seconds
...@@ -6,7 +6,7 @@ import Draggable from "react-draggable"; ...@@ -6,7 +6,7 @@ import Draggable from "react-draggable";
export interface DragModalProps extends ModalProps {} export interface DragModalProps extends ModalProps {}
const Style = { const style = {
borderStyle: "groove", borderStyle: "groove",
borderRadius: "8px", borderRadius: "8px",
backgroundColor: "#303030", backgroundColor: "#303030",
...@@ -39,7 +39,7 @@ export const DragModal = (props: DragModalProps) => { ...@@ -39,7 +39,7 @@ export const DragModal = (props: DragModalProps) => {
{...props} {...props}
modalRender={(modal) => ( modalRender={(modal) => (
<Draggable bounds={bounds} onStart={onStart}> <Draggable bounds={bounds} onStart={onStart}>
<div ref={dragRef} style={Style}> <div ref={dragRef} style={style}>
{modal} {modal}
</div> </div>
</Draggable> </Draggable>
......
...@@ -7,6 +7,12 @@ import { ygopro } from "@/api"; ...@@ -7,6 +7,12 @@ import { ygopro } from "@/api";
import { useConfig } from "@/config"; import { useConfig } from "@/config";
import { matStore } from "@/stores"; import { matStore } from "@/stores";
const style = {
borderStyle: "groove",
borderRadius: "8px",
backgroundColor: "#303030",
};
const MsgWin = ygopro.StocGameMessage.MsgWin; const MsgWin = ygopro.StocGameMessage.MsgWin;
const NeosConfig = useConfig(); const NeosConfig = useConfig();
...@@ -19,34 +25,36 @@ export const HintNotification = () => { ...@@ -19,34 +25,36 @@ export const HintNotification = () => {
const result = snap.result; const result = snap.result;
const navigate = useNavigate(); const navigate = useNavigate();
const [api, contextHolder] = notification.useNotification({ const [api, contextHolder] = notification.useNotification({
maxCount: NeosConfig.ui.hint.maxCount, maxCount: NeosConfig.ui.hint.maxCount,
}); });
useEffect(() => { useEffect(() => {
if (hintState && hintState.msg) { if (hintState && hintState.msg) {
api.info({ api.open({
message: `${hintState.msg}`, message: `${hintState.msg}`,
placement: "bottom", placement: "topLeft",
style: style,
}); });
} }
}, [hintState.msg]); }, [hintState.msg]);
useEffect(() => { useEffect(() => {
if (currentPhase) { if (currentPhase) {
api.info({ api.open({
message: `<当前阶段>${currentPhase}`, message: `<当前阶段>${currentPhase}`,
placement: "topRight", placement: "topRight",
style: style,
}); });
} }
}, [currentPhase]); }, [currentPhase]);
useEffect(() => { useEffect(() => {
if (waiting) { if (waiting) {
api.info({ api.open({
message: "...等待对方行动中...", message: "...等待对方行动中...",
placement: "top", placement: "top",
duration: NeosConfig.ui.hint.waitingDuration, duration: NeosConfig.ui.hint.waitingDuration,
style: style,
}); });
} }
}, [waiting]); }, [waiting]);
...@@ -59,9 +67,10 @@ export const HintNotification = () => { ...@@ -59,9 +67,10 @@ export const HintNotification = () => {
: MsgWin.ActionType.Defeated : MsgWin.ActionType.Defeated
? "失败" ? "失败"
: "未知结果"; : "未知结果";
api.info({ api.open({
message, message,
placement: "bottom", placement: "bottom",
style: style,
onClose() { onClose() {
navigate("/"); navigate("/");
}, },
......
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