+
@@ -70,9 +75,13 @@ export function EntrySettingsDialog({
-
+
- {userRating > 0 ? `${userRating}/10` : '—'}
+ {userRating > 0 ? `${userRating}/10` : "—"}
diff --git a/react_frontend/src/components/dialogs/EpisodeSeenEditDialog.tsx b/react_frontend/src/components/dialogs/EpisodeSeenEditDialog.tsx
index 0a283c4..4190e8a 100644
--- a/react_frontend/src/components/dialogs/EpisodeSeenEditDialog.tsx
+++ b/react_frontend/src/components/dialogs/EpisodeSeenEditDialog.tsx
@@ -1,23 +1,26 @@
-import { useState } from 'react';
+import { useState } from "react";
import {
Dialog,
DialogContent,
DialogFooter,
DialogHeader,
DialogTitle,
-} from '@/components/ui/dialog';
-import { Button } from '@/components/ui/button';
-import { Input } from '@/components/ui/input';
-import { Label } from '@/components/ui/label';
+} from "@/components/ui/dialog";
+import { Button } from "@/components/ui/button";
+import { Input } from "@/components/ui/input";
+import { Label } from "@/components/ui/label";
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
-} from '@/components/ui/select';
-import { useUpdateEpisodeSeen, useCreateEpisodeSeen } from '@/hooks/useEpisodeSeen';
-import type { EpisodeSeen, SeenAccuracy } from '@/types';
+} from "@/components/ui/select";
+import {
+ useUpdateEpisodeSeen,
+ useCreateEpisodeSeen,
+} from "@/hooks/useEpisodeSeen";
+import type { EpisodeSeen, SeenAccuracy } from "@/types";
interface EpisodeSeenEditDialogProps {
open: boolean;
@@ -28,9 +31,13 @@ interface EpisodeSeenEditDialogProps {
episodeId?: number;
entryId: number;
seasonId?: number;
- mode?: 'create' | 'edit';
+ mode?: "create" | "edit";
/** If provided, called instead of the normal create/update mutation */
- overrideSubmit?: (date: string, seenWith: string, accuracy: SeenAccuracy) => void;
+ overrideSubmit?: (
+ date: string,
+ seenWith: string,
+ accuracy: SeenAccuracy,
+ ) => void;
}
export function EpisodeSeenEditDialog({
@@ -40,13 +47,15 @@ export function EpisodeSeenEditDialog({
episodeId,
entryId,
seasonId,
- mode = record ? 'edit' : 'create',
+ mode = record ? "edit" : "create",
overrideSubmit,
}: EpisodeSeenEditDialogProps) {
- const today = new Date().toISOString().split('T')[0];
- const [date, setDate] = useState(record?.date_seen?.split('T')[0] ?? today);
- const [seenWith, setSeenWith] = useState(record?.seen_with ?? '');
- const [accuracy, setAccuracy] = useState
(record?.accuracy ?? 'EXACT');
+ const today = new Date().toISOString().split("T")[0];
+ const [date, setDate] = useState(record?.date_seen?.split("T")[0] ?? today);
+ const [seenWith, setSeenWith] = useState(record?.seen_with ?? "");
+ const [accuracy, setAccuracy] = useState(
+ record?.accuracy ?? "EXACT",
+ );
const updateEpisodeSeen = useUpdateEpisodeSeen();
const createEpisodeSeen = useCreateEpisodeSeen();
@@ -56,7 +65,7 @@ export function EpisodeSeenEditDialog({
overrideSubmit(date, seenWith, accuracy);
return;
}
- if (mode === 'edit' && record) {
+ if (mode === "edit" && record) {
updateEpisodeSeen.mutate({
id: record.id,
data: {
@@ -86,7 +95,9 @@ export function EpisodeSeenEditDialog({
)}
@@ -293,19 +299,17 @@ export function MarkSeasonWatchedDialog({
disabled={
isSubmitting ||
unwatched.length === 0 ||
- (mode === 'single' && !singleDate) ||
- (mode === 'scatter' &&
+ (mode === "single" && !singleDate) ||
+ (mode === "scatter" &&
(!startDate ||
!endDate ||
new Date(endDate) < new Date(startDate)))
}
>
- {isSubmitting && (
-
- )}
+ {isSubmitting &&
}
{isSubmitting
- ? 'Marking...'
- : `Mark ${unwatched.length} Episode${unwatched.length !== 1 ? 's' : ''}`}
+ ? "Marking..."
+ : `Mark ${unwatched.length} Episode${unwatched.length !== 1 ? "s" : ""}`}
diff --git a/react_frontend/src/components/dialogs/MovieWatchHistoryDialog.tsx b/react_frontend/src/components/dialogs/MovieWatchHistoryDialog.tsx
index 21387d6..4d7262c 100644
--- a/react_frontend/src/components/dialogs/MovieWatchHistoryDialog.tsx
+++ b/react_frontend/src/components/dialogs/MovieWatchHistoryDialog.tsx
@@ -1,13 +1,13 @@
-import { format } from 'date-fns';
+import { format } from "date-fns";
import {
Dialog,
DialogContent,
DialogHeader,
DialogTitle,
-} from '@/components/ui/dialog';
-import { Button } from '@/components/ui/button';
-import { Trash2 } from 'lucide-react';
-import type { EntrySeen } from '@/types';
+} from "@/components/ui/dialog";
+import { Button } from "@/components/ui/button";
+import { Trash2 } from "lucide-react";
+import type { EntrySeen } from "@/types";
interface MovieWatchHistoryDialogProps {
open: boolean;
@@ -51,11 +51,11 @@ export function MovieWatchHistoryDialog({
>
{record.date_seen
- ? format(new Date(record.date_seen), 'MMM d, yyyy')
- : '-'}
+ ? format(new Date(record.date_seen), "MMM d, yyyy")
+ : "-"}
|
- {record.seen_with || '-'}
+ {record.seen_with || "-"}
|
diff --git a/react_frontend/src/components/dialogs/RatingDialog.tsx b/react_frontend/src/components/dialogs/RatingDialog.tsx
index 8c795b6..72a743f 100644
--- a/react_frontend/src/components/dialogs/RatingDialog.tsx
+++ b/react_frontend/src/components/dialogs/RatingDialog.tsx
@@ -1,14 +1,14 @@
-import { useState, useEffect } from 'react';
+import { useState, useEffect } from "react";
import {
Dialog,
DialogContent,
DialogHeader,
DialogTitle,
-} from '@/components/ui/dialog';
-import { Button } from '@/components/ui/button';
-import { StarRating } from '@/components/ui/star-rating';
-import { useUpdateEntryRatings } from '@/hooks/useEntries';
-import type { Entry } from '@/types';
+} from "@/components/ui/dialog";
+import { Button } from "@/components/ui/button";
+import { StarRating } from "@/components/ui/star-rating";
+import { useUpdateEntryRatings } from "@/hooks/useEntries";
+import type { Entry } from "@/types";
interface RatingDialogProps {
open: boolean;
@@ -48,14 +48,16 @@ export function RatingDialog({ open, onOpenChange, entry }: RatingDialogProps) {
Rate
- {entry.title}
+
+ {entry.title}
+
- {selected > 0 ? `${selected} / 10` : '—'}
+ {selected > 0 ? `${selected} / 10` : "—"}
{(selected > 0 || currentRating > 0) && (
diff --git a/react_frontend/src/components/entries/EpisodeWatchHistory.tsx b/react_frontend/src/components/entries/EpisodeWatchHistory.tsx
index 408b966..871a444 100644
--- a/react_frontend/src/components/entries/EpisodeWatchHistory.tsx
+++ b/react_frontend/src/components/entries/EpisodeWatchHistory.tsx
@@ -1,7 +1,7 @@
-import { format } from 'date-fns';
-import type { EntrySeen, EpisodeSeen } from '@/types';
-import { Button } from '@/components/ui/button';
-import { Pencil, Trash2 } from 'lucide-react';
+import { format } from "date-fns";
+import type { EntrySeen, EpisodeSeen } from "@/types";
+import { Button } from "@/components/ui/button";
+import { Pencil, Trash2 } from "lucide-react";
interface EpisodeWatchHistoryProps {
watchHistory: (EntrySeen | EpisodeSeen)[];
@@ -40,11 +40,11 @@ export function EpisodeWatchHistory({
>
{record.date_seen
- ? format(new Date(record.date_seen), 'MMM d, yyyy')
- : '-'}
+ ? format(new Date(record.date_seen), "MMM d, yyyy")
+ : "-"}
|
- {record.seen_with || '-'}
+ {record.seen_with || "-"}
|
diff --git a/react_frontend/src/components/entries/SeasonsContainer.tsx b/react_frontend/src/components/entries/SeasonsContainer.tsx
index 06cc660..72590cb 100644
--- a/react_frontend/src/components/entries/SeasonsContainer.tsx
+++ b/react_frontend/src/components/entries/SeasonsContainer.tsx
@@ -1,21 +1,18 @@
-import { useState } from 'react';
-import { Link } from 'react-router-dom';
-import { ChevronDown, ChevronUp, Play } from 'lucide-react';
-import { Button } from '@/components/ui/button';
-import { Progress } from '@/components/ui/progress';
-import { EpisodeSeenEditDialog } from '@/components/dialogs/EpisodeSeenEditDialog';
-import { getYear, getTmdbPosterUrl } from '@/lib/media-utils';
-import type { Season } from '@/types';
+import { useState } from "react";
+import { Link } from "react-router-dom";
+import { ChevronDown, ChevronUp, Play } from "lucide-react";
+import { Button } from "@/components/ui/button";
+import { Progress } from "@/components/ui/progress";
+import { EpisodeSeenEditDialog } from "@/components/dialogs/EpisodeSeenEditDialog";
+import { getYear, getTmdbPosterUrl } from "@/lib/media-utils";
+import type { Season } from "@/types";
interface SeasonsContainerProps {
seasons: Season[];
entryId: number;
}
-export function SeasonsContainer({
- seasons,
- entryId,
-}: SeasonsContainerProps) {
+export function SeasonsContainer({ seasons, entryId }: SeasonsContainerProps) {
const [expanded, setExpanded] = useState(false);
// Sort: specials (season 0) at bottom, rest latest to oldest
@@ -48,8 +45,8 @@ export function SeasonsContainer({
>
) : (
<>
- Show All (
- {sorted.length})
+ Show All ({sorted.length}
+ )
>
)}
@@ -58,17 +55,12 @@ export function SeasonsContainer({
);
}
-function SeasonItem({
- season,
- entryId,
-}: {
- season: Season;
- entryId: number;
-}) {
+function SeasonItem({ season, entryId }: { season: Season; entryId: number }) {
const [dialogOpen, setDialogOpen] = useState(false);
const watchedCount =
season.episodes?.filter(
- (ep) => ep.date_first_seen || (ep.episodeSeens && ep.episodeSeens.length > 0)
+ (ep) =>
+ ep.date_first_seen || (ep.episodeSeens && ep.episodeSeens.length > 0),
).length ?? 0;
const totalEpisodes = season.episode_count || season.episodes?.length || 0;
const progress = totalEpisodes > 0 ? (watchedCount / totalEpisodes) * 100 : 0;
@@ -76,7 +68,11 @@ function SeasonItem({
const nextUnwatched = season.episodes
?.slice()
.sort((a, b) => a.episode_number - b.episode_number)
- .find((ep) => !ep.date_first_seen && (!ep.episodeSeens || ep.episodeSeens.length === 0));
+ .find(
+ (ep) =>
+ !ep.date_first_seen &&
+ (!ep.episodeSeens || ep.episodeSeens.length === 0),
+ );
return (
<>
@@ -87,7 +83,7 @@ function SeasonItem({
{/* Poster thumbnail */}
 ('movie');
- const entries = activeTab === 'movie' ? movieEntries : tvEntries;
+ const [activeTab, setActiveTab] = useState<"movie" | "tv">("movie");
+ const entries = activeTab === "movie" ? movieEntries : tvEntries;
const displayEntries = entries.slice(0, 14);
return (
@@ -33,7 +33,7 @@ export function TrendingGrid({
setActiveTab(v as 'movie' | 'tv')}
+ onValueChange={(v) => setActiveTab(v as "movie" | "tv")}
>
diff --git a/react_frontend/src/components/entries/TrendingSlider.tsx b/react_frontend/src/components/entries/TrendingSlider.tsx
index f61a2d6..efb55ea 100644
--- a/react_frontend/src/components/entries/TrendingSlider.tsx
+++ b/react_frontend/src/components/entries/TrendingSlider.tsx
@@ -1,10 +1,10 @@
-import { useState, useEffect, useCallback, useRef } from 'react';
-import { Link } from 'react-router-dom';
-import { ChevronLeft, ChevronRight, Star } from 'lucide-react';
-import { Button } from '@/components/ui/button';
-import { useCreateEntry } from '@/hooks/useEntries';
-import { useLibraryStore } from '@/stores/useLibraryStore';
-import type { TmdbEntry } from '@/types';
+import { useState, useEffect, useCallback, useRef } from "react";
+import { Link } from "react-router-dom";
+import { ChevronLeft, ChevronRight, Star } from "lucide-react";
+import { Button } from "@/components/ui/button";
+import { useCreateEntry } from "@/hooks/useEntries";
+import { useLibraryStore } from "@/stores/useLibraryStore";
+import type { TmdbEntry } from "@/types";
interface TrendingSliderProps {
entries: TmdbEntry[];
@@ -48,14 +48,14 @@ export function TrendingSlider({ entries, isLoading }: TrendingSliderProps) {
const safeIndex = currentIndex < display.length ? currentIndex : 0;
const item = display[safeIndex];
- const title = item.title || item.name || 'Untitled';
+ const title = item.title || item.name || "Untitled";
const backdropUrl = item.backdrop_path
? `https://image.tmdb.org/t/p/w1280${item.backdrop_path}`
: null;
- const isTv = item.media_type === 'tv' || !!item.name;
+ const isTv = item.media_type === "tv" || !!item.name;
const matchedEntry = Array.from(libraryEntries.values()).find(
- (e) => e.entryIds?.tmdb_id === item.id
+ (e) => e.entryIds?.tmdb_id === item.id,
);
const isInLibrary = !!matchedEntry;
@@ -77,14 +77,20 @@ export function TrendingSlider({ entries, isLoading }: TrendingSliderProps) {
@@ -94,7 +100,7 @@ export function TrendingSlider({ entries, isLoading }: TrendingSliderProps) {
- {isTv ? 'TV Series' : 'Movie'}
+ {isTv ? "TV Series" : "Movie"}
{item.vote_average > 0 && (
@@ -122,7 +128,9 @@ export function TrendingSlider({ entries, isLoading }: TrendingSliderProps) {
|
- )
+ );
},
...components,
}}
{...props}
/>
- )
+ );
}
function CalendarDayButton({
@@ -187,12 +194,12 @@ function CalendarDayButton({
locale,
...props
}: React.ComponentProps & { locale?: Partial }) {
- const defaultClassNames = getDefaultClassNames()
+ const defaultClassNames = getDefaultClassNames();
- const ref = React.useRef(null)
+ const ref = React.useRef(null);
React.useEffect(() => {
- if (modifiers.focused) ref.current?.focus()
- }, [modifiers.focused])
+ if (modifiers.focused) ref.current?.focus();
+ }, [modifiers.focused]);
return (
span]:text-xs [&>span]:opacity-70",
defaultClassNames.day,
- className
+ className,
)}
{...props}
/>
- )
+ );
}
-export { Calendar, CalendarDayButton }
+export { Calendar, CalendarDayButton };
diff --git a/react_frontend/src/components/ui/card.tsx b/react_frontend/src/components/ui/card.tsx
index 40cac5f..325aa00 100644
--- a/react_frontend/src/components/ui/card.tsx
+++ b/react_frontend/src/components/ui/card.tsx
@@ -1,6 +1,6 @@
-import * as React from "react"
+import * as React from "react";
-import { cn } from "@/lib/utils"
+import { cn } from "@/lib/utils";
function Card({
className,
@@ -13,11 +13,11 @@ function Card({
data-size={size}
className={cn(
"group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-card py-4 text-sm text-card-foreground ring-1 ring-foreground/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",
- className
+ className,
)}
{...props}
/>
- )
+ );
}
function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
@@ -26,11 +26,11 @@ function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
data-slot="card-header"
className={cn(
"group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3",
- className
+ className,
)}
{...props}
/>
- )
+ );
}
function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
@@ -39,11 +39,11 @@ function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
data-slot="card-title"
className={cn(
"font-heading text-base leading-snug font-medium group-data-[size=sm]/card:text-sm",
- className
+ className,
)}
{...props}
/>
- )
+ );
}
function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
@@ -53,7 +53,7 @@ function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
className={cn("text-sm text-muted-foreground", className)}
{...props}
/>
- )
+ );
}
function CardAction({ className, ...props }: React.ComponentProps<"div">) {
@@ -62,11 +62,11 @@ function CardAction({ className, ...props }: React.ComponentProps<"div">) {
data-slot="card-action"
className={cn(
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
- className
+ className,
)}
{...props}
/>
- )
+ );
}
function CardContent({ className, ...props }: React.ComponentProps<"div">) {
@@ -76,7 +76,7 @@ function CardContent({ className, ...props }: React.ComponentProps<"div">) {
className={cn("px-4 group-data-[size=sm]/card:px-3", className)}
{...props}
/>
- )
+ );
}
function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
@@ -85,11 +85,11 @@ function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
data-slot="card-footer"
className={cn(
"flex items-center rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/card:p-3",
- className
+ className,
)}
{...props}
/>
- )
+ );
}
export {
@@ -100,4 +100,4 @@ export {
CardAction,
CardDescription,
CardContent,
-}
+};
diff --git a/react_frontend/src/components/ui/checkbox.tsx b/react_frontend/src/components/ui/checkbox.tsx
index 824b50f..c165fc9 100644
--- a/react_frontend/src/components/ui/checkbox.tsx
+++ b/react_frontend/src/components/ui/checkbox.tsx
@@ -1,7 +1,7 @@
-import { Checkbox as CheckboxPrimitive } from "@base-ui/react/checkbox"
+import { Checkbox as CheckboxPrimitive } from "@base-ui/react/checkbox";
-import { cn } from "@/lib/utils"
-import { CheckIcon } from "lucide-react"
+import { cn } from "@/lib/utils";
+import { CheckIcon } from "lucide-react";
function Checkbox({ className, ...props }: CheckboxPrimitive.Root.Props) {
return (
@@ -9,7 +9,7 @@ function Checkbox({ className, ...props }: CheckboxPrimitive.Root.Props) {
data-slot="checkbox"
className={cn(
"peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary",
- className
+ className,
)}
{...props}
>
@@ -17,11 +17,10 @@ function Checkbox({ className, ...props }: CheckboxPrimitive.Root.Props) {
data-slot="checkbox-indicator"
className="grid place-content-center text-current transition-none [&>svg]:size-3.5"
>
-
+
- )
+ );
}
-export { Checkbox }
+export { Checkbox };
diff --git a/react_frontend/src/components/ui/dialog.tsx b/react_frontend/src/components/ui/dialog.tsx
index 014f5aa..308e17f 100644
--- a/react_frontend/src/components/ui/dialog.tsx
+++ b/react_frontend/src/components/ui/dialog.tsx
@@ -1,26 +1,26 @@
-"use client"
+"use client";
-import * as React from "react"
-import { Dialog as DialogPrimitive } from "@base-ui/react/dialog"
+import * as React from "react";
+import { Dialog as DialogPrimitive } from "@base-ui/react/dialog";
-import { cn } from "@/lib/utils"
-import { Button } from "@/components/ui/button"
-import { XIcon } from "lucide-react"
+import { cn } from "@/lib/utils";
+import { Button } from "@/components/ui/button";
+import { XIcon } from "lucide-react";
function Dialog({ ...props }: DialogPrimitive.Root.Props) {
- return
+ return ;
}
function DialogTrigger({ ...props }: DialogPrimitive.Trigger.Props) {
- return
+ return ;
}
function DialogPortal({ ...props }: DialogPrimitive.Portal.Props) {
- return
+ return ;
}
function DialogClose({ ...props }: DialogPrimitive.Close.Props) {
- return
+ return ;
}
function DialogOverlay({
@@ -32,11 +32,11 @@ function DialogOverlay({
data-slot="dialog-overlay"
className={cn(
"fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",
- className
+ className,
)}
{...props}
/>
- )
+ );
}
function DialogContent({
@@ -45,7 +45,7 @@ function DialogContent({
showCloseButton = true,
...props
}: DialogPrimitive.Popup.Props & {
- showCloseButton?: boolean
+ showCloseButton?: boolean;
}) {
return (
@@ -54,7 +54,7 @@ function DialogContent({
data-slot="dialog-content"
className={cn(
"fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
- className
+ className,
)}
{...props}
>
@@ -70,14 +70,13 @@ function DialogContent({
/>
}
>
-
+
Close
)}
- )
+ );
}
function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
@@ -87,7 +86,7 @@ function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
className={cn("flex flex-col gap-2", className)}
{...props}
/>
- )
+ );
}
function DialogFooter({
@@ -96,14 +95,14 @@ function DialogFooter({
children,
...props
}: React.ComponentProps<"div"> & {
- showCloseButton?: boolean
+ showCloseButton?: boolean;
}) {
return (
@@ -114,7 +113,7 @@ function DialogFooter({
)}
- )
+ );
}
function DialogTitle({ className, ...props }: DialogPrimitive.Title.Props) {
@@ -123,11 +122,11 @@ function DialogTitle({ className, ...props }: DialogPrimitive.Title.Props) {
data-slot="dialog-title"
className={cn(
"font-heading text-base leading-none font-medium",
- className
+ className,
)}
{...props}
/>
- )
+ );
}
function DialogDescription({
@@ -139,11 +138,11 @@ function DialogDescription({
data-slot="dialog-description"
className={cn(
"text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",
- className
+ className,
)}
{...props}
/>
- )
+ );
}
export {
@@ -157,4 +156,4 @@ export {
DialogPortal,
DialogTitle,
DialogTrigger,
-}
+};
diff --git a/react_frontend/src/components/ui/dropdown-menu.tsx b/react_frontend/src/components/ui/dropdown-menu.tsx
index 9d5ebbd..0d67f0d 100644
--- a/react_frontend/src/components/ui/dropdown-menu.tsx
+++ b/react_frontend/src/components/ui/dropdown-menu.tsx
@@ -1,21 +1,21 @@
-"use client"
+"use client";
-import * as React from "react"
-import { Menu as MenuPrimitive } from "@base-ui/react/menu"
+import * as React from "react";
+import { Menu as MenuPrimitive } from "@base-ui/react/menu";
-import { cn } from "@/lib/utils"
-import { ChevronRightIcon, CheckIcon } from "lucide-react"
+import { cn } from "@/lib/utils";
+import { ChevronRightIcon, CheckIcon } from "lucide-react";
function DropdownMenu({ ...props }: MenuPrimitive.Root.Props) {
- return
+ return ;
}
function DropdownMenuPortal({ ...props }: MenuPrimitive.Portal.Props) {
- return
+ return ;
}
function DropdownMenuTrigger({ ...props }: MenuPrimitive.Trigger.Props) {
- return
+ return ;
}
function DropdownMenuContent({
@@ -41,16 +41,19 @@ function DropdownMenuContent({
>
- )
+ );
}
function DropdownMenuGroup({ ...props }: MenuPrimitive.Group.Props) {
- return
+ return ;
}
function DropdownMenuLabel({
@@ -58,7 +61,7 @@ function DropdownMenuLabel({
inset,
...props
}: MenuPrimitive.GroupLabel.Props & {
- inset?: boolean
+ inset?: boolean;
}) {
return (
- )
+ );
}
function DropdownMenuItem({
@@ -79,8 +82,8 @@ function DropdownMenuItem({
variant = "default",
...props
}: MenuPrimitive.Item.Props & {
- inset?: boolean
- variant?: "default" | "destructive"
+ inset?: boolean;
+ variant?: "default" | "destructive";
}) {
return (
- )
+ );
}
function DropdownMenuSub({ ...props }: MenuPrimitive.SubmenuRoot.Props) {
- return
+ return ;
}
function DropdownMenuSubTrigger({
@@ -106,7 +109,7 @@ function DropdownMenuSubTrigger({
children,
...props
}: MenuPrimitive.SubmenuTrigger.Props & {
- inset?: boolean
+ inset?: boolean;
}) {
return (
{children}
- )
+ );
}
function DropdownMenuSubContent({
@@ -135,14 +138,17 @@ function DropdownMenuSubContent({
return (
- )
+ );
}
function DropdownMenuCheckboxItem({
@@ -152,7 +158,7 @@ function DropdownMenuCheckboxItem({
inset,
...props
}: MenuPrimitive.CheckboxItem.Props & {
- inset?: boolean
+ inset?: boolean;
}) {
return (
-
+
{children}
- )
+ );
}
function DropdownMenuRadioGroup({ ...props }: MenuPrimitive.RadioGroup.Props) {
@@ -185,7 +190,7 @@ function DropdownMenuRadioGroup({ ...props }: MenuPrimitive.RadioGroup.Props) {
data-slot="dropdown-menu-radio-group"
{...props}
/>
- )
+ );
}
function DropdownMenuRadioItem({
@@ -194,7 +199,7 @@ function DropdownMenuRadioItem({
inset,
...props
}: MenuPrimitive.RadioItem.Props & {
- inset?: boolean
+ inset?: boolean;
}) {
return (
@@ -211,13 +216,12 @@ function DropdownMenuRadioItem({
data-slot="dropdown-menu-radio-item-indicator"
>
-
+
{children}
- )
+ );
}
function DropdownMenuSeparator({
@@ -230,7 +234,7 @@ function DropdownMenuSeparator({
className={cn("-mx-1 my-1 h-px bg-border", className)}
{...props}
/>
- )
+ );
}
function DropdownMenuShortcut({
@@ -242,11 +246,11 @@ function DropdownMenuShortcut({
data-slot="dropdown-menu-shortcut"
className={cn(
"ml-auto text-xs tracking-widest text-muted-foreground group-focus/dropdown-menu-item:text-accent-foreground",
- className
+ className,
)}
{...props}
/>
- )
+ );
}
export {
@@ -265,4 +269,4 @@ export {
DropdownMenuSub,
DropdownMenuSubTrigger,
DropdownMenuSubContent,
-}
+};
diff --git a/react_frontend/src/components/ui/input.tsx b/react_frontend/src/components/ui/input.tsx
index 7d21bab..abb87eb 100644
--- a/react_frontend/src/components/ui/input.tsx
+++ b/react_frontend/src/components/ui/input.tsx
@@ -1,7 +1,7 @@
-import * as React from "react"
-import { Input as InputPrimitive } from "@base-ui/react/input"
+import * as React from "react";
+import { Input as InputPrimitive } from "@base-ui/react/input";
-import { cn } from "@/lib/utils"
+import { cn } from "@/lib/utils";
function Input({ className, type, ...props }: React.ComponentProps<"input">) {
return (
@@ -10,11 +10,11 @@ function Input({ className, type, ...props }: React.ComponentProps<"input">) {
data-slot="input"
className={cn(
"h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
- className
+ className,
)}
{...props}
/>
- )
+ );
}
-export { Input }
+export { Input };
diff --git a/react_frontend/src/components/ui/label.tsx b/react_frontend/src/components/ui/label.tsx
index f162996..ef05c96 100644
--- a/react_frontend/src/components/ui/label.tsx
+++ b/react_frontend/src/components/ui/label.tsx
@@ -1,6 +1,6 @@
-import * as React from "react"
+import * as React from "react";
-import { cn } from "@/lib/utils"
+import { cn } from "@/lib/utils";
function Label({ className, ...props }: React.ComponentProps<"label">) {
return (
@@ -8,11 +8,11 @@ function Label({ className, ...props }: React.ComponentProps<"label">) {
data-slot="label"
className={cn(
"flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
- className
+ className,
)}
{...props}
/>
- )
+ );
}
-export { Label }
+export { Label };
diff --git a/react_frontend/src/components/ui/popover.tsx b/react_frontend/src/components/ui/popover.tsx
index 4dc28c3..028ecc2 100644
--- a/react_frontend/src/components/ui/popover.tsx
+++ b/react_frontend/src/components/ui/popover.tsx
@@ -1,16 +1,16 @@
-"use client"
+"use client";
-import * as React from "react"
-import { Popover as PopoverPrimitive } from "@base-ui/react/popover"
+import * as React from "react";
+import { Popover as PopoverPrimitive } from "@base-ui/react/popover";
-import { cn } from "@/lib/utils"
+import { cn } from "@/lib/utils";
function Popover({ ...props }: PopoverPrimitive.Root.Props) {
- return
+ return ;
}
function PopoverTrigger({ ...props }: PopoverPrimitive.Trigger.Props) {
- return
+ return ;
}
function PopoverContent({
@@ -38,13 +38,13 @@ function PopoverContent({
data-slot="popover-content"
className={cn(
"z-50 flex w-72 origin-(--transform-origin) flex-col gap-2.5 rounded-lg bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
- className
+ className,
)}
{...props}
/>
- )
+ );
}
function PopoverHeader({ className, ...props }: React.ComponentProps<"div">) {
@@ -54,7 +54,7 @@ function PopoverHeader({ className, ...props }: React.ComponentProps<"div">) {
className={cn("flex flex-col gap-0.5 text-sm", className)}
{...props}
/>
- )
+ );
}
function PopoverTitle({ className, ...props }: PopoverPrimitive.Title.Props) {
@@ -64,7 +64,7 @@ function PopoverTitle({ className, ...props }: PopoverPrimitive.Title.Props) {
className={cn("font-heading font-medium", className)}
{...props}
/>
- )
+ );
}
function PopoverDescription({
@@ -77,7 +77,7 @@ function PopoverDescription({
className={cn("text-muted-foreground", className)}
{...props}
/>
- )
+ );
}
export {
@@ -87,4 +87,4 @@ export {
PopoverHeader,
PopoverTitle,
PopoverTrigger,
-}
+};
diff --git a/react_frontend/src/components/ui/progress.tsx b/react_frontend/src/components/ui/progress.tsx
index 844e869..1aa08d9 100644
--- a/react_frontend/src/components/ui/progress.tsx
+++ b/react_frontend/src/components/ui/progress.tsx
@@ -1,6 +1,6 @@
-import { Progress as ProgressPrimitive } from "@base-ui/react/progress"
+import { Progress as ProgressPrimitive } from "@base-ui/react/progress";
-import { cn } from "@/lib/utils"
+import { cn } from "@/lib/utils";
function Progress({
className,
@@ -20,7 +20,7 @@ function Progress({
- )
+ );
}
function ProgressTrack({ className, ...props }: ProgressPrimitive.Track.Props) {
@@ -28,12 +28,12 @@ function ProgressTrack({ className, ...props }: ProgressPrimitive.Track.Props) {
- )
+ );
}
function ProgressIndicator({
@@ -46,7 +46,7 @@ function ProgressIndicator({
className={cn("h-full bg-primary transition-all", className)}
{...props}
/>
- )
+ );
}
function ProgressLabel({ className, ...props }: ProgressPrimitive.Label.Props) {
@@ -56,7 +56,7 @@ function ProgressLabel({ className, ...props }: ProgressPrimitive.Label.Props) {
data-slot="progress-label"
{...props}
/>
- )
+ );
}
function ProgressValue({ className, ...props }: ProgressPrimitive.Value.Props) {
@@ -64,12 +64,12 @@ function ProgressValue({ className, ...props }: ProgressPrimitive.Value.Props) {
- )
+ );
}
export {
@@ -78,4 +78,4 @@ export {
ProgressIndicator,
ProgressLabel,
ProgressValue,
-}
+};
diff --git a/react_frontend/src/components/ui/scroll-area.tsx b/react_frontend/src/components/ui/scroll-area.tsx
index 84c1e9f..de177a3 100644
--- a/react_frontend/src/components/ui/scroll-area.tsx
+++ b/react_frontend/src/components/ui/scroll-area.tsx
@@ -1,9 +1,9 @@
-"use client"
+"use client";
-import * as React from "react"
-import { ScrollArea as ScrollAreaPrimitive } from "@base-ui/react/scroll-area"
+import * as React from "react";
+import { ScrollArea as ScrollAreaPrimitive } from "@base-ui/react/scroll-area";
-import { cn } from "@/lib/utils"
+import { cn } from "@/lib/utils";
function ScrollArea({
className,
@@ -25,7 +25,7 @@ function ScrollArea({
- )
+ );
}
function ScrollBar({
@@ -40,7 +40,7 @@ function ScrollBar({
orientation={orientation}
className={cn(
"flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent",
- className
+ className,
)}
{...props}
>
@@ -49,7 +49,7 @@ function ScrollBar({
className="relative flex-1 rounded-full bg-border"
/>
- )
+ );
}
-export { ScrollArea, ScrollBar }
+export { ScrollArea, ScrollBar };
diff --git a/react_frontend/src/components/ui/select.tsx b/react_frontend/src/components/ui/select.tsx
index e8021f5..7810016 100644
--- a/react_frontend/src/components/ui/select.tsx
+++ b/react_frontend/src/components/ui/select.tsx
@@ -1,12 +1,12 @@
-"use client"
+"use client";
-import * as React from "react"
-import { Select as SelectPrimitive } from "@base-ui/react/select"
+import * as React from "react";
+import { Select as SelectPrimitive } from "@base-ui/react/select";
-import { cn } from "@/lib/utils"
-import { ChevronDownIcon, CheckIcon, ChevronUpIcon } from "lucide-react"
+import { cn } from "@/lib/utils";
+import { ChevronDownIcon, CheckIcon, ChevronUpIcon } from "lucide-react";
-const Select = SelectPrimitive.Root
+const Select = SelectPrimitive.Root;
function SelectGroup({ className, ...props }: SelectPrimitive.Group.Props) {
return (
@@ -15,7 +15,7 @@ function SelectGroup({ className, ...props }: SelectPrimitive.Group.Props) {
className={cn("scroll-my-1 p-1", className)}
{...props}
/>
- )
+ );
}
function SelectValue({ className, ...props }: SelectPrimitive.Value.Props) {
@@ -25,7 +25,7 @@ function SelectValue({ className, ...props }: SelectPrimitive.Value.Props) {
className={cn("flex flex-1 text-left", className)}
{...props}
/>
- )
+ );
}
function SelectTrigger({
@@ -34,7 +34,7 @@ function SelectTrigger({
children,
...props
}: SelectPrimitive.Trigger.Props & {
- size?: "sm" | "default"
+ size?: "sm" | "default";
}) {
return (
@@ -53,7 +53,7 @@ function SelectTrigger({
}
/>
- )
+ );
}
function SelectContent({
@@ -83,7 +83,10 @@ function SelectContent({
@@ -92,7 +95,7 @@ function SelectContent({
- )
+ );
}
function SelectLabel({
@@ -105,7 +108,7 @@ function SelectLabel({
className={cn("px-1.5 py-1 text-xs text-muted-foreground", className)}
{...props}
/>
- )
+ );
}
function SelectItem({
@@ -118,7 +121,7 @@ function SelectItem({
data-slot="select-item"
className={cn(
"relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
- className
+ className,
)}
{...props}
>
@@ -133,7 +136,7 @@ function SelectItem({
- )
+ );
}
function SelectSeparator({
@@ -146,7 +149,7 @@ function SelectSeparator({
className={cn("pointer-events-none -mx-1 my-1 h-px bg-border", className)}
{...props}
/>
- )
+ );
}
function SelectScrollUpButton({
@@ -158,14 +161,13 @@ function SelectScrollUpButton({
data-slot="select-scroll-up-button"
className={cn(
"top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",
- className
+ className,
)}
{...props}
>
-
+
- )
+ );
}
function SelectScrollDownButton({
@@ -177,14 +179,13 @@ function SelectScrollDownButton({
data-slot="select-scroll-down-button"
className={cn(
"bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",
- className
+ className,
)}
{...props}
>
-
+
- )
+ );
}
export {
@@ -198,4 +199,4 @@ export {
SelectSeparator,
SelectTrigger,
SelectValue,
-}
+};
diff --git a/react_frontend/src/components/ui/separator.tsx b/react_frontend/src/components/ui/separator.tsx
index 4f65961..32b4af2 100644
--- a/react_frontend/src/components/ui/separator.tsx
+++ b/react_frontend/src/components/ui/separator.tsx
@@ -1,6 +1,6 @@
-import { Separator as SeparatorPrimitive } from "@base-ui/react/separator"
+import { Separator as SeparatorPrimitive } from "@base-ui/react/separator";
-import { cn } from "@/lib/utils"
+import { cn } from "@/lib/utils";
function Separator({
className,
@@ -13,11 +13,11 @@ function Separator({
orientation={orientation}
className={cn(
"shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",
- className
+ className,
)}
{...props}
/>
- )
+ );
}
-export { Separator }
+export { Separator };
diff --git a/react_frontend/src/components/ui/sheet.tsx b/react_frontend/src/components/ui/sheet.tsx
index 13281f5..de9452e 100644
--- a/react_frontend/src/components/ui/sheet.tsx
+++ b/react_frontend/src/components/ui/sheet.tsx
@@ -1,24 +1,24 @@
-import * as React from "react"
-import { Dialog as SheetPrimitive } from "@base-ui/react/dialog"
+import * as React from "react";
+import { Dialog as SheetPrimitive } from "@base-ui/react/dialog";
-import { cn } from "@/lib/utils"
-import { Button } from "@/components/ui/button"
-import { XIcon } from "lucide-react"
+import { cn } from "@/lib/utils";
+import { Button } from "@/components/ui/button";
+import { XIcon } from "lucide-react";
function Sheet({ ...props }: SheetPrimitive.Root.Props) {
- return
+ return ;
}
function SheetTrigger({ ...props }: SheetPrimitive.Trigger.Props) {
- return
+ return ;
}
function SheetClose({ ...props }: SheetPrimitive.Close.Props) {
- return
+ return ;
}
function SheetPortal({ ...props }: SheetPrimitive.Portal.Props) {
- return
+ return ;
}
function SheetOverlay({ className, ...props }: SheetPrimitive.Backdrop.Props) {
@@ -27,11 +27,11 @@ function SheetOverlay({ className, ...props }: SheetPrimitive.Backdrop.Props) {
data-slot="sheet-overlay"
className={cn(
"fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs",
- className
+ className,
)}
{...props}
/>
- )
+ );
}
function SheetContent({
@@ -41,8 +41,8 @@ function SheetContent({
showCloseButton = true,
...props
}: SheetPrimitive.Popup.Props & {
- side?: "top" | "right" | "bottom" | "left"
- showCloseButton?: boolean
+ side?: "top" | "right" | "bottom" | "left";
+ showCloseButton?: boolean;
}) {
return (
@@ -52,7 +52,7 @@ function SheetContent({
data-side={side}
className={cn(
"fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",
- className
+ className,
)}
{...props}
>
@@ -68,14 +68,13 @@ function SheetContent({
/>
}
>
-
+
Close
)}
- )
+ );
}
function SheetHeader({ className, ...props }: React.ComponentProps<"div">) {
@@ -85,7 +84,7 @@ function SheetHeader({ className, ...props }: React.ComponentProps<"div">) {
className={cn("flex flex-col gap-0.5 p-4", className)}
{...props}
/>
- )
+ );
}
function SheetFooter({ className, ...props }: React.ComponentProps<"div">) {
@@ -95,7 +94,7 @@ function SheetFooter({ className, ...props }: React.ComponentProps<"div">) {
className={cn("mt-auto flex flex-col gap-2 p-4", className)}
{...props}
/>
- )
+ );
}
function SheetTitle({ className, ...props }: SheetPrimitive.Title.Props) {
@@ -104,11 +103,11 @@ function SheetTitle({ className, ...props }: SheetPrimitive.Title.Props) {
data-slot="sheet-title"
className={cn(
"font-heading text-base font-medium text-foreground",
- className
+ className,
)}
{...props}
/>
- )
+ );
}
function SheetDescription({
@@ -121,7 +120,7 @@ function SheetDescription({
className={cn("text-sm text-muted-foreground", className)}
{...props}
/>
- )
+ );
}
export {
@@ -133,4 +132,4 @@ export {
SheetFooter,
SheetTitle,
SheetDescription,
-}
+};
diff --git a/react_frontend/src/components/ui/skeleton.tsx b/react_frontend/src/components/ui/skeleton.tsx
index 0118624..26bc059 100644
--- a/react_frontend/src/components/ui/skeleton.tsx
+++ b/react_frontend/src/components/ui/skeleton.tsx
@@ -1,4 +1,4 @@
-import { cn } from "@/lib/utils"
+import { cn } from "@/lib/utils";
function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
return (
@@ -7,7 +7,7 @@ function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
className={cn("animate-pulse rounded-md bg-muted", className)}
{...props}
/>
- )
+ );
}
-export { Skeleton }
+export { Skeleton };
diff --git a/react_frontend/src/components/ui/sonner.tsx b/react_frontend/src/components/ui/sonner.tsx
index 158aa1e..c2f34fd 100644
--- a/react_frontend/src/components/ui/sonner.tsx
+++ b/react_frontend/src/components/ui/sonner.tsx
@@ -1,8 +1,8 @@
-import { Toaster as Sonner, type ToasterProps } from "sonner"
-import { useThemeStore } from "@/stores/useThemeStore"
+import { Toaster as Sonner, type ToasterProps } from "sonner";
+import { useThemeStore } from "@/stores/useThemeStore";
function Toaster({ ...props }: ToasterProps) {
- const theme = useThemeStore((s) => s.theme)
+ const theme = useThemeStore((s) => s.theme);
return (
- )
+ );
}
-export { Toaster }
+export { Toaster };
diff --git a/react_frontend/src/components/ui/star-rating.tsx b/react_frontend/src/components/ui/star-rating.tsx
index 3d7867b..3fdf912 100644
--- a/react_frontend/src/components/ui/star-rating.tsx
+++ b/react_frontend/src/components/ui/star-rating.tsx
@@ -1,25 +1,25 @@
-import { useState } from 'react';
-import { Star } from 'lucide-react';
+import { useState } from "react";
+import { Star } from "lucide-react";
interface StarRatingProps {
value: number;
onChange?: (rating: number) => void;
max?: number;
- size?: 'sm' | 'md' | 'lg';
+ size?: "sm" | "md" | "lg";
readOnly?: boolean;
}
const sizeMap = {
- sm: 'h-4 w-4',
- md: 'h-6 w-6',
- lg: 'h-8 w-8',
+ sm: "h-4 w-4",
+ md: "h-6 w-6",
+ lg: "h-8 w-8",
};
export function StarRating({
value,
onChange,
max = 10,
- size = 'lg',
+ size = "lg",
readOnly = false,
}: StarRatingProps) {
const [hovered, setHovered] = useState(null);
@@ -39,7 +39,9 @@ export function StarRating({
className="absolute inset-y-0 left-0 w-1/2 z-10 focus:outline-none"
onMouseEnter={() => setHovered(halfValue)}
onMouseLeave={() => setHovered(null)}
- onClick={() => onChange?.(halfValue === value ? 0 : halfValue)}
+ onClick={() =>
+ onChange?.(halfValue === value ? 0 : halfValue)
+ }
/>
{displayRating >= star ? (
-
+
) : displayRating >= halfValue ? (
) : (
-
+
)}
diff --git a/react_frontend/src/components/ui/switch.tsx b/react_frontend/src/components/ui/switch.tsx
index 9498efe..d0b82e2 100644
--- a/react_frontend/src/components/ui/switch.tsx
+++ b/react_frontend/src/components/ui/switch.tsx
@@ -1,13 +1,13 @@
-import { Switch as SwitchPrimitive } from "@base-ui/react/switch"
+import { Switch as SwitchPrimitive } from "@base-ui/react/switch";
-import { cn } from "@/lib/utils"
+import { cn } from "@/lib/utils";
function Switch({
className,
size = "default",
...props
}: SwitchPrimitive.Root.Props & {
- size?: "sm" | "default"
+ size?: "sm" | "default";
}) {
return (
@@ -24,7 +24,7 @@ function Switch({
className="pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"
/>
- )
+ );
}
-export { Switch }
+export { Switch };
diff --git a/react_frontend/src/components/ui/tabs.tsx b/react_frontend/src/components/ui/tabs.tsx
index 56c4288..ff8532e 100644
--- a/react_frontend/src/components/ui/tabs.tsx
+++ b/react_frontend/src/components/ui/tabs.tsx
@@ -1,9 +1,9 @@
-"use client"
+"use client";
-import { Tabs as TabsPrimitive } from "@base-ui/react/tabs"
-import { cva, type VariantProps } from "class-variance-authority"
+import { Tabs as TabsPrimitive } from "@base-ui/react/tabs";
+import { cva, type VariantProps } from "class-variance-authority";
-import { cn } from "@/lib/utils"
+import { cn } from "@/lib/utils";
function Tabs({
className,
@@ -16,11 +16,11 @@ function Tabs({
data-orientation={orientation}
className={cn(
"group/tabs flex gap-2 data-horizontal:flex-col",
- className
+ className,
)}
{...props}
/>
- )
+ );
}
const tabsListVariants = cva(
@@ -35,8 +35,8 @@ const tabsListVariants = cva(
defaultVariants: {
variant: "default",
},
- }
-)
+ },
+);
function TabsList({
className,
@@ -50,7 +50,7 @@ function TabsList({
className={cn(tabsListVariants({ variant }), className)}
{...props}
/>
- )
+ );
}
function TabsTrigger({ className, ...props }: TabsPrimitive.Tab.Props) {
@@ -62,11 +62,11 @@ function TabsTrigger({ className, ...props }: TabsPrimitive.Tab.Props) {
"group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent",
"data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground",
"after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",
- className
+ className,
)}
{...props}
/>
- )
+ );
}
function TabsContent({ className, ...props }: TabsPrimitive.Panel.Props) {
@@ -76,7 +76,7 @@ function TabsContent({ className, ...props }: TabsPrimitive.Panel.Props) {
className={cn("flex-1 text-sm outline-none", className)}
{...props}
/>
- )
+ );
}
-export { Tabs, TabsList, TabsTrigger, TabsContent, tabsListVariants }
+export { Tabs, TabsList, TabsTrigger, TabsContent, tabsListVariants };
diff --git a/react_frontend/src/components/ui/textarea.tsx b/react_frontend/src/components/ui/textarea.tsx
index 04d27f7..d102c70 100644
--- a/react_frontend/src/components/ui/textarea.tsx
+++ b/react_frontend/src/components/ui/textarea.tsx
@@ -1,6 +1,6 @@
-import * as React from "react"
+import * as React from "react";
-import { cn } from "@/lib/utils"
+import { cn } from "@/lib/utils";
function Textarea({ className, ...props }: React.ComponentProps<"textarea">) {
return (
@@ -8,11 +8,11 @@ function Textarea({ className, ...props }: React.ComponentProps<"textarea">) {
data-slot="textarea"
className={cn(
"flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
- className
+ className,
)}
{...props}
/>
- )
+ );
}
-export { Textarea }
+export { Textarea };
diff --git a/react_frontend/src/hooks/useCollections.ts b/react_frontend/src/hooks/useCollections.ts
index cb22eeb..189be2b 100644
--- a/react_frontend/src/hooks/useCollections.ts
+++ b/react_frontend/src/hooks/useCollections.ts
@@ -1,10 +1,10 @@
-import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
-import { toast } from 'sonner';
-import { collectionsApi } from '@/api/collections';
+import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
+import { toast } from "sonner";
+import { collectionsApi } from "@/api/collections";
export const collectionKeys = {
- all: ['collections'] as const,
- detail: (id: number) => ['collections', id] as const,
+ all: ["collections"] as const,
+ detail: (id: number) => ["collections", id] as const,
};
export function useCollections() {
@@ -29,12 +29,14 @@ export function useUpdateCollection() {
mutationFn: ({ id, data }: { id: number; data: FormData }) =>
collectionsApi.updateWithMedia(id, data),
onSuccess: (_data, variables) => {
- queryClient.invalidateQueries({ queryKey: collectionKeys.detail(variables.id) });
+ queryClient.invalidateQueries({
+ queryKey: collectionKeys.detail(variables.id),
+ });
queryClient.invalidateQueries({ queryKey: collectionKeys.all });
- toast.success('Collection updated');
+ toast.success("Collection updated");
},
onError: () => {
- toast.error('Failed to update collection');
+ toast.error("Failed to update collection");
},
});
}
@@ -46,10 +48,10 @@ export function useDeleteCollection() {
mutationFn: (id: number) => collectionsApi.delete(id),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: collectionKeys.all });
- toast.success('Collection deleted');
+ toast.success("Collection deleted");
},
onError: () => {
- toast.error('Failed to delete collection');
+ toast.error("Failed to delete collection");
},
});
}
@@ -62,10 +64,10 @@ export function useGetCollectionParts() {
onSuccess: (_data, id) => {
queryClient.invalidateQueries({ queryKey: collectionKeys.detail(id) });
queryClient.invalidateQueries({ queryKey: collectionKeys.all });
- toast.success('Collection parts fetched');
+ toast.success("Collection parts fetched");
},
onError: () => {
- toast.error('Failed to fetch collection parts');
+ toast.error("Failed to fetch collection parts");
},
});
}
@@ -74,15 +76,22 @@ export function useRemoveEntryFromCollection() {
const queryClient = useQueryClient();
return useMutation({
- mutationFn: ({ collectionId, entryId }: { collectionId: number; entryId: number }) =>
- collectionsApi.removeEntry(collectionId, entryId),
+ mutationFn: ({
+ collectionId,
+ entryId,
+ }: {
+ collectionId: number;
+ entryId: number;
+ }) => collectionsApi.removeEntry(collectionId, entryId),
onSuccess: (_data, { collectionId }) => {
- queryClient.invalidateQueries({ queryKey: collectionKeys.detail(collectionId) });
+ queryClient.invalidateQueries({
+ queryKey: collectionKeys.detail(collectionId),
+ });
queryClient.invalidateQueries({ queryKey: collectionKeys.all });
- toast.success('Entry removed from collection');
+ toast.success("Entry removed from collection");
},
onError: () => {
- toast.error('Failed to remove entry from collection');
+ toast.error("Failed to remove entry from collection");
},
});
}
diff --git a/react_frontend/src/hooks/useDebounce.ts b/react_frontend/src/hooks/useDebounce.ts
index 680704e..e3ab66c 100644
--- a/react_frontend/src/hooks/useDebounce.ts
+++ b/react_frontend/src/hooks/useDebounce.ts
@@ -1,4 +1,4 @@
-import { useState, useEffect } from 'react';
+import { useState, useEffect } from "react";
export function useDebounce(value: T, delay = 300): T {
const [debouncedValue, setDebouncedValue] = useState(value);
diff --git a/react_frontend/src/hooks/useEntrySeen.ts b/react_frontend/src/hooks/useEntrySeen.ts
index 6666fee..4618ae5 100644
--- a/react_frontend/src/hooks/useEntrySeen.ts
+++ b/react_frontend/src/hooks/useEntrySeen.ts
@@ -1,11 +1,11 @@
-import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
-import { toast } from 'sonner';
-import { entrySeenApi } from '@/api/entry-seen';
-import { entryKeys } from './useEntries';
+import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
+import { toast } from "sonner";
+import { entrySeenApi } from "@/api/entry-seen";
+import { entryKeys } from "./useEntries";
export const entrySeenKeys = {
- all: ['entry-seen'] as const,
- byEntry: (entryId: number) => ['entry-seen', 'by-entry', entryId] as const,
+ all: ["entry-seen"] as const,
+ byEntry: (entryId: number) => ["entry-seen", "by-entry", entryId] as const,
};
export function useEntrySeenByEntry(entryId: number) {
@@ -34,10 +34,10 @@ export function useCreateEntrySeen() {
queryKey: entryKeys.detail(variables.entry_id),
});
queryClient.invalidateQueries({ queryKey: entryKeys.all });
- toast.success('Marked as watched');
+ toast.success("Marked as watched");
},
onError: () => {
- toast.error('Failed to mark as watched');
+ toast.error("Failed to mark as watched");
},
});
}
@@ -51,16 +51,21 @@ export function useUpdateEntrySeen() {
data,
}: {
id: number;
- data: { entry_id: number; date_seen?: string; seen_with?: string; accuracy?: 'EXACT' | 'ESTIMATED' | 'UNKNOWN' };
+ data: {
+ entry_id: number;
+ date_seen?: string;
+ seen_with?: string;
+ accuracy?: "EXACT" | "ESTIMATED" | "UNKNOWN";
+ };
}) => entrySeenApi.update(id, data),
onSuccess: (_data, variables) => {
queryClient.invalidateQueries({
queryKey: entrySeenKeys.byEntry(variables.data.entry_id),
});
- toast.success('Watch record updated');
+ toast.success("Watch record updated");
},
onError: () => {
- toast.error('Failed to update watch record');
+ toast.error("Failed to update watch record");
},
});
}
@@ -76,10 +81,10 @@ export function useDeleteEntrySeen() {
queryKey: entrySeenKeys.byEntry(variables.entryId),
});
queryClient.invalidateQueries({ queryKey: entryKeys.all });
- toast.success('Watch record removed');
+ toast.success("Watch record removed");
},
onError: () => {
- toast.error('Failed to remove watch record');
+ toast.error("Failed to remove watch record");
},
});
}
diff --git a/react_frontend/src/hooks/useEpisodeSeen.ts b/react_frontend/src/hooks/useEpisodeSeen.ts
index 381cf5d..dad5da3 100644
--- a/react_frontend/src/hooks/useEpisodeSeen.ts
+++ b/react_frontend/src/hooks/useEpisodeSeen.ts
@@ -1,13 +1,13 @@
-import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
-import { toast } from 'sonner';
-import { episodeSeenApi } from '@/api/episode-seen';
-import { entryKeys } from './useEntries';
-import { seasonKeys } from './useSeasons';
+import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
+import { toast } from "sonner";
+import { episodeSeenApi } from "@/api/episode-seen";
+import { entryKeys } from "./useEntries";
+import { seasonKeys } from "./useSeasons";
export const episodeSeenKeys = {
- all: ['episode-seen'] as const,
+ all: ["episode-seen"] as const,
byEpisode: (episodeId: number) =>
- ['episode-seen', 'by-episode', episodeId] as const,
+ ["episode-seen", "by-episode", episodeId] as const,
};
export function useEpisodeSeenByEpisode(episodeId: number) {
@@ -45,10 +45,10 @@ export function useCreateEpisodeSeen() {
queryKey: seasonKeys.episodes(variables.season_id),
});
}
- toast.success('Episode marked as watched');
+ toast.success("Episode marked as watched");
},
onError: () => {
- toast.error('Failed to mark episode as watched');
+ toast.error("Failed to mark episode as watched");
},
});
}
@@ -62,7 +62,13 @@ export function useUpdateEpisodeSeen() {
data,
}: {
id: number;
- data: { episode_id: number; entry_id: number; date_seen?: string; seen_with?: string | null; accuracy?: 'EXACT' | 'ESTIMATED' | 'UNKNOWN' };
+ data: {
+ episode_id: number;
+ entry_id: number;
+ date_seen?: string;
+ seen_with?: string | null;
+ accuracy?: "EXACT" | "ESTIMATED" | "UNKNOWN";
+ };
}) => episodeSeenApi.update(id, data),
onSuccess: (_data, variables) => {
queryClient.invalidateQueries({
@@ -71,10 +77,10 @@ export function useUpdateEpisodeSeen() {
queryClient.invalidateQueries({
queryKey: entryKeys.detail(variables.data.entry_id),
});
- toast.success('Episode watch record updated');
+ toast.success("Episode watch record updated");
},
onError: () => {
- toast.error('Failed to update episode watch record');
+ toast.error("Failed to update episode watch record");
},
});
}
@@ -108,10 +114,10 @@ export function useDeleteEpisodeSeen() {
queryKey: seasonKeys.episodes(variables.seasonId),
});
}
- toast.success('Episode watch record removed');
+ toast.success("Episode watch record removed");
},
onError: () => {
- toast.error('Failed to remove episode watch record');
+ toast.error("Failed to remove episode watch record");
},
});
}
diff --git a/react_frontend/src/hooks/useEpisodes.ts b/react_frontend/src/hooks/useEpisodes.ts
index 3186043..9e17d93 100644
--- a/react_frontend/src/hooks/useEpisodes.ts
+++ b/react_frontend/src/hooks/useEpisodes.ts
@@ -1,9 +1,9 @@
-import { useQuery } from '@tanstack/react-query';
-import { episodesApi } from '@/api/episodes';
+import { useQuery } from "@tanstack/react-query";
+import { episodesApi } from "@/api/episodes";
export const episodeKeys = {
byMonth: (start: string, end: string) =>
- ['episodes', 'month', start, end] as const,
+ ["episodes", "month", start, end] as const,
};
export function useEpisodesByMonth(startDate: string, endDate: string) {
diff --git a/react_frontend/src/hooks/usePeople.ts b/react_frontend/src/hooks/usePeople.ts
index f88bf59..403c729 100644
--- a/react_frontend/src/hooks/usePeople.ts
+++ b/react_frontend/src/hooks/usePeople.ts
@@ -1,13 +1,18 @@
-import { useQuery, useMutation, useQueryClient, useInfiniteQuery } from '@tanstack/react-query';
-import { toast } from 'sonner';
-import { peopleApi } from '@/api/people';
+import {
+ useQuery,
+ useMutation,
+ useQueryClient,
+ useInfiniteQuery,
+} from "@tanstack/react-query";
+import { toast } from "sonner";
+import { peopleApi } from "@/api/people";
export const peopleKeys = {
- all: ['people'] as const,
- detail: (id: number) => ['people', id] as const,
- credits: (id: number) => ['people', id, 'credits'] as const,
- tmdbFilmography: (id: number) => ['people', id, 'tmdb-filmography'] as const,
- tmdbPreview: (tmdbId: number) => ['people', 'tmdb-preview', tmdbId] as const,
+ all: ["people"] as const,
+ detail: (id: number) => ["people", id] as const,
+ credits: (id: number) => ["people", id, "credits"] as const,
+ tmdbFilmography: (id: number) => ["people", id, "tmdb-filmography"] as const,
+ tmdbPreview: (tmdbId: number) => ["people", "tmdb-preview", tmdbId] as const,
};
export function usePerson(id: number) {
@@ -54,22 +59,30 @@ export function useUpdatePerson() {
const queryClient = useQueryClient();
return useMutation({
- mutationFn: ({ id, data }: { id: number; data: Partial }) =>
- peopleApi.update(id, data),
+ mutationFn: ({
+ id,
+ data,
+ }: {
+ id: number;
+ data: Partial;
+ }) => peopleApi.update(id, data),
onSuccess: (updatedPerson) => {
- queryClient.invalidateQueries({ queryKey: peopleKeys.detail(updatedPerson.id) });
- toast.success('Person updated');
+ queryClient.invalidateQueries({
+ queryKey: peopleKeys.detail(updatedPerson.id),
+ });
+ toast.success("Person updated");
},
onError: () => {
- toast.error('Failed to update person');
+ toast.error("Failed to update person");
},
});
}
export function useSearchLocalPeople(query: string) {
return useQuery({
- queryKey: ['people', 'search', query],
- queryFn: () => query === '*' ? peopleApi.getAll() : peopleApi.search(query),
+ queryKey: ["people", "search", query],
+ queryFn: () =>
+ query === "*" ? peopleApi.getAll() : peopleApi.search(query),
enabled: query.length > 0,
});
}
@@ -78,9 +91,13 @@ const LOCAL_PEOPLE_PAGE_SIZE = 48;
export function useLocalPeopleInfinite(search: string, enabled: boolean) {
return useInfiniteQuery({
- queryKey: ['people', 'paginated', search],
+ queryKey: ["people", "paginated", search],
queryFn: ({ pageParam = 1 }) =>
- peopleApi.getAllPaginated(pageParam, LOCAL_PEOPLE_PAGE_SIZE, search || undefined),
+ peopleApi.getAllPaginated(
+ pageParam,
+ LOCAL_PEOPLE_PAGE_SIZE,
+ search || undefined,
+ ),
getNextPageParam: (lastPage) =>
lastPage.page < lastPage.totalPages ? lastPage.page + 1 : undefined,
initialPageParam: 1,
diff --git a/react_frontend/src/hooks/useSeasons.ts b/react_frontend/src/hooks/useSeasons.ts
index 9b3987f..1dceb2a 100644
--- a/react_frontend/src/hooks/useSeasons.ts
+++ b/react_frontend/src/hooks/useSeasons.ts
@@ -1,10 +1,10 @@
-import { useQuery } from '@tanstack/react-query';
-import { seasonsApi } from '@/api/seasons';
+import { useQuery } from "@tanstack/react-query";
+import { seasonsApi } from "@/api/seasons";
export const seasonKeys = {
- all: ['seasons'] as const,
- detail: (id: number) => ['seasons', id] as const,
- episodes: (id: number) => ['seasons', id, 'episodes'] as const,
+ all: ["seasons"] as const,
+ detail: (id: number) => ["seasons", id] as const,
+ episodes: (id: number) => ["seasons", id, "episodes"] as const,
};
export function useSeason(id: number) {
diff --git a/react_frontend/src/hooks/useStatistics.ts b/react_frontend/src/hooks/useStatistics.ts
index 511842e..ca201ee 100644
--- a/react_frontend/src/hooks/useStatistics.ts
+++ b/react_frontend/src/hooks/useStatistics.ts
@@ -1,30 +1,30 @@
-import { useQuery } from '@tanstack/react-query';
-import { statisticsApi } from '@/api/statistics';
+import { useQuery } from "@tanstack/react-query";
+import { statisticsApi } from "@/api/statistics";
export function useStatistics() {
return useQuery({
- queryKey: ['statistics', 'watch-time-all'],
+ queryKey: ["statistics", "watch-time-all"],
queryFn: statisticsApi.getAllTimeWatchTime,
});
}
export function useYearlyWatchCount(year: number) {
return useQuery({
- queryKey: ['statistics', 'watch-count', year],
+ queryKey: ["statistics", "watch-count", year],
queryFn: () => statisticsApi.getYearlyWatchCount(year),
});
}
export function useYearlyWatchTime(year: number) {
return useQuery({
- queryKey: ['statistics', 'watch-time', year],
+ queryKey: ["statistics", "watch-time", year],
queryFn: () => statisticsApi.getYearlyWatchTime(year),
});
}
export function useWatchdayDistribution() {
return useQuery({
- queryKey: ['statistics', 'watch-weekday'],
+ queryKey: ["statistics", "watch-weekday"],
queryFn: statisticsApi.getWatchdayDistribution,
});
}
diff --git a/react_frontend/src/hooks/useTmdb.ts b/react_frontend/src/hooks/useTmdb.ts
index ebb4019..6043fc1 100644
--- a/react_frontend/src/hooks/useTmdb.ts
+++ b/react_frontend/src/hooks/useTmdb.ts
@@ -1,9 +1,9 @@
-import { useInfiniteQuery } from '@tanstack/react-query';
-import { tmdbApi } from '@/api/tmdb';
+import { useInfiniteQuery } from "@tanstack/react-query";
+import { tmdbApi } from "@/api/tmdb";
export function usePopularMovies() {
return useInfiniteQuery({
- queryKey: ['tmdb', 'popular', 'movie'],
+ queryKey: ["tmdb", "popular", "movie"],
queryFn: ({ pageParam }) => tmdbApi.getPopularMovies(pageParam),
initialPageParam: 1,
getNextPageParam: (lastPage) =>
@@ -13,7 +13,7 @@ export function usePopularMovies() {
export function usePopularTv() {
return useInfiniteQuery({
- queryKey: ['tmdb', 'popular', 'tv'],
+ queryKey: ["tmdb", "popular", "tv"],
queryFn: ({ pageParam }) => tmdbApi.getPopularTv(pageParam),
initialPageParam: 1,
getNextPageParam: (lastPage) =>
@@ -23,7 +23,7 @@ export function usePopularTv() {
export function useTrendingMovies() {
return useInfiniteQuery({
- queryKey: ['tmdb', 'trending', 'movie'],
+ queryKey: ["tmdb", "trending", "movie"],
queryFn: ({ pageParam }) => tmdbApi.getTrendingMovies(pageParam),
initialPageParam: 1,
getNextPageParam: (lastPage) =>
@@ -33,7 +33,7 @@ export function useTrendingMovies() {
export function useTrendingTv() {
return useInfiniteQuery({
- queryKey: ['tmdb', 'trending', 'tv'],
+ queryKey: ["tmdb", "trending", "tv"],
queryFn: ({ pageParam }) => tmdbApi.getTrendingTv(pageParam),
initialPageParam: 1,
getNextPageParam: (lastPage) =>
@@ -43,7 +43,7 @@ export function useTrendingTv() {
export function useTopRatedMovies() {
return useInfiniteQuery({
- queryKey: ['tmdb', 'top-rated', 'movie'],
+ queryKey: ["tmdb", "top-rated", "movie"],
queryFn: ({ pageParam }) => tmdbApi.getTopRatedMovies(pageParam),
initialPageParam: 1,
getNextPageParam: (lastPage) =>
@@ -53,7 +53,7 @@ export function useTopRatedMovies() {
export function useTopRatedTv() {
return useInfiniteQuery({
- queryKey: ['tmdb', 'top-rated', 'tv'],
+ queryKey: ["tmdb", "top-rated", "tv"],
queryFn: ({ pageParam }) => tmdbApi.getTopRatedTv(pageParam),
initialPageParam: 1,
getNextPageParam: (lastPage) =>
@@ -63,7 +63,7 @@ export function useTopRatedTv() {
export function useUpcomingMovies() {
return useInfiniteQuery({
- queryKey: ['tmdb', 'upcoming', 'movie'],
+ queryKey: ["tmdb", "upcoming", "movie"],
queryFn: ({ pageParam }) => tmdbApi.getUpcomingMovies(pageParam),
initialPageParam: 1,
getNextPageParam: (lastPage) =>
@@ -73,7 +73,7 @@ export function useUpcomingMovies() {
export function useTmdbSearch(query: string) {
return useInfiniteQuery({
- queryKey: ['tmdb', 'search', query],
+ queryKey: ["tmdb", "search", query],
queryFn: ({ pageParam }) => tmdbApi.search(query, pageParam),
initialPageParam: 1,
getNextPageParam: (lastPage) =>
@@ -84,7 +84,7 @@ export function useTmdbSearch(query: string) {
export function usePopularPeople() {
return useInfiniteQuery({
- queryKey: ['tmdb', 'popular', 'people'],
+ queryKey: ["tmdb", "popular", "people"],
queryFn: ({ pageParam }) => tmdbApi.getPopularPeople(pageParam),
initialPageParam: 1,
getNextPageParam: (lastPage) =>
@@ -94,7 +94,7 @@ export function usePopularPeople() {
export function useTmdbSearchPeople(query: string) {
return useInfiniteQuery({
- queryKey: ['tmdb', 'search', 'people', query],
+ queryKey: ["tmdb", "search", "people", query],
queryFn: ({ pageParam }) => tmdbApi.searchPeople(query, pageParam),
initialPageParam: 1,
getNextPageParam: (lastPage) =>
diff --git a/react_frontend/src/hooks/useTmdbEntryLink.ts b/react_frontend/src/hooks/useTmdbEntryLink.ts
index 01163f1..fe497dd 100644
--- a/react_frontend/src/hooks/useTmdbEntryLink.ts
+++ b/react_frontend/src/hooks/useTmdbEntryLink.ts
@@ -1,6 +1,6 @@
-import { useMemo } from 'react';
-import { useLibraryStore } from '@/stores/useLibraryStore';
-import type { TmdbEntry } from '@/types';
+import { useMemo } from "react";
+import { useLibraryStore } from "@/stores/useLibraryStore";
+import type { TmdbEntry } from "@/types";
interface TmdbEntryLink {
/** The resolved link — either /entry/:id if in library, or /entry/tmdb/:type/:id */
@@ -20,7 +20,7 @@ export function useTmdbEntryLink(entry: TmdbEntry): TmdbEntryLink {
const libraryEntries = useLibraryStore((s) => s.entries);
return useMemo(() => {
- const isTv = entry.media_type === 'tv' || !!entry.name;
+ const isTv = entry.media_type === "tv" || !!entry.name;
const libraryEntry = Array.from(libraryEntries.values()).find(
(e) => e.entryIds?.tmdb_id === entry.id,
);
@@ -34,7 +34,7 @@ export function useTmdbEntryLink(entry: TmdbEntry): TmdbEntryLink {
}
return {
- linkTo: `/entry/tmdb/${isTv ? 'tv' : 'movie'}/${entry.id}`,
+ linkTo: `/entry/tmdb/${isTv ? "tv" : "movie"}/${entry.id}`,
isInLibrary: false,
libraryEntryId: null,
};
diff --git a/react_frontend/src/lib/api.ts b/react_frontend/src/lib/api.ts
index d38279c..736e8ff 100644
--- a/react_frontend/src/lib/api.ts
+++ b/react_frontend/src/lib/api.ts
@@ -1,22 +1,23 @@
-import axios from 'axios';
+import axios from "axios";
-const API_BASE_URL = import.meta.env.VITE_ELECTRON === 'true'
- ? 'http://localhost:4000/api/v1'
- : (import.meta.env.VITE_API_URL || '/api/v1');
+const API_BASE_URL =
+ import.meta.env.VITE_ELECTRON === "true"
+ ? "http://localhost:4000/api/v1"
+ : import.meta.env.VITE_API_URL || "/api/v1";
export const api = axios.create({
baseURL: API_BASE_URL,
headers: {
- 'Content-Type': 'application/json',
+ "Content-Type": "application/json",
},
});
export const getMediaUrl = (
category: string,
type: string,
- size: 'preview' | 'full',
- file: string
+ size: "preview" | "full",
+ file: string,
) => `${API_BASE_URL}/media/${category}/${type}/${size}/${file}`;
-export const getTmdbImageUrl = (path: string, size = 'w342') =>
+export const getTmdbImageUrl = (path: string, size = "w342") =>
`https://image.tmdb.org/t/p/${size}${path}`;
diff --git a/react_frontend/src/lib/media-utils.ts b/react_frontend/src/lib/media-utils.ts
index 275e9fb..0cda7da 100644
--- a/react_frontend/src/lib/media-utils.ts
+++ b/react_frontend/src/lib/media-utils.ts
@@ -1,29 +1,29 @@
-import { getMediaUrl, getTmdbImageUrl } from '@/lib/api';
-import type { Entry, Collection, Media } from '@/types';
+import { getMediaUrl, getTmdbImageUrl } from "@/lib/api";
+import type { Entry, Collection, Media } from "@/types";
-const DEFAULT_POSTER = '/images/default-poster.png';
+const DEFAULT_POSTER = "/images/default-poster.png";
export function getPosterUrl(entry: Entry): string {
// Not in library, use TMDB poster
if (!entry.isInLibrary) {
return entry.poster_path
- ? getTmdbImageUrl(entry.poster_path, 'w342')
+ ? getTmdbImageUrl(entry.poster_path, "w342")
: DEFAULT_POSTER;
}
// In library: try local selected poster
if (entry.medias) {
const selectedPoster = entry.medias.find(
- (m: Media) => m.type === 'poster' && m.is_selected
+ (m: Media) => m.type === "poster" && m.is_selected,
);
if (selectedPoster?.path) {
- return getMediaUrl('entries', 'posters', 'preview', selectedPoster.path);
+ return getMediaUrl("entries", "posters", "preview", selectedPoster.path);
}
}
// Fallback to TMDB poster
if (entry.poster_path) {
- return getTmdbImageUrl(entry.poster_path, 'w300');
+ return getTmdbImageUrl(entry.poster_path, "w300");
}
return DEFAULT_POSTER;
@@ -32,28 +32,23 @@ export function getPosterUrl(entry: Entry): string {
export function getBackdropUrl(entry: Entry): string {
if (entry.medias) {
const selectedBackdrop = entry.medias.find(
- (m: Media) => m.type === 'backdrop' && m.is_selected
+ (m: Media) => m.type === "backdrop" && m.is_selected,
);
if (selectedBackdrop?.path) {
- return getMediaUrl(
- 'entries',
- 'backdrops',
- 'full',
- selectedBackdrop.path
- );
+ return getMediaUrl("entries", "backdrops", "full", selectedBackdrop.path);
}
}
if (entry.banner_path) {
- return getTmdbImageUrl(entry.banner_path, 'w1280');
+ return getTmdbImageUrl(entry.banner_path, "w1280");
}
- return '';
+ return "";
}
export function getTmdbPosterUrl(
posterPath: string | null,
- size = 'w342'
+ size = "w342",
): string {
if (!posterPath) return DEFAULT_POSTER;
return getTmdbImageUrl(posterPath, size);
@@ -62,14 +57,19 @@ export function getTmdbPosterUrl(
export function getCollectionBackdropUrl(collection: Collection): string {
if (collection.medias) {
const selectedBackdrop = collection.medias.find(
- (m: Media) => m.type === 'backdrop' && m.is_selected
+ (m: Media) => m.type === "backdrop" && m.is_selected,
);
if (selectedBackdrop?.path) {
- return getMediaUrl('collections', 'backdrops', 'full', selectedBackdrop.path);
+ return getMediaUrl(
+ "collections",
+ "backdrops",
+ "full",
+ selectedBackdrop.path,
+ );
}
}
if (collection.backdrop_path) {
- return getTmdbImageUrl(collection.backdrop_path, 'w780');
+ return getTmdbImageUrl(collection.backdrop_path, "w780");
}
return getCollectionPosterUrl(collection);
}
@@ -77,42 +77,47 @@ export function getCollectionBackdropUrl(collection: Collection): string {
export function getCollectionPosterUrl(collection: Collection): string {
if (collection.medias) {
const selectedPoster = collection.medias.find(
- (m: Media) => m.type === 'poster' && m.is_selected
+ (m: Media) => m.type === "poster" && m.is_selected,
);
if (selectedPoster?.path) {
- return getMediaUrl('collections', 'posters', 'preview', selectedPoster.path);
+ return getMediaUrl(
+ "collections",
+ "posters",
+ "preview",
+ selectedPoster.path,
+ );
}
}
if (collection.poster_path) {
- return getTmdbImageUrl(collection.poster_path, 'w342');
+ return getTmdbImageUrl(collection.poster_path, "w342");
}
return DEFAULT_POSTER;
}
export function getProfileUrl(profilePath: string | null): string {
- if (!profilePath) return '/images/default-profile.png';
- return getTmdbImageUrl(profilePath, 'w185');
+ if (!profilePath) return "/images/default-profile.png";
+ return getTmdbImageUrl(profilePath, "w185");
}
export function formatRuntime(minutes: number | null): string {
- if (!minutes) return '';
+ if (!minutes) return "";
const h = Math.floor(minutes / 60);
const m = minutes % 60;
return h > 0 ? `${h}h ${m}m` : `${m}m`;
}
export function formatDate(dateStr: string | null): string {
- if (!dateStr) return '';
- return new Date(dateStr).toLocaleDateString('en-US', {
- year: 'numeric',
- month: 'short',
- day: 'numeric',
+ if (!dateStr) return "";
+ return new Date(dateStr).toLocaleDateString("en-US", {
+ year: "numeric",
+ month: "short",
+ day: "numeric",
});
}
export function getYear(dateStr: string | null): string {
- if (!dateStr) return '';
+ if (!dateStr) return "";
return new Date(dateStr).getFullYear().toString();
}
diff --git a/react_frontend/src/lib/streaming/index.ts b/react_frontend/src/lib/streaming/index.ts
index 70d9a1e..d9f749b 100644
--- a/react_frontend/src/lib/streaming/index.ts
+++ b/react_frontend/src/lib/streaming/index.ts
@@ -1,4 +1,15 @@
-export type { StreamingProvider, StreamingServer, StreamRequest, StreamResponse, StreamError, PlayerEvent, WatchProgressData, AutoMarkWatchedConfig, StreamingState, MediaType } from './types';
+export type {
+ StreamingProvider,
+ StreamingServer,
+ StreamRequest,
+ StreamResponse,
+ StreamError,
+ PlayerEvent,
+ WatchProgressData,
+ AutoMarkWatchedConfig,
+ StreamingState,
+ MediaType,
+} from "./types";
export {
getAllServers,
getProviderForServer,
@@ -23,4 +34,4 @@ export {
isConsideredWatched,
isValidEmbedUrl,
isValidEventOrigin,
-} from './streaming-manager';
+} from "./streaming-manager";
diff --git a/react_frontend/src/lib/streaming/providers/anyembed.ts b/react_frontend/src/lib/streaming/providers/anyembed.ts
index fe1087f..63b9cc2 100644
--- a/react_frontend/src/lib/streaming/providers/anyembed.ts
+++ b/react_frontend/src/lib/streaming/providers/anyembed.ts
@@ -1,42 +1,46 @@
-import type { StreamingProvider, StreamingServer, StreamRequest } from '../types';
+import type {
+ StreamingProvider,
+ StreamingServer,
+ StreamRequest,
+} from "../types";
const ANYEMBED_SERVERS: StreamingServer[] = [
{
- id: 'anyembed-1',
- name: 'AnyEmbed (Server 1)',
- provider: 'anyembed',
+ id: "anyembed-1",
+ name: "AnyEmbed (Server 1)",
+ provider: "anyembed",
serverIndex: 1,
supportsEvents: false,
supportsProgress: false,
},
{
- id: 'anyembed-2',
- name: 'AnyEmbed (Server 2)',
- provider: 'anyembed',
+ id: "anyembed-2",
+ name: "AnyEmbed (Server 2)",
+ provider: "anyembed",
serverIndex: 2,
supportsEvents: false,
supportsProgress: false,
},
{
- id: 'anyembed-3',
- name: 'AnyEmbed (Server 3)',
- provider: 'anyembed',
+ id: "anyembed-3",
+ name: "AnyEmbed (Server 3)",
+ provider: "anyembed",
serverIndex: 3,
supportsEvents: false,
supportsProgress: false,
},
{
- id: 'anyembed-4',
- name: 'AnyEmbed (Server 4)',
- provider: 'anyembed',
+ id: "anyembed-4",
+ name: "AnyEmbed (Server 4)",
+ provider: "anyembed",
serverIndex: 4,
supportsEvents: false,
supportsProgress: false,
},
{
- id: 'anyembed-5',
- name: 'AnyEmbed (Server 5)',
- provider: 'anyembed',
+ id: "anyembed-5",
+ name: "AnyEmbed (Server 5)",
+ provider: "anyembed",
serverIndex: 5,
supportsEvents: false,
supportsProgress: false,
@@ -44,8 +48,8 @@ const ANYEMBED_SERVERS: StreamingServer[] = [
];
export const anyembedProvider: StreamingProvider = {
- id: 'anyembed',
- name: 'AnyEmbed',
+ id: "anyembed",
+ name: "AnyEmbed",
servers: ANYEMBED_SERVERS,
getStreamUrl(request: StreamRequest, server: StreamingServer): string {
@@ -53,7 +57,7 @@ export const anyembedProvider: StreamingProvider = {
const id = request.imdbId || String(request.tmdbId);
let basePath: string;
- if (request.type === 'movie') {
+ if (request.type === "movie") {
basePath = `/movie/${id}`;
} else {
basePath = `/tv/${id}/${request.season}/${request.episode}`;
@@ -61,18 +65,18 @@ export const anyembedProvider: StreamingProvider = {
const params = new URLSearchParams();
if (server.serverIndex) {
- params.set('server', String(server.serverIndex));
+ params.set("server", String(server.serverIndex));
}
const query = params.toString();
- return `https://anyembed.xyz${basePath}${query ? `?${query}` : ''}`;
+ return `https://anyembed.xyz${basePath}${query ? `?${query}` : ""}`;
},
getSandboxPolicy(): string {
- return 'allow-scripts allow-same-origin allow-forms allow-popups allow-presentation';
+ return "allow-scripts allow-same-origin allow-forms allow-popups allow-presentation";
},
getAllowedFeatures(): string {
- return 'autoplay; fullscreen; picture-in-picture; encrypted-media';
+ return "autoplay; fullscreen; picture-in-picture; encrypted-media";
},
};
diff --git a/react_frontend/src/lib/streaming/providers/index.ts b/react_frontend/src/lib/streaming/providers/index.ts
index 694d9f4..c192983 100644
--- a/react_frontend/src/lib/streaming/providers/index.ts
+++ b/react_frontend/src/lib/streaming/providers/index.ts
@@ -1,3 +1,3 @@
-export { vidlinkProvider } from './vidlink';
-export { vidkingProvider } from './vidking';
-export { anyembedProvider } from './anyembed';
+export { vidlinkProvider } from "./vidlink";
+export { vidkingProvider } from "./vidking";
+export { anyembedProvider } from "./anyembed";
diff --git a/react_frontend/src/lib/streaming/providers/vidking.ts b/react_frontend/src/lib/streaming/providers/vidking.ts
index c82188e..2c05b80 100644
--- a/react_frontend/src/lib/streaming/providers/vidking.ts
+++ b/react_frontend/src/lib/streaming/providers/vidking.ts
@@ -1,32 +1,36 @@
-import type { StreamingProvider, StreamingServer, StreamRequest } from '../types';
+import type {
+ StreamingProvider,
+ StreamingServer,
+ StreamRequest,
+} from "../types";
const VIDKING_SERVERS: StreamingServer[] = [
{
- id: 'vidking-default',
- name: 'VidKing',
- provider: 'vidking',
+ id: "vidking-default",
+ name: "VidKing",
+ provider: "vidking",
supportsEvents: true,
supportsProgress: true,
},
];
export const vidkingProvider: StreamingProvider = {
- id: 'vidking',
- name: 'VidKing',
+ id: "vidking",
+ name: "VidKing",
servers: VIDKING_SERVERS,
getStreamUrl(request: StreamRequest, _server: StreamingServer): string {
const params = new URLSearchParams();
- params.set('autoPlay', 'true');
- params.set('nextEpisode', 'true');
- params.set('episodeSelector', 'true');
+ params.set("autoPlay", "true");
+ params.set("nextEpisode", "true");
+ params.set("episodeSelector", "true");
if (request.startAt && request.startAt > 0) {
- params.set('progress', String(Math.floor(request.startAt)));
+ params.set("progress", String(Math.floor(request.startAt)));
}
let basePath: string;
- if (request.type === 'movie') {
+ if (request.type === "movie") {
basePath = `/embed/movie/${request.tmdbId}`;
} else {
basePath = `/embed/tv/${request.tmdbId}/${request.season}/${request.episode}`;
@@ -36,10 +40,10 @@ export const vidkingProvider: StreamingProvider = {
},
getSandboxPolicy(): string {
- return 'allow-scripts allow-same-origin allow-forms allow-popups allow-presentation';
+ return "allow-scripts allow-same-origin allow-forms allow-popups allow-presentation";
},
getAllowedFeatures(): string {
- return 'autoplay; fullscreen; picture-in-picture; encrypted-media';
+ return "autoplay; fullscreen; picture-in-picture; encrypted-media";
},
};
diff --git a/react_frontend/src/lib/streaming/providers/vidlink.ts b/react_frontend/src/lib/streaming/providers/vidlink.ts
index 2a5ab82..68e2910 100644
--- a/react_frontend/src/lib/streaming/providers/vidlink.ts
+++ b/react_frontend/src/lib/streaming/providers/vidlink.ts
@@ -1,17 +1,21 @@
-import type { StreamingProvider, StreamingServer, StreamRequest } from '../types';
+import type {
+ StreamingProvider,
+ StreamingServer,
+ StreamRequest,
+} from "../types";
const VIDLINK_SERVERS: StreamingServer[] = [
{
- id: 'vidlink-default',
- name: 'VidLink (Default)',
- provider: 'vidlink',
+ id: "vidlink-default",
+ name: "VidLink (Default)",
+ provider: "vidlink",
supportsEvents: true,
supportsProgress: true,
},
{
- id: 'vidlink-jw',
- name: 'VidLink (JW Player)',
- provider: 'vidlink',
+ id: "vidlink-jw",
+ name: "VidLink (JW Player)",
+ provider: "vidlink",
serverIndex: 2,
supportsEvents: true,
supportsProgress: true,
@@ -19,27 +23,27 @@ const VIDLINK_SERVERS: StreamingServer[] = [
];
export const vidlinkProvider: StreamingProvider = {
- id: 'vidlink',
- name: 'VidLink',
+ id: "vidlink",
+ name: "VidLink",
servers: VIDLINK_SERVERS,
getStreamUrl(request: StreamRequest, server: StreamingServer): string {
const params = new URLSearchParams();
- params.set('autoplay', 'true');
- params.set('title', 'false');
- params.set('poster', 'true');
- params.set('nextbutton', 'true');
+ params.set("autoplay", "true");
+ params.set("title", "false");
+ params.set("poster", "true");
+ params.set("nextbutton", "true");
if (server.serverIndex === 2) {
- params.set('player', 'jw');
+ params.set("player", "jw");
}
if (request.startAt && request.startAt > 0) {
- params.set('startAt', String(Math.floor(request.startAt)));
+ params.set("startAt", String(Math.floor(request.startAt)));
}
let basePath: string;
- if (request.type === 'movie') {
+ if (request.type === "movie") {
basePath = `/movie/${request.tmdbId}`;
} else {
basePath = `/tv/${request.tmdbId}/${request.season}/${request.episode}`;
@@ -49,10 +53,10 @@ export const vidlinkProvider: StreamingProvider = {
},
getSandboxPolicy(): string {
- return 'allow-scripts allow-same-origin allow-forms allow-popups allow-presentation';
+ return "allow-scripts allow-same-origin allow-forms allow-popups allow-presentation";
},
getAllowedFeatures(): string {
- return 'autoplay; fullscreen; picture-in-picture; encrypted-media';
+ return "autoplay; fullscreen; picture-in-picture; encrypted-media";
},
};
diff --git a/react_frontend/src/lib/streaming/streaming-manager.ts b/react_frontend/src/lib/streaming/streaming-manager.ts
index 5884d5f..768eed8 100644
--- a/react_frontend/src/lib/streaming/streaming-manager.ts
+++ b/react_frontend/src/lib/streaming/streaming-manager.ts
@@ -7,15 +7,19 @@ import type {
WatchProgressData,
AutoMarkWatchedConfig,
PlayerEvent,
-} from './types';
-import { vidlinkProvider, vidkingProvider, anyembedProvider } from './providers';
+} from "./types";
+import {
+ vidlinkProvider,
+ vidkingProvider,
+ anyembedProvider,
+} from "./providers";
const STORAGE_KEYS = {
- PREFERRED_SERVER: 'showy_preferred_server',
- WATCH_PROGRESS: 'showy_watch_progress',
- AUTO_MARK_WATCHED: 'showy_auto_mark_watched',
- AUTO_MARK_PROMPT_SHOWN: 'showy_auto_mark_prompt_shown',
- WATCH_LOGS: 'showy_watch_logs',
+ PREFERRED_SERVER: "showy_preferred_server",
+ WATCH_PROGRESS: "showy_watch_progress",
+ AUTO_MARK_WATCHED: "showy_auto_mark_watched",
+ AUTO_MARK_PROMPT_SHOWN: "showy_auto_mark_prompt_shown",
+ WATCH_LOGS: "showy_watch_logs",
} as const;
/** All registered streaming providers */
@@ -31,7 +35,9 @@ export function getAllServers(): StreamingServer[] {
}
/** Get a provider by server ID */
-export function getProviderForServer(serverId: string): StreamingProvider | undefined {
+export function getProviderForServer(
+ serverId: string,
+): StreamingProvider | undefined {
return providers.find((p) => p.servers.some((s) => s.id === serverId));
}
@@ -41,13 +47,16 @@ export function getServerById(serverId: string): StreamingServer | undefined {
}
/** Build a stream URL for the given request and server */
-export function getStreamUrl(request: StreamRequest, server: StreamingServer): StreamResponse | StreamError {
+export function getStreamUrl(
+ request: StreamRequest,
+ server: StreamingServer,
+): StreamResponse | StreamError {
const provider = getProviderForServer(server.id);
if (!provider) {
return {
server,
- message: 'Provider not found for this server',
- code: 'UNAVAILABLE',
+ message: "Provider not found for this server",
+ code: "UNAVAILABLE",
};
}
@@ -55,16 +64,16 @@ export function getStreamUrl(request: StreamRequest, server: StreamingServer): S
if (!request.tmdbId && !request.imdbId) {
return {
server,
- message: 'A valid TMDB or IMDB ID is required',
- code: 'INVALID_ID',
+ message: "A valid TMDB or IMDB ID is required",
+ code: "INVALID_ID",
};
}
- if (request.type === 'tv' && (!request.season || !request.episode)) {
+ if (request.type === "tv" && (!request.season || !request.episode)) {
return {
server,
- message: 'Season and episode numbers are required for TV shows',
- code: 'MISSING_EPISODE',
+ message: "Season and episode numbers are required for TV shows",
+ code: "MISSING_EPISODE",
};
}
@@ -74,27 +83,29 @@ export function getStreamUrl(request: StreamRequest, server: StreamingServer): S
} catch {
return {
server,
- message: 'Failed to build stream URL',
- code: 'UNKNOWN',
+ message: "Failed to build stream URL",
+ code: "UNKNOWN",
};
}
}
/** Check if a response is an error */
-export function isStreamError(result: StreamResponse | StreamError): result is StreamError {
- return 'code' in result;
+export function isStreamError(
+ result: StreamResponse | StreamError,
+): result is StreamError {
+ return "code" in result;
}
/** Get iframe sandbox policy for a server */
export function getServerSandboxPolicy(serverId: string): string {
const provider = getProviderForServer(serverId);
- return provider?.getSandboxPolicy() ?? 'allow-scripts allow-same-origin';
+ return provider?.getSandboxPolicy() ?? "allow-scripts allow-same-origin";
}
/** Get iframe allowed features for a server */
export function getServerAllowedFeatures(serverId: string): string {
const provider = getProviderForServer(serverId);
- return provider?.getAllowedFeatures() ?? 'autoplay; fullscreen';
+ return provider?.getAllowedFeatures() ?? "autoplay; fullscreen";
}
// --- Persistence ---
@@ -140,7 +151,9 @@ export function getWatchProgress(): Record {
}
/** Get watch progress for a specific entry */
-export function getEntryWatchProgress(tmdbId: number): WatchProgressData | null {
+export function getEntryWatchProgress(
+ tmdbId: number,
+): WatchProgressData | null {
const progress = getWatchProgress();
return progress[String(tmdbId)] || null;
}
@@ -165,7 +178,7 @@ function getEpisodeKey(season: number, episode: number): string {
export function updateProgressFromEvent(
event: PlayerEvent,
title: string,
- posterPath?: string
+ posterPath?: string,
): void {
const existing = getEntryWatchProgress(event.tmdbId);
@@ -180,7 +193,7 @@ export function updateProgressFromEvent(
...(existing?.showProgress ? { showProgress: existing.showProgress } : {}),
};
- if (event.mediaType === 'tv' && event.season && event.episode) {
+ if (event.mediaType === "tv" && event.season && event.episode) {
data.lastSeasonWatched = event.season;
data.lastEpisodeWatched = event.episode;
const key = getEpisodeKey(event.season, event.episode);
@@ -213,7 +226,10 @@ export function getAutoMarkWatchedConfig(): AutoMarkWatchedConfig {
/** Save auto-mark-watched config */
export function setAutoMarkWatchedConfig(config: AutoMarkWatchedConfig): void {
try {
- localStorage.setItem(STORAGE_KEYS.AUTO_MARK_WATCHED, JSON.stringify(config));
+ localStorage.setItem(
+ STORAGE_KEYS.AUTO_MARK_WATCHED,
+ JSON.stringify(config),
+ );
} catch {
// Storage not available
}
@@ -222,7 +238,7 @@ export function setAutoMarkWatchedConfig(config: AutoMarkWatchedConfig): void {
/** Check if the auto-mark prompt has been shown */
export function hasAutoMarkPromptBeenShown(): boolean {
try {
- return localStorage.getItem(STORAGE_KEYS.AUTO_MARK_PROMPT_SHOWN) === 'true';
+ return localStorage.getItem(STORAGE_KEYS.AUTO_MARK_PROMPT_SHOWN) === "true";
} catch {
return false;
}
@@ -231,7 +247,7 @@ export function hasAutoMarkPromptBeenShown(): boolean {
/** Mark that the auto-mark prompt has been shown */
export function markAutoMarkPromptShown(): void {
try {
- localStorage.setItem(STORAGE_KEYS.AUTO_MARK_PROMPT_SHOWN, 'true');
+ localStorage.setItem(STORAGE_KEYS.AUTO_MARK_PROMPT_SHOWN, "true");
} catch {
// Storage not available
}
@@ -241,7 +257,7 @@ export function markAutoMarkPromptShown(): void {
interface WatchLog {
tmdbId: number;
- type: 'movie' | 'tv';
+ type: "movie" | "tv";
title: string;
season?: number;
episode?: number;
@@ -274,7 +290,11 @@ export function getWatchLogs(): WatchLog[] {
}
/** Check if an episode/movie is considered "watched" based on progress */
-export function isConsideredWatched(watched: number, duration: number, threshold = 90): boolean {
+export function isConsideredWatched(
+ watched: number,
+ duration: number,
+ threshold = 90,
+): boolean {
if (duration <= 0) return false;
const percent = (watched / duration) * 100;
return percent >= threshold;
@@ -283,9 +303,9 @@ export function isConsideredWatched(watched: number, duration: number, threshold
// --- URL Validation ---
const ALLOWED_ORIGINS = [
- 'https://vidlink.pro',
- 'https://www.vidking.net',
- 'https://anyembed.xyz',
+ "https://vidlink.pro",
+ "https://www.vidking.net",
+ "https://anyembed.xyz",
];
/** Validate that an embed URL is from an allowed origin */
diff --git a/react_frontend/src/lib/streaming/types.ts b/react_frontend/src/lib/streaming/types.ts
index b40d85b..8f649d4 100644
--- a/react_frontend/src/lib/streaming/types.ts
+++ b/react_frontend/src/lib/streaming/types.ts
@@ -1,6 +1,6 @@
// Streaming system types
-export type MediaType = 'movie' | 'tv';
+export type MediaType = "movie" | "tv";
export interface StreamingServer {
id: string;
@@ -34,11 +34,17 @@ export interface StreamResponse {
export interface StreamError {
server: StreamingServer;
message: string;
- code: 'INVALID_ID' | 'MISSING_EPISODE' | 'TIMEOUT' | 'NETWORK' | 'UNAVAILABLE' | 'UNKNOWN';
+ code:
+ | "INVALID_ID"
+ | "MISSING_EPISODE"
+ | "TIMEOUT"
+ | "NETWORK"
+ | "UNAVAILABLE"
+ | "UNKNOWN";
}
export interface PlayerEvent {
- event: 'play' | 'pause' | 'seeked' | 'ended' | 'timeupdate';
+ event: "play" | "pause" | "seeked" | "ended" | "timeupdate";
currentTime: number;
duration: number;
mediaType: MediaType;
@@ -61,12 +67,15 @@ export interface WatchProgressData {
lastSeasonWatched?: number;
lastEpisodeWatched?: number;
/** Per-episode progress for TV shows */
- showProgress?: Record;
+ showProgress?: Record<
+ string,
+ {
+ season: number;
+ episode: number;
+ watched: number;
+ duration: number;
+ }
+ >;
lastUpdated: number;
}
diff --git a/react_frontend/src/lib/utils.ts b/react_frontend/src/lib/utils.ts
index bd0c391..a5ef193 100644
--- a/react_frontend/src/lib/utils.ts
+++ b/react_frontend/src/lib/utils.ts
@@ -1,6 +1,6 @@
-import { clsx, type ClassValue } from "clsx"
-import { twMerge } from "tailwind-merge"
+import { clsx, type ClassValue } from "clsx";
+import { twMerge } from "tailwind-merge";
export function cn(...inputs: ClassValue[]) {
- return twMerge(clsx(inputs))
+ return twMerge(clsx(inputs));
}
diff --git a/react_frontend/src/main.tsx b/react_frontend/src/main.tsx
index 831cb4e..861daaf 100644
--- a/react_frontend/src/main.tsx
+++ b/react_frontend/src/main.tsx
@@ -1,10 +1,10 @@
-import { StrictMode } from 'react'
-import { createRoot } from 'react-dom/client'
-import './index.css'
-import { App } from './App'
+import { StrictMode } from "react";
+import { createRoot } from "react-dom/client";
+import "./index.css";
+import { App } from "./App";
-createRoot(document.getElementById('root')!).render(
+createRoot(document.getElementById("root")!).render(
,
-)
+);
diff --git a/react_frontend/src/pages/CalendarPage.tsx b/react_frontend/src/pages/CalendarPage.tsx
index 4af6a59..fff4f36 100644
--- a/react_frontend/src/pages/CalendarPage.tsx
+++ b/react_frontend/src/pages/CalendarPage.tsx
@@ -1,31 +1,56 @@
-import { useState, useMemo } from 'react';
-import { Link } from 'react-router-dom';
-import { format, startOfMonth, endOfMonth, eachDayOfInterval, getDay, addMonths, subMonths, isSameDay } from 'date-fns';
-import { ChevronLeft, ChevronRight, LayoutGrid, List } from 'lucide-react';
-import { Button } from '@/components/ui/button';
-import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog';
-import { useEpisodesByMonth } from '@/hooks/useEpisodes';
-import { Tooltip, TooltipContent, TooltipTrigger, TooltipProvider } from '@/components/ui/tooltip';
-import { getTmdbPosterUrl } from '@/lib/media-utils';
-import type { Episode } from '@/types';
+import { useState, useMemo } from "react";
+import { Link } from "react-router-dom";
+import {
+ format,
+ startOfMonth,
+ endOfMonth,
+ eachDayOfInterval,
+ getDay,
+ addMonths,
+ subMonths,
+ isSameDay,
+} from "date-fns";
+import { ChevronLeft, ChevronRight, LayoutGrid, List } from "lucide-react";
+import { Button } from "@/components/ui/button";
+import {
+ Dialog,
+ DialogContent,
+ DialogHeader,
+ DialogTitle,
+} from "@/components/ui/dialog";
+import { useEpisodesByMonth } from "@/hooks/useEpisodes";
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+ TooltipProvider,
+} from "@/components/ui/tooltip";
+import { getTmdbPosterUrl } from "@/lib/media-utils";
+import type { Episode } from "@/types";
-const DAYS = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
+const DAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
export function CalendarPage() {
const [currentDate, setCurrentDate] = useState(new Date());
- const [viewMode, setViewMode] = useState<'grid' | 'list'>(
- () => (typeof window !== 'undefined' && window.innerWidth < 640 ? 'list' : 'grid')
+ const [viewMode, setViewMode] = useState<"grid" | "list">(() =>
+ typeof window !== "undefined" && window.innerWidth < 640 ? "list" : "grid",
);
- const [selectedDay, setSelectedDay] = useState<{ date: Date; episodes: Episode[] } | null>(null);
+ const [selectedDay, setSelectedDay] = useState<{
+ date: Date;
+ episodes: Episode[];
+ } | null>(null);
const monthStart = startOfMonth(currentDate);
const monthEnd = endOfMonth(currentDate);
- const startDateStr = format(monthStart, 'yyyy-MM-dd');
- const endDateStr = format(monthEnd, 'yyyy-MM-dd');
+ const startDateStr = format(monthStart, "yyyy-MM-dd");
+ const endDateStr = format(monthEnd, "yyyy-MM-dd");
const { data: episodes = [] } = useEpisodesByMonth(startDateStr, endDateStr);
- const days = useMemo(() => eachDayOfInterval({ start: monthStart, end: monthEnd }), [monthStart, monthEnd]);
+ const days = useMemo(
+ () => eachDayOfInterval({ start: monthStart, end: monthEnd }),
+ [monthStart, monthEnd],
+ );
const startDayOfWeek = getDay(monthStart);
// Group episodes by date
@@ -33,7 +58,7 @@ export function CalendarPage() {
const map = new Map();
episodes.forEach((ep) => {
if (!ep.air_date) return;
- const key = format(new Date(ep.air_date), 'yyyy-MM-dd');
+ const key = format(new Date(ep.air_date), "yyyy-MM-dd");
const existing = map.get(key) || [];
existing.push(ep);
map.set(key, existing);
@@ -54,7 +79,7 @@ export function CalendarPage() {
- {format(currentDate, 'MMMM yyyy')}
+ {format(currentDate, "MMMM yyyy")}
setViewMode((v) => (v === 'grid' ? 'list' : 'grid'))}
- title={viewMode === 'grid' ? 'Switch to list view' : 'Switch to grid view'}
+ onClick={() => setViewMode((v) => (v === "grid" ? "list" : "grid"))}
+ title={
+ viewMode === "grid"
+ ? "Switch to list view"
+ : "Switch to grid view"
+ }
>
- {viewMode === 'grid' ? : }
+ {viewMode === "grid" ? (
+
+ ) : (
+
+ )}
@@ -84,12 +117,15 @@ export function CalendarPage() {
onClose={() => setSelectedDay(null)}
/>
)}
- {viewMode === 'grid' ? (
+ {viewMode === "grid" ? (
{/* Day headers */}
{DAYS.map((day) => (
-
+
{day}
))}
@@ -99,34 +135,44 @@ export function CalendarPage() {
{/* Empty cells for offset */}
{Array.from({ length: startDayOfWeek }).map((_, i) => (
-
+
))}
{days.map((day) => {
- const key = format(day, 'yyyy-MM-dd');
+ const key = format(day, "yyyy-MM-dd");
const dayEpisodes = episodesByDate.get(key) || [];
const isToday = isSameDay(day, new Date());
return (
dayEpisodes.length > 0 && setSelectedDay({ date: day, episodes: dayEpisodes })}
+ onClick={() =>
+ dayEpisodes.length > 0 &&
+ setSelectedDay({ date: day, episodes: dayEpisodes })
+ }
className={`border-t border-r border-border p-1 overflow-hidden flex flex-col min-h-0 ${
- isToday ? 'bg-primary/5' : ''
- } ${dayEpisodes.length > 0 ? 'cursor-pointer hover:bg-accent/30 transition-colors' : ''}`}
+ isToday ? "bg-primary/5" : ""
+ } ${dayEpisodes.length > 0 ? "cursor-pointer hover:bg-accent/30 transition-colors" : ""}`}
>
- {format(day, 'd')}
+ {format(day, "d")}
{dayEpisodes.slice(0, 3).map((ep) => (
-
+
))}
{dayEpisodes.length > 3 && (
@@ -143,7 +189,7 @@ export function CalendarPage() {
/* List / Agenda view */
{days.map((day) => {
- const key = format(day, 'yyyy-MM-dd');
+ const key = format(day, "yyyy-MM-dd");
const dayEpisodes = episodesByDate.get(key) || [];
const isToday = isSameDay(day, new Date());
@@ -152,34 +198,39 @@ export function CalendarPage() {
key={key}
className={`rounded-lg border ${
isToday
- ? 'border-primary/30 bg-primary/5'
+ ? "border-primary/30 bg-primary/5"
: dayEpisodes.length > 0
- ? 'border-border'
- : 'border-transparent'
+ ? "border-border"
+ : "border-transparent"
}`}
>
0 ? 'border-b border-border/40' : ''
+ dayEpisodes.length > 0 ? "border-b border-border/40" : ""
}`}
>
- {format(day, 'd')}
+ {format(day, "d")}
-
- {format(day, 'EEEE, MMM d')}
+
+ {format(day, "EEEE, MMM d")}
{dayEpisodes.length > 0 && (
- {dayEpisodes.length} ep{dayEpisodes.length !== 1 ? 's' : ''}
+ {dayEpisodes.length} ep
+ {dayEpisodes.length !== 1 ? "s" : ""}
)}
@@ -200,14 +251,20 @@ export function CalendarPage() {
);
}
-function EpisodeCalendarItem({ episode, variant = 'list' }: { episode: Episode; variant?: 'grid' | 'list' | 'dialog' }) {
+function EpisodeCalendarItem({
+ episode,
+ variant = "list",
+}: {
+ episode: Episode;
+ variant?: "grid" | "list" | "dialog";
+}) {
type EpisodeWithEntry = Episode & {
entry?: { id: number; title?: string; poster_path?: string | null };
};
const ep = episode as EpisodeWithEntry;
const entry = ep.entry;
const entryId = entry?.id;
- const entryTitle = entry?.title ?? '';
+ const entryTitle = entry?.title ?? "";
// Hide episodes with no known entry title
if (!entryTitle) return null;
@@ -215,18 +272,17 @@ function EpisodeCalendarItem({ episode, variant = 'list' }: { episode: Episode;
const seasonId = episode.season_id;
const seasonNumber = episode.season?.season_number ?? null;
- const seasonLabel = seasonNumber != null
- ? `S${String(seasonNumber).padStart(2, '0')}`
- : '';
- const episodeLabel = `E${String(episode.episode_number).padStart(2, '0')}`;
+ const seasonLabel =
+ seasonNumber != null ? `S${String(seasonNumber).padStart(2, "0")}` : "";
+ const episodeLabel = `E${String(episode.episode_number).padStart(2, "0")}`;
const thumbSrc = entry?.poster_path
- ? getTmdbPosterUrl(entry.poster_path, 'w92')
+ ? getTmdbPosterUrl(entry.poster_path, "w92")
: undefined;
const isMovie = entry && !(entry as any).is_tvseries;
- if (variant === 'grid') {
+ if (variant === "grid") {
const gridContent = (
{thumbSrc ? (
@@ -237,7 +293,9 @@ function EpisodeCalendarItem({ episode, variant = 'list' }: { episode: Episode;
/>
) : (
- {entryTitle}
+
+ {entryTitle}
+
)}
@@ -250,7 +308,10 @@ function EpisodeCalendarItem({ episode, variant = 'list' }: { episode: Episode;
{entryId ? (
-
+
{gridContent}
) : (
@@ -274,7 +335,7 @@ function EpisodeCalendarItem({ episode, variant = 'list' }: { episode: Episode;
);
}
- if (variant === 'dialog') {
+ if (variant === "dialog") {
const dialogContent = (
{thumbSrc ? (
@@ -285,25 +346,35 @@ function EpisodeCalendarItem({ episode, variant = 'list' }: { episode: Episode;
/>
) : (
- {entryTitle}
+
+ {entryTitle}
+
)}
- {entryTitle}
+
+ {entryTitle}
+
{!isMovie && (
- {seasonLabel}{episodeLabel}
+ {seasonLabel}
+ {episodeLabel}
)}
{episode.name && (
- {episode.name}
+
+ {episode.name}
+
)}
);
return entryId ? (
-
+
{dialogContent}
) : (
@@ -362,12 +433,20 @@ function EpisodeCalendarItem({ episode, variant = 'list' }: { episode: Episode;
);
}
-function DayDialog({ date, episodes, onClose }: { date: Date; episodes: Episode[]; onClose: () => void }) {
+function DayDialog({
+ date,
+ episodes,
+ onClose,
+}: {
+ date: Date;
+ episodes: Episode[];
+ onClose: () => void;
+}) {
return (
);
}
diff --git a/react_frontend/src/pages/DashboardPage.tsx b/react_frontend/src/pages/DashboardPage.tsx
index e32153b..194c0c2 100644
--- a/react_frontend/src/pages/DashboardPage.tsx
+++ b/react_frontend/src/pages/DashboardPage.tsx
@@ -1,19 +1,19 @@
-import { useMemo, useState } from 'react';
-import { Link } from 'react-router-dom';
-import { useLibrary } from '@/hooks/useEntries';
-import { useStatistics } from '@/hooks/useStatistics';
-import { useLibraryEntries } from '@/stores/useLibraryStore';
-import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
-import { Skeleton } from '@/components/ui/skeleton';
-import { Film, Tv, Heart, ListVideo, Clock } from 'lucide-react';
-import { formatRuntime, getPosterUrl } from '@/lib/media-utils';
-import { WatchActivityChart } from '@/components/dashboard/WatchActivityChart';
-import { WatchTimeChart } from '@/components/dashboard/WatchTimeChart';
-import { RatingsChart } from '@/components/dashboard/RatingsChart';
-import { TopGenresChart } from '@/components/dashboard/TopGenresChart';
-import { CouchDayChart } from '@/components/dashboard/CouchDayChart';
-import { LibraryGrowthChart } from '@/components/dashboard/LibraryGrowthChart';
-import { MediaTypeChart } from '@/components/dashboard/MediaTypeChart';
+import { useMemo, useState } from "react";
+import { Link } from "react-router-dom";
+import { useLibrary } from "@/hooks/useEntries";
+import { useStatistics } from "@/hooks/useStatistics";
+import { useLibraryEntries } from "@/stores/useLibraryStore";
+import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
+import { Skeleton } from "@/components/ui/skeleton";
+import { Film, Tv, Heart, ListVideo, Clock } from "lucide-react";
+import { formatRuntime, getPosterUrl } from "@/lib/media-utils";
+import { WatchActivityChart } from "@/components/dashboard/WatchActivityChart";
+import { WatchTimeChart } from "@/components/dashboard/WatchTimeChart";
+import { RatingsChart } from "@/components/dashboard/RatingsChart";
+import { TopGenresChart } from "@/components/dashboard/TopGenresChart";
+import { CouchDayChart } from "@/components/dashboard/CouchDayChart";
+import { LibraryGrowthChart } from "@/components/dashboard/LibraryGrowthChart";
+import { MediaTypeChart } from "@/components/dashboard/MediaTypeChart";
export function DashboardPage() {
useLibrary();
@@ -21,43 +21,58 @@ export function DashboardPage() {
const allEntries = useLibraryEntries();
const [watchYear, setWatchYear] = useState(new Date().getFullYear());
- const movies = useMemo(() => allEntries.filter((e) => !e.is_tvseries && !e.watchlist), [allEntries]);
- const tvSeries = useMemo(() => allEntries.filter((e) => e.is_tvseries && !e.watchlist), [allEntries]);
- const favorites = useMemo(() => allEntries.filter((e) => e.favorit && !e.watchlist), [allEntries]);
- const watchlist = useMemo(() => allEntries.filter((e) => e.watchlist), [allEntries]);
+ const movies = useMemo(
+ () => allEntries.filter((e) => !e.is_tvseries && !e.watchlist),
+ [allEntries],
+ );
+ const tvSeries = useMemo(
+ () => allEntries.filter((e) => e.is_tvseries && !e.watchlist),
+ [allEntries],
+ );
+ const favorites = useMemo(
+ () => allEntries.filter((e) => e.favorit && !e.watchlist),
+ [allEntries],
+ );
+ const watchlist = useMemo(
+ () => allEntries.filter((e) => e.watchlist),
+ [allEntries],
+ );
const statCards = [
{
- title: 'Movies',
+ title: "Movies",
value: movies.length,
icon: Film,
- color: 'text-blue-500',
+ color: "text-blue-500",
},
{
- title: 'TV Series',
+ title: "TV Series",
value: tvSeries.length,
icon: Tv,
- color: 'text-green-500',
+ color: "text-green-500",
},
{
- title: 'Favorites',
+ title: "Favorites",
value: favorites.length,
icon: Heart,
- color: 'text-red-500',
+ color: "text-red-500",
},
{
- title: 'Watchlist',
+ title: "Watchlist",
value: watchlist.length,
icon: ListVideo,
- color: 'text-purple-500',
+ color: "text-purple-500",
},
{
- title: 'Watch Time',
+ title: "Watch Time",
value: stats
- ? formatRuntime((parseInt(stats.series || '0') || 0) + (parseInt(stats.movies || '0') || 0))
- : '0h',
+ ? formatRuntime(
+ (parseInt(stats.series || "0") || 0) +
+ (parseInt(stats.movies || "0") || 0),
+ )
+ : "0h",
icon: Clock,
- color: 'text-orange-500',
+ color: "text-orange-500",
},
];
@@ -108,7 +123,7 @@ export function DashboardPage() {
.sort(
(a, b) =>
new Date(b.date_last_seen!).getTime() -
- new Date(a.date_last_seen!).getTime()
+ new Date(a.date_last_seen!).getTime(),
)
.slice(0, 14)
.map((entry, index) => (
diff --git a/react_frontend/src/pages/DiscoverPage.tsx b/react_frontend/src/pages/DiscoverPage.tsx
index f054785..2e0d421 100644
--- a/react_frontend/src/pages/DiscoverPage.tsx
+++ b/react_frontend/src/pages/DiscoverPage.tsx
@@ -1,41 +1,41 @@
-import { useState, useEffect, useRef, useCallback } from 'react';
-import { useParams } from 'react-router-dom';
-import { useInfiniteQuery } from '@tanstack/react-query';
-import { tmdbApi } from '@/api/tmdb';
-import { useLibrary } from '@/hooks/useEntries';
-import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs';
-import { EntryCard, EntryCardSkeleton } from '@/components/entries/EntryCard';
-import { Loader2 } from 'lucide-react';
-import type { TmdbEntry, TmdbPaginatedResponse } from '@/types';
+import { useState, useEffect, useRef, useCallback } from "react";
+import { useParams } from "react-router-dom";
+import { useInfiniteQuery } from "@tanstack/react-query";
+import { tmdbApi } from "@/api/tmdb";
+import { useLibrary } from "@/hooks/useEntries";
+import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
+import { EntryCard, EntryCardSkeleton } from "@/components/entries/EntryCard";
+import { Loader2 } from "lucide-react";
+import type { TmdbEntry, TmdbPaginatedResponse } from "@/types";
const CATEGORY_LABELS: Record = {
- trending: 'Trending',
- popular: 'Popular',
- 'top-rated': 'Top Rated',
- upcoming: 'Upcoming',
+ trending: "Trending",
+ popular: "Popular",
+ "top-rated": "Top Rated",
+ upcoming: "Upcoming",
};
-type MediaTab = 'movie' | 'tv';
+type MediaTab = "movie" | "tv";
function useCategoryQuery(category: string, mediaType: MediaTab) {
return useInfiniteQuery>({
- queryKey: ['tmdb', category, mediaType],
+ queryKey: ["tmdb", category, mediaType],
queryFn: ({ pageParam }) => {
const page = pageParam as number;
switch (category) {
- case 'trending':
- return mediaType === 'movie'
+ case "trending":
+ return mediaType === "movie"
? tmdbApi.getTrendingMovies(page)
: tmdbApi.getTrendingTv(page);
- case 'popular':
- return mediaType === 'movie'
+ case "popular":
+ return mediaType === "movie"
? tmdbApi.getPopularMovies(page)
: tmdbApi.getPopularTv(page);
- case 'top-rated':
- return mediaType === 'movie'
+ case "top-rated":
+ return mediaType === "movie"
? tmdbApi.getTopRatedMovies(page)
: tmdbApi.getTopRatedTv(page);
- case 'upcoming':
+ case "upcoming":
return tmdbApi.getUpcomingMovies(page);
default:
return tmdbApi.getPopularMovies(page);
@@ -48,20 +48,24 @@ function useCategoryQuery(category: string, mediaType: MediaTab) {
}
export function DiscoverPage() {
- const { category = 'trending' } = useParams<{ category: string }>();
- const [mediaType, setMediaType] = useState('movie');
+ const { category = "trending" } = useParams<{ category: string }>();
+ const [mediaType, setMediaType] = useState("movie");
const sentinelRef = useRef(null);
useLibrary();
- const isUpcoming = category === 'upcoming';
+ const isUpcoming = category === "upcoming";
const query = useCategoryQuery(category, mediaType);
const entries = query.data?.pages.flatMap((p) => p.results) ?? [];
// Infinite scroll via IntersectionObserver
const handleIntersect = useCallback(
(entries: IntersectionObserverEntry[]) => {
- if (entries[0]?.isIntersecting && query.hasNextPage && !query.isFetchingNextPage) {
+ if (
+ entries[0]?.isIntersecting &&
+ query.hasNextPage &&
+ !query.isFetchingNextPage
+ ) {
query.fetchNextPage();
}
},
@@ -71,12 +75,14 @@ export function DiscoverPage() {
useEffect(() => {
const el = sentinelRef.current;
if (!el) return;
- const observer = new IntersectionObserver(handleIntersect, { rootMargin: '400px' });
+ const observer = new IntersectionObserver(handleIntersect, {
+ rootMargin: "400px",
+ });
observer.observe(el);
return () => observer.disconnect();
}, [handleIntersect]);
- const title = CATEGORY_LABELS[category] || 'Discover';
+ const title = CATEGORY_LABELS[category] || "Discover";
return (
diff --git a/react_frontend/src/pages/EntryCastsPage.tsx b/react_frontend/src/pages/EntryCastsPage.tsx
index 5bd1584..1ab80dc 100644
--- a/react_frontend/src/pages/EntryCastsPage.tsx
+++ b/react_frontend/src/pages/EntryCastsPage.tsx
@@ -1,69 +1,83 @@
-import { useState, useMemo, useEffect, useRef } from 'react';
-import { useParams, Link } from 'react-router-dom';
-import { useEntry, useEntryCredits } from '@/hooks/useEntries';
-import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
-import { Skeleton } from '@/components/ui/skeleton';
-import { Button } from '@/components/ui/button';
-import { Input } from '@/components/ui/input';
+import { useState, useMemo, useEffect, useRef } from "react";
+import { useParams, Link } from "react-router-dom";
+import { useEntry, useEntryCredits } from "@/hooks/useEntries";
+import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
+import { Skeleton } from "@/components/ui/skeleton";
+import { Button } from "@/components/ui/button";
+import { Input } from "@/components/ui/input";
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
-} from '@/components/ui/select';
-import { getProfileUrl } from '@/lib/media-utils';
-import { ArrowUpDown } from 'lucide-react';
-import type { Credit } from '@/types';
+} from "@/components/ui/select";
+import { getProfileUrl } from "@/lib/media-utils";
+import { ArrowUpDown } from "lucide-react";
+import type { Credit } from "@/types";
-type SortField = 'order' | 'popularity' | 'name' | 'birthday' | 'gender' | 'episode_count';
-type SortDir = 'asc' | 'desc';
-type CastFilter = 'all' | 'cast' | 'crew';
+type SortField =
+ | "order"
+ | "popularity"
+ | "name"
+ | "birthday"
+ | "gender"
+ | "episode_count";
+type SortDir = "asc" | "desc";
+type CastFilter = "all" | "cast" | "crew";
const PAGE_SIZE = 24;
const SORT_LABELS: Record = {
- order: 'Credit Order',
- popularity: 'Popularity',
- name: 'Name',
- birthday: 'Birthday',
- gender: 'Gender',
- episode_count: 'Episodes',
+ order: "Credit Order",
+ popularity: "Popularity",
+ name: "Name",
+ birthday: "Birthday",
+ gender: "Gender",
+ episode_count: "Episodes",
};
const FILTER_LABELS: Record = {
- all: 'All',
- cast: 'Cast',
- crew: 'Crew',
+ all: "All",
+ cast: "Cast",
+ crew: "Crew",
};
-function sortCredits(credits: Credit[], field: SortField, dir: SortDir): Credit[] {
+function sortCredits(
+ credits: Credit[],
+ field: SortField,
+ dir: SortDir,
+): Credit[] {
return [...credits].sort((a, b) => {
let cmp = 0;
switch (field) {
- case 'order':
+ case "order":
cmp = (a.order ?? 9999) - (b.order ?? 9999);
break;
- case 'popularity':
+ case "popularity":
cmp = (b.people?.popularity ?? 0) - (a.people?.popularity ?? 0);
break;
- case 'name':
- cmp = (a.people?.name ?? '').localeCompare(b.people?.name ?? '');
+ case "name":
+ cmp = (a.people?.name ?? "").localeCompare(b.people?.name ?? "");
break;
- case 'birthday': {
- const da = a.people?.birthday ? new Date(a.people.birthday).getTime() : 0;
- const db = b.people?.birthday ? new Date(b.people.birthday).getTime() : 0;
+ case "birthday": {
+ const da = a.people?.birthday
+ ? new Date(a.people.birthday).getTime()
+ : 0;
+ const db = b.people?.birthday
+ ? new Date(b.people.birthday).getTime()
+ : 0;
cmp = da - db;
break;
}
- case 'gender':
+ case "gender":
cmp = (a.people?.gender ?? 0) - (b.people?.gender ?? 0);
break;
- case 'episode_count':
+ case "episode_count":
cmp = (b.episode_count ?? 0) - (a.episode_count ?? 0);
break;
}
- return dir === 'asc' ? cmp : -cmp;
+ return dir === "asc" ? cmp : -cmp;
});
}
@@ -71,38 +85,51 @@ export function EntryCastsPage() {
const { id } = useParams<{ id: string }>();
const entryId = parseInt(id!, 10);
const { data: entry, isLoading } = useEntry(entryId);
- const { data: allCredits = [], isLoading: creditsLoading } = useEntryCredits(entryId);
+ const { data: allCredits = [], isLoading: creditsLoading } =
+ useEntryCredits(entryId);
- const [sortField, setSortField] = useState('episode_count');
- const [sortDir, setSortDir] = useState('asc');
- const [filter, setFilter] = useState('cast');
- const [search, setSearch] = useState('');
+ const [sortField, setSortField] = useState("episode_count");
+ const [sortDir, setSortDir] = useState("asc");
+ const [filter, setFilter] = useState("cast");
+ const [search, setSearch] = useState("");
const [visibleCount, setVisibleCount] = useState(PAGE_SIZE);
const filtered = useMemo(() => {
if (!allCredits) return [];
let result = allCredits;
- if (filter === 'cast') result = result.filter((c) => c.cast_type === 'cast');
- else if (filter === 'crew') result = result.filter((c) => c.cast_type === 'crew');
+ if (filter === "cast")
+ result = result.filter((c) => c.cast_type === "cast");
+ else if (filter === "crew")
+ result = result.filter((c) => c.cast_type === "crew");
if (search.trim()) {
const q = search.trim().toLowerCase();
result = result.filter((c) => {
- const name = c.people?.name?.toLowerCase() ?? '';
- const role = (c.cast_type === 'cast' ? c.character : (c.job || c.department))?.toLowerCase() ?? '';
+ const name = c.people?.name?.toLowerCase() ?? "";
+ const role =
+ (c.cast_type === "cast"
+ ? c.character
+ : c.job || c.department
+ )?.toLowerCase() ?? "";
return name.includes(q) || role.includes(q);
});
}
return result;
}, [allCredits, filter, search]);
- const sorted = useMemo(() => sortCredits(filtered, sortField, sortDir), [filtered, sortField, sortDir]);
+ const sorted = useMemo(
+ () => sortCredits(filtered, sortField, sortDir),
+ [filtered, sortField, sortDir],
+ );
// Reset visible window whenever filter/sort/search changes
useEffect(() => {
setVisibleCount(PAGE_SIZE);
}, [filter, sortField, sortDir, search]);
- const visible = useMemo(() => sorted.slice(0, visibleCount), [sorted, visibleCount]);
+ const visible = useMemo(
+ () => sorted.slice(0, visibleCount),
+ [sorted, visibleCount],
+ );
const hasMore = visibleCount < sorted.length;
// IntersectionObserver-based lazy load on scroll
@@ -117,7 +144,7 @@ export function EntryCastsPage() {
setVisibleCount((c) => Math.min(c + PAGE_SIZE, sorted.length));
}
},
- { rootMargin: '400px 0px' }
+ { rootMargin: "400px 0px" },
);
observer.observe(node);
return () => observer.disconnect();
@@ -165,12 +192,15 @@ export function EntryCastsPage() {
className="w-48"
/>
- {sorted.length} {sorted.length === 1 ? 'credit' : 'credits'}
+ {sorted.length} {sorted.length === 1 ? "credit" : "credits"}
{/* Right: filter + sort */}
- |