Skip to content

Commit

Permalink
feature: improve ui
Browse files Browse the repository at this point in the history
  • Loading branch information
wilcorrea committed Apr 9, 2024
1 parent 73154e5 commit 13d740f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 17 deletions.
14 changes: 7 additions & 7 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ export default function App () {
path="/auth/otp"
element={<WaitOneTimePassword />}
/>
</Route>
<Route
element={<ProtectPage />}
>
<Route
element={<ProtectPage />}
>
<Route
path="/dashboard"
element={<DashboardPage />}
/>
</Route>
path="/dashboard"
element={<DashboardPage />}
/>
</Route>
</Routes>
</AppProvider>
Expand Down
6 changes: 3 additions & 3 deletions src/view/components/game/GamePlaySession.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Game from '../../../app/Domain/Game/Game.ts'

import { GamePlaySessionInstruction } from './game-play-session/GamePlaySessionInstruction.tsx'
import { GamePlaySessionQuestion, GameQuestionAnswerQuestion } from './game-play-session/GamePlaySessionQuestion.tsx'
import { Case, Switch } from '../general/Switch.tsx'
import { Case, Match } from '../general/Match.tsx'
import { Loading } from '../general/Loading.tsx'
import { AlertWarning } from '../general/Alert.tsx'

Expand Down Expand Up @@ -79,7 +79,7 @@ export function GamePlaySession ({ game, onStart, onFinish }: GamePlaySessionPro
}, [status, game, questions])

return (
<Switch condition={status}>
<Match condition={status}>
<Case value={GamePlaySessionStatus.WAITING}>
<Loading />
</Case>
Expand Down Expand Up @@ -120,6 +120,6 @@ export function GamePlaySession ({ game, onStart, onFinish }: GamePlaySessionPro
<Case value={GamePlaySessionStatus.FINISHED}>
<AlertWarning />
</Case>
</Switch>
</Match>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Answer from '../../../../app/Domain/Game/Answer.ts'
import { shuffle } from '../../../../app/Domain/Util.ts'
import AnswerStatus from '../../../../app/Domain/Game/AnswerStatus.ts'

import { Case, Switch } from '../../general/Switch.tsx'
import { Case, Match } from '../../general/Match.tsx'

import {
GamePlaySessionQuestionCorrect,
Expand Down Expand Up @@ -77,10 +77,8 @@ export function GamePlaySessionQuestion (props: GameQuestionProps) {

return (
<>
<Switch condition={status}>
<Case
value={AnswerStatus.UNANSWERED}
>
<Match condition={status}>
<Case value={AnswerStatus.UNANSWERED}>
<GamePlaySessionQuestionUnanswered
text={text}
options={options}
Expand All @@ -100,7 +98,7 @@ export function GamePlaySessionQuestion (props: GameQuestionProps) {
<Case value={AnswerStatus.CORRECT}>
<GamePlaySessionQuestionCorrect finishQuestion={finishQuestion} />
</Case>
</Switch>
</Match>
</>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export type SwitchProps = {
children: ReactNode[]
}

export function Switch (props: SwitchProps) {
export function Match (props: SwitchProps) {
const { condition, children } = props
return children.find((child: any) => child.props.value === condition)
}

0 comments on commit 13d740f

Please sign in to comment.