import { createBrowserRouter } from 'react-router-dom' import { Layout } from 'layout' import { SearchPage } from 'pages/search' import { AboutPage } from '../pages/about' import { BlogsPage } from '../pages/blogs' import { GamesPage } from '../pages/games' import { HomePage } from '../pages/home' import { ModPage } from '../pages/mod' import { ModsPage } from '../pages/mods' import { ProfilePage } from '../pages/profile' import { SettingsPage } from '../pages/settings' import { SubmitModPage } from '../pages/submitMod' import { WritePage } from '../pages/write' import { GamePage } from 'pages/game' import { NotFoundPage } from 'pages/404' import { FeedLayout } from 'layout/feed' import { FeedPage } from 'pages/feed' import { NotificationsPage } from 'pages/notifications' export const appRoutes = { index: '/', home: '/', games: '/games', game: '/game/:name', mods: '/mods', mod: '/mod/:naddr', about: '/about', blog: '/blog', submitMod: '/submit-mod', editMod: '/edit-mod/:naddr', write: '/write', search: '/search', settingsProfile: '/settings-profile', settingsRelays: '/settings-relays', settingsPreferences: '/settings-preferences', settingsAdmin: '/settings-admin', profile: '/profile/:nprofile?', feed: '/feed', notifications: '/notifications' } export const getGamePageRoute = (name: string) => appRoutes.game.replace(':name', name) export const getModPageRoute = (eventId: string) => appRoutes.mod.replace(':naddr', eventId) export const getModsEditPageRoute = (eventId: string) => appRoutes.editMod.replace(':naddr', eventId) export const getProfilePageRoute = (nprofile: string) => appRoutes.profile.replace(':nprofile', nprofile) export const router = createBrowserRouter([ { element: , children: [ { path: appRoutes.index, element: }, { path: appRoutes.games, element: }, { path: appRoutes.game, element: }, { path: appRoutes.mods, element: }, { path: appRoutes.mod, element: }, { path: appRoutes.about, element: }, { path: appRoutes.blog, element: }, { path: appRoutes.submitMod, element: }, { path: appRoutes.editMod, element: }, { path: appRoutes.write, element: }, { path: appRoutes.search, element: }, { path: appRoutes.settingsProfile, element: }, { path: appRoutes.settingsRelays, element: }, { path: appRoutes.settingsPreferences, element: }, { path: appRoutes.settingsAdmin, element: }, { path: appRoutes.profile, element: }, { element: , children: [ { path: appRoutes.feed, element: }, { path: appRoutes.notifications, element: } ] }, { path: '*', element: } ] } ])