-
Notifications
You must be signed in to change notification settings - Fork 1
/
App.tsx
105 lines (100 loc) · 4.33 KB
/
App.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import { nanoid } from 'nanoid';
import { useEffect } from 'react';
import { Route, Routes } from 'react-router-dom';
import * as config from '../environment.json';
import {
CustomPage,
LoadingSpinner,
MainNav,
MarkdownPage,
MarkdownRenderer,
Message,
} from './components';
import { useGetSummary } from './Hooks';
import { Document } from './pages/Document/Document';
import example from './pages/example.json';
import buildingFromSource from './pages/GettingStarted/BuildingFromSource.md';
import gswApacheMavenPath from './pages/GettingStarted/GettingStartedWithApacheMaven.md';
import gswGradlePath from './pages/GettingStarted/GettingStartedWithGradle.md';
import gswGroovyGrape from './pages/GettingStarted/GettingStartedWithGroovyGrape.md';
import gswJitpack from './pages/GettingStarted/GettingStartedWithJitpack.md';
import { NeuralNetworksQuickstart } from './pages/GettingStarted/NeuralNetworksQuickstart/NeuralNetworksQuickstart';
import { Home } from './pages/Home/Home';
import { CodeTag } from './components/shared/CodeTag/CodeTag';
export const App = (): JSX.Element => {
const { data: summary, isLoading, isError } = useGetSummary();
useEffect(() => {
document.title = config.appName;
}, []);
if (isError) {
return (
<Message level="error" headline="The summary couldn't be loaded">
The summary has some loading problems. Please try again later.
If the problem still occurs, please open an{' '}
<a href={config.LinkToIssueReport}>issue</a>.
</Message>
);
} else if (isLoading) {
return <LoadingSpinner isLoading={isLoading} />;
} else {
return (
<main>
<div className="app">
{summary !== undefined && summary !== null && (
<MainNav summary={summary} />
)}
<Routes>
<Route path="/" element={<Home />} />
{summary?.specifications.map((spec) => (
<Route
path={`/${spec.className}`}
element={<Document fileName={spec.className} />}
key={nanoid()}
/>
))}
<Route
path="/getting-started/neural-networks-quickstart"
element={<NeuralNetworksQuickstart />}
/>
<Route
path="/getting-started/getting-started-with-apache-maven"
element={
<MarkdownPage filePath={gswApacheMavenPath} />
}
/>
<Route
path="/getting-started/getting-started-with-gradle"
element={<MarkdownPage filePath={gswGradlePath} />}
/>
<Route
path="/getting-started/getting-started-with-jitpack"
element={<MarkdownPage filePath={gswJitpack} />}
/>
<Route
path="/getting-started/getting-started-with-groovy-grape"
element={<MarkdownPage filePath={gswGroovyGrape} />}
/>
<Route
path="/getting-started/building-from-source"
element={
<MarkdownPage filePath={buildingFromSource} />
}
/>
<Route
path="/example"
element={
<CustomPage>
<MarkdownRenderer>
{example.narrative}
</MarkdownRenderer>
<br />
<CodeTag>Code Tag</CodeTag>
</CustomPage>
}
/>
</Routes>
</div>
</main>
);
}
};