Skip to content

feat: add estimated reading time for books (#606) - #1089

Open
aarushii25 wants to merge 1 commit into
devanshi14malhotra:mainfrom
aarushii25:feature-est-reading-time-new
Open

aarushii25 wants to merge 1 commit into
devanshi14malhotra:mainfrom
aarushii25:feature-est-reading-time-new

Conversation

@aarushii25

Copy link
Copy Markdown

📖 feat: Add Estimated Reading Time for Books (Fixes #606)

Hey @devanshi14malhotra! I've implemented the estimated reading time feature as described in Issue #606. Here's a full breakdown:


📋 What Was Done

Added a frontend-only estimated reading time system that calculates and displays how long a book will take to read, updating dynamically based on reading progress.


🗂️ Files Changed

New File:

  • frontend/js/readingTime.js — Reusable utility with three exported functions:
    • calcReadingTime(pageCount) — total reading time from page count
    • calcRemainingTime(pageCount, progressPercent) — time left based on progress
    • formatReadingTime(minutes) — formats minutes into human-readable label

Modified Files:

  • frontend/pages/library.html — Added reading time stat item in book detail modal's book-stats-row
  • frontend/js/library-3d.js — Reading time badge on book spine + modal population
  • frontend/js/app.js — Reading time badge on book back face cards
  • frontend/css/style.css — Styled .reading-time-badge and .reading-time-remaining badges

✅ Formula Used

words  = pageCount × 250   (avg words per printed page)
time   = words ÷ 250       (avg adult reading speed: 250 WPM)
∴ time (minutes) = pageCount
Pages Reading Time
150 pages ~2 hrs 30 mins
300 pages ~5 hrs
500 pages ~8 hrs 20 mins

🎯 Where It Appears

  1. Book Detail Modal — "Est. Reading Time" shown in stats row. For books being currently read, shows "X hrs left" based on progress percentage.

  2. Book Spine (3D shelf) — Small vertical time badge on the spine face.

  3. Book Back Face (Discovery cards) — Badge showing total time or remaining time.


📱 Behavior

  • Shows "~4 hrs" format for full books
  • Shows "~35 mins left" for currently-reading books
  • Shows "Finished!" at 100% progress
  • Gracefully hides if page count data is unavailable
  • No backend changes required — fully frontend

🔗 Related

Closes #606

GSSoC'26 contribution — frontend assigned to @aarushii25

Let me know if any adjustments are needed! 🙏

@netlify

netlify Bot commented May 28, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for bibliodrift-dm ready!

Name Link
🔨 Latest commit b25aa59
🔍 Latest deploy log https://app.netlify.com/projects/bibliodrift-dm/deploys/6a182fd44022d40007260286
😎 Deploy Preview https://deploy-preview-1089--bibliodrift-dm.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Add estimated reading time for books

1 participant