@@ -3,7 +3,6 @@ import type { Component, JSXElement, VoidComponent } from 'solid-js'
33import { Navigate , type RouteSectionProps , useLocation } from '@solidjs/router'
44import clsx from 'clsx'
55
6- import { isSignedIn } from '~/api/auth/client'
76import { USERADMIN_URL } from '~/api/config'
87import { getDevices } from '~/api/devices'
98import { getProfile } from '~/api/profile'
@@ -52,14 +51,25 @@ const DashboardDrawer: VoidComponent<{ devices: Device[] }> = (props) => {
5251 < Suspense fallback = { < div class = "min-h-16 rounded-md skeleton-loader" /> } >
5352 < div class = "flex max-w-full items-center px-3 rounded-md outline outline-1 outline-outline-variant min-h-16" >
5453 < div class = "shrink-0 size-10 inline-flex items-center justify-center rounded-full bg-primary-container text-on-primary-container" >
55- < Icon name = " person" filled />
54+ < Icon name = { ! profile . loading && ! profile . latest ? 'person_off' : ' person' } filled />
5655 </ div >
57- < div class = "min-w-0 mx-3" >
58- < div class = "truncate text-body-md text-on-surface" > { profile ( ) ?. email } </ div >
59- < div class = "truncate text-label-sm text-on-surface-variant" > { profile ( ) ?. user_id } </ div >
60- </ div >
61- < div class = "grow" />
62- < IconButton name = "logout" href = "/logout" />
56+ < Show
57+ when = { profile ( ) }
58+ fallback = {
59+ < >
60+ < div class = "mx-3" > Not signed in</ div >
61+ < div class = "grow" />
62+ < IconButton name = "login" href = "/login" />
63+ </ >
64+ }
65+ >
66+ < div class = "min-w-0 mx-3" >
67+ < div class = "truncate text-body-md text-on-surface" > { profile ( ) ?. email } </ div >
68+ < div class = "truncate text-label-sm text-on-surface-variant" > { profile ( ) ?. user_id } </ div >
69+ </ div >
70+ < div class = "grow" />
71+ < IconButton name = "logout" href = "/logout" />
72+ </ Show >
6373 </ div >
6474 </ Suspense >
6575 </ ButtonBase >
@@ -119,9 +129,6 @@ const Dashboard: Component<RouteSectionProps> = () => {
119129 return (
120130 < Drawer drawer = { < DashboardDrawer devices = { devices ( ) } /> } >
121131 < Switch fallback = { < TopAppBar leading = { < DrawerToggleButton /> } > No device</ TopAppBar > } >
122- < Match when = { ! isSignedIn ( ) || ( ! profile . loading && ! profile . latest ) } >
123- < Navigate href = "/login" />
124- </ Match >
125132 < Match when = { urlState ( ) . dongleId === 'pair' || ! ! location . query . pair } >
126133 < PairActivity onPaired = { refetch } />
127134 </ Match >
@@ -152,6 +159,9 @@ const Dashboard: Component<RouteSectionProps> = () => {
152159 />
153160 ) }
154161 </ Match >
162+ < Match when = { ! profile . loading && ! profile . latest } >
163+ < Navigate href = "/login" />
164+ </ Match >
155165 < Match when = { getDefaultDongleId ( ) } keyed >
156166 { ( defaultDongleId ) => < Navigate href = { `/${ defaultDongleId } ` } /> }
157167 </ Match >
0 commit comments