Skip to content

Handle Y offsets in EH preview sprites, migrate preview cache to v2, and update UI#23

Closed
patrick3399 wants to merge 1 commit intomainfrom
codex/find-layout-issue-with-browse-thumbnails
Closed

Handle Y offsets in EH preview sprites, migrate preview cache to v2, and update UI#23
patrick3399 wants to merge 1 commit intomainfrom
codex/find-layout-issue-with-browse-thumbnails

Conversation

@patrick3399
Copy link
Copy Markdown
Owner

Motivation

  • Preview sprite sheets now include both X and Y offsets in some formats, so the backend and frontend must preserve and render the vertical offset correctly.
  • The preview cache format is being bumped to avoid collisions with old serialized values and allow clients to expect the new offsetY field.
  • Frontend components and types must be updated so sprite previews render correctly in the gallery detail and reader thumbnail strip.

Description

  • Changed preview cache key from eh:previews:{gid} to eh:previews:v2:{gid} in backend/services/cache.py to version the cache.
  • Updated preview HTML parsing in backend/services/eh_client.py to extract both X and Y offsets from new and legacy preview formats, and to store previews as url|offsetX|offsetY|width|height (legacy offsetY omitted handled).
  • Normalization logic in _parse_detail_html now computes and applies sprite max heights for the new 5-field format.
  • Frontend gallery detail page (pwa/src/app/browse/[gid]/[token]/page.tsx) updated PreviewGrid and preview parsing to accept and normalize offsetY and to use both offsets when rendering sprite backgrounds.
  • Reader component updates in pwa/src/components/Reader/index.tsx updated ThumbnailStrip to parse optional offsetY, normalize offsets, and include vertical offset in backgroundPosition and backgroundSize calculations.
  • Type definitions updated in pwa/src/lib/types.ts and inline comments to document the new preview string format and legacy handling.

Testing

  • Ran backend unit tests with pytest and the suite completed successfully.
  • Ran frontend type check and build (pnpm install + pnpm build / tsc) and the TypeScript build succeeded without errors.
  • Manual smoke render verification performed by exercising gallery detail and reader thumbnail components to confirm sprite offsets render as expected.

Codex Task

@patrick3399 patrick3399 closed this Mar 8, 2026
@patrick3399 patrick3399 deleted the codex/find-layout-issue-with-browse-thumbnails branch March 9, 2026 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant