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