Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add routes meta #49

Merged
merged 3 commits into from
Sep 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 39 additions & 3 deletions package-lock.json

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

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"react": "^18",
"react-day-picker": "^8",
"react-dom": "^18",
"react-helmet": "^6.1.0",
"react-hook-form": "^7.53.0",
"sharp": "^0.33",
"sonner": "^1.5.0",
Expand All @@ -78,6 +79,7 @@
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"@types/react-helmet": "^6.1.11",
"@typescript-eslint/eslint-plugin": "^7",
"@typescript-eslint/parser": "^7",
"@vitest/coverage-v8": "^2.1.1",
Expand Down
8 changes: 2 additions & 6 deletions routes/~__root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import { createRootRoute, Outlet, redirect } from '@tanstack/react-router'
import { NextIntlClientProvider } from 'next-intl'
import { useLayoutEffect } from 'react'
import { Helmet } from 'react-helmet'

Check warning on line 12 in routes/~__root.tsx

View check run for this annotation

Codecov / codecov/patch

routes/~__root.tsx#L12

Added line #L12 was not covered by tests
import { auth } from '@/modules/firebase/app'
import { AuthProvider } from '@/modules/firebase/AuthProvider'
import messages from '@/modules/messages/translations/en.json'
Expand All @@ -17,12 +18,6 @@
import { lightTheme } from '@/packages/design-system/src'
import { Toaster } from '@/packages/design-system/src/components/Toaster'

/**
* TODO
* metadata
* favicon
* */

