- docs/README.md: overview and table of contents - docs/tech_stack.md: full dependency inventory and design decisions - docs/project_structure.md: directory tree with conventions - docs/architecture.md: data flow, layer responsibilities, key patterns - docs/routing.md: route table, code splitting, discover categories - docs/state_management.md: Zustand stores and React Query conventions - docs/api_layer.md: all API modules with endpoint mappings - docs/components.md: layout, entries, collections, charts, dialogs, UI primitives - docs/pages.md: all 16 pages with features and routes - docs/styling.md: theming, CSS tokens, responsive breakpoints, animations - AGENTS.md: architecture summary, code conventions, data flow, key files
150 lines
5.8 KiB
Markdown
150 lines
5.8 KiB
Markdown
# Components
|
|
|
|
## Layout
|
|
|
|
### `AppLayout`
|
|
**File:** `src/components/layout/AppLayout.tsx`
|
|
|
|
Root layout component rendered around all routes via React Router's `<Outlet />`.
|
|
|
|
- **Desktop:** Fixed left sidebar (`w-56`) + main content area
|
|
- **Mobile:** Top header with hamburger menu → `Sheet` overlay sidebar
|
|
- Responsive padding adjustments (`pt-18` on mobile for fixed header)
|
|
|
|
### `Sidebar`
|
|
**File:** `src/components/layout/Sidebar.tsx`
|
|
|
|
Navigation sidebar with grouped links:
|
|
|
|
| Group | Items |
|
|
| ------- | -------------------------------------- |
|
|
| Main | Dashboard, Home |
|
|
| Library | Library, Watchlist, Collections, Media |
|
|
| Other | Calendar, People |
|
|
| Footer | Settings, Theme toggle |
|
|
|
|
Active route highlighted with `bg-sidebar-accent`. Tooltips on all items.
|
|
|
|
---
|
|
|
|
## Entry Components
|
|
|
|
### `EntryCard`
|
|
**File:** `src/components/entries/EntryCard.tsx`
|
|
|
|
Versatile card for displaying a movie or TV series. Accepts either a library `Entry` or a `TmdbEntry`.
|
|
|
|
- Poster image with `aspect-[2/3]` ratio
|
|
- Overlays: title, year, rating badge, type badge (Movie/TV)
|
|
- Action button: "Add to Library" for TMDB entries, "Remove" (with confirm) for library entries
|
|
- Checks Zustand library store to determine if a TMDB entry is already in the library
|
|
- Skeleton loading state
|
|
|
|
### `EntryLibraryGrid`
|
|
**File:** `src/components/entries/EntryLibraryGrid.tsx`
|
|
|
|
Responsive grid for displaying `EntryCard` items with infinite scroll.
|
|
|
|
- Responsive columns: 2 → 3 → 4 → 5 → 6 → 7 cols across breakpoints
|
|
- `IntersectionObserver` for lazy loading / load-more trigger
|
|
- Loading skeletons and empty state
|
|
- Animated card entrance (`animate-card-enter`)
|
|
|
|
### `TrendingSlider`
|
|
**File:** `src/components/entries/TrendingSlider.tsx`
|
|
|
|
Auto-rotating hero carousel for featured entries.
|
|
|
|
- Displays top 10 entries as full-width backdrop heroes
|
|
- Auto-rotates every 6 seconds
|
|
- Manual navigation (prev/next arrows)
|
|
- Gradient overlay with title, description, rating, type badge
|
|
- Add/remove library actions
|
|
|
|
### `TrendingGrid`
|
|
**File:** `src/components/entries/TrendingGrid.tsx`
|
|
|
|
Tabbed grid showing entries by category (trending, popular, etc.).
|
|
|
|
- Tab switcher: Movies / TV Series
|
|
- Shows up to 14 items + "More" link to discover page
|
|
- Animated card entrance
|
|
|
|
### `CastList`
|
|
**File:** `src/components/entries/CastList.tsx`
|
|
|
|
Horizontal scrollable list of cast members for an entry.
|
|
|
|
- Filters credits to `cast_type === 'cast'` only
|
|
- Avatar + name + character name
|
|
- Clickable → links to person details page
|
|
|
|
### `SeasonsContainer`
|
|
**File:** `src/components/entries/SeasonsContainer.tsx`
|
|
|
|
Expandable seasons list for TV series entries.
|
|
|
|
### `EpisodeWatchHistory`
|
|
**File:** `src/components/entries/EpisodeWatchHistory.tsx`
|
|
|
|
Watch history display for individual episodes.
|
|
|
|
---
|
|
|
|
## Collection Components
|
|
|
|
### `CollectionsGrid`
|
|
**File:** `src/components/collections/CollectionsGrid.tsx`
|
|
|
|
Grid of collection cards showing poster with gradient overlay and name. Includes skeleton and empty states.
|
|
|
|
---
|
|
|
|
## Dashboard Charts
|
|
|
|
All chart components use **Recharts** with `ResponsiveContainer`. Common pattern: card wrapper + filter controls in `CardHeader` + chart in `CardContent`.
|
|
|
|
| Component | Chart Type | Data Source | Controls |
|
|
| -------------------- | ------------- | -------------------------- | -------------------------- |
|
|
| `WatchActivityChart` | Area chart | Yearly watch count | Year selector, type filter |
|
|
| `WatchTimeChart` | Bar chart | Yearly watch time | Year selector |
|
|
| `RatingsChart` | Bar chart | Rating distribution | — |
|
|
| `TopGenresChart` | Bar/Pie chart | Genre frequency | — |
|
|
| `CouchDayChart` | Bar chart | Weekday watch distribution | — |
|
|
| `LibraryGrowthChart` | Line chart | Library size over time | — |
|
|
| `MediaTypeChart` | Pie chart | Movies vs TV split | — |
|
|
|
|
---
|
|
|
|
## Dialog Components
|
|
|
|
All dialogs follow a controlled pattern: `open` + `onOpenChange` props from parent, mutation hooks for actions, loading states on submit buttons.
|
|
|
|
| Component | Purpose |
|
|
| ---------------------------- | ------------------------------------------------ |
|
|
| `ConfirmDialog` | Generic confirmation modal (default/destructive) |
|
|
| `EntrySettingsDialog` | Toggle entry flags (favourite, hidden, etc.) |
|
|
| `EntrySeenDialog` | Add/edit movie watch record or TV episode watch |
|
|
| `RatingDialog` | 10-star rating picker with hover preview |
|
|
| `EntryMediaDialog` | Upload custom posters/backdrops for an entry |
|
|
| `MovieWatchHistoryDialog` | View/edit/delete movie watch records |
|
|
| `AddEntryToCollectionDialog` | Add an entry to one or more collections |
|
|
| `CollectionEditDialog` | Edit collection metadata and media |
|
|
| `EpisodeSeenEditDialog` | Edit an episode watch record |
|
|
|
|
---
|
|
|
|
## Skeleton Components
|
|
|
|
**File:** `src/components/skeletons/PageSkeletons.tsx`
|
|
|
|
Loading placeholder components matching the layout of their target pages. Used as `<Suspense>` fallbacks for lazy-loaded routes.
|
|
|
|
---
|
|
|
|
## UI Primitives (shadcn/ui)
|
|
|
|
Located in `src/components/ui/`. These are copy-pasted from the shadcn/ui registry and customised via CSS variables. They are **not** installed as a package.
|
|
|
|
`avatar` · `badge` · `button` · `calendar` · `card` · `checkbox` · `dialog` · `dropdown-menu` · `input` · `label` · `popover` · `progress` · `scroll-area` · `select` · `separator` · `sheet` · `skeleton` · `sonner` · `switch` · `tabs` · `textarea` · `tooltip`
|