Commit 51ea38a5 authored by Chunchi Che's avatar Chunchi Che

fix

parent 8646aa12
Pipeline #23194 passed with stages
in 11 minutes and 21 seconds
.container {
display: flex;
align-items: center;
flex-direction: column;
justify-content: center;
flex-direction: row;
gap: 80px;
button {
width: 100px;
height: 50px;
font-size: 16px;
}
}
import { Modal } from "antd";
import { Button, Modal } from "antd";
import React from "react";
import { useSnapshot } from "valtio";
import { sendTpResult } from "@/api";
import { SideStage, sideStore } from "@/stores";
import { IconFont, SpecialButton } from "@/ui/Shared";
import { Tp, TpPopover } from "@/ui/WaitRoom/Popover";
import styles from "./index.module.scss";
......@@ -20,18 +18,22 @@ export const TpModal: React.FC = () => {
closable={false}
>
<div className={styles.container}>
<TpPopover
onSelect={(tp) => {
sendTpResult(tp === Tp.First);
<Button
onClick={() => {
sendTpResult(true);
sideStore.stage = SideStage.TP_SELECTED;
}}
forceOpen={stage === SideStage.TP_SELECTING}
>
<SpecialButton>
<IconFont type="icon-one" size={18} />
<span>请选择先后手</span>
</SpecialButton>
</TpPopover>
先手
</Button>
<Button
onClick={() => {
sendTpResult(false);
sideStore.stage = SideStage.TP_SELECTED;
}}
>
后手
</Button>
</div>
</Modal>
);
......
......@@ -70,9 +70,8 @@ export const MoraPopover: React.FC<
export const TpPopover: React.FC<
React.PropsWithChildren<{
onSelect?: (result: Tp) => void;
forceOpen?: boolean;
}>
> = ({ children, onSelect, forceOpen }) => {
> = ({ children, onSelect }) => {
const [open, setOpen] = useState(false);
// 需要在mora的service之中,emit一个事件,让这个组件监听到,然后打开popover
......@@ -116,7 +115,7 @@ export const TpPopover: React.FC<
))}
</Space>
}
open={open || forceOpen === true}
open={open}
placement="bottom"
>
{children}
......
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