const Root = () => {
useLayoutEffect(() => {
Object.entries(lightTheme).forEach(([key, value]) => {
Expand All @@ -38,6 +33,7 @@
timeZone="Europe/Warsaw"
messages={messages}
>
<Helmet defaultTitle="ENGAGE-HF" titleTemplate="%s - ENGAGE-HF" />

Check warning on line 36 in routes/~__root.tsx

View check run for this annotation

Codecov / codecov/patch

routes/~__root.tsx#L36

Added line #L36 was not covered by tests
<Outlet />
<Toaster />
</NextIntlClientProvider>
Expand Down
4 changes: 4 additions & 0 deletions routes/~_dashboard/~index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@
//
import { createFileRoute } from '@tanstack/react-router'
import { Home } from 'lucide-react'
import { Helmet } from 'react-helmet'

Check warning on line 10 in routes/~_dashboard/~index.tsx

View check run for this annotation

Codecov / codecov/patch

routes/~_dashboard/~index.tsx#L10

Added line #L10 was not covered by tests
import { PageTitle } from '@/packages/design-system/src/molecules/DashboardLayout'
import { DashboardLayout } from './DashboardLayout'

const DashboardPage = () => (
<DashboardLayout title={<PageTitle title="Home" icon={<Home />} />}>
<Helmet>
<title>Home</title>
</Helmet>

Check warning on line 18 in routes/~_dashboard/~index.tsx

View check run for this annotation

Codecov / codecov/patch

routes/~_dashboard/~index.tsx#L16-L18

Added lines #L16 - L18 were not covered by tests
<h1 className="text-2xl">Dashboard</h1>
</DashboardLayout>
)
Expand Down
4 changes: 4 additions & 0 deletions routes/~_dashboard/~patients/~$id/~index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import { UserType } from '@stanfordbdhg/engagehf-models'
import { createFileRoute, notFound, useRouter } from '@tanstack/react-router'
import { Contact } from 'lucide-react'
import { Helmet } from 'react-helmet'

Check warning on line 12 in routes/~_dashboard/~patients/~$id/~index.tsx

View check run for this annotation

Codecov / codecov/patch

routes/~_dashboard/~patients/~$id/~index.tsx#L12

Added line #L12 was not covered by tests
import { callables, db, docRefs, refs } from '@/modules/firebase/app'
import {
getMedicationRequestData,
Expand Down Expand Up @@ -175,6 +176,9 @@
/>
}
>
<Helmet>
<title>Edit {userName}</title>
</Helmet>

Check warning on line 181 in routes/~_dashboard/~patients/~$id/~index.tsx

View check run for this annotation

Codecov / codecov/patch

routes/~_dashboard/~patients/~$id/~index.tsx#L179-L181

Added lines #L179 - L181 were not covered by tests
<Tabs defaultValue={Tab.medications}>
<TabsList className="mb-6 w-full">
<TabsTrigger value={Tab.information} className="grow">
Expand Down
4 changes: 4 additions & 0 deletions routes/~_dashboard/~patients/~index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import { createFileRoute, Link } from '@tanstack/react-router'
import { query, where } from 'firebase/firestore'
import { Contact, UserPlus } from 'lucide-react'
import { Helmet } from 'react-helmet'

Check warning on line 12 in routes/~_dashboard/~patients/~index.tsx

View check run for this annotation

Codecov / codecov/patch

routes/~_dashboard/~patients/~index.tsx#L12

Added line #L12 was not covered by tests
import {
docRefs,
getCurrentUser,
Expand Down Expand Up @@ -96,6 +97,9 @@
</Button>
}
>
<Helmet>
<title>Patients</title>
</Helmet>

Check warning on line 102 in routes/~_dashboard/~patients/~index.tsx

View check run for this annotation

Codecov / codecov/patch

routes/~_dashboard/~patients/~index.tsx#L100-L102

Added lines #L100 - L102 were not covered by tests
<PatientsTable data={patients} />
</DashboardLayout>
)
Expand Down
4 changes: 4 additions & 0 deletions routes/~_dashboard/~patients/~invite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import { UserType } from '@stanfordbdhg/engagehf-models'
import { createFileRoute, useNavigate } from '@tanstack/react-router'
import { Contact } from 'lucide-react'
import { Helmet } from 'react-helmet'

Check warning on line 11 in routes/~_dashboard/~patients/~invite.tsx

View check run for this annotation

Codecov / codecov/patch

routes/~_dashboard/~patients/~invite.tsx#L11

Added line #L11 was not covered by tests
import { callables, docRefs } from '@/modules/firebase/app'
import { useUser } from '@/modules/firebase/UserProvider'
import { getDocDataOrThrow } from '@/modules/firebase/utils'
Expand Down Expand Up @@ -48,6 +49,9 @@
<DashboardLayout
title={<PageTitle title="Invite patient" icon={<Contact />} />}
>
<Helmet>
<title>Invite patient</title>
</Helmet>

Check warning on line 54 in routes/~_dashboard/~patients/~invite.tsx

View check run for this annotation

Codecov / codecov/patch

routes/~_dashboard/~patients/~invite.tsx#L52-L54

Added lines #L52 - L54 were not covered by tests
<PatientForm
onSubmit={invitePatient}
clinicianPreselectId={
Expand Down
11 changes: 6 additions & 5 deletions routes/~_dashboard/~users/~$id.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import { UserType } from '@stanfordbdhg/engagehf-models'
import { createFileRoute, notFound, useRouter } from '@tanstack/react-router'
import { Users } from 'lucide-react'
import { Helmet } from 'react-helmet'

Check warning on line 12 in routes/~_dashboard/~users/~$id.tsx

View check run for this annotation

Codecov / codecov/patch

routes/~_dashboard/~users/~$id.tsx#L12

Added line #L12 was not covered by tests
import { callables, docRefs, ensureType } from '@/modules/firebase/app'
import { getDocDataOrThrow } from '@/modules/firebase/utils'
import { queryClient } from '@/modules/query/queryClient'
Expand Down Expand Up @@ -64,16 +65,16 @@
await router.invalidate()
}

const userName = getUserName(authUser)

Check warning on line 68 in routes/~_dashboard/~users/~$id.tsx

View check run for this annotation

Codecov / codecov/patch

routes/~_dashboard/~users/~$id.tsx#L68

Added line #L68 was not covered by tests
return (
<DashboardLayout
title={
<PageTitle
title="Edit user"
subTitle={getUserName(authUser)}
icon={<Users />}
/>
<PageTitle title="Edit user" subTitle={userName} icon={<Users />} />

Check warning on line 72 in routes/~_dashboard/~users/~$id.tsx

View check run for this annotation

Codecov / codecov/patch

routes/~_dashboard/~users/~$id.tsx#L72

Added line #L72 was not covered by tests
}
>
<Helmet>
<title>Edit {userName}</title>
</Helmet>

Check warning on line 77 in routes/~_dashboard/~users/~$id.tsx

View check run for this annotation

Codecov / codecov/patch

routes/~_dashboard/~users/~$id.tsx#L75-L77

Added lines #L75 - L77 were not covered by tests
<UserForm
organizations={organizations}
type={user.type}
Expand Down
4 changes: 4 additions & 0 deletions routes/~_dashboard/~users/~index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import { createFileRoute, Link } from '@tanstack/react-router'
import { query, where } from 'firebase/firestore'
import { UserPlus, Users } from 'lucide-react'
import { Helmet } from 'react-helmet'

Check warning on line 12 in routes/~_dashboard/~users/~index.tsx

View check run for this annotation

Codecov / codecov/patch

routes/~_dashboard/~users/~index.tsx#L12

Added line #L12 was not covered by tests
import { ensureType, getCurrentUser, refs } from '@/modules/firebase/app'
import { mapAuthData } from '@/modules/firebase/user'
import { getDocsData } from '@/modules/firebase/utils'
Expand Down Expand Up @@ -91,6 +92,9 @@
}
title={<PageTitle title="Users" icon={<Users />} />}
>
<Helmet>
<title>Users</title>
</Helmet>

Check warning on line 97 in routes/~_dashboard/~users/~index.tsx

View check run for this annotation

Codecov / codecov/patch

routes/~_dashboard/~users/~index.tsx#L95-L97

Added lines #L95 - L97 were not covered by tests
<UsersTable data={users} />
</DashboardLayout>
)
Expand Down
4 changes: 4 additions & 0 deletions routes/~_dashboard/~users/~invite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import { UserType } from '@stanfordbdhg/engagehf-models'
import { createFileRoute, useNavigate } from '@tanstack/react-router'
import { Users } from 'lucide-react'
import { Helmet } from 'react-helmet'

Check warning on line 11 in routes/~_dashboard/~users/~invite.tsx

View check run for this annotation

Codecov / codecov/patch

routes/~_dashboard/~users/~invite.tsx#L11

Added line #L11 was not covered by tests
import { callables, ensureType } from '@/modules/firebase/app'
import { queryClient } from '@/modules/query/queryClient'
import { routes } from '@/modules/routes'
Expand Down Expand Up @@ -40,6 +41,9 @@

return (
<DashboardLayout title={<PageTitle title="Invite user" icon={<Users />} />}>
<Helmet>
<title>Invite user</title>
</Helmet>

Check warning on line 46 in routes/~_dashboard/~users/~invite.tsx

View check run for this annotation

Codecov / codecov/patch

routes/~_dashboard/~users/~invite.tsx#L44-L46

Added lines #L44 - L46 were not covered by tests
<UserForm organizations={organizations} onSubmit={inviteUser} />
</DashboardLayout>
)
Expand Down
4 changes: 4 additions & 0 deletions routes/~sign-in/~index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@
//
import { createFileRoute } from '@tanstack/react-router'
import { signInWithEmailAndPassword, signInWithPopup } from 'firebase/auth'
import { Helmet } from 'react-helmet'

Check warning on line 10 in routes/~sign-in/~index.tsx

View check run for this annotation

Codecov / codecov/patch

routes/~sign-in/~index.tsx#L10

Added line #L10 was not covered by tests
import { AsideEngageLayout } from '@/components/AsideEngageLayout'
import { authProvider, auth } from '@/modules/firebase/app'
import { SignInForm as AuthSignInForm } from '@/packages/design-system/src/modules/auth/SignInForm'

const SignIn = () => (
<AsideEngageLayout>
<Helmet>
<title>Sign In</title>
</Helmet>

Check warning on line 19 in routes/~sign-in/~index.tsx

View check run for this annotation

Codecov / codecov/patch

routes/~sign-in/~index.tsx#L17-L19

Added lines #L17 - L19 were not covered by tests
<AuthSignInForm
className="mx-auto w-[350px]"
providers={[
Expand Down
Loading