From 806e9f358a2fec20452c35760b9c425aa0818abe Mon Sep 17 00:00:00 2001 From: MartinBraquet Date: Sat, 23 May 2026 19:46:02 +0200 Subject: [PATCH] Add loading indicator with timeout for ProfilesPage while user data is being fetched --- common/messages/de.json | 3 +++ common/messages/fr.json | 3 +++ web/pages/index.tsx | 25 ++++++++++++++++++------- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/common/messages/de.json b/common/messages/de.json index d85cd3bf..f006402b 100644 --- a/common/messages/de.json +++ b/common/messages/de.json @@ -1099,6 +1099,9 @@ "profiles.seeing_all_profiles": "Sie sehen alle Profile. Verwenden Sie Suche oder Filter, um einzugrenzen.", "profiles.show_filters": "Filter anzeigen", "profiles.sort_differently": "Anders sortieren", + "profiles.loading_dashboard": "Dashboard wird geladen…", + "profiles.loading_dashboard_desc": "Der Server startet gerade, bitte warten.", + "profiles.loading_slow": "Noch am Starten — gleich geht's los…", "profiles.title": "Personen", "profiles.try_keyword_search": "Schlüsselwortsuche versuchen", "referrals.title": "Lade jemanden ein, Compass beizutreten!", diff --git a/common/messages/fr.json b/common/messages/fr.json index 2e093999..e4df429c 100644 --- a/common/messages/fr.json +++ b/common/messages/fr.json @@ -1098,6 +1098,9 @@ "profiles.seeing_all_profiles": "Vous voyez tous les profils. Utilisez la recherche ou les filtres pour affiner.", "profiles.show_filters": "Voir les filtres", "profiles.sort_differently": "Trier différemment", + "profiles.loading_dashboard": "Chargement du tableau de bord…", + "profiles.loading_dashboard_desc": "Le serveur démarre, patientez un instant.", + "profiles.loading_slow": "Démarrage en cours — encore quelques secondes…", "profiles.title": "Personnes", "profiles.try_keyword_search": "Essayer une recherche par mot-clé", "referrals.title": "Invitez quelqu'un à rejoindre Compass !", diff --git a/web/pages/index.tsx b/web/pages/index.tsx index ef1f8263..38a54d74 100644 --- a/web/pages/index.tsx +++ b/web/pages/index.tsx @@ -1,8 +1,10 @@ import {debug} from 'common/logger' +import {useEffect, useState} from 'react' import {LoggedOutHome} from 'web/components/home/home' import {Col} from 'web/components/layout/col' import {PageBase} from 'web/components/page-base' import {ProfilesHome} from 'web/components/profiles/profiles-home' +import {CompassLoadingIndicator} from 'web/components/widgets/loading-indicator' import {useUser} from 'web/hooks/use-user' import {useT} from 'web/lib/locale' @@ -15,20 +17,29 @@ import {useT} from 'web/lib/locale' export default function ProfilesPage() { const user = useUser() const t = useT() + const [slowLoad, setSlowLoad] = useState(false) + + useEffect(() => { + if (user !== undefined) return + const timer = setTimeout(() => setSlowLoad(true), 5000) + return () => clearTimeout(timer) + }, [user]) if (user === undefined) { return ( - -
-
+ + +

{t('profiles.loading_dashboard', 'Loading dashboard…')}

- {/*

*/} - {/* {t('profiles.loading_dashboard_desc', 'Hang tight while we set things up for you.')}*/} - {/*

*/} -
+

+ {slowLoad + ? t('profiles.loading_slow', 'Still starting up — almost there…') + : t('profiles.loading_dashboard_desc', 'The server is waking up, hang tight.')} +

+ )