Commit 60bab06a authored by Chunchi Che's avatar Chunchi Che

update

parent 675b9e5a
Pipeline #20097 passed with stages
in 4 minutes and 56 seconds
...@@ -81,8 +81,18 @@ const WaitRoom = () => { ...@@ -81,8 +81,18 @@ const WaitRoom = () => {
const isHost = useAppSelector(selectIsHost); const isHost = useAppSelector(selectIsHost);
const player0 = useAppSelector(selectPlayer0); const player0 = useAppSelector(selectPlayer0);
const player1 = useAppSelector(selectPlayer1); const player1 = useAppSelector(selectPlayer1);
const handleChoseDeck = async () => { const [api, contextHolder] = notification.useNotification();
const deck = await fetchDeck("hero"); const [deckTitle, setDeckTitle] = useState("请选择卡组");
// FIXME: 这些数据应该从`store`中获取
const decks: MenuProps["items"] = [
{
label: "hero",
key: "hero",
},
];
const handleChoseDeck = async (deckName: string) => {
const deck = await fetchDeck(deckName);
sendUpdateDeck(deck); sendUpdateDeck(deck);
dispatch(initMeExtraDeckMeta({ controler: 0, codes: deck.extra || [] })); dispatch(initMeExtraDeckMeta({ controler: 0, codes: deck.extra || [] }));
...@@ -99,21 +109,6 @@ const WaitRoom = () => { ...@@ -99,21 +109,6 @@ const WaitRoom = () => {
}; };
const navigate = useNavigate(); const navigate = useNavigate();
const items: MenuProps["items"] = [
{
label: "卡组1",
key: "1",
},
{
label: "卡组2",
key: "2",
},
{
label: "卡组3",
key: "3",
},
];
const [api, contextHolder] = notification.useNotification();
useEffect(() => { useEffect(() => {
if (joined) { if (joined) {
...@@ -211,10 +206,18 @@ const WaitRoom = () => { ...@@ -211,10 +206,18 @@ const WaitRoom = () => {
<></> <></>
)} )}
</Space> </Space>
<Dropdown menu={{ items, onClick: ({ key }) => {} }}> <Dropdown
menu={{
items: decks,
onClick: async ({ key }) => {
await handleChoseDeck(key);
setDeckTitle(key);
},
}}
>
<a onClick={(e) => e.preventDefault()}> <a onClick={(e) => e.preventDefault()}>
<Space> <Space>
卡组选择 {deckTitle}
<DownOutlined /> <DownOutlined />
</Space> </Space>
</a> </a>
......
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