added chapter view, fixes, added ratings, added chapter updates/deletions

This commit is contained in:
lnn0q 2025-06-01 00:37:26 +03:00
parent 029b7e9353
commit 4801cf3a13
34 changed files with 1345 additions and 191 deletions

View file

@ -18,7 +18,10 @@ import { Route as AboutImport } from './pages/about'
import { Route as IndexImport } from './pages/index'
import { Route as ProfileUsernameImport } from './pages/profile/$username'
import { Route as NewBookImport } from './pages/new/book'
import { Route as WorkBookBookIdImport } from './pages/work/book/$bookId'
import { Route as WorkBookBookIdOverviewImport } from './pages/work/book/$bookId/overview'
import { Route as WorkBookBookIdChapterNewImport } from './pages/work/book/$bookId/chapter/new'
import { Route as WorkBookBookIdChapterChapterIdViewImport } from './pages/work/book/$bookId/chapter/$chapterId/view'
import { Route as WorkBookBookIdChapterChapterIdEditImport } from './pages/work/book/$bookId/chapter/$chapterId/edit'
// Create/Update Routes
@ -64,12 +67,32 @@ const NewBookRoute = NewBookImport.update({
getParentRoute: () => rootRoute,
} as any)
const WorkBookBookIdRoute = WorkBookBookIdImport.update({
id: '/work/book/$bookId',
path: '/work/book/$bookId',
const WorkBookBookIdOverviewRoute = WorkBookBookIdOverviewImport.update({
id: '/work/book/$bookId/overview',
path: '/work/book/$bookId/overview',
getParentRoute: () => rootRoute,
} as any)
const WorkBookBookIdChapterNewRoute = WorkBookBookIdChapterNewImport.update({
id: '/work/book/$bookId/chapter/new',
path: '/work/book/$bookId/chapter/new',
getParentRoute: () => rootRoute,
} as any)
const WorkBookBookIdChapterChapterIdViewRoute =
WorkBookBookIdChapterChapterIdViewImport.update({
id: '/work/book/$bookId/chapter/$chapterId/view',
path: '/work/book/$bookId/chapter/$chapterId/view',
getParentRoute: () => rootRoute,
} as any)
const WorkBookBookIdChapterChapterIdEditRoute =
WorkBookBookIdChapterChapterIdEditImport.update({
id: '/work/book/$bookId/chapter/$chapterId/edit',
path: '/work/book/$bookId/chapter/$chapterId/edit',
getParentRoute: () => rootRoute,
} as any)
// Populate the FileRoutesByPath interface
declare module '@tanstack/react-router' {
@ -123,11 +146,32 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof ProfileUsernameImport
parentRoute: typeof rootRoute
}
'/work/book/$bookId': {
id: '/work/book/$bookId'
path: '/work/book/$bookId'
fullPath: '/work/book/$bookId'
preLoaderRoute: typeof WorkBookBookIdImport
'/work/book/$bookId/overview': {
id: '/work/book/$bookId/overview'
path: '/work/book/$bookId/overview'
fullPath: '/work/book/$bookId/overview'
preLoaderRoute: typeof WorkBookBookIdOverviewImport
parentRoute: typeof rootRoute
}
'/work/book/$bookId/chapter/new': {
id: '/work/book/$bookId/chapter/new'
path: '/work/book/$bookId/chapter/new'
fullPath: '/work/book/$bookId/chapter/new'
preLoaderRoute: typeof WorkBookBookIdChapterNewImport
parentRoute: typeof rootRoute
}
'/work/book/$bookId/chapter/$chapterId/edit': {
id: '/work/book/$bookId/chapter/$chapterId/edit'
path: '/work/book/$bookId/chapter/$chapterId/edit'
fullPath: '/work/book/$bookId/chapter/$chapterId/edit'
preLoaderRoute: typeof WorkBookBookIdChapterChapterIdEditImport
parentRoute: typeof rootRoute
}
'/work/book/$bookId/chapter/$chapterId/view': {
id: '/work/book/$bookId/chapter/$chapterId/view'
path: '/work/book/$bookId/chapter/$chapterId/view'
fullPath: '/work/book/$bookId/chapter/$chapterId/view'
preLoaderRoute: typeof WorkBookBookIdChapterChapterIdViewImport
parentRoute: typeof rootRoute
}
}
@ -143,7 +187,10 @@ export interface FileRoutesByFullPath {
'/register': typeof RegisterRoute
'/new/book': typeof NewBookRoute
'/profile/$username': typeof ProfileUsernameRoute
'/work/book/$bookId': typeof WorkBookBookIdRoute
'/work/book/$bookId/overview': typeof WorkBookBookIdOverviewRoute
'/work/book/$bookId/chapter/new': typeof WorkBookBookIdChapterNewRoute
'/work/book/$bookId/chapter/$chapterId/edit': typeof WorkBookBookIdChapterChapterIdEditRoute
'/work/book/$bookId/chapter/$chapterId/view': typeof WorkBookBookIdChapterChapterIdViewRoute
}
export interface FileRoutesByTo {
@ -154,7 +201,10 @@ export interface FileRoutesByTo {
'/register': typeof RegisterRoute
'/new/book': typeof NewBookRoute
'/profile/$username': typeof ProfileUsernameRoute
'/work/book/$bookId': typeof WorkBookBookIdRoute
'/work/book/$bookId/overview': typeof WorkBookBookIdOverviewRoute
'/work/book/$bookId/chapter/new': typeof WorkBookBookIdChapterNewRoute
'/work/book/$bookId/chapter/$chapterId/edit': typeof WorkBookBookIdChapterChapterIdEditRoute
'/work/book/$bookId/chapter/$chapterId/view': typeof WorkBookBookIdChapterChapterIdViewRoute
}
export interface FileRoutesById {
@ -166,7 +216,10 @@ export interface FileRoutesById {
'/register': typeof RegisterRoute
'/new/book': typeof NewBookRoute
'/profile/$username': typeof ProfileUsernameRoute
'/work/book/$bookId': typeof WorkBookBookIdRoute
'/work/book/$bookId/overview': typeof WorkBookBookIdOverviewRoute
'/work/book/$bookId/chapter/new': typeof WorkBookBookIdChapterNewRoute
'/work/book/$bookId/chapter/$chapterId/edit': typeof WorkBookBookIdChapterChapterIdEditRoute
'/work/book/$bookId/chapter/$chapterId/view': typeof WorkBookBookIdChapterChapterIdViewRoute
}
export interface FileRouteTypes {
@ -179,7 +232,10 @@ export interface FileRouteTypes {
| '/register'
| '/new/book'
| '/profile/$username'
| '/work/book/$bookId'
| '/work/book/$bookId/overview'
| '/work/book/$bookId/chapter/new'
| '/work/book/$bookId/chapter/$chapterId/edit'
| '/work/book/$bookId/chapter/$chapterId/view'
fileRoutesByTo: FileRoutesByTo
to:
| '/'
@ -189,7 +245,10 @@ export interface FileRouteTypes {
| '/register'
| '/new/book'
| '/profile/$username'
| '/work/book/$bookId'
| '/work/book/$bookId/overview'
| '/work/book/$bookId/chapter/new'
| '/work/book/$bookId/chapter/$chapterId/edit'
| '/work/book/$bookId/chapter/$chapterId/view'
id:
| '__root__'
| '/'
@ -199,7 +258,10 @@ export interface FileRouteTypes {
| '/register'
| '/new/book'
| '/profile/$username'
| '/work/book/$bookId'
| '/work/book/$bookId/overview'
| '/work/book/$bookId/chapter/new'
| '/work/book/$bookId/chapter/$chapterId/edit'
| '/work/book/$bookId/chapter/$chapterId/view'
fileRoutesById: FileRoutesById
}
@ -211,7 +273,10 @@ export interface RootRouteChildren {
RegisterRoute: typeof RegisterRoute
NewBookRoute: typeof NewBookRoute
ProfileUsernameRoute: typeof ProfileUsernameRoute
WorkBookBookIdRoute: typeof WorkBookBookIdRoute
WorkBookBookIdOverviewRoute: typeof WorkBookBookIdOverviewRoute
WorkBookBookIdChapterNewRoute: typeof WorkBookBookIdChapterNewRoute
WorkBookBookIdChapterChapterIdEditRoute: typeof WorkBookBookIdChapterChapterIdEditRoute
WorkBookBookIdChapterChapterIdViewRoute: typeof WorkBookBookIdChapterChapterIdViewRoute
}
const rootRouteChildren: RootRouteChildren = {
@ -222,7 +287,12 @@ const rootRouteChildren: RootRouteChildren = {
RegisterRoute: RegisterRoute,
NewBookRoute: NewBookRoute,
ProfileUsernameRoute: ProfileUsernameRoute,
WorkBookBookIdRoute: WorkBookBookIdRoute,
WorkBookBookIdOverviewRoute: WorkBookBookIdOverviewRoute,
WorkBookBookIdChapterNewRoute: WorkBookBookIdChapterNewRoute,
WorkBookBookIdChapterChapterIdEditRoute:
WorkBookBookIdChapterChapterIdEditRoute,
WorkBookBookIdChapterChapterIdViewRoute:
WorkBookBookIdChapterChapterIdViewRoute,
}
export const routeTree = rootRoute
@ -242,7 +312,10 @@ export const routeTree = rootRoute
"/register",
"/new/book",
"/profile/$username",
"/work/book/$bookId"
"/work/book/$bookId/overview",
"/work/book/$bookId/chapter/new",
"/work/book/$bookId/chapter/$chapterId/edit",
"/work/book/$bookId/chapter/$chapterId/view"
]
},
"/": {
@ -266,8 +339,17 @@ export const routeTree = rootRoute
"/profile/$username": {
"filePath": "profile/$username.tsx"
},
"/work/book/$bookId": {
"filePath": "work/book/$bookId.tsx"
"/work/book/$bookId/overview": {
"filePath": "work/book/$bookId/overview.tsx"
},
"/work/book/$bookId/chapter/new": {
"filePath": "work/book/$bookId/chapter/new.tsx"
},
"/work/book/$bookId/chapter/$chapterId/edit": {
"filePath": "work/book/$bookId/chapter/$chapterId/edit.tsx"
},
"/work/book/$bookId/chapter/$chapterId/view": {
"filePath": "work/book/$bookId/chapter/$chapterId/view.tsx"
}
}
}