2026-03-28 17:33:56 +01:00
|
|
|
import { component, unmount } from 'riot'
|
2026-03-27 15:03:17 +01:00
|
|
|
import App from './components/app.riot'
|
2026-03-28 17:33:56 +01:00
|
|
|
import PageDetail from './components/page-detail.riot'
|
2026-03-28 18:23:03 +01:00
|
|
|
import 'chart.css'
|
2026-03-22 13:25:37 +01:00
|
|
|
|
2026-03-28 17:33:56 +01:00
|
|
|
const app = document.getElementById('app')
|
|
|
|
|
let currentComponent = null
|
|
|
|
|
|
|
|
|
|
function navigate()
|
|
|
|
|
{
|
|
|
|
|
const hash = window.location.hash
|
|
|
|
|
|
|
|
|
|
if (currentComponent)
|
|
|
|
|
{
|
|
|
|
|
unmount(app, true)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (hash.startsWith('#/formation/'))
|
|
|
|
|
{
|
|
|
|
|
const id = hash.replace('#/formation/', '')
|
|
|
|
|
currentComponent = component(PageDetail)(app, { id })
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
currentComponent = component(App)(app)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
window.addEventListener('hashchange', navigate)
|
|
|
|
|
navigate()
|