Files
misode.github.io/src/app/App.tsx
Misode 6f27465c78 Add guides (#224)
* Add guides

* Add versioning to guides

* Guides: special variables and nested expressions

* Add guides page to vite build

* Add search and hash hooks, guide tags and headings

* Improve guides list and filtering

* Add 1.19 download link
2022-05-06 06:37:27 +02:00

33 lines
1.0 KiB
TypeScript

import type { RouterOnChangeArgs } from 'preact-router'
import { Router } from 'preact-router'
import '../styles/global.css'
import '../styles/nodes.css'
import { Analytics } from './Analytics'
import { Header } from './components'
import { Category, Changelog, Generator, Guide, Guides, Home, Project, Sounds, Versions } from './pages'
import { cleanUrl } from './Utils'
export function App() {
const changeRoute = (e: RouterOnChangeArgs) => {
window.dispatchEvent(new CustomEvent('replacestate'))
// Needs a timeout to ensure the title is set correctly
setTimeout(() => Analytics.pageview(cleanUrl(e.url)))
}
return <>
<Header />
<Router onChange={changeRoute}>
<Home path="/" />
<Category path="/worldgen" category="worldgen" />
<Category path="/assets" category="assets" />
<Sounds path="/sounds" />
<Changelog path="/changelog" />
<Versions path="/versions" />
<Project path="/project" />
<Guides path="/guides/" />
<Guide path="/guides/:id" />
<Generator default />
</Router>
</>
}