fix: reklam kreatiflerini Apify verisinden goster

This commit is contained in:
2026-08-09 07:05:56 +03:00
parent 0ade96903d
commit b7fa66d04c
8 changed files with 144 additions and 47 deletions
+25
View File
@@ -0,0 +1,25 @@
import { MediaType } from "@prisma/client";
type Creative = {
type: MediaType;
url: string;
thumbnailUrl?: string | null;
};
export function AdCreativeMedia({ creative, className }: { creative?: Creative | null; className?: string }) {
const classes = className || "h-44 w-full rounded-2xl object-cover";
if (!creative) {
return <div className={`${classes} grid place-items-center bg-slate-100 text-sm font-semibold text-slate-400`}>Kreatif bulunamadı</div>;
}
if (creative.type === MediaType.VIDEO) {
return (
<video controls playsInline preload="metadata" poster={creative.thumbnailUrl || undefined} className={classes}>
<source src={creative.url} />
Tarayıcınız video oynatmayı desteklemiyor.
</video>
);
}
return <img src={creative.thumbnailUrl || creative.url} alt="Reklam kreatifi" loading="lazy" className={classes} />;
}