feat: web (#6)

This commit is contained in:
Cody Tseng 2024-11-16 15:44:37 +08:00 committed by GitHub
parent ab667afc30
commit 26c2512d61
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
60 changed files with 937 additions and 547 deletions

View file

@ -0,0 +1,21 @@
import { match } from 'path-to-regexp'
import { isValidElement } from 'react'
import FollowingListPage from './pages/secondary/FollowingListPage'
import HashtagPage from './pages/secondary/HashtagPage'
import HomePage from './pages/secondary/HomePage'
import NotePage from './pages/secondary/NotePage'
import ProfilePage from './pages/secondary/ProfilePage'
const ROUTES = [
{ path: '/', element: <HomePage /> },
{ path: '/note/:id', element: <NotePage /> },
{ path: '/user/:id', element: <ProfilePage /> },
{ path: '/user/:id/following', element: <FollowingListPage /> },
{ path: '/hashtag/:id', element: <HashtagPage /> }
]
export const routes = ROUTES.map(({ path, element }) => ({
path,
element: isValidElement(element) ? element : null,
matcher: match(path)
}))