fix(content): update conditional checks to use mimeType for content rendering

- Replaced `type` field checks with `mimeType.startsWith("image/")` for improved accuracy in `content-card` and admin content page components.
- Adjusted `CardContent` background color for better visual consistency.
This commit is contained in:
Mathis HERRIOT
2026-01-21 09:41:11 +01:00
parent de7d41f4a1
commit 70a4249e41
2 changed files with 4 additions and 3 deletions

View File

@@ -98,7 +98,7 @@ export default function AdminContentsPage() {
<TableCell className="font-medium"> <TableCell className="font-medium">
<div className="flex items-center gap-3"> <div className="flex items-center gap-3">
<div className="flex h-10 w-10 items-center justify-center rounded bg-muted"> <div className="flex h-10 w-10 items-center justify-center rounded bg-muted">
{content.type === "meme" ? ( {content.mimeType.startsWith("image/") ? (
<ImageIcon className="h-5 w-5 text-muted-foreground" /> <ImageIcon className="h-5 w-5 text-muted-foreground" />
) : ( ) : (
<Video className="h-5 w-5 text-muted-foreground" /> <Video className="h-5 w-5 text-muted-foreground" />

View File

@@ -71,6 +71,7 @@ export function ContentCard({ content }: ContentCardProps) {
} }
}; };
return ( return (
<Card className="overflow-hidden border-none shadow-sm hover:shadow-md transition-shadow"> <Card className="overflow-hidden border-none shadow-sm hover:shadow-md transition-shadow">
<CardHeader className="p-4 flex flex-row items-center space-y-0 gap-3"> <CardHeader className="p-4 flex flex-row items-center space-y-0 gap-3">
@@ -93,9 +94,9 @@ export function ContentCard({ content }: ContentCardProps) {
<MoreHorizontal className="h-4 w-4" /> <MoreHorizontal className="h-4 w-4" />
</Button> </Button>
</CardHeader> </CardHeader>
<CardContent className="p-0 relative bg-zinc-100 dark:bg-zinc-900 aspect-square flex items-center justify-center"> <CardContent className="p-0 relative bg-zinc-200 dark:bg-zinc-900 aspect-square flex items-center justify-center">
<Link href={`/meme/${content.slug}`} className="w-full h-full relative"> <Link href={`/meme/${content.slug}`} className="w-full h-full relative">
{content.type === "meme" ? ( {content.mimeType.startsWith("image/") ? (
<Image <Image
src={content.url} src={content.url}
alt={content.title} alt={content.title}