feat: show an "imported from" badge on recipe cards

sourceUrl was already persisted and shown on the recipe detail page, but
never surfaced on cards in the grid/list/compact views or the simpler
RecipeCard (collections) — added a small external-link icon with a
tooltip naming the source hostname, sized identically to the existing
batch-cook badge so it doesn't reintroduce the compact-view alignment
bug fixed earlier this session.
This commit is contained in:
Arnaud
2026-07-12 16:11:26 +02:00
parent d7e0d7eada
commit e98a9c3bb7
4 changed files with 74 additions and 5 deletions
+6 -2
View File
@@ -3,7 +3,7 @@
import Link from "next/link";
import Image from "next/image";
import { useTranslations } from "next-intl";
import { Clock, Users, Lock, Globe, Link2 } from "lucide-react";
import { Clock, Users, Lock, Globe, Link2, ExternalLink } from "lucide-react";
import { Badge } from "@/components/ui/badge";
import { Card, CardContent, CardFooter, CardHeader } from "@/components/ui/card";
import { getPublicUrl } from "@/lib/storage";
@@ -19,6 +19,7 @@ type Recipe = {
visibility: "private" | "unlisted" | "public";
updatedAt: Date;
photos?: Array<{ storageKey: string; isCover: boolean }>;
sourceUrl?: string | null;
};
const VISIBILITY_ICON = {
@@ -85,7 +86,10 @@ export function RecipeCard({ recipe }: { recipe: Recipe }) {
</Badge>
)}
</div>
<VisibilityIcon className="h-3 w-3" />
<div className="flex items-center gap-2 shrink-0">
{recipe.sourceUrl && <ExternalLink className="h-3 w-3" />}
<VisibilityIcon className="h-3 w-3" />
</div>
</CardFooter>
</Card>
</Link>