Skip to content

Commit

Permalink
generates static params for all study pages
Browse files Browse the repository at this point in the history
  • Loading branch information
land-cap committed Dec 29, 2023
1 parent 2e51d48 commit 9d8bee5
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/app/[readerMode]/[bookCode]/[chapter]/page.tsx
Original file line number Diff line number Diff line change
@@ -1 +1,25 @@
import { range } from 'ramda'

import {
READER_MODE,
type TReaderPageParams,
} from '~/_pages/ReaderPage/ReaderPage.types'
import { getBookList } from '~/db'

export const generateStaticParams = async (): Promise<TReaderPageParams[]> => {
const bookList = await getBookList()

return bookList.flatMap((book, i) => {
const bookCode = book.book.code.toLowerCase()

if (i >= 10) return []

return range(1)(book.book.chapter_count + 1).map((chapter) => ({
bookCode,
chapter: chapter.toString(),
readerMode: READER_MODE.Study,
}))
})
}

export { ReaderPage as default } from '~/_pages'

1 comment on commit 9d8bee5

@vercel
Copy link

@vercel vercel bot commented on 9d8bee5 Dec 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

the-good-book – ./

the-good-book-git-master-dalandcap.vercel.app
the-good-book-dalandcap.vercel.app
the-good-book.vercel.app

Please sign in to comment.