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' // To simulate downtime, you need the error to happen at runtime, not at build time. // That means the page must be server-rendered, not statically generated. // export async function getServerSideProps() { // throw new Error('500 - Test downtime'); // } 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…')}

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

) } debug('user:', user) return ( {user ? : } ) }