Skip to content

Commit 04d197a

Browse files
committed
feat: add station page
1 parent d02b592 commit 04d197a

File tree

14 files changed

+120
-25
lines changed

14 files changed

+120
-25
lines changed

web/components/layout/ContentPanel.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
import type { HTMLAttributes } from 'react'
1+
import type { HTMLAttributes, ReactNode } from 'react'
22
import clsx from 'clsx'
33

44
type ContentPanelProps = HTMLAttributes<HTMLDivElement> & {
5-
title?: string,
6-
description?: string,
5+
titleElement?: ReactNode,
6+
description?: ReactNode,
77
}
88

99
/**
1010
* The base for every content section of the page
1111
*/
1212
export const ContentPanel = ({
1313
children,
14-
title,
14+
titleElement,
1515
description,
1616
...props
1717
}: ContentPanelProps) => {
1818
return (
1919
<div {...props} className={clsx('flex-col-2 w-full h-full pt-6', props.className)}>
2020
<div className="flex-col-0">
21-
<h1 className="typography-title-lg">{title}</h1>
22-
<p className="typography-label-md text-description">
21+
<h1 className="typography-title-lg">{titleElement}</h1>
22+
<div className="typography-label-md text-description">
2323
{description ?? <span className="invisible">placeholder</span>}
24-
</p>
24+
</div>
2525
</div>
2626
{children}
2727
</div>

web/hooks/useAuth.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,11 @@ export const AuthProvider = ({
4141
const { isLoading, identity } = authState
4242

4343
const pathname = usePathname()
44-
const isUnprotected = unprotectedURLs.some(pattern =>
44+
const isUnprotected = !!pathname && unprotectedURLs.some(pattern =>
4545
pathname.startsWith(pattern))
46-
const isIgnored = ignoredURLs.some(pattern =>
46+
const isIgnored = !!pathname && ignoredURLs.some(pattern =>
4747
pathname.startsWith(pattern))
4848

49-
console.log(pathname, {
50-
isUnprotected,
51-
isIgnored,
52-
})
5349
useEffect(() => {
5450
if(isIgnored) {
5551
return

web/hooks/useTasksContext.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ export const TasksContextProvider = ({ children }: PropsWithChildren) => {
5656
setState(prevState => ({
5757
...prevState,
5858
sidebar: {
59-
isShowingWards: pathName.startsWith('/wards') || prevState.sidebar.isShowingWards,
60-
isShowingTeams: pathName.startsWith('/teams') || prevState.sidebar.isShowingTeams,
59+
isShowingWards: !!pathName && (pathName.startsWith('/wards') || prevState.sidebar.isShowingWards),
60+
isShowingTeams: !!pathName && (pathName.startsWith('/teams') || prevState.sidebar.isShowingTeams),
6161
},
6262
}))
6363
}, [pathName])

web/i18n/translations.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export type TasksTranslationEntries = {
2828
'logout': string,
2929
'myTasks': string,
3030
'nBed': (values: { count: number }) => string,
31+
'nCurrentlyPatients': (values: { count: number }) => string,
3132
'noPatient': string,
3233
'nOrganization': (values: { count: number }) => string,
3334
'notAssigned': string,
@@ -53,6 +54,7 @@ export type TasksTranslationEntries = {
5354
'settingsDescription': string,
5455
'stagingModalDisclaimerMarkdown': string,
5556
'status': string,
57+
'tasks': string,
5658
'taskStatus': (values: { status: string }) => string,
5759
'teams': string,
5860
'visibility': string,
@@ -84,6 +86,15 @@ export const tasksTranslation: Translation<TasksTranslationLocales, Partial<Task
8486
'other': `${count} Betten`,
8587
})
8688
},
89+
'nCurrentlyPatients': ({ count }): string => {
90+
let _out: string = ''
91+
_out += `Aktuell `
92+
_out += TranslationGen.resolvePlural(count, {
93+
'=1': `${count} Patient`,
94+
'other': `${count} Patienten`,
95+
})
96+
return _out
97+
},
8798
'noPatient': `Kein Patient`,
8899
'nOrganization': ({ count }): string => {
89100
return TranslationGen.resolvePlural(count, {
@@ -134,6 +145,7 @@ export const tasksTranslation: Translation<TasksTranslationLocales, Partial<Task
134145
'settingsDescription': `Hier kannst du die App Konfiguration ändern.`,
135146
'stagingModalDisclaimerMarkdown': `Diese öffentliche Instanz von helpwave tasks ist für \\b{Entwicklungs- und Vorschauzwecke} gedacht. Bitte stellen Sie sicher, dass Sie \\b{ausschließlich nicht-vertrauliche Testdaten} eingeben. Diese Instanz kann \\negative{\\b{jederzeit gelöscht}} werden.`,
136147
'status': `Status`,
148+
'tasks': `Aufgaben`,
137149
'taskStatus': ({ status }): string => {
138150
return TranslationGen.resolveSelect(status, {
139151
'overdue': `Überfällig`,
@@ -169,6 +181,15 @@ export const tasksTranslation: Translation<TasksTranslationLocales, Partial<Task
169181
'other': `${count} Beds`,
170182
})
171183
},
184+
'nCurrentlyPatients': ({ count }): string => {
185+
let _out: string = ''
186+
_out += `Currently `
187+
_out += TranslationGen.resolvePlural(count, {
188+
'=1': `${count} Patient`,
189+
'other': `${count} Patients`,
190+
})
191+
return _out
192+
},
172193
'noPatient': `No Patient`,
173194
'nOrganization': ({ count }): string => {
174195
return TranslationGen.resolvePlural(count, {
@@ -219,6 +240,7 @@ export const tasksTranslation: Translation<TasksTranslationLocales, Partial<Task
219240
'settingsDescription': `Here you can change the app configuration.`,
220241
'stagingModalDisclaimerMarkdown': `This public instance of helpwave tasks is for \\b{development and preview purposes}. Please make sure to \\b{only} enter \\b{non-confidential testing data}. This instance can be \\negative{\\b{deleted at any time}}`,
221242
'status': `Status`,
243+
'tasks': `Tasks`,
222244
'taskStatus': ({ status }): string => {
223245
return TranslationGen.resolveSelect(status, {
224246
'overdue': `Overdue`,

web/locales/de-DE.arb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,14 @@
8989
"wards": "Stationen",
9090
"overview": "Übersicht",
9191
"teams": "Teams",
92-
"logout": "Logout"
92+
"logout": "Logout",
93+
"nCurrentlyPatients": "Aktuell {count, plural, =1{# Patient} other{# Patienten}}",
94+
"@nCurrentlyPatients": {
95+
"placeholders": {
96+
"count": {
97+
"type": "number"
98+
}
99+
}
100+
},
101+
"tasks": "Aufgaben"
93102
}

web/locales/en-US.arb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,5 +88,14 @@
8888
"wards": "Wards",
8989
"overview": "Overview",
9090
"teams": "Teams",
91-
"logout": "Logout"
91+
"logout": "Logout",
92+
"nCurrentlyPatients": "Currently {count, plural, =1{# Patient} other{# Patients}}",
93+
"@nCurrentlyPatients": {
94+
"placeholders": {
95+
"count": {
96+
"type": "number"
97+
}
98+
}
99+
},
100+
"tasks": "Tasks"
92101
}

web/pages/404.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const NotFound: NextPage = () => {
1010
const translation = useTasksTranslation()
1111
return (
1212
<Page pageTitle={titleWrapper(translation('pages.404.notFound'))}>
13-
<ContentPanel title={translation('pages.404.notFound')}>
13+
<ContentPanel titleElement={translation('pages.404.notFound')}>
1414
<div className="flex-col-2 items-center justify-center h-full">
1515
<HelpwaveLogo className="w-64 h-64" animate="bounce"/>
1616
<p className="text-lg font-inter">{translation('pages.404.notFoundDescription1')}...</p>

web/pages/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const Dashboard: NextPage = () => {
1212
const { data, isLoading } = useMyQueryQuery()
1313
return (
1414
<Page pageTitle={titleWrapper(translation('homePage'))}>
15-
<ContentPanel title={translation('homePage')} description="The beginning of something">
15+
<ContentPanel titleElement={translation('homePage')} description="The beginning of something">
1616
{isLoading ? 'Loading' : data?.patients.toString()}
1717
<div className="h-3000"></div>
1818
</ContentPanel>

web/pages/patients/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ const PatientsPage: NextPage = () => {
222222
return (
223223
<Page pageTitle={titleWrapper(translation('patients'))}>
224224
<ContentPanel
225-
title={translation('patients')}
225+
titleElement={translation('patients')}
226226
description={translation('nPatient', { count: patients.length })}
227227
>
228228
<Table

web/pages/settings/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const SettingsPage: NextPage = () => {
3232
onClose={() => setIsThemeDialogOpen(false)}
3333
/>
3434
<ContentPanel
35-
title={translation('settings')}
35+
titleElement={translation('settings')}
3636
description={translation('settingsDescription')}
3737
>
3838
<h2 className="typography-title-md">{translation('preferences')}</h2>

0 commit comments

Comments
 (0)