Skip to content

Preact app frontend - #76

Open
Roznoshchik wants to merge 14 commits into
mainfrom
preact-app-frontend
Open

Preact app frontend#76
Roznoshchik wants to merge 14 commits into
mainfrom
preact-app-frontend

Conversation

@Roznoshchik

@Roznoshchik Roznoshchik commented Feb 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • Split article content into chunks for efficient loading of large articles
  • Reader refactored to use a sliding window that loads adjacent chunks on scroll
  • Chunk/offset-based bookmark and highlight positioning replaces percentage-based
  • Legacy bookmarks migrated to chunk/offset format on first article access
  • Highlights reanchored using flexible regex matching (tolerates whitespace/inline element differences)
  • Articles and highlights lists handle unprocessed articles, routing to processing path on first open
  • Reader UI: notes panel slides in from left, sidebar and layout suppress transitions on initial mount
  • Warning shown when navigating to a highlight that couldn't be anchored in the article text

Test plan

  • Open an unprocessed article from the articles list — processing loader appears, then reader loads at furthest position
  • Open a processed article — loads directly at last position
  • Navigate from highlights list to a highlight — reader scrolls to exact highlight position
  • Navigate from highlights list to an unanchored highlight — warning toast appears
  • Add, jump to, reorder, and delete bookmarks
  • Toggle notes panel — content stays in view, panel slides in from left
  • Reader settings (font, size, spacing) persist across page loads
  • Progress saves and furthest bookmark updates on scroll

Bookmark migration now handles missing bookmarks with existing progress,
clamps percentages over 100%, and handles offsets at article end.

Reanchoring switches from exact string search to regex pattern that
tolerates whitespace/void element differences around inline elements.
GET /articles/<uuid>/chunks/<idx> for lazy chunk loading,
POST /articles/<uuid>/process for first-time article processing
with highlight navigation and unanchorable detection.
Highlight populate now includes start_chunk and end_chunk fields.
Replace single-chunk loading with a sliding window hook (useChunkWindow)
that loads adjacent chunks as the user scrolls. Reader now supports
chunk/offset-based navigation, bookmarks, and highlight anchoring.
Scroll-to-position uses Range API for character-precise positioning.
Unanchorable highlights show a warning alert on navigation.
Notes panel slides in from the left with CSS transform transition.
Sidebar and main content suppress transitions on initial mount to
prevent layout flash. Notes toggle saves and restores scroll position.
Articles and highlights lists detect unprocessed articles and route
to the processing path. Article/highlight cards link to reader with
chunk/offset params when anchored, or unprocessed flag when not.
Was used as transient storage during chunk building then immediately
set to None — replaced with a local variable. Also removed the unused
get_flat_text method that depended on it.
build_content_tree, tree splitting, slicing, and offset helpers were
pure functions with no model state — extracted to a standalone module.
Article model now imports and delegates to them.
useReaderBookmarks and useReaderProgress used an old bookmark format
predating the chunk-based system — superseded by inline logic in reader.jsx
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.

1 participant