Skip to content

Commit

Permalink
Merge pull request #303 from TaloDev/develop
Browse files Browse the repository at this point in the history
Release 0.38.0
  • Loading branch information
tudddorrr authored Oct 25, 2024
2 parents cbb3e3b + 6b93845 commit 2fb8f77
Show file tree
Hide file tree
Showing 27 changed files with 382 additions and 198 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/pages/ResetPassword.spec.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('ResetPassword', () => {

cy.findByText('Success! Your password has been reset').should('exist')
cy.findByText('Go to Login').click()
cy.findByText('Welcome back').should('exist')
cy.findByText('Talo Game Services').should('exist')
})

it('should let users login with valid credentials', () => {
Expand Down
110 changes: 32 additions & 78 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"react-hook-form": "^7.43.8",
"react-router-dom": "^6.23.1",
"react-select": "^5.8.0",
"recharts": "^2.1.15",
"recharts": "^2.13.0",
"recoil": "^0.7.6",
"swr": "^2.0.0",
"use-debounce": "^9.0.0",
Expand Down Expand Up @@ -78,7 +78,7 @@
"lint-staged": {
"*.{ts,js,tsx,jsx}": "eslint --fix"
},
"version": "0.37.0",
"version": "0.38.0",
"engines": {
"node": "20.x"
},
Expand Down
33 changes: 19 additions & 14 deletions src/Router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import canViewPage from './utils/canViewPage'
import IntendedRouteHandler from './components/IntendedRouteHandler'
import userState from './state/userState'
import activeGameState from './state/activeGameState'
import Footer from './components/Footer'

const Login = lazy(() => import(/* webpackChunkName: 'login' */ './pages/Login'))
const Dashboard = lazy(() => import(/* webpackChunkName: 'dashboard' */ './pages/Dashboard'))
Expand Down Expand Up @@ -57,26 +58,29 @@ function Router({
return (
<>
{!AuthService.getToken() &&
<main className='bg-gray-800 w-full'>
<Routes>
<Route path={routes.login} element={<Login />} />
<Route path={routes.register} element={<Register />} />
<Route path={routes.demo} element={<Demo />} />
<Route path={routes.verify2FA} element={<Verify2FA />} />
<Route path={routes.recover} element={<RecoverAccount />} />
<Route path={routes.acceptInvite} element={<AcceptInvite />} />
<Route path={routes.forgotPassword} element={<ForgotPassword />} />
<Route path={routes.resetPassword} element={<ResetPassword />} />
<div className='w-full flex flex-col'>
<main className='bg-gray-800 w-full md:py-16 lg:py-32'>
<Routes>
<Route path={routes.login} element={<Login />} />
<Route path={routes.register} element={<Register />} />
<Route path={routes.demo} element={<Demo />} />
<Route path={routes.verify2FA} element={<Verify2FA />} />
<Route path={routes.recover} element={<RecoverAccount />} />
<Route path={routes.acceptInvite} element={<AcceptInvite />} />
<Route path={routes.forgotPassword} element={<ForgotPassword />} />
<Route path={routes.resetPassword} element={<ResetPassword />} />

<Route path='*' element={<IntendedRouteHandler intendedRoute={intendedRoute} />} />
</Routes>
</main>
<Route path='*' element={<IntendedRouteHandler intendedRoute={intendedRoute} />} />
</Routes>
</main>
<Footer />
</div>
}

{AuthService.getToken() &&
<div className='w-full flex flex-col'>
<NavBar />
<main className='bg-gray-800 p-4 md:p-8 text-white'>
<main className='bg-gray-800 p-4 md:p-8 md:pb-16 lg:pb-32 text-white'>
<Routes>
<Route path={routes.dashboard} element={<Dashboard />} />
<Route path={routes.account} element={<Account />} />
Expand Down Expand Up @@ -112,6 +116,7 @@ function Router({
<Route path='*' element={<NotFound />} />
</Routes>
</main>
<Footer />
</div>
}
</>
Expand Down
4 changes: 2 additions & 2 deletions src/api/usePinnedGroups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import makeValidatedGetRequest from './makeValidatedGetRequest'
import { playerGroupSchema } from '../entities/playerGroup'
import { z } from 'zod'

export default function usePinnedGroups(activeGame: Game | null) {
export default function usePinnedGroups(activeGame: Game | null, includeDevData?: boolean) {
const fetcher = async ([url]: [string]) => {
const res = await makeValidatedGetRequest(url, z.object({
groups: z.array(playerGroupSchema)
Expand All @@ -15,7 +15,7 @@ export default function usePinnedGroups(activeGame: Game | null) {
}

const { data, error, mutate } = useSWR(
activeGame ? [`games/${activeGame.id}/player-groups/pinned`] : null,
activeGame ? [`games/${activeGame.id}/player-groups/pinned`, includeDevData] : null,
fetcher
)

Expand Down
5 changes: 5 additions & 0 deletions src/assets/talo-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions src/components/CheckboxButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { useState } from 'react'
import clsx from 'clsx'
import { IconCheck } from '@tabler/icons-react'
import { hiddenInputStyle, labelFocusStyle } from '../styles/theme'

type CheckboxButtonProps = {
id: string
checked: boolean
onChange: (checked: boolean) => void
label: string
}

export default function CheckboxButton({ id, checked, label, onChange }: CheckboxButtonProps) {
const [focus, setFocus] = useState(false)

return (
<>
<input
id={id}
type='checkbox'
className={hiddenInputStyle}
onFocus={() => setFocus(true)}
onBlur={() => setFocus(false)}
onChange={() => onChange(!checked)}
/>

<label
htmlFor={id}
className={clsx('p-1 rounded hover:bg-gray-200 flex items-center space-x-2 cursor-pointer transition-all', { [labelFocusStyle]: focus })}
>
<span className='inline-block rounded w-6 h-6 bg-white border border-black/30 align-text-bottom text-black active:bg-gray-200 transition-colors'>
{checked &&
<span className='flex items-center justify-center h-full'>
<IconCheck size={16} stroke={3} />
</span>
}
</span>
<span>{label}</span>
</label>
</>
)
}
44 changes: 0 additions & 44 deletions src/components/ColourfulCheckbox.tsx

This file was deleted.

Loading

0 comments on commit 2fb8f77

Please sign in to comment.