Commit 64510003 authored by timel's avatar timel

refactor: 80%

parent dbbf2469
import "./index.scss"; import styles from "./index.module.scss";
import { import {
ArrowRightOutlined, ArrowRightOutlined,
...@@ -53,7 +53,12 @@ export const Menu = () => { ...@@ -53,7 +53,12 @@ export const Menu = () => {
: 7; : 7;
// PhaseType, 中文, response, 是否显示 // PhaseType, 中文, response, 是否显示
const phaseBind: [PhaseType, string, number, boolean][] = [ const phaseBind: [
phase: PhaseType,
label: string,
response: number,
show: boolean
][] = [
[PhaseType.DRAW, "抽卡阶段", -1, true], [PhaseType.DRAW, "抽卡阶段", -1, true],
[PhaseType.STANDBY, "准备阶段", -1, true], [PhaseType.STANDBY, "准备阶段", -1, true],
[PhaseType.MAIN1, "主要阶段 1", -1, true], [PhaseType.MAIN1, "主要阶段 1", -1, true],
...@@ -69,9 +74,9 @@ export const Menu = () => { ...@@ -69,9 +74,9 @@ export const Menu = () => {
const phaseSwitchItems: MenuProps["items"] = phaseBind const phaseSwitchItems: MenuProps["items"] = phaseBind
.filter(([, , , show]) => show) .filter(([, , , show]) => show)
.map(([phase, str, response], i) => ({ .map(([phase, label, response], key) => ({
key: i, key,
label: str, label,
disabled: currentPhase >= phase, disabled: currentPhase >= phase,
onClick: () => { onClick: () => {
if (response === 2) sendSelectIdleCmdResponse(response); if (response === 2) sendSelectIdleCmdResponse(response);
...@@ -95,8 +100,7 @@ export const Menu = () => { ...@@ -95,8 +100,7 @@ export const Menu = () => {
const globalDisable = !matStore.isMe(currentPlayer); const globalDisable = !matStore.isMe(currentPlayer);
return ( return (
<> <div className={styles["menu-container"]}>
<div className="menu-container">
<DropdownWithTitle <DropdownWithTitle
title="请选择要进入的阶段" title="请选择要进入的阶段"
menu={{ items: phaseSwitchItems }} menu={{ items: phaseSwitchItems }}
...@@ -125,7 +129,6 @@ export const Menu = () => { ...@@ -125,7 +129,6 @@ export const Menu = () => {
<Button icon={<CloseCircleFilled />} type="text"></Button> <Button icon={<CloseCircleFilled />} type="text"></Button>
</DropdownWithTitle> </DropdownWithTitle>
</div> </div>
</>
); );
}; };
......
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