Commit dbaab022 authored by Chunchi Che's avatar Chunchi Che

optimize WaitRoom

parent 3a3e233a
Pipeline #23002 passed with stages
in 15 minutes and 31 seconds
......@@ -139,14 +139,18 @@ export const Component: React.FC = () => {
who={Who.Op}
player={op}
btn={
<MoraAvatar
mora={
op?.moraResult !== undefined &&
op.moraResult !== HandType.UNKNOWN
? Object.values(Mora)[op.moraResult - 1]
: undefined
}
/>
room.stage === RoomStage.WAITING ? (
<></>
) : (
<MoraAvatar
mora={
op?.moraResult !== undefined &&
op.moraResult !== HandType.UNKNOWN
? Object.values(Mora)[op.moraResult - 1]
: undefined
}
/>
)
}
/>
</div>
......@@ -314,7 +318,8 @@ const ActionButton: React.FC<{
onMoraSelect: (mora: Mora) => void;
onTpSelect: (tp: Tp) => void;
}> = ({ onMoraSelect, onTpSelect }) => {
const { stage, isHost } = useSnapshot(roomStore);
const room = useSnapshot(roomStore);
const { stage, isHost } = room;
return (
<MoraPopover onSelect={onMoraSelect}>
<TpPopover onSelect={onTpSelect}>
......@@ -322,7 +327,10 @@ const ActionButton: React.FC<{
className={styles["btns-action"]}
disabled={
stage !== RoomStage.WAITING ||
(stage === RoomStage.WAITING && !isHost)
(stage === RoomStage.WAITING &&
(!isHost ||
room.getMePlayer()?.state !== PlayerState.READY ||
room.getOpPlayer()?.state !== PlayerState.READY))
}
onClick={() => {
sendHsStart();
......
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