Skip to content

Feature/library status refine - #15

Open
CoffeePatch wants to merge 7 commits into
mainfrom
feature/library-status-refine
Open

CoffeePatch wants to merge 7 commits into
mainfrom
feature/library-status-refine

Conversation

@CoffeePatch

Copy link
Copy Markdown
Owner

No description provided.

- Updated libraryAdapter to support additional options in updateLibraryStatus and markCompleted methods.
- Enhanced useLibraryItemStatus hook to manage tracking data alongside status.
- Introduced WatchDateModal component for selecting watch dates with validation.
- Implemented ThemeContext for managing light and dark themes with localStorage persistence.
- Improved useLibraryFilters to save user preferences in sessionStorage.
- Refactored useAutoSeasonSelection to prevent auto-selection during loading states.
- Added CSS variables for theming and improved scrollbar styles.
@netlify

netlify Bot commented Jul 29, 2026

Copy link
Copy Markdown

Deploy Preview for dainty-lolly-ef4d13 ready!

Name Link
🔨 Latest commit 80b0fbe
🔍 Latest deploy log https://app.netlify.com/projects/dainty-lolly-ef4d13/deploys/6a798ab70ff98400085cca91
😎 Deploy Preview https://deploy-preview-15--dainty-lolly-ef4d13.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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

@vercel

vercel Bot commented Jul 29, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
strive Error Error Aug 10, 2026 8:24am

Copilot AI lite review requested due to automatic review settings August 9, 2026 08:08

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR continues the migration away from legacy Firestore/TMDB proxy flows toward a Prisma/PostgreSQL-backed BFF, while also refining UI theming and adding new user-facing surfaces (lists, history, profile access).

Changes:

  • Introduces new BFF API routes and Prisma-backed services/repositories for library, lists, tracking, catalog search, and user preferences/analytics.
  • Updates client hooks/adapters to call the new BFF endpoints (lists, tracking, search, continue-watching, browse library, user history/analytics).
  • Adds theme infrastructure (FOUC-prevention + ThemeProvider) and expands UI components for bulk actions, selection mode, and styling refresh.

Reviewed changes

