Files
page-agent/packages/website/src/main.tsx
T

23 lines
600 B
TypeScript
Raw Normal View History

2025-09-29 16:33:15 +08:00
import { createRoot } from 'react-dom/client'
2026-01-11 01:04:43 +08:00
import { Router } from 'wouter'
2025-09-29 16:33:15 +08:00
2026-01-30 16:47:23 +08:00
import { LanguageProvider } from './i18n/context'
2025-12-16 01:30:40 +08:00
import { default as PagesRouter } from './router'
2025-09-29 16:33:15 +08:00
import './index.css'
2026-02-27 19:46:44 +08:00
// Redirect legacy hash routes (e.g. /#/docs/foo) to clean paths
const { hash } = window.location
if (hash.length > 1 && hash.includes('/')) {
const path = hash.replace(/^#\/?/, '/')
history.replaceState(null, '', '/page-agent' + path)
}
2025-09-29 16:33:15 +08:00
createRoot(document.getElementById('root')!).render(
2026-01-30 16:47:23 +08:00
<LanguageProvider>
2026-02-27 19:46:44 +08:00
<Router base="/page-agent">
2026-01-30 16:47:23 +08:00
<PagesRouter />
</Router>
</LanguageProvider>
2025-09-29 16:33:15 +08:00
)