Skip to content

Commit

Permalink
Merge branch 'issues/13' of github.com:PHPcomRapadura/quiz
Browse files Browse the repository at this point in the history
  • Loading branch information
gmarkiin committed Apr 10, 2024
2 parents e3ceeef + eba474b commit 6787b22
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 63 deletions.
55 changes: 31 additions & 24 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,34 @@
.GamePlaySessionQuestionUnanswered > .card {
.PublicLayout {
padding-top: 82px;
}

.PublicLayout nav {
height: 82px;
}

.PublicLayout main {
padding: 30px 10px;
}

.PublicLayout main > .container {
min-height: calc(100vh - 198px);
transition: height 0.3s;
max-width: 1024px;
}

.PublicLayout footer {
height: 56px;
}

.PublicLayout main .btn.btn-primary {
box-shadow: rgba(64, 60, 67, 0.4) 1px 2px 4px 1px !important;
}

.PublicLayout .GamePlaySessionQuestionUnanswered > .card {
text-shadow: 1px 1px 1px #707070;
}

.GamePlaySessionQuestionUnanswered > .card code {
.PublicLayout .GamePlaySessionQuestionUnanswered > .card code {
text-shadow: none;
padding: 4px 6px;
border-radius: 6px;
Expand All @@ -11,37 +37,18 @@
margin: 0 0.1rem;
}

.GamePlaySessionQuestionUnanswered > .card pre {
.PublicLayout .GamePlaySessionQuestionUnanswered > .card pre {
overflow: visible;
white-space: pre-wrap; /* css-3 */
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
white-space: -o-pre-wrap; /* Opera 7 */
word-wrap: break-word; /* Internet Explorer 5.5+ */
}

.GamePlaySessionQuestionUnanswered > .card > .card-header code {
.PublicLayout .GamePlaySessionQuestionUnanswered > .card > .card-header code {
font-size: 1rem;
}

.GamePlaySessionQuestionUnanswered > .card > .card-body > .form-check p {
.PublicLayout .GamePlaySessionQuestionUnanswered > .card > .card-body > .form-check p {
line-height: 165%;
}

main .btn.btn-primary {
box-shadow: rgba(64, 60, 67, 0.4) 1px 2px 4px 1px !important;
}

main input[type="text"], input[type="password"] {
background-color: #ffffff;
color: #5c5c5c;
}

input[type="text"]:focus, input[type="password"]:focus {
color: #5c5c5c;
background-color: #ffffff;
border: 1px solid #a8a8a8;
}

input[type="text"]::placeholder, input[type="password"]::placeholder {
color: #c5c5c5;
}
2 changes: 1 addition & 1 deletion src/app/Infrastructure/InMemory/games.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Game from '../../Domain/Game/Game.ts'

import games from './games.json'
import games from '../../../database/static/games.json'

export default function (): Game[] {
return games as unknown as Game[]
Expand Down
36 changes: 20 additions & 16 deletions src/config/dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,31 @@ import InMemoryGameRepository from '../app/Infrastructure/InMemory/InMemoryGameR
import SupabaseGameRepository from '../app/Infrastructure/Supabase/SupabaseGameRepository.ts'
import { mode } from './env.ts'

const factory = (binds: Record<string, () => unknown>) => {
const binds: Record<string, Record<string, () => unknown>> = {
http: {
AuthRepository: () => HttpAuthRepository.build(),
// GameRepository: () => HttpGameRepository.build(),
},
memory: {
// AuthRepository: () => new InMemoryAuthRepository(),
GameRepository: () => new InMemoryGameRepository(),
},
supabase: {
AuthRepository: () => SupabaseAuthRepository.build(),
GameRepository: () => SupabaseGameRepository.build(),
},
}

const factory = (token: string): [string, { useFactory: () => unknown }] => {
const bind = binds[mode()]
return bind && bind()
const useFactory = bind[token]
return [token, { useFactory }]
}

export default function () {
container.register('AuthService', { useClass: AuthService })
container.register('AuthRepository', {
useFactory: () => {
return factory({
http: () => HttpAuthRepository.build(),
supabase: () => SupabaseAuthRepository.build(),
})
}
})
container.register('GameRepository', {
useFactory: () => factory({
memory: () => new InMemoryGameRepository(),
supabase: () => SupabaseGameRepository.build(),
})
})
container.register(...factory('AuthRepository'))
container.register(...factory('GameRepository'))

return container
}
2 changes: 1 addition & 1 deletion src/config/env.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const mode = () => localStorage.getItem('mode') || import.meta.env.VITE_BACKEND_MODE || 'supabase'
export const mode = (): string => localStorage.getItem('mode') || import.meta.env.VITE_BACKEND_MODE || 'supabase'
3 changes: 3 additions & 0 deletions src/config/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ const resources = {
waiting: 'Recomeçar em {{timer}} segundos',
restart: 'Começar de novo'
}
},
dashboard: {
soon: 'Em breve!'
}
},
components: {
Expand Down
File renamed without changes.
33 changes: 13 additions & 20 deletions src/index.css
Original file line number Diff line number Diff line change
@@ -1,31 +1,24 @@
#root {
height: 100%;
width: 100%;
position: relative;
}

body {
background-image: linear-gradient(90deg, #33b7e2, #a680da, #fd81b8);
}

.PublicLayout {
padding-top: 82px;
}

.PublicLayout nav {
height: 82px;
#root {
height: 100%;
width: 100%;
position: relative;
}

.PublicLayout main {
padding: 30px 10px;
input[type="text"], input[type="password"] {
background-color: #ffffff;
color: #5c5c5c;
}

.PublicLayout main > .container {
min-height: calc(100vh - 198px);
transition: height 0.3s;
max-width: 1024px;
input[type="text"]:focus, input[type="password"]:focus {
color: #5c5c5c;
background-color: #ffffff;
border: 1px solid #a8a8a8;
}

.PublicLayout footer {
height: 56px;
input[type="text"]::placeholder, input[type="password"]::placeholder {
color: #c5c5c5;
}
9 changes: 8 additions & 1 deletion src/view/pages/DashboardPage.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import { useTranslation } from 'react-i18next'

export function DashboardPage () {
const { t } = useTranslation(
'default',
{ keyPrefix: 'pages.dashboard' }
)

return (
<p>
Eu sou uma página privada
{t('soon')}
</p>
)
}
1 change: 1 addition & 0 deletions src/view/pages/HomePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export function HomePage () {
'default',
{ keyPrefix: 'pages.home' }
)

return (
<div className="card bg-secondary py-3 px-4 rounded">
<h1>{t('title')}</h1>
Expand Down

0 comments on commit 6787b22

Please sign in to comment.