Skip to content

Commit 2069d02

Browse files
committed
Tidy up loading and error states
1 parent feb1c8b commit 2069d02

12 files changed

Lines changed: 75 additions & 35 deletions

File tree

frontend/src/components/App.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import { lazy, Suspense, type FunctionComponent } from 'react';
22
import { Route, Switch } from 'wouter';
33
import { RedirectRoute } from './RedirectRoute';
44
import { Footer } from './Footer';
5+
import { Header } from './common/Header';
6+
import { LoadingIndicator } from './common/Loader';
57
import { LoginCallback } from './login/LoginCallback';
68
import { RetroRouter } from './RetroRouter';
79
import { WatchRetro } from './WatchRetro';
@@ -61,4 +63,9 @@ export const App: FunctionComponent = () => (
6163
</>
6264
);
6365

64-
const LOADER = <div className="loader">Loading&hellip;</div>;
66+
const LOADER = (
67+
<article className="page-loading">
68+
<Header documentTitle="Refacto" title="Refacto" />
69+
<LoadingIndicator />
70+
</article>
71+
);

frontend/src/components/RetroRouter.tsx

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import { useRetroAuth } from '../hooks/data/useRetroAuth';
1414
import { useRetroReducer } from '../hooks/data/useRetroReducer';
1515
import { StateMapProvider } from '../hooks/useStateMap';
1616
import { RetroNotFoundPage } from './retro-not-found/RetroNotFoundPage';
17+
import { Header } from './common/Header';
18+
import { LoadingError, LoadingIndicator } from './common/Loader';
1719
import { PasswordPage } from './password/PasswordPage';
1820
import { ConnectionOverlay } from './retro/ConnectionOverlay';
1921
import { RetroPage } from './retro/RetroPage';
@@ -41,19 +43,46 @@ export const RetroRouter: FunctionComponent<PropsT> = ({ slug }) => {
4143
}
4244

4345
if (slugError) {
44-
return <div className="loader error">{slugError.message}</div>;
46+
return (
47+
<article className="page-retro-error">
48+
<Header
49+
documentTitle={`${slug} - Refacto`}
50+
title={slug}
51+
backLink={{ label: 'Home', action: '/' }}
52+
/>
53+
<LoadingError error={slugError.message} />
54+
</article>
55+
);
4556
}
4657

4758
if (!retroId) {
48-
return <div className="loader">Loading&hellip;</div>;
59+
return (
60+
<article className="page-retro-loading">
61+
<Header
62+
documentTitle={`${slug} - Refacto`}
63+
title={slug}
64+
backLink={{ label: 'Home', action: '/' }}
65+
/>
66+
<LoadingIndicator />
67+
</article>
68+
);
4969
}
5070

5171
if (!retroAuth || (!retroState && status === 'reauthenticate')) {
5272
return <PasswordPage slug={slug} retroId={retroId} />;
5373
}
5474

5575
if (!retroState) {
56-
return <div className="loader">Loading&hellip;</div>;
76+
return (
77+
<article className="page-retro-loading">
78+
<Header
79+
documentTitle={`${slug} - Refacto`}
80+
title={slug}
81+
backLink={{ label: 'Home', action: '/' }}
82+
/>
83+
<LoadingIndicator />
84+
</article>
85+
);
5786
}
5887

5988
const retroParams = {

frontend/src/components/WatchRetro.tsx

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { retroAuthService } from '../api/api';
44
import { LiveEventsProvider } from '../hooks/useLiveEvents';
55
import { useRetroReducer } from '../hooks/data/useRetroReducer';
66
import { useLocationHash } from '../hooks/env/useLocationHash';
7+
import { Header } from './common/Header';
8+
import { LoadingIndicator } from './common/Loader';
79
import { ConnectionOverlay } from './retro/ConnectionOverlay';
810
import { RetroPage } from './retro/RetroPage';
911

@@ -30,14 +32,28 @@ export const WatchRetro: FunctionComponent<PropsT> = ({ retroId }) => {
3032

3133
if (retroAuth.state === 'rejected') {
3234
return (
33-
<div className="loader error">
34-
Incorrect URL, or access to this retro has been revoked
35-
</div>
35+
<article className="page-watch-auth-error short-page">
36+
<Header
37+
documentTitle="Incorrect URL - Refacto"
38+
title="Incorrect URL"
39+
backLink={{ label: 'Home', action: '/' }}
40+
/>
41+
<p>Incorrect URL, or access to this retro has been revoked</p>
42+
</article>
3643
);
3744
}
3845

3946
if (!retroAuth.latestData || !retroState) {
40-
return <div className="loader">Loading&hellip;</div>;
47+
return (
48+
<article className="page-retro-loading">
49+
<Header
50+
documentTitle="Refacto"
51+
title="Refacto"
52+
backLink={{ label: 'Home', action: '/' }}
53+
/>
54+
<LoadingIndicator />
55+
</article>
56+
);
4157
}
4258

4359
return (

frontend/src/components/archive-list/ArchiveListPage.css

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
11
.page-archive-list {
2-
text-align: center;
3-
4-
& p {
5-
margin: 64px 32px;
6-
}
7-
82
& ul.archives {
93
margin: 64px 16px 128px;
104
list-style: none;

frontend/src/components/archive-list/ArchiveListPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const ArchiveListPage = memo(({ retroAuth, retro }: PropsT) => {
1616
);
1717

1818
return (
19-
<article className="page-archive-list">
19+
<article className="page-archive-list short-page">
2020
<Header
2121
documentTitle={`Archives - ${retro.name} - Refacto`}
2222
title={`${retro.name} Archives`}

frontend/src/components/global-styles/article.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,11 @@
5353
}
5454
}
5555
}
56+
57+
.short-page {
58+
text-align: center;
59+
60+
& p {
61+
margin: 64px 32px;
62+
}
63+
}

frontend/src/components/login/LoginCallback.css

Lines changed: 0 additions & 7 deletions
This file was deleted.

frontend/src/components/login/LoginCallback.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { handleLogin } from './handleLogin';
44
import { useEvent } from '../../hooks/useEvent';
55
import { sessionStore } from '../../helpers/storage';
66
import { Header } from '../common/Header';
7-
import './LoginCallback.css';
87

98
interface PropsT {
109
service: string;
@@ -55,7 +54,7 @@ export const LoginCallback = memo(({ service }: PropsT) => {
5554
}, [stableSetLocation]);
5655

5756
return (
58-
<article className="page-login-callback">
57+
<article className="page-login-callback short-page">
5958
<Header
6059
documentTitle="Refacto"
6160
title="Refacto"

frontend/src/components/not-found/NotFoundPage.css

Lines changed: 0 additions & 7 deletions
This file was deleted.

frontend/src/components/not-found/NotFoundPage.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import { memo } from 'react';
22
import { Header } from '../common/Header';
3-
import './NotFoundPage.css';
43

54
export const NotFoundPage = memo(() => (
6-
<article className="page-not-found">
5+
<article className="page-not-found short-page">
76
<Header
87
documentTitle="Not Found - Refacto"
98
title="Not Found"

0 commit comments

Comments
 (0)