Normalize to double quotes across all files with Prettier
This commit is contained in:
1 parent
73bff72cec
commit
a5659cf4c8
190 files changed
+9523
-8859
No files matched your search
@@ -1,26 +1,32 @@
|
||||
import { useState } from 'react';
|
||||
import { useParams, useNavigate, Link } from 'react-router-dom';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { seasonsApi } from '@/api/seasons';
|
||||
import { useSeason } from '@/hooks/useSeasons';
|
||||
import { useEntry, useEntrySeasons } from '@/hooks/useEntries';
|
||||
import { useLibraryStore } from '@/stores/useLibraryStore';
|
||||
import { useState } from "react";
|
||||
import { useParams, useNavigate, Link } from "react-router-dom";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { seasonsApi } from "@/api/seasons";
|
||||
import { useSeason } from "@/hooks/useSeasons";
|
||||
import { useEntry, useEntrySeasons } from "@/hooks/useEntries";
|
||||
import { useLibraryStore } from "@/stores/useLibraryStore";
|
||||
import {
|
||||
useEpisodeSeenByEpisode,
|
||||
useDeleteEpisodeSeen,
|
||||
} from '@/hooks/useEpisodeSeen';
|
||||
import { StreamingDialog } from '@/components/streaming/StreamingDialog';
|
||||
import { useStreamingStore } from '@/stores/useStreamingStore';
|
||||
import { Skeleton } from '@/components/ui/skeleton';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Separator } from '@/components/ui/separator';
|
||||
import { EpisodeWatchHistory } from '@/components/entries/EpisodeWatchHistory';
|
||||
import { EpisodeSeenEditDialog } from '@/components/dialogs/EpisodeSeenEditDialog';
|
||||
import { ConfirmDialog } from '@/components/dialogs/ConfirmDialog';
|
||||
import { CastList } from '@/components/entries/CastList';
|
||||
import { Eye, ChevronLeft, ChevronRight, Clock, PlayCircle } from 'lucide-react';
|
||||
import { getTmdbPosterUrl, formatDate, formatRuntime } from '@/lib/media-utils';
|
||||
import type { Episode, EpisodeSeen } from '@/types';
|
||||
} from "@/hooks/useEpisodeSeen";
|
||||
import { StreamingDialog } from "@/components/streaming/StreamingDialog";
|
||||
import { useStreamingStore } from "@/stores/useStreamingStore";
|
||||
import { Skeleton } from "@/components/ui/skeleton";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Separator } from "@/components/ui/separator";
|
||||
import { EpisodeWatchHistory } from "@/components/entries/EpisodeWatchHistory";
|
||||
import { EpisodeSeenEditDialog } from "@/components/dialogs/EpisodeSeenEditDialog";
|
||||
import { ConfirmDialog } from "@/components/dialogs/ConfirmDialog";
|
||||
import { CastList } from "@/components/entries/CastList";
|
||||
import {
|
||||
Eye,
|
||||
ChevronLeft,
|
||||
ChevronRight,
|
||||
Clock,
|
||||
PlayCircle,
|
||||
} from "lucide-react";
|
||||
import { getTmdbPosterUrl, formatDate, formatRuntime } from "@/lib/media-utils";
|
||||
import type { Episode, EpisodeSeen } from "@/types";
|
||||
|
||||
export function EpisodePage() {
|
||||
const { entryId, seasonId, episodeId } = useParams<{
|
||||
@@ -31,14 +37,16 @@ export function EpisodePage() {
|
||||
const navigate = useNavigate();
|
||||
|
||||
const { data: episodes = [] } = useQuery({
|
||||
queryKey: ['seasons', parseInt(seasonId!, 10), 'episodes'],
|
||||
queryKey: ["seasons", parseInt(seasonId!, 10), "episodes"],
|
||||
queryFn: () => seasonsApi.getEpisodes(parseInt(seasonId!, 10)),
|
||||
});
|
||||
|
||||
const { data: season } = useSeason(parseInt(seasonId!, 10));
|
||||
const { data: entry } = useEntry(parseInt(entryId!, 10));
|
||||
const { data: entrySeasons } = useEntrySeasons(parseInt(entryId!, 10));
|
||||
const entryTitle = entry?.title ?? useLibraryStore.getState().entries.get(parseInt(entryId!, 10))?.title;
|
||||
const entryTitle =
|
||||
entry?.title ??
|
||||
useLibraryStore.getState().entries.get(parseInt(entryId!, 10))?.title;
|
||||
const seasonNumber = season?.season_number;
|
||||
|
||||
const { initialize, play } = useStreamingStore();
|
||||
@@ -46,7 +54,9 @@ export function EpisodePage() {
|
||||
|
||||
const epId = parseInt(episodeId!, 10);
|
||||
const entryIdNum = parseInt(entryId!, 10);
|
||||
const episode: Episode | undefined = episodes.find((ep: Episode) => ep.id === epId);
|
||||
const episode: Episode | undefined = episodes.find(
|
||||
(ep: Episode) => ep.id === epId,
|
||||
);
|
||||
const { data: watchHistory = [] } = useEpisodeSeenByEpisode(epId);
|
||||
const deleteEpisodeSeen = useDeleteEpisodeSeen();
|
||||
|
||||
@@ -56,7 +66,8 @@ export function EpisodePage() {
|
||||
|
||||
// Find prev/next episode
|
||||
const currentIndex = episodes.findIndex((ep: Episode) => ep.id === epId);
|
||||
const prevEpisode: Episode | undefined = currentIndex > 0 ? episodes[currentIndex - 1] : undefined;
|
||||
const prevEpisode: Episode | undefined =
|
||||
currentIndex > 0 ? episodes[currentIndex - 1] : undefined;
|
||||
const nextEpisode: Episode | undefined =
|
||||
currentIndex < episodes.length - 1 ? episodes[currentIndex + 1] : undefined;
|
||||
|
||||
@@ -78,24 +89,27 @@ export function EpisodePage() {
|
||||
to={`/entry/${entryId}`}
|
||||
className="hover:text-foreground transition-colors truncate max-w-50"
|
||||
>
|
||||
{entryTitle || 'Entry'}
|
||||
{entryTitle || "Entry"}
|
||||
</Link>
|
||||
<span>/</span>
|
||||
<Link
|
||||
to={`/entry/${entryId}/season/${seasonId}`}
|
||||
className="hover:text-foreground transition-colors"
|
||||
>
|
||||
Season {seasonNumber ?? '?'}
|
||||
Season {seasonNumber ?? "?"}
|
||||
</Link>
|
||||
<span>/</span>
|
||||
<span className="text-foreground font-medium">Episode {episode.episode_number}</span>
|
||||
<span className="text-foreground font-medium">
|
||||
Episode {episode.episode_number}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{/* Top bar: nav breadcrumb + Mark Watched */}
|
||||
<div className="flex items-center justify-between gap-4">
|
||||
<div className="flex items-center gap-2 text-sm text-muted-foreground">
|
||||
<span className="font-medium text-foreground">
|
||||
S{String(seasonNumber ?? 0).padStart(2, '0')} E{String(episode.episode_number).padStart(2, '0')}
|
||||
S{String(seasonNumber ?? 0).padStart(2, "0")} E
|
||||
{String(episode.episode_number).padStart(2, "0")}
|
||||
</span>
|
||||
</div>
|
||||
<Button size="sm" onClick={() => setShowAddDialog(true)}>
|
||||
@@ -112,7 +126,7 @@ export function EpisodePage() {
|
||||
if (!entry?.entryIds?.tmdb_id || !seasonNumber) return;
|
||||
initialize();
|
||||
play({
|
||||
type: 'tv',
|
||||
type: "tv",
|
||||
tmdbId: entry.entryIds.tmdb_id,
|
||||
imdbId: entry.entryIds?.imdb_id || undefined,
|
||||
season: seasonNumber,
|
||||
@@ -122,14 +136,16 @@ export function EpisodePage() {
|
||||
}}
|
||||
>
|
||||
<img
|
||||
src={getTmdbPosterUrl(episode.still_path, 'w1280')}
|
||||
src={getTmdbPosterUrl(episode.still_path, "w1280")}
|
||||
alt={episode.name}
|
||||
className="w-full max-h-96 object-cover transition-[filter] group-hover:brightness-50"
|
||||
/>
|
||||
<div className="absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity">
|
||||
<div className="flex items-center gap-2 bg-black/60 backdrop-blur-sm rounded-full px-5 py-2.5">
|
||||
<PlayCircle className="h-6 w-6 text-white" />
|
||||
<span className="text-white font-medium text-sm">Watch Episode</span>
|
||||
<span className="text-white font-medium text-sm">
|
||||
Watch Episode
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -171,7 +187,9 @@ export function EpisodePage() {
|
||||
<EpisodeWatchHistory
|
||||
watchHistory={watchHistory}
|
||||
onEdit={(id) => {
|
||||
const rec = watchHistory.find((r) => r.id === id) as EpisodeSeen | undefined;
|
||||
const rec = watchHistory.find((r) => r.id === id) as
|
||||
| EpisodeSeen
|
||||
| undefined;
|
||||
if (rec) setEditRecord(rec);
|
||||
}}
|
||||
onDelete={(id) => setDeleteTarget(id)}
|
||||
@@ -188,7 +206,9 @@ export function EpisodePage() {
|
||||
size="sm"
|
||||
className="flex items-center gap-1 max-w-60"
|
||||
onClick={() =>
|
||||
navigate(`/entry/${entryId}/season/${seasonId}/episode/${prevEpisode.id}`)
|
||||
navigate(
|
||||
`/entry/${entryId}/season/${seasonId}/episode/${prevEpisode.id}`,
|
||||
)
|
||||
}
|
||||
>
|
||||
<ChevronLeft className="h-4 w-4 shrink-0" />
|
||||
@@ -205,7 +225,9 @@ export function EpisodePage() {
|
||||
size="sm"
|
||||
className="flex items-center gap-1 max-w-60 ml-auto"
|
||||
onClick={() =>
|
||||
navigate(`/entry/${entryId}/season/${seasonId}/episode/${nextEpisode.id}`)
|
||||
navigate(
|
||||
`/entry/${entryId}/season/${seasonId}/episode/${nextEpisode.id}`,
|
||||
)
|
||||
}
|
||||
>
|
||||
<span className="truncate">
|
||||
@@ -234,7 +256,9 @@ export function EpisodePage() {
|
||||
{editRecord && (
|
||||
<EpisodeSeenEditDialog
|
||||
open={!!editRecord}
|
||||
onOpenChange={(open) => { if (!open) setEditRecord(null); }}
|
||||
onOpenChange={(open) => {
|
||||
if (!open) setEditRecord(null);
|
||||
}}
|
||||
mode="edit"
|
||||
record={editRecord}
|
||||
entryId={entryIdNum}
|
||||
@@ -245,14 +269,21 @@ export function EpisodePage() {
|
||||
{/* Delete confirm dialog */}
|
||||
<ConfirmDialog
|
||||
open={deleteTarget !== null}
|
||||
onOpenChange={(open) => { if (!open) setDeleteTarget(null); }}
|
||||
onOpenChange={(open) => {
|
||||
if (!open) setDeleteTarget(null);
|
||||
}}
|
||||
title="Delete Watch Record"
|
||||
description="Are you sure you want to remove this watch record? This cannot be undone."
|
||||
confirmLabel="Delete"
|
||||
variant="destructive"
|
||||
onConfirm={() => {
|
||||
if (deleteTarget !== null) {
|
||||
deleteEpisodeSeen.mutate({ id: deleteTarget, entryId: entryIdNum, episodeId: epId, seasonId: parseInt(seasonId!, 10) });
|
||||
deleteEpisodeSeen.mutate({
|
||||
id: deleteTarget,
|
||||
entryId: entryIdNum,
|
||||
episodeId: epId,
|
||||
seasonId: parseInt(seasonId!, 10),
|
||||
});
|
||||
setDeleteTarget(null);
|
||||
}
|
||||
}}
|
||||
|
||||
Reference in new issue
Block a user