Feature/chapter read time badge#431
Conversation
|
@DharshiniPujarolla is attempting to deploy a commit to the Adarsh's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Hi @MRIARC-08 , |
MRIARC-08
left a comment
There was a problem hiding this comment.
@DharshiniPujarolla Thanks for reopening this. Please clean up the branch before review: pnpm-lock.yaml should not remove the repo security overrides or update the dependency tree for a read-time badge, and the touched page still has Prettier errors. Keep the PR focused on src/app/ncert/[class]/[subject]/page.tsx, run the formatter, and push the result.
|
@MRIARC-08, |
|
@MRIARC-08 can you please go through the changes when you have time and let me know if there is anything i need to do |
Closes #408
Summary
Adds a small "Estimated Read Time" badge to each chapter card, calculated client-side from
chapter.contentusingwords / 200(avg. reading speed).Changes
getReadTime(content?: string | null): number | nullhelperChapterTypewithcontent?: string | nullbg-primary/10/text-primary/70rounded-pill, consistent with existing conventions in this filecontentis null, empty, or whitespace-onlyTesting
Verified
getReadTime()directly:5(Math.ceil(850/200))nullnull→nullnullConfirmed
contentis included in the/api/ncert/chaptersresponse — repository usesinclude: { chapters: true }with no field-levelselect, so no backend changes needed.Full in-browser visual check was blocked locally by a Google OAuth
client_idconfig issue (unrelated to this change). JSX conditional follows the same pattern as existing conditional UI in this file.Notes
.gitignoreupdated to exclude.idea/