Skip to content

Commit dc715e4

Browse files
committed
Split Main.tsx into components
1 parent d4c1f14 commit dc715e4

File tree

7 files changed

+513
-453
lines changed

7 files changed

+513
-453
lines changed

.gitignore

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
build/
22
node_modules/
3-
output.*
3+
output.aux
4+
output.log
5+
output.pdf
6+
output.png
7+
output.synctex.gz
8+
output.tex
49
/*.png
510
!pipeline.png
611
dist

src/web/App.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useDarkMode } from 'usehooks-ts';
2-
import { Main } from './Main';
2+
import { Interactive } from './Interactive';
33
import { Sentences } from './Sentences';
44
import './App.css';
55
import { NavLink, Route, Routes } from 'react-router-dom';
@@ -21,7 +21,7 @@ export function App() {
2121
</button>
2222
</header>
2323
<Routes>
24-
<Route path="/" element={<Main />} />
24+
<Route path="/" element={<Interactive />} />
2525
<Route path="/sentences" element={<Sentences />} />
2626
</Routes>
2727
</div>

src/web/Interactive.tsx

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import _ from 'lodash';
2+
import { useState } from 'react';
3+
import { useLocalStorage } from 'usehooks-ts';
4+
5+
import { Configuration, Mode, Settings } from './Settings';
6+
import { Output } from './Output';
7+
8+
export function Interactive() {
9+
const [dismissed, setDismissed] = useLocalStorage(
10+
'explanationDismissed',
11+
false,
12+
);
13+
14+
const [configuration, setConfiguration] = useState<Configuration>();
15+
16+
return (
17+
<>
18+
{!dismissed && (
19+
<div className="card explanation">
20+
<p>
21+
This is a parser for the constructed language{' '}
22+
<a href="https://toaq.net/">Toaq</a>. It can interpret Toaq
23+
sentences and convert them to a variety of output formats.
24+
</p>
25+
<p>
26+
Write some Toaq in the textbox below, then click one of the buttons
27+
to see the output.
28+
</p>
29+
<button className="dismiss" onClick={() => setDismissed(true)}>
30+
Dismiss
31+
</button>
32+
</div>
33+
)}
34+
<Settings
35+
onSubmit={config => setConfiguration(config)}
36+
dismissExplanation={() => setDismissed(true)}
37+
/>
38+
{configuration && <Output configuration={configuration} />}
39+
</>
40+
);
41+
}

0 commit comments

Comments
 (0)