Skip to content

Commit 806e9f3

Browse files
committed
Add loading indicator with timeout for ProfilesPage while user data is being fetched
1 parent 1adad6f commit 806e9f3

3 files changed

Lines changed: 24 additions & 7 deletions

File tree

common/messages/de.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,6 +1099,9 @@
10991099
"profiles.seeing_all_profiles": "Sie sehen alle Profile. Verwenden Sie Suche oder Filter, um einzugrenzen.",
11001100
"profiles.show_filters": "Filter anzeigen",
11011101
"profiles.sort_differently": "Anders sortieren",
1102+
"profiles.loading_dashboard": "Dashboard wird geladen…",
1103+
"profiles.loading_dashboard_desc": "Der Server startet gerade, bitte warten.",
1104+
"profiles.loading_slow": "Noch am Starten — gleich geht's los…",
11021105
"profiles.title": "Personen",
11031106
"profiles.try_keyword_search": "Schlüsselwortsuche versuchen",
11041107
"referrals.title": "Lade jemanden ein, Compass beizutreten!",

common/messages/fr.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,6 +1098,9 @@
10981098
"profiles.seeing_all_profiles": "Vous voyez tous les profils. Utilisez la recherche ou les filtres pour affiner.",
10991099
"profiles.show_filters": "Voir les filtres",
11001100
"profiles.sort_differently": "Trier différemment",
1101+
"profiles.loading_dashboard": "Chargement du tableau de bord…",
1102+
"profiles.loading_dashboard_desc": "Le serveur démarre, patientez un instant.",
1103+
"profiles.loading_slow": "Démarrage en cours — encore quelques secondes…",
11011104
"profiles.title": "Personnes",
11021105
"profiles.try_keyword_search": "Essayer une recherche par mot-clé",
11031106
"referrals.title": "Invitez quelqu'un à rejoindre Compass !",

web/pages/index.tsx

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import {debug} from 'common/logger'
2+
import {useEffect, useState} from 'react'
23
import {LoggedOutHome} from 'web/components/home/home'
34
import {Col} from 'web/components/layout/col'
45
import {PageBase} from 'web/components/page-base'
56
import {ProfilesHome} from 'web/components/profiles/profiles-home'
7+
import {CompassLoadingIndicator} from 'web/components/widgets/loading-indicator'
68
import {useUser} from 'web/hooks/use-user'
79
import {useT} from 'web/lib/locale'
810

@@ -15,20 +17,29 @@ import {useT} from 'web/lib/locale'
1517
export default function ProfilesPage() {
1618
const user = useUser()
1719
const t = useT()
20+
const [slowLoad, setSlowLoad] = useState(false)
21+
22+
useEffect(() => {
23+
if (user !== undefined) return
24+
const timer = setTimeout(() => setSlowLoad(true), 5000)
25+
return () => clearTimeout(timer)
26+
}, [user])
1827

1928
if (user === undefined) {
2029
return (
2130
<PageBase trackPageView={'loading'}>
22-
<Col className="items-center justify-center min-h-[60vh] gap-6 text-center">
23-
<div className="animate-spin rounded-full h-14 w-14 border-4 border-primary-500 border-t-transparent" />
24-
<div className="flex flex-col gap-2">
31+
<Col className="items-center gap-8 px-4 py-8">
32+
<Col className="items-center gap-3 text-center pt-8">
33+
<CompassLoadingIndicator />
2534
<h2 className="text-2xl font-semibold">
2635
{t('profiles.loading_dashboard', 'Loading dashboard…')}
2736
</h2>
28-
{/*<p className="text-ink-500 max-w-sm">*/}
29-
{/* {t('profiles.loading_dashboard_desc', 'Hang tight while we set things up for you.')}*/}
30-
{/*</p>*/}
31-
</div>
37+
<p className="text-ink-500 max-w-sm text-sm">
38+
{slowLoad
39+
? t('profiles.loading_slow', 'Still starting up — almost there…')
40+
: t('profiles.loading_dashboard_desc', 'The server is waking up, hang tight.')}
41+
</p>
42+
</Col>
3243
</Col>
3344
</PageBase>
3445
)

0 commit comments

Comments
 (0)