Skip to content

Commit 0336cc7

Browse files
committed
Add screen when Routinator is not initialised yet
1 parent f14bb0a commit 0336cc7

5 files changed

Lines changed: 41 additions & 0 deletions

File tree

src/components/App.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,17 @@ import Metrics from './Metrics';
77
import useStatus, { StatusContext } from '../hooks/useStatus';
88
import Repositories from './Repositories';
99
import Connections from './Connections';
10+
import Loading from './Loading';
1011

1112
export default function App() {
1213
const routerState = useRouter();
1314
const { status, roto } = useStatus();
1415
const routeName = routerState.route.name;
1516

17+
if (!status || (status && status.error)) {
18+
return <Loading error={status?.error} />
19+
}
20+
1621
return (
1722
<RouterContext.Provider value={routerState}>
1823
<Nav />

src/components/Loading.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
interface LoadingProps {
2+
error?: string;
3+
}
4+
5+
export default function Loading({ error }: LoadingProps) {
6+
return (
7+
<div id="loading">
8+
<div>
9+
<img src='/src/img/routinator_logo_white.svg' alt='Routinator logo' />
10+
<br />
11+
<p>{error || "Something went wrong"}</p>
12+
</div>
13+
</div>
14+
);
15+
}

src/style/index.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@
1212
@import './prefix-check-sidebar.css';
1313
@import './prefix-check.css';
1414
@import './help.css';
15+
@import './loading.css';

src/style/loading.css

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#loading {
2+
width: 100%;
3+
height: 100%;
4+
display: flex;
5+
justify-content: center;
6+
align-items: center;
7+
text-align: center;
8+
min-height: 100vh;
9+
background-color: var(--blue-dark);
10+
background: radial-gradient(circle,rgba(0, 31, 109, 1) 0%, rgba(0, 25, 87, 1) 100%);
11+
color: var(--white);
12+
font-weight: bold;
13+
font-size: 2rem;
14+
}
15+
16+
#loading img {
17+
max-width: 40rem;
18+
animation: pulse 2s infinite;
19+
}

src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export interface RoutinatorStatus {
2+
error?: string;
23
version: string;
34
serial: number;
45
now: Date;

0 commit comments

Comments
 (0)