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

Implement dashboard layout #13

Merged
merged 27 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
36acc47
Create Avatar component
arkadiuszbachorski Jul 4, 2024
a1f2888
Create Tooltip component
arkadiuszbachorski Jul 4, 2024
f19087d
Add useOpenState helper hook
arkadiuszbachorski Jul 4, 2024
349d7e1
Add misc helpers
arkadiuszbachorski Jul 4, 2024
8cc6909
Fix focus-ring
arkadiuszbachorski Jul 4, 2024
31c30ff
Use placeholder logo svg instead of just text
arkadiuszbachorski Jul 4, 2024
89acfe5
Speed up transitions
arkadiuszbachorski Jul 4, 2024
e4fb206
Add Nil utility
arkadiuszbachorski Jul 5, 2024
ae26a4c
Return firebaseApp from guards
arkadiuszbachorski Jul 5, 2024
b51ec1a
Add firebase user helpers
arkadiuszbachorski Jul 5, 2024
10edd65
Create DropdownMenu component
arkadiuszbachorski Jul 5, 2024
0d1bc51
Add dashboard layout
arkadiuszbachorski Jul 5, 2024
4776373
Fix tests
arkadiuszbachorski Jul 5, 2024
849975f
Fix imports
arkadiuszbachorski Jul 5, 2024
c8508c3
Remove relative imports
arkadiuszbachorski Jul 5, 2024
7e99e57
Migrate design system storybook to NextJS
arkadiuszbachorski Jul 5, 2024
c16dc85
Add correct dashboard story
arkadiuszbachorski Jul 5, 2024
21c9bb2
Remove unused screen debug
arkadiuszbachorski Jul 5, 2024
af224f4
Create basic table components
arkadiuszbachorski Jul 5, 2024
f5c081f
Add className support to DataTable
arkadiuszbachorski Jul 5, 2024
467cc17
Fix compliance
arkadiuszbachorski Jul 9, 2024
926c615
Format and lint
arkadiuszbachorski Jul 9, 2024
fe7e4d3
Add DashboardLayout test
arkadiuszbachorski Jul 11, 2024
4a39ae1
Fix compliance
arkadiuszbachorski Jul 11, 2024
9cf830c
Decrease vertical space
arkadiuszbachorski Jul 16, 2024
fad9ead
Make Dashboard more compact
arkadiuszbachorski Jul 16, 2024
024e9f2
Fix classes clash
arkadiuszbachorski Jul 16, 2024
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
7 changes: 7 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
"parserOptions": {
"project": "./tsconfig.json"
},
"settings": {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It allows ESLint plugin to resolve path alias

"import/resolver": {
"typescript": {
"project": ["./tsconfig.json"]
}
}
},
"parser": "@typescript-eslint/parser",
"extends": [
"plugin:@typescript-eslint/strict-type-checked",
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,3 @@ jobs:
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET='${{ secrets.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET }}'
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID='${{ secrets.NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID }}'
NEXT_PUBLIC_FIREBASE_APP_ID='${{ secrets.NEXT_PUBLIC_FIREBASE_APP_ID }}'
21 changes: 0 additions & 21 deletions app/(dashboard)/SignOutButton.tsx

This file was deleted.

43 changes: 43 additions & 0 deletions app/(dashboard)/User.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
//
// This source file is part of the Stanford Biodesign Digital Health ENGAGE-HF open-source project
//
// SPDX-FileCopyrightText: 2023 Stanford University and the project authors (see CONTRIBUTORS.md)
//
// SPDX-License-Identifier: MIT
//
'use client'
import { LogOut } from 'lucide-react'
import { auth } from '@/modules/firebase/clientApp'
import {

Check warning on line 11 in app/(dashboard)/User.tsx

View check run for this annotation

Codecov / codecov/patch

app/(dashboard)/User.tsx#L9-L11

Added lines #L9 - L11 were not covered by tests
DropdownMenu,
DropdownMenuTrigger,
DropdownMenuContent,
DropdownMenuItem,
} from '@stanfordbdhg/design-system/components/DropdownMenu'
import {

Check warning on line 17 in app/(dashboard)/User.tsx

View check run for this annotation

Codecov / codecov/patch

app/(dashboard)/User.tsx#L17

Added line #L17 was not covered by tests
getUserName,
type UserInfo,
} from '@stanfordbdhg/design-system/modules/auth/user'
import { UserMenuItem } from '@stanfordbdhg/design-system/molecules/DashboardLayout'

Check warning on line 21 in app/(dashboard)/User.tsx

View check run for this annotation

Codecov / codecov/patch

app/(dashboard)/User.tsx#L21

Added line #L21 was not covered by tests

interface UserProps {
user: UserInfo
}

export const User = ({ user }: UserProps) => (
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Composed out of design system components, but can't be design system itself, because different projects might require different user options

<DropdownMenu>

Check warning on line 28 in app/(dashboard)/User.tsx

View check run for this annotation

Codecov / codecov/patch

app/(dashboard)/User.tsx#L27-L28

Added lines #L27 - L28 were not covered by tests
<DropdownMenuTrigger asChild>
<UserMenuItem img={user.photoURL} name={getUserName(user)} />
</DropdownMenuTrigger>
<DropdownMenuContent>
<DropdownMenuItem
onClick={async () => {
await auth.signOut()

Check warning on line 35 in app/(dashboard)/User.tsx

View check run for this annotation

Codecov / codecov/patch

app/(dashboard)/User.tsx#L34-L35

Added lines #L34 - L35 were not covered by tests
}}
>
<LogOut className="size-4" />
Sign Out
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
)
50 changes: 47 additions & 3 deletions app/(dashboard)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,62 @@
//
// SPDX-License-Identifier: MIT
//
import { Home } from 'lucide-react'
import Link from 'next/link'

Check warning on line 9 in app/(dashboard)/layout.tsx

View check run for this annotation

Codecov / codecov/patch

app/(dashboard)/layout.tsx#L8-L9

Added lines #L8 - L9 were not covered by tests
import { type ReactNode } from 'react'
import { authenticatedOnly } from '../../modules/firebase/guards'
import { LogoType } from '@/components/icons/LogoType'
import { getAuthenticatedOnlyApp } from '@/modules/firebase/guards'
import { getUserInfo } from '@stanfordbdhg/design-system/modules/auth/user'
import {

Check warning on line 14 in app/(dashboard)/layout.tsx

View check run for this annotation

Codecov / codecov/patch

app/(dashboard)/layout.tsx#L11-L14

Added lines #L11 - L14 were not covered by tests
DashboardLayout as DashboardLayoutBase,
MenuItem,
PageTitle,
} from '@stanfordbdhg/design-system/molecules/DashboardLayout'
import { User } from './User'

Check warning on line 19 in app/(dashboard)/layout.tsx

View check run for this annotation

Codecov / codecov/patch

app/(dashboard)/layout.tsx#L19

Added line #L19 was not covered by tests

interface DashboardLayoutProps {
children?: ReactNode
}

export const dynamic = 'force-dynamic'

const MenuLinks = () => (
<>

Check warning on line 28 in app/(dashboard)/layout.tsx

View check run for this annotation

Codecov / codecov/patch

app/(dashboard)/layout.tsx#L27-L28

Added lines #L27 - L28 were not covered by tests
<MenuItem href="/" label="Home" icon={<Home />} isActive />
</>
)

const DashboardLayout = async ({ children }: DashboardLayoutProps) => {
await authenticatedOnly()
return children
const { currentUser } = await getAuthenticatedOnlyApp()

Check warning on line 34 in app/(dashboard)/layout.tsx

View check run for this annotation

Codecov / codecov/patch

app/(dashboard)/layout.tsx#L34

Added line #L34 was not covered by tests

const user = <User user={getUserInfo(currentUser)} />

Check warning on line 36 in app/(dashboard)/layout.tsx

View check run for this annotation

Codecov / codecov/patch

app/(dashboard)/layout.tsx#L36

Added line #L36 was not covered by tests

return (

Check warning on line 38 in app/(dashboard)/layout.tsx

View check run for this annotation

Codecov / codecov/patch

app/(dashboard)/layout.tsx#L38

Added line #L38 was not covered by tests
<DashboardLayoutBase
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is very cool. Thank you for the outline.

I have a few high-level feedbacks on the UI components:

  1. Would be good to move this closer to the top, maybe below the horizontal title line with some small padding?
  2. I have the feeling this main bar has a bit too much vertical (and maybe slightly horizontal) spacing, might be cool to explore how this can be reduced a bit, e.g. taking the GitHub Main Bar as some inspiration.
  3. I would suggest making the sidebar a bit wider in its expanded form. It might be a bit of a bias, but it would be great if my name would fit without truncation 😄
Screenshot 2024-07-15 at 4 45 06 PM

I have also encountered a small bug:

  1. Resize the browser to go into the mobile view
  2. Open the menu in the view by pressing the hamburger menu
  3. Resize the view again to its full size: The menu stays open, but the button to dismiss it disappears. The expected behavior would be to show the normal navigation menu size instead; there might be some state handling here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Would be good to move this closer to the top, maybe below the horizontal title line with some small padding?

Sure, that works too.

Decrease vertical space

  1. I have the feeling this main bar has a bit too much vertical (and maybe slightly horizontal) spacing, might be cool to explore how this can be reduced a bit, e.g. taking the GitHub Main Bar as some inspiration.

Header bar is just mostly empty for now. It can contain way more, like action button, search input, controls, tabs, breadcrumbs. I think your feeling might be caused because of it's current emptiness. When you compare it against GitHub Main bar, it's way more crowded, but at the same GH's bar is even more vertical (86px ours vs 106px GH). I'd keep as is for now and possibly iterate later if needed.

  1. I would suggest making the sidebar a bit wider in its expanded form. It might be a bit of a bias, but it would be great if my name would fit without truncation 😄

Mine doesn't fit either 😄 It's not easy to fit our names! I would love not to expand sidebar more, because it's going to occupy more working space.

I played around making dashboard more compact in general. Let me know what you think
Make Dashboard more compact

I was very generous with white space, but more compact design is more universal.

I have also encountered a small bug

Fixed, thanks for catching it. It was actually caused by design system vs app classes clash. I might resolve it different way in the future, but for now this is ok. Fix classes clash

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for looking at all of this! Will check this out later today but feel free to merge the PR if you feel comfortable in merging it before 👍

aside={
<>
<Link href="/" className="interactive-opacity w-full pt-4">
<LogoType className="!h-auto !w-full px-2 xl:px-8" />
</Link>
<nav className="mt-9 flex flex-col gap-1 xl:w-full">
<MenuLinks />
</nav>
{user}
</>
}
mobile={
<>
<nav className="mt-9 flex flex-col gap-1 px-4">
<MenuLinks />
</nav>
{user}
</>
}
title={<PageTitle icon={<Home />} title="Home" />}
>
{children}
</DashboardLayoutBase>
)
}

export default DashboardLayout
4 changes: 1 addition & 3 deletions app/(dashboard)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@
//
// SPDX-License-Identifier: MIT
//
import { SignOutButton } from './SignOutButton'

const DashboardPage = () => (
<div className="grid gap-6 p-10 text-center">
<div className="text-center">

Check warning on line 10 in app/(dashboard)/page.tsx

View check run for this annotation

Codecov / codecov/patch

app/(dashboard)/page.tsx#L10

Added line #L10 was not covered by tests
<h1 className="text-2xl">Dashboard</h1>
<SignOutButton />
</div>
)

Expand Down
3 changes: 2 additions & 1 deletion app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ SPDX-FileCopyrightText: 2023 Stanford University and the project authors (see CO
SPDX-License-Identifier: MIT

*/
@import '../packages/design-system/src/main.css';

@tailwind base;
@tailwind components;
Expand All @@ -24,7 +25,7 @@ SPDX-License-Identifier: MIT

@layer components {
.focus-ring {
@apply ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2;
@apply ring-offset-surface focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2;
}
}

Expand Down
1 change: 0 additions & 1 deletion app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import type { Metadata } from 'next'
import { getLocale } from 'next-intl/server'
import type { ReactNode } from 'react'
import '@stanfordbdhg/design-system/main.css'
import { themeToCSSVariables, lightTheme } from '@stanfordbdhg/design-system'
import './globals.css'
import { AuthProvider } from '../modules/firebase/AuthProvider'
Expand Down
4 changes: 2 additions & 2 deletions app/sign-in/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
// SPDX-License-Identifier: MIT
//
import { SignInForm } from './SignInForm'
import { unauthenticatedOnly } from '../../modules/firebase/guards'
import { getUnauthenticatedOnlyApp } from '../../modules/firebase/guards'

Check warning on line 9 in app/sign-in/page.tsx

View check run for this annotation

Codecov / codecov/patch

app/sign-in/page.tsx#L9

Added line #L9 was not covered by tests

export const dynamic = 'force-dynamic'

const SignInPage = async () => {
await unauthenticatedOnly()
await getUnauthenticatedOnlyApp()

Check warning on line 14 in app/sign-in/page.tsx

View check run for this annotation

Codecov / codecov/patch

app/sign-in/page.tsx#L14

Added line #L14 was not covered by tests
return <SignInForm />
}

Expand Down
5 changes: 2 additions & 3 deletions components/AsideEngageLayout/AsideEngageLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// SPDX-License-Identifier: MIT
//
import Image from 'next/image'
import { LogoType } from '@/components/icons/LogoType'

Check warning on line 9 in components/AsideEngageLayout/AsideEngageLayout.tsx

View check run for this annotation

Codecov / codecov/patch

components/AsideEngageLayout/AsideEngageLayout.tsx#L9

Added line #L9 was not covered by tests
import {
type AsideBrandLayoutProps,
AsideBrandLayout,
Expand All @@ -17,9 +18,7 @@
<AsideBrandLayout
aside={
<>
<h2 className="text-6xl font-light tracking-widest text-primary">
ENGAGE-HF
</h2>
<LogoType className="h-auto w-80 text-primary" />
<Image
src="/stanfordbiodesign.png"
alt="Stanford Biodesign Logo"
Expand Down
28 changes: 28 additions & 0 deletions components/icons/LogoType.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//
// This source file is part of the Stanford Biodesign Digital Health ENGAGE-HF open-source project
//
// SPDX-FileCopyrightText: 2023 Stanford University and the project authors (see CONTRIBUTORS.md)
//
// SPDX-License-Identifier: MIT
//
import type { SVGProps } from 'react'

type LogoTypeProps = SVGProps<SVGSVGElement> & {
className?: string
}

export const LogoType = (props: LogoTypeProps) => (
<svg

Check warning on line 15 in components/icons/LogoType.tsx

View check run for this annotation

Codecov / codecov/patch

components/icons/LogoType.tsx#L14-L15

Added lines #L14 - L15 were not covered by tests
width="69"
height="10"
viewBox="0 0 69 10"
fill="none"
xmlns="http://www.w3.org/2000/svg"
{...props}
>
<path
d="M0.0568182 9V0.272727H5.32386V1.21023H1.11364V4.15909H5.05114V5.09659H1.11364V8.0625H5.39205V9H0.0568182ZM14.1491 0.272727V9H13.1264L8.37074 2.14773H8.28551V9H7.22869V0.272727H8.25142L13.0241 7.14205H13.1094V0.272727H14.1491ZM22.2298 3C22.136 2.71307 22.0124 2.45597 21.859 2.22869C21.7085 1.99858 21.5281 1.80256 21.3178 1.64062C21.1104 1.47869 20.8746 1.35511 20.6104 1.26989C20.3462 1.18466 20.0565 1.14205 19.7411 1.14205C19.2241 1.14205 18.7539 1.27557 18.3306 1.54261C17.9073 1.80966 17.5707 2.20312 17.3207 2.72301C17.0707 3.2429 16.9457 3.88068 16.9457 4.63636C16.9457 5.39205 17.0721 6.02983 17.3249 6.54972C17.5778 7.0696 17.9201 7.46307 18.3519 7.73011C18.7837 7.99716 19.2695 8.13068 19.8093 8.13068C20.3093 8.13068 20.7496 8.02415 21.1303 7.81108C21.5138 7.59517 21.8121 7.29119 22.0252 6.89915C22.2411 6.50426 22.3491 6.03977 22.3491 5.50568L22.6729 5.57386H20.0479V4.63636H23.3718V5.57386C23.3718 6.29261 23.2184 6.91761 22.9116 7.44886C22.6076 7.98011 22.1871 8.39205 21.6502 8.68466C21.1161 8.97443 20.5025 9.11932 19.8093 9.11932C19.0366 9.11932 18.3576 8.9375 17.7724 8.57386C17.19 8.21023 16.7354 7.69318 16.4087 7.02273C16.0849 6.35227 15.9229 5.55682 15.9229 4.63636C15.9229 3.94602 16.0153 3.32528 16.1999 2.77415C16.3874 2.22017 16.6516 1.74858 16.9925 1.35938C17.3335 0.97017 17.7369 0.671875 18.2028 0.464489C18.6687 0.257102 19.1815 0.153409 19.7411 0.153409C20.2013 0.153409 20.6303 0.223011 21.0281 0.362216C21.4286 0.498579 21.7852 0.693181 22.0977 0.946022C22.413 1.19602 22.6758 1.49574 22.886 1.84517C23.0962 2.19176 23.2411 2.5767 23.3207 3H22.2298ZM25.2702 9H24.1623L27.3668 0.272727H28.4577L31.6623 9H30.5543L27.9464 1.65341H27.8782L25.2702 9ZM25.6793 5.59091H30.1452V6.52841H25.6793V5.59091ZM38.5774 3C38.4837 2.71307 38.3601 2.45597 38.2067 2.22869C38.0561 1.99858 37.8757 1.80256 37.6655 1.64062C37.4581 1.47869 37.2223 1.35511 36.9581 1.26989C36.6939 1.18466 36.4041 1.14205 36.0888 1.14205C35.5717 1.14205 35.1016 1.27557 34.6783 1.54261C34.255 1.80966 33.9183 2.20312 33.6683 2.72301C33.4183 3.2429 33.2933 3.88068 33.2933 4.63636C33.2933 5.39205 33.4197 6.02983 33.6726 6.54972C33.9254 7.0696 34.2678 7.46307 34.6996 7.73011C35.1314 7.99716 35.6172 8.13068 36.157 8.13068C36.657 8.13068 37.0973 8.02415 37.478 7.81108C37.8615 7.59517 38.1598 7.29119 38.3729 6.89915C38.5888 6.50426 38.6967 6.03977 38.6967 5.50568L39.0206 5.57386H36.3956V4.63636H39.7195V5.57386C39.7195 6.29261 39.5661 6.91761 39.2592 7.44886C38.9553 7.98011 38.5348 8.39205 37.9979 8.68466C37.4638 8.97443 36.8501 9.11932 36.157 9.11932C35.3842 9.11932 34.7053 8.9375 34.12 8.57386C33.5376 8.21023 33.0831 7.69318 32.7564 7.02273C32.4325 6.35227 32.2706 5.55682 32.2706 4.63636C32.2706 3.94602 32.3629 3.32528 32.5476 2.77415C32.7351 2.22017 32.9993 1.74858 33.3402 1.35938C33.6811 0.97017 34.0845 0.671875 34.5504 0.464489C35.0163 0.257102 35.5291 0.153409 36.0888 0.153409C36.549 0.153409 36.978 0.223011 37.3757 0.362216C37.7763 0.498579 38.1328 0.693181 38.4453 0.946022C38.7607 1.19602 39.0234 1.49574 39.2337 1.84517C39.4439 2.19176 39.5888 2.5767 39.6683 3H38.5774ZM41.5295 9V0.272727H46.7965V1.21023H42.5863V4.15909H46.5238V5.09659H42.5863V8.0625H46.8647V9H41.5295ZM52.315 4.16761V5.10511H48.4968V4.16761H52.315ZM54.2209 9V0.272727H55.2777V4.15909H59.9311V0.272727H60.9879V9H59.9311V5.09659H55.2777V9H54.2209ZM63.1037 9V0.272727H68.3366V1.21023H64.1605V4.15909H67.9446V5.09659H64.1605V9H63.1037Z"
fill="currentColor"
/>
</svg>
)
4 changes: 2 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ module.exports = {
'!**/node_modules/**',
'!**/.storybook/**',
'!**/tailwind.config.ts',
'!**/*.stories.tsx'
]
'!**/*.stories.tsx',
],
}
2 changes: 1 addition & 1 deletion modules/firebase/AuthProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
'use client'
import { useRouter } from 'next/navigation'
import { useEffect } from 'react'
import { routes } from '@/modules/routes'

Check warning on line 11 in modules/firebase/AuthProvider.ts

View check run for this annotation

Codecov / codecov/patch

modules/firebase/AuthProvider.ts#L11

Added line #L11 was not covered by tests
import {
useAuthUser,
useRegisterAuthServiceWorker,
} from '@stanfordbdhg/design-system/modules/auth/hooks'
import { auth } from './clientApp'
import { firebaseConfig } from './config'
import { routes } from '../routes'

export const AuthProvider = () => {
const router = useRouter()
Expand Down
17 changes: 10 additions & 7 deletions modules/firebase/guards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,25 @@
//
// SPDX-License-Identifier: MIT
//
import { type User } from '@firebase/auth-types'
import { redirect } from 'next/navigation'
import { routes } from '@/modules/routes'

Check warning on line 10 in modules/firebase/guards.tsx

View check run for this annotation

Codecov / codecov/patch

modules/firebase/guards.tsx#L10

Added line #L10 was not covered by tests
import { getServerApp } from './serverApp'
import { routes } from '../routes'

/**
* Redirects to home if authenticated
* */
export const unauthenticatedOnly = async () => {
const { currentUser } = await getServerApp()
if (currentUser) redirect(routes.home)
export const getUnauthenticatedOnlyApp = async () => {
const firebaseApp = await getServerApp()

Check warning on line 17 in modules/firebase/guards.tsx

View check run for this annotation

Codecov / codecov/patch

modules/firebase/guards.tsx#L16-L17

Added lines #L16 - L17 were not covered by tests
if (firebaseApp.currentUser) redirect(routes.home)
return firebaseApp

Check warning on line 19 in modules/firebase/guards.tsx

View check run for this annotation

Codecov / codecov/patch

modules/firebase/guards.tsx#L19

Added line #L19 was not covered by tests
}

/**
* Redirects to signIn if not authenticated
* */
export const authenticatedOnly = async () => {
const { currentUser } = await getServerApp()
if (!currentUser) redirect(routes.signIn)
export const getAuthenticatedOnlyApp = async () => {
arkadiuszbachorski marked this conversation as resolved.
Show resolved Hide resolved
const firebaseApp = await getServerApp()

Check warning on line 26 in modules/firebase/guards.tsx

View check run for this annotation

Codecov / codecov/patch

modules/firebase/guards.tsx#L25-L26

Added lines #L25 - L26 were not covered by tests
if (!firebaseApp.currentUser) redirect(routes.signIn)
return firebaseApp as typeof firebaseApp & { currentUser: User }

Check warning on line 28 in modules/firebase/guards.tsx

View check run for this annotation

Codecov / codecov/patch

modules/firebase/guards.tsx#L28

Added line #L28 was not covered by tests
}
Loading
Loading