Frontend: UI improvements, dashboard fixes, and settings cleanup

- EntrySeenDialog: native date input, merged date+accuracy row
- EpisodeSeenEditDialog: merged date+accuracy row
- LibraryGrowthChart: use createdAt only, include all entries
- SeasonPage/EpisodePage: max-w-4xl, improved breadcrumbs ("Title / Season x / Episode x"), fixed season number display
- SettingsPage: added Cleanup section for orphan files/media records
- Added maintenance API client
- Updated docs-vault and project documentation
This commit is contained in:
Mohammed Abad committed 2026-04-22 02:08:54 +01:00
1 parent cd695ef4cf
commit 3c4958df50
7 files changed
+245 -100

No files matched your search

@@ -43,8 +43,8 @@ export function LibraryGrowthChart() {
const allEntries = useLibraryEntries();
const currentYear = new Date().getFullYear();
const getEntryDate = (e: { createdAt?: string; date_first_seen?: string | null }) =>
e.date_first_seen || e.createdAt || null;
const getEntryDate = (e: { createdAt?: string }) =>
e.createdAt || null;
const years = useMemo(() => {
const set = new Set<number>();
@@ -62,11 +62,12 @@ export function LibraryGrowthChart() {
const effectiveYear = year === 'all' ? 'all' : (years.includes(year) ? year : years[0]);
const chartData = useMemo(() => {
const library = allEntries.filter((e) => !e.watchlist);
// Include all entries (library + watchlist)
const entries = allEntries;
if (effectiveYear === 'all') {
// Build monthly data across all years
const dateEntries = library
const dateEntries = entries
.map((e) => {
const d = getEntryDate(e);
return d ? new Date(d) : null;
@@ -100,13 +101,13 @@ export function LibraryGrowthChart() {
return data;
}
const beforeYear = library.filter((e) => {
const beforeYear = entries.filter((e) => {
const d = getEntryDate(e);
return d && new Date(d).getFullYear() < effectiveYear;
}).length;
const monthlyCounts = new Array(12).fill(0);
library.forEach((e) => {
entries.forEach((e) => {
const d = getEntryDate(e);
if (!d) return;
const date = new Date(d);
@@ -3,7 +3,7 @@ import { useForm } from 'react-hook-form';
import { zodResolver } from '@hookform/resolvers/zod';
import { z } from 'zod';
import { format } from 'date-fns';
import { CalendarIcon, Loader2 } from 'lucide-react';
import { Loader2 } from 'lucide-react';
import {
Dialog,
DialogContent,
@@ -14,12 +14,6 @@ import {
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import {
Popover,
PopoverContent,
PopoverTrigger,
} from '@/components/ui/popover';
import { Calendar } from '@/components/ui/calendar';
import {
Select,
SelectContent,
@@ -27,7 +21,6 @@ import {
SelectTrigger,
SelectValue,
} from '@/components/ui/select';
import { cn } from '@/lib/utils';
import { useCreateEntrySeen, useUpdateEntrySeen } from '@/hooks/useEntrySeen';
import { useCreateEpisodeSeen } from '@/hooks/useEpisodeSeen';
import type { Entry, Season, EntrySeen, SeenAccuracy } from '@/types';
@@ -57,9 +50,6 @@ export function EntrySeenDialog({
mode,
editRecord,
}: EntrySeenDialogProps) {
const [date, setDate] = useState<Date | undefined>(
editRecord?.date_seen ? new Date(editRecord.date_seen) : new Date()
);
const [selectedSeasonId, setSelectedSeasonId] = useState<string>('');
const isTV = entry.is_tvseries;
@@ -196,34 +186,33 @@ export function EntrySeenDialog({
</>
)}
{/* Date picker */}
{/* Date + Accuracy */}
<div className="space-y-2">
<Label>Date Seen</Label>
<Popover>
<PopoverTrigger asChild>
<Button
variant="outline"
className={cn(
'w-full justify-start text-left font-normal',
!date && 'text-muted-foreground'
)}
>
<CalendarIcon className="mr-2 h-4 w-4" />
{date ? format(date, 'PPP') : <span>Pick a date</span>}
</Button>
</PopoverTrigger>
<PopoverContent className="w-auto p-0" align="start">
<Calendar
mode="single"
selected={date}
onSelect={(d) => {
setDate(d);
if (d) setValue('date_seen', format(d, 'yyyy-MM-dd'));
}}
initialFocus
/>
</PopoverContent>
</Popover>
<div className="flex items-center gap-2">
<Input
type="date"
value={watch('date_seen')}
onChange={(e) => {
setValue('date_seen', e.target.value);
setDate(e.target.value ? new Date(e.target.value) : undefined);
}}
className="flex-1"
/>
<Select
value={accuracyValue}
onValueChange={(v) => setValue('accuracy', v as SeenAccuracy)}
>
<SelectTrigger className="w-[120px] shrink-0">
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectItem value="EXACT">Exact</SelectItem>
<SelectItem value="ESTIMATED">Estimated</SelectItem>
<SelectItem value="UNKNOWN">Unknown</SelectItem>
</SelectContent>
</Select>
</div>
{errors.date_seen && (
<p className="text-xs text-destructive">
{errors.date_seen.message}
@@ -237,24 +226,6 @@ export function EntrySeenDialog({
<Input id="seen_with" {...register('seen_with')} placeholder="e.g. John, Jane" />
</div>
{/* Accuracy */}
<div className="space-y-2">
<Label>Date Accuracy</Label>
<Select
value={accuracyValue}
onValueChange={(v) => setValue('accuracy', v as SeenAccuracy)}
>
<SelectTrigger>
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectItem value="EXACT">Exact</SelectItem>
<SelectItem value="ESTIMATED">Estimated</SelectItem>
<SelectItem value="UNKNOWN">Unknown</SelectItem>
</SelectContent>
</Select>
</div>
<DialogFooter>
<Button
type="button"
@@ -91,12 +91,25 @@ export function EpisodeSeenEditDialog({
<div className="space-y-4 py-2">
<div className="space-y-1.5">
<Label htmlFor="date">Date Watched</Label>
<Input
id="date"
type="date"
value={date}
onChange={(e) => setDate(e.target.value)}
/>
<div className="flex items-center gap-2">
<Input
id="date"
type="date"
value={date}
onChange={(e) => setDate(e.target.value)}
className="flex-1"
/>
<Select value={accuracy} onValueChange={(v) => setAccuracy(v as SeenAccuracy)}>
<SelectTrigger className="w-[120px] shrink-0">
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectItem value="EXACT">Exact</SelectItem>
<SelectItem value="ESTIMATED">Estimated</SelectItem>
<SelectItem value="UNKNOWN">Unknown</SelectItem>
</SelectContent>
</Select>
</div>
</div>
<div className="space-y-1.5">
<Label htmlFor="seen-with">Seen With</Label>
@@ -107,19 +120,6 @@ export function EpisodeSeenEditDialog({
placeholder="Optional"
/>
</div>
<div className="space-y-1.5">
<Label>Date Accuracy</Label>
<Select value={accuracy} onValueChange={(v) => setAccuracy(v as SeenAccuracy)}>
<SelectTrigger>
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectItem value="EXACT">Exact</SelectItem>
<SelectItem value="ESTIMATED">Estimated</SelectItem>
<SelectItem value="UNKNOWN">Unknown</SelectItem>
</SelectContent>
</Select>
</div>
</div>
<DialogFooter>
<Button variant="outline" onClick={() => onOpenChange(false)}>Cancel</Button>