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 1989305 commit 19752bb
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"build:preview": "tsc && vite build && mkdir dist/quiz && mv dist/index.html dist/quiz && mv dist/assets/ dist/quiz && code dist",
"ci": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
Expand Down
1 change: 1 addition & 0 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ main {
main > .container {
min-height: calc(100vh - 198px);
transition: height 0.3s;
max-width: 1024px;
}

footer {
Expand Down
16 changes: 8 additions & 8 deletions src/view/components/game/GamePlaySession.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,21 @@ export function GamePlaySession ({ game, onStart, onFinish }: GamePlaySessionPro
/>
</Case>
<Case value={GamePlaySessionStatus.STARTED}>
<div className="progress opacity-50 mb-1">
<div
className="progress-bar bg-primary"
role="progressbar"
style={{ width: `${((game.questions.length - questions.length) / game.questions.length) * 100}%` }}
/>
</div>
<GamePlaySessionQuestion
timeout={timeout}
text={currentQuestion?.text || ''}
answers={currentQuestion?.answers || []}
answerQuestion={answerQuestion}
nextQuestion={nextQuestion}
/>
<div className="py-1">
<div className="mt-1">
<small>{game.questions.length - questions.length} / {game.questions.length} ({interaction})</small>
&nbsp;
{
Expand All @@ -109,13 +116,6 @@ export function GamePlaySession ({ game, onStart, onFinish }: GamePlaySessionPro
''
}
</div>
<div className="progress opacity-50">
<div
className="progress-bar bg-warning"
role="progressbar"
style={{ width: `${((game.questions.length - questions.length) / game.questions.length) * 100}%` }}
/>
</div>
</Case>
<Case value={GamePlaySessionStatus.FINISHED}>
<AlertWarning />
Expand Down
6 changes: 6 additions & 0 deletions src/view/pages/auth/SignInPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useNavigate } from 'react-router-dom'
import { useApp } from '../../hooks/useApp.ts'
import { AlertDanger } from '../../components/general/Alert.tsx'
import { mode } from '../../../config/env.ts'
import { Loading } from '../../components/general/Loading.tsx'

export function SignInPage () {
const { auth, session } = useApp()
Expand Down Expand Up @@ -97,6 +98,11 @@ export function SignInPage () {
Entrar
</button>
</div>
{
loading && (
<Loading />
)
}
{error && (
<AlertDanger>
<span className="text-light-emphasis">{error}</span>
Expand Down
4 changes: 3 additions & 1 deletion src/view/providers/AppProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ export function AppProvider ({ children }: { children: React.ReactNode }) {
const [session, setSession] = useState<Session>(null)

const updateAuthSession = (session: Session) => {
setSession(session)
if (session?.credential) {
setSession(session)
}
}

const auth = authManagerFactory(updateAuthSession)
Expand Down

0 comments on commit 19752bb

Please sign in to comment.