feat(web): add toggle to hide sub-minute calendar entries#110
Open
gbumanzordev wants to merge 2 commits into
Open
feat(web): add toggle to hide sub-minute calendar entries#110gbumanzordev wants to merge 2 commits into
gbumanzordev wants to merge 2 commits into
Conversation
KOReader sometimes records brief opens that surface as 00:00 totals on the calendar. Add a "Hide entries under a minute" switch on the calendar page and per-book calendar to filter those out.
Adds short "accidental open" page stats across recent days so the new calendar toggle has data to filter against during local development.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an opt-in UI toggle in the web calendars to hide “00:00” clutter by filtering out per-day reading totals under 60 seconds, plus a dev seed to generate short sessions for local testing.
Changes:
- Add “Hide entries under a minute”
Switchto the main calendar page and filter out per-book daily totals< 60s(dropping days that become empty). - Add the same toggle to the per-book calendar and hide days where that book’s total is
< 60s. - Add a new server seed to generate short “accidental open” sessions across recent days.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| apps/web/src/pages/calendar-page.tsx | Adds toggle + client-side filtering of calendar events under 60 seconds. |
| apps/web/src/pages/book-page/book-page-calendar.tsx | Adds toggle + per-book day filtering under 60 seconds. |
| apps/server/src/db/seeds/08_short_sessions.ts | Seeds short sessions for local dev to exercise the new toggle. |
Comments suppressed due to low confidence (1)
apps/web/src/pages/calendar-page.tsx:127
dayRendereris rendering an array via.map(...)without providing a stablekeyprop on the returned elements, which will cause React "unique key" warnings and can lead to incorrect reconciliation. Consider returning elements with keys (e.g., key by book md5/id) rather than wrappinggetBookNames(data)in a keyless<div>map (and notegetBookNamesitself maps to fragments without keys).
<Calendar<DayData>
events={calendarEvents}
dayRenderer={(data) => getBookNames(data).map((el) => <div>{el}</div>)}
/>
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+58
to
+60
| const filtered = entry.data!.events.filter( | ||
| (event) => totalsByBook[event.book_md5] >= 60 | ||
| ); |
Comment on lines
+26
to
+27
| const [hideEmpty, setHideEmpty] = useState(false); | ||
|
|
Comment on lines
+39
to
+41
| const total = sum(entry.data!.events.map((event) => event.duration)); | ||
| if (total >= 60) { | ||
| acc[key] = entry; |
Comment on lines
+19
to
20
| const [hideEmpty, setHideEmpty] = useState(false); | ||
|
|
gbumanzordev
added a commit
to gbumanzordev/KoInsight
that referenced
this pull request
Apr 29, 2026
…ions-cherry feat(web): hide sub-minute calendar entries (from upstream PR GeorgeSG#110)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
KOReader occasionally records brief, accidental book opens. Those sessions surface on the KoInsight calendar as
00:00entries (less than a minute of total reading time on that day), which clutters the month view, especially when the same day already has real reading activity on other books.This PR adds an opt-in "Hide entries under a minute" toggle to both calendar views so those incidental opens can be filtered out without removing real data.
Changes
apps/web/src/pages/calendar-page.tsxSwitchnext to the page title.< 60s. Days that end up with no remaining books are dropped from the calendar entirely.apps/web/src/pages/book-page/book-page-calendar.tsxSwitchplaced above the per-book calendar.< 60s.apps/server/src/db/seeds/08_short_sessions.ts(new)5-24s) "accidental open" page stats across the last 14 days for the first 6 books, so the new toggle has data to filter against during local development.Rationale
Filtering happens client-side on the already-fetched stats, so there is no API or schema impact. Threshold (60s) matches the existing
shortDurationformatter, which renders anything below a minute as00:00, the exact rows users want to hide.Screenshots
00:00line under the day.Test plan
npm run seed(inapps/server/) repopulates the dev DB, including the new short sessions./calendar, confirm00:00entries are visible by default.Notes for reviewers
Switchandramda.sum.