Copilot reviewed 170 out of 172 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
vite.config.js Removes explicit esbuild JSX loader configuration.
src/util/store/listsSlice.js Updates list thunks (remove item payload shape, reorder thunk, list sorting).
src/util/imdb/imdbService.js Tightens IMDb base URL handling; fails requests when not configured.
src/util/firebase/firestoreService.js Narrows re-exports to the remaining library service functions.
src/util/export/exportToCsv.js Simplifies catch block in year extraction helper.
src/util/cache/sessionCache.js Adds USER_ANALYTICS cache keys/TTL and catalog-cache invalidation helper.
src/util/tests/exportToCsv.test.js Adjusts papaparse mock signature and adds global lint directive.
src/styles/BulkToolbar.css Adds styles for the new bulk toolbar component.
src/services/imdbService.js Switches IMDb data fetching to metadata enrichment coordinator snapshot.
src/services/imdb/imdbApiService.js Makes IMDb API base URL configurable via VITE_IMDB_BASE_URL.
src/main.jsx Wraps app with ThemeProvider.
src/hooks/user/useWatchHistory.js Adds watch history hook backed by userAdapter API calls.
src/hooks/user/useUserAnalytics.js Adds user analytics hook backed by userAdapter API calls.
src/hooks/tv/useUnwatchSeries.js Routes unwatch flow through /api/tracking/watch with mode payload.
src/hooks/tv/useTvShowDetails.js Removes legacy TV show details hook.
src/hooks/tv/useSeriesProgress.js Replaces Firestore progress reads with catalog/progress API-backed flow + caching.
src/hooks/tv/useRecomputeSeriesProgress.js Removes recompute hook that called the legacy endpoint.
src/hooks/tv/useMarkEpisodeWatched.js Updates endpoint to /api/tracking/watch.
src/hooks/tv/useEpisodeStates.js Replaces Firestore realtime episode states with catalog API + caching.
src/hooks/tv/useAutoSeasonSelection.js Adjusts auto-season selection to wait for watched-set loading and use season metadata.
src/hooks/media/useLibraryItemStatus.js Switches to libraryIdentity input and returns trackingData.
src/hooks/media/useImdbTitle.js Switches to metadata enrichment coordinator (request + subscription).
src/hooks/media/useImdbRating.js Switches rating resolution to shared metadata snapshot and simplifies caching path.
src/hooks/library/useContinueWatching.js Uses new getContinueWatching service with backend-native sorting/hydration.
src/hooks/library/useBrowseLibraryData.js Routes through new loadLibraryItems pipeline helper.
src/hooks/library/libraryPipelineCache.js Adds a sessionStorage/in-memory cache for library pipeline results.
src/hooks/library/LibraryFiltersContext.jsx Provides a default context value when provider is missing.
src/hooks/library/libraryDataPipeline.js Adds library data pipeline helpers, including optional mock-size duplication.
src/hooks/common/useSearch.js Switches search to authenticated BFF endpoint /api/catalog/search.
src/hooks/common/useRequireAuth.js Removes unused useState import.
src/hooks/common/useLibraryHealth.js Updates callable name and endpoint to tracking watch route.
src/domain/user/userAdapter.js Adds API-backed userAdapter (watch history + analytics) with caching.
src/domain/tracking/useSeriesTracking.js Integrates new episode/progress fetching, cache invalidation, and libraryIdentity usage.
src/domain/tracking/trackingHelpers.js Adds season mode selection logic filtering to aired episodes.
src/domain/lists/useLists.js Adds reorderItem dispatcher and memoizes hook return value.
src/domain/lists/useListMembership.js Updates remove item dispatch param name to match new thunk signature.
src/domain/library/libraryIdentity.js Introduces normalized library identity helpers (titleKey/mediaType/tmdbId).
src/contexts/ThemeContext.jsx Adds ThemeContext, persistence to localStorage, and system theme resolution.
src/context/LibrarySelectionContext.jsx Adds selection mode context for bulk actions / range selection.
src/components/ui/EpisodeCard.jsx Updates visual tokens/classes for overlays and watched state styling.
src/components/ui/BaseCard.jsx Refactors styling tokens; adjusts image skeleton/fallback styling.
src/components/ui/Badge.jsx Updates default badge styling tokens.
src/components/ui/AnimatedPrimitives.jsx Removes unused AnimatePresence import.
src/components/ui/ActionButton.jsx Updates styling tokens and focus ring classes.
src/components/tv/TVShowDetails/SimilarShowsPanel.jsx Updates accent/token usage for spinners/tabs.
src/components/tv/TVShowDetails/EpisodeOverlay.jsx Removes unused props and titleKey derivation tied to showDetails.
src/components/tv/TVShowCard.jsx Hides rating display when vote_average is not positive.
src/components/pages/Browse.jsx Moves dashboard prefs from Firestore to /api/user/preferences and refactors shelf components.
src/components/movie/MovieDetails/SimilarMoviesPanel.jsx Updates accent/token usage for spinners/tabs.
src/components/movie/MovieDetails/MovieDetails.jsx Adapts to new normalized movie field names and adds user notes/ratings integration.
src/components/movie/Cards/MovieCard.jsx Hides rating display when vote_average is not positive.
src/components/media/SeriesProgressBar.jsx Updates styling tokens for progress bar labels.
src/components/media/SeasonTabs.jsx Simplifies styling to tokenized Tailwind classes.
src/components/media/MediaDetailSkeleton.jsx Updates hero gradient styling to use theme CSS variables/tokens.
src/components/media/MediaDetails/UserRatingWidget.jsx Adds user rating dropdown widget.
src/components/media/MediaDetails/TV/EpisodeList.jsx Updates spinner/error text styling tokens.
src/components/media/MediaDetails/MediaTrailers.jsx Updates text/border styling tokens and accent hover color.
src/components/media/MediaDetails/MediaHero.jsx Removes layoutType branching and updates hero tokens/gradients.
src/components/media/MediaDetails/MediaCast.jsx Updates header text token.
src/components/lists/PosterCollage.jsx Adds list poster collage component with fallback rendering.
src/components/lists/ListShelf.jsx Removes unused ref import.
src/components/lists/EditListModal.jsx Adds modal to edit list metadata.
src/components/lists/ConfirmationModal.jsx Updates modal styling tokens.
src/components/library/SortBottomSheet.jsx Updates bottom sheet styling tokens.
src/components/library/LibraryHealthPanel.jsx Updates styling tokens and switches to tracking endpoint naming.
src/components/library/LibraryGridSkeleton.jsx Updates skeleton styling tokens.
src/components/library/LibraryGrid.jsx Adds reorderable mode (framer-motion Reorder) and selection-mode integration.
src/components/library/LibraryEmptyState.jsx Adds empty state component for library views.
src/components/library/LibraryDesktopView.jsx Adds a dedicated desktop library layout container.
src/components/library/BulkToolbar.jsx Adds bulk toolbar UI for selection-mode actions.
src/components/layout/Header.jsx Adds nav items for Lists/History and a profile button.
src/components/layout/BottomNav.jsx Adds Lists entry to bottom navigation.
src/components/layout/Body.jsx Adds routes for Lists hub and Activity History pages; cleans up unused location.
scripts/verifyServices.js Adds a Prisma service verification script for local validation.
scripts/verifyRepositories.js Adds a Prisma repository verification script for local validation.
scripts/verifyPostgresConnection.js Adds a script to validate Prisma/Postgres connectivity.
scripts/verifyDatabaseSchema.js Adds a script to verify schema objects via Prisma raw queries.
scripts/update_series_progress_view.sql Adds SQL view definition for user series progress.
scripts/investigateQueryPerformance.js Adds explain-analyze investigation script for key queries.
scripts/analyzeQueryPerformance.js Adds empirical benchmark script for key queries (baseline/indexed).
prisma/migrations/migration_lock.toml Adds Prisma migration lock file.
prisma/migrations/20260807130738_add_performance_indexes/migration.sql Adds indexes for library and list query performance.
package.json Adds Prisma scripts and Prisma dependencies.
index.html Adds FOUC-prevention script to set data-theme early.
eslint.config.js Adjusts no-unused-vars ignore pattern and adds Node globals for api/scripts.
docs/ui/tv-show-details.md Removes legacy UI documentation file.
docs/ui/shows.md Removes legacy UI documentation file.
docs/ui/movies.md Removes legacy UI documentation file.
docs/ui/movie-details.md Removes legacy UI documentation file.
docs/ui/library.md Removes legacy UI documentation file.
docs/ui/home.md Removes legacy UI documentation file.
docs/IMPORT_EXPORT_GUIDE.md Removes legacy import/export guide.
docs/imdb-tmdb-firestore-flow.md Removes legacy Firestore flow documentation.
api/user/preferences.js Adds API for user dashboard preferences (GET/PATCH).
api/user/history.js Adds API for watch history (GET).
api/user/analytics.js Adds API for user analytics (GET).
api/unwatchSeries.js Removes legacy Firestore-backed unwatch endpoint.
api/tv/details.js Removes legacy TV details endpoint.
api/tracking/watch.js Adds unified tracking endpoint that forwards payload to trackingService.
api/tmdb.js Adds retry/backoff handling and transient error mapping for TMDB proxy.
api/movie/details.js Removes legacy movie details endpoint.
api/lists/index.js Adds lists collection endpoint (GET/POST).
api/lists/[listId]/import/confirm.js Minor cleanup of ignored fallback fetch errors.
api/lists/[listId]/enrich.js Removes unused db import (but keeps list enrichment handler).
api/lists/[id]/reorder.js Adds list reorder endpoint.
api/lists/[id]/items.js Adds list item add/remove endpoint.
api/lists/[id].js Adds list detail endpoint (GET/PATCH/DELETE).
api/library/index.js Adds library fetch endpoint (GET) with cursor/limit options.
api/library/continue-watching.js Adds continue-watching endpoint (GET).
api/library/batch.js Adds batch library mutation endpoint (POST).
api/library/[titleKey].js Adds per-title library update/delete endpoint (PATCH/DELETE).
api/catalog/search.js Adds catalog search endpoint (GET) with optional auth.
api/catalog/[titleKey].js Adds catalog detail endpoint (GET) with optional auth/user-state injection.
api/_lib/watchMutation.js Adjusts absoluteOrder fallback logic.
api/_lib/services/userService.js Adds service layer for preferences/history/analytics.
api/_lib/services/trackingService.js Adds tracking service implementing watch/unwatch modes and status derivation.
api/_lib/services/progressService.js Adds series progress service wrapper.
api/_lib/services/listService.js Adds list service layer (CRUD + items + reorder).
api/_lib/services/libraryService.js Adds library service layer (fetch, status updates, batch ops).
api/_lib/services/catalogService.js Adds catalog service layer (search + media details with user-state injection).
api/_lib/repositories/TrackingRepository.js Adds Prisma repository for episode state mutations.
api/_lib/repositories/ProgressRepository.js Adds Prisma repository for series progress view reads.
api/_lib/repositories/LibraryRepository.js Adds Prisma repository for library operations and continue-watching query.
api/_lib/repositories/CatalogRepository.js Adds Prisma repository for catalog reads and similarity search.
api/_lib/prisma.js Adds Prisma singleton client initialization for serverless/runtime.
api/_lib/listUtils.js Allows IMDb base URL from IMDB_API_BASE_URL or VITE_IMDB_BASE_URL.
api/_lib/errorHandler.js Adds centralized API error mapping to sendError responses.
api/_lib/authMiddleware.js Adds test-only mock auth support and simplifies catch handling.
.gitignore Adds docs/ to ignored paths.
.env.example Adds DATABASE_URL example for Prisma/Postgres.
Suppressed comments (1)

