degmods.com/src/routes/index.tsx

142 lines
3.4 KiB
TypeScript
Raw Normal View History

2024-10-23 16:00:53 +00:00
import { createBrowserRouter } from 'react-router-dom'
import { Layout } from 'layout'
import { SearchPage } from 'pages/search'
2024-07-11 15:09:47 +00:00
import { AboutPage } from '../pages/about'
2024-07-11 13:34:12 +00:00
import { BlogsPage } from '../pages/blogs'
2024-07-11 12:15:03 +00:00
import { GamesPage } from '../pages/games'
2024-07-11 11:45:59 +00:00
import { HomePage } from '../pages/home'
import { ModPage } from '../pages/mod'
2024-07-11 12:52:48 +00:00
import { ModsPage } from '../pages/mods'
import { ProfilePage } from '../pages/profile'
2024-07-12 13:55:42 +00:00
import { SettingsPage } from '../pages/settings'
2024-07-11 20:03:52 +00:00
import { SubmitModPage } from '../pages/submitMod'
2024-07-12 09:22:31 +00:00
import { WritePage } from '../pages/write'
import { GamePage } from 'pages/game'
2024-10-23 16:00:53 +00:00
import { NotFoundPage } from 'pages/404'
import { FeedLayout } from 'layout/feed'
import { FeedPage } from 'pages/feed'
import { NotificationsPage } from 'pages/notifications'
2024-07-11 11:45:59 +00:00
2024-07-11 12:15:03 +00:00
export const appRoutes = {
2024-07-11 11:45:59 +00:00
index: '/',
2024-10-23 15:54:33 +00:00
home: '/',
2024-07-11 12:15:03 +00:00
games: '/games',
game: '/game/:name',
2024-07-11 12:15:03 +00:00
mods: '/mods',
mod: '/mod/:naddr',
2024-07-11 12:15:03 +00:00
about: '/about',
2024-07-11 20:03:52 +00:00
blog: '/blog',
2024-07-12 09:22:31 +00:00
submitMod: '/submit-mod',
2024-08-26 12:11:33 +00:00
editMod: '/edit-mod/:naddr',
2024-07-12 13:55:42 +00:00
write: '/write',
search: '/search',
2024-07-12 13:55:42 +00:00
settingsProfile: '/settings-profile',
settingsRelays: '/settings-relays',
settingsPreferences: '/settings-preferences',
settingsAdmin: '/settings-admin',
2024-10-23 16:00:53 +00:00
profile: '/profile/:nprofile?',
feed: '/feed',
notifications: '/notifications'
2024-07-11 11:45:59 +00:00
}
export const getGamePageRoute = (name: string) =>
appRoutes.game.replace(':name', name)
export const getModPageRoute = (eventId: string) =>
appRoutes.mod.replace(':naddr', eventId)
2024-07-25 15:05:28 +00:00
2024-08-19 06:41:11 +00:00
export const getModsEditPageRoute = (eventId: string) =>
2024-08-26 12:11:33 +00:00
appRoutes.editMod.replace(':naddr', eventId)
2024-08-19 06:41:11 +00:00
export const getProfilePageRoute = (nprofile: string) =>
appRoutes.profile.replace(':nprofile', nprofile)
2024-10-23 16:00:53 +00:00
export const router = createBrowserRouter([
{
element: <Layout />,
children: [
{
path: appRoutes.index,
element: <HomePage />
},
{
path: appRoutes.games,
element: <GamesPage />
},
{
path: appRoutes.game,
element: <GamePage />
},
{
path: appRoutes.mods,
element: <ModsPage />
},
{
path: appRoutes.mod,
element: <ModPage />
},
{
path: appRoutes.about,
element: <AboutPage />
},
{
path: appRoutes.blog,
element: <BlogsPage />
},
{
path: appRoutes.submitMod,
element: <SubmitModPage />
},
{
path: appRoutes.editMod,
element: <SubmitModPage />
},
{
path: appRoutes.write,
element: <WritePage />
},
{
path: appRoutes.search,
element: <SearchPage />
},
{
path: appRoutes.settingsProfile,
element: <SettingsPage />
},
{
path: appRoutes.settingsRelays,
element: <SettingsPage />
},
{
path: appRoutes.settingsPreferences,
element: <SettingsPage />
},
{
path: appRoutes.settingsAdmin,
element: <SettingsPage />
},
{
path: appRoutes.profile,
element: <ProfilePage />
},
{
element: <FeedLayout />,
children: [
{
path: appRoutes.feed,
element: <FeedPage />
},
{
path: appRoutes.notifications,
element: <NotificationsPage />
}
]
},
{
path: '*',
element: <NotFoundPage />
}
]
2024-07-11 11:45:59 +00:00
}
2024-10-23 16:00:53 +00:00
])