Skip to content

feat: Add scroll-aware remaining read time indicator to blog post pages#1670

Merged
sanjay-kv merged 2 commits into
mainfrom
copilot/add-remaining-read-time-on-scroll
May 23, 2026
Merged

feat: Add scroll-aware remaining read time indicator to blog post pages#1670
sanjay-kv merged 2 commits into
mainfrom
copilot/add-remaining-read-time-on-scroll

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 23, 2026

Adds a fixed bottom-right reading time badge to blog post pages that appears at 15% scroll depth, counts down remaining read time as the user scrolls, and disappears once the author card enters the viewport.

Description

Blog post pages lacked any reading progress feedback. This adds a non-intrusive "N mins remaining" pill that tracks scroll position relative to article content.

Type of Change

  • New feature (e.g., new page, component, or functionality)
  • UI/UX improvement (design, layout, or styling updates)

Changes Made

src/components/ReadingTimeIndicator/index.tsx — new component

  • Hidden until page scroll ≥ 15%; hides when author card enters viewport
  • Remaining time = ceil(totalReadTime × (1 − readProgress)) where readProgress is scrollY / authorCardAbsoluteTop
  • Fallback when no author card: hides at 90% scroll, progress derived from overall page scroll %
  • Scroll handler throttled via requestAnimationFrame to avoid layout thrash
  • Accessible: role="status", aria-live="polite", descriptive aria-label
  • Correct pluralisation: "1 min remaining" / "N mins remaining"

src/components/ReadingTimeIndicator/styles.module.css — new styles

  • position: fixed; bottom: 24px; right: 24px teal pill with dark-mode variant and mobile sizing

src/theme/BlogPostItem/Footer/index.tsx — wired up

  • useRef attached to the author card <section> as the content-end sentinel
  • <ReadingTimeIndicator totalReadTime={roundedReadTime} authorCardRef={authorCardRef} /> rendered for all isBlogPostPage renders

Dependencies

No new dependencies.

Checklist

  • My code follows the style guidelines of this project.
  • I have tested my changes across major browsers and devices
  • My changes do not generate new console warnings or errors .
  • I ran npm run build and attached screenshot(s) in this PR.
  • This is already assigned Issue to me, not an unassigned issue.

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
recode-website Ready Ready Preview, Comment May 23, 2026 5:30am

@github-actions
Copy link
Copy Markdown

Thank you for submitting your pull request! 🙌 We'll review it as soon as possible. The estimated time for response is 5–8 hrs.

In the meantime, please provide all necessary screenshots and make sure you run - npm build run , command and provide a screenshot, a video recording, or an image of the update you made below, which helps speed up the review and assignment. If you have questions, reach out to LinkedIn. Your contributions are highly appreciated!😊

Note: I maintain the repo issue every day twice at 8:00 AM IST and 9:00 PM IST. If your PR goes stale for more than one day, you can tag and comment on this same issue by tagging @sanjay-kv.

We are here to help you on this journey of open source. Consistent 20 contributions are eligible for sponsorship 💰

🎁 check our list of amazing people we sponsored so far: GitHub Sponsorship. ✨

📚Your perks for contribution to this community 👇🏻

  1. Get free Consultation use code recode50 to get free: Mentorship for free.

  2. Get the Ebook for free use code recode at checkout: Data Science cheatsheet for Beginners.

  3. Check out this weekly Newsletter: Sanjay's Newsletter.

If there are any specific instructions or feedback regarding your PR, we'll provide them here. Thanks again for your contribution! 😊

@github-actions github-actions Bot added in-review The current changes are in review and would need approval and testing before merging level 1 10 points recode this is label for leaderboard labels May 23, 2026
@github-actions github-actions Bot added this to the recode:launch 3.0 milestone May 23, 2026
@sanjay-kv sanjay-kv marked this pull request as ready for review May 23, 2026 05:29
@sanjay-kv
Copy link
Copy Markdown
Member

@copilot there is 0 file changed

Copilot AI changed the title [WIP] Add remaining read time display on blog page scroll feat: Add scroll-aware remaining read time indicator to blog post pages May 23, 2026
Copilot AI requested a review from sanjay-kv May 23, 2026 05:30
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 23, 2026

@copilot there is 0 file changed

The PR shows 3 files changed (176 additions, 2 deletions) on the "Files changed" tab:

  • src/components/ReadingTimeIndicator/index.tsx (added, 117 lines)
  • src/components/ReadingTimeIndicator/styles.module.css (added, 49 lines)
  • src/theme/BlogPostItem/Footer/index.tsx (modified, +10/-2)

This might have been a temporary GitHub UI caching issue. Could you try refreshing the "Files changed" tab? The changes are confirmed present on the branch (commit 40c4711).

@sanjay-kv sanjay-kv merged commit 199cb56 into main May 23, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in-review The current changes are in review and would need approval and testing before merging level 1 10 points recode this is label for leaderboard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

need reamaining read time on scroll on blog page

2 participants