api/lists/[listId]/enrich.js:9

  • These imports use ../../../../_lib/*, which resolves outside api/ and will fail to locate api/_lib/*. Since this file is at api/lists/[listId]/enrich.js, the correct relative path is ../../_lib/*.
import { admin } from "../../../../_lib/firebaseAdmin.js";
import { pLimit, sendError } from "../../../../_lib/utils.js";
import {
  fetchImdbRatings,
  fetchTmdbDetails,
  resolveListItemsCollection,
  HttpRequestError,
  requireUidFromAuthHeader,
} from "../../../../_lib/listUtils.js";

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +159 to +162
async ({ userId, listId, mediaItem }, { rejectWithValue }) => {
try {
await listsAdapter.removeItemFromList(userId, listId, mediaId);
return { listId, mediaId }; // Return list ID and media ID of the removed item
await listsAdapter.removeItemFromList(userId, listId, mediaItem);
return { listId, mediaItem }; // Return list ID and the removed identity
Comment thread api/user/preferences.js
Comment on lines +1 to +4
import { verifyAuth } from "../../_lib/authMiddleware.js";
import { handleApiError } from "../../_lib/errorHandler.js";
import { getUserPreferences, updateUserPreferences } from "../../_lib/services/userService.js";
import { sendError } from "../../_lib/utils.js";
Comment thread api/lists/[id]/items.js
Comment on lines +1 to +4
import { verifyAuth } from "../../../_lib/authMiddleware.js";
import { handleApiError } from "../../../_lib/errorHandler.js";
import { addItemsToList, removeItemsFromList } from "../../../_lib/services/listService.js";
import { sendError } from "../../../_lib/utils.js";
Comment thread package.json
Comment on lines 31 to 33
"@eslint/js": "^9.25.0",
"@prisma/client": "^6.19.3",
"@reduxjs/toolkit": "^2.8.2",
Comment on lines 91 to 96
loadTime: Date.now()
});
}}
onError={() => setImageError(true)}
loading="lazy"
decoding="async"
/>
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.

2 participants