Implemented the new react version of the frontend

This commit is contained in:
Mohammed Abad committed 2026-03-31 01:56:38 +01:00
1 parent 236e6e06fb
commit ffe7e52527
65 files changed
+5228 -177

No files matched your search

@@ -0,0 +1,80 @@
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)[];
onEdit?: (id: number) => void;
onDelete?: (id: number) => void;
}
export function EpisodeWatchHistory({
watchHistory,
onEdit,
onDelete,
}: EpisodeWatchHistoryProps) {
if (watchHistory.length === 0) {
return (
<p className="text-sm text-muted-foreground">No watch history yet.</p>
);
}
return (
<div className="space-y-3">
<h3 className="text-lg font-semibold">Watch History</h3>
<div className="overflow-x-auto rounded-lg border border-border">
<table className="w-full text-sm">
<thead>
<tr className="border-b border-border bg-muted/50">
<th className="px-4 py-2 text-left font-medium">Date</th>
<th className="px-4 py-2 text-left font-medium">Seen With</th>
<th className="px-4 py-2 text-right font-medium">Actions</th>
</tr>
</thead>
<tbody>
{watchHistory.map((record) => (
<tr
key={record.id}
className="border-b border-border last:border-0"
>
<td className="px-4 py-2">
{record.date_seen
? format(new Date(record.date_seen), 'MMM d, yyyy')
: '-'}
</td>
<td className="px-4 py-2 text-muted-foreground">
{record.seen_with || '-'}
</td>
<td className="px-4 py-2">
<div className="flex justify-end gap-1">
{onEdit && (
<Button
size="icon"
variant="ghost"
className="h-7 w-7"
onClick={() => onEdit(record.id)}
>
<Pencil className="h-3 w-3" />
</Button>
)}
{onDelete && (
<Button
size="icon"
variant="ghost"
className="h-7 w-7 text-destructive"
onClick={() => onDelete(record.id)}
>
<Trash2 className="h-3 w-3" />
</Button>
)}
</div>
</td>
</tr>
))}
</tbody>
</table>
</div>
</div>
);
}