merge new_starr_app@qas history into apps/web

git-subtree-dir: apps/web
git-subtree-mainline: eaa6d2276a
git-subtree-split: 459af9d46a
This commit is contained in:
2026-08-24 12:21:16 +08:00
699 changed files with 103969 additions and 0 deletions
@@ -0,0 +1,97 @@
// components/admin/advertisements/AdvertisementPreview.jsx
import { ChevronLeft, ChevronRight, Megaphone } from "lucide-react";
import { Badge } from "@/components/ui/badge";
import { Card, CardContent } from "@/components/ui/card";
import { Button } from "@/components/ui/button";
import { Progress } from "@/components/ui/progress";
// ── AdvertisementPreview ─────────────────────────────────────────────────────
/**
* Live, presentational preview of a single ad slide as it will actually
* render inside the real Hero/Banner carousel (see components/generic/Blocks/
* Client/Advertisements/{Hero,Banner}.jsx) — same image + gradient overlay +
* bottom-left badge/headline/description layout, just scaled down for the
* admin form. The prev/next/progress chrome below the slide is static (no
* real carousel behind it, since there's only ever one slide to preview) —
* it's there purely so the admin recognizes this as "inside a carousel."
*
* Props:
* format — "hero" | "banner", determines slide height/typography
* badgeLabels — string[]
* headline — string
* description — string
* imageSrc — resolved image URL, or null/undefined
*/
export function AdvertisementPreview({ format = "hero", badgeLabels, headline, description, imageSrc }) {
const isHero = format !== "banner";
const labels = Array.isArray(badgeLabels) ? badgeLabels.filter(Boolean) : [];
return (
<div>
<p className="text-xs text-muted-foreground mb-2">
Preview — this is how it will appear in the carousel.
</p>
<Card className={cnRounded(isHero)}>
<CardContent className={cnHeight(isHero) + " relative bg-muted flex items-center justify-center p-0"}>
{imageSrc ? (
<img
src={imageSrc}
alt={headline || "Advertisement preview"}
className="absolute inset-0 w-full h-full object-cover"
/>
) : (
<Megaphone className="size-6 text-muted-foreground" />
)}
<div className="absolute inset-0 bg-gradient-to-t from-black/90 via-black/50 to-transparent" />
<div className="absolute bottom-0 left-0 p-4 flex flex-col gap-2 max-w-[85%]">
{labels.length > 0 && (
<div className="flex items-center gap-1.5 flex-wrap">
{labels.map((label, i) => (
<Badge key={i} variant="outline" className="pointer-events-none select-none w-fit border-white/30 bg-black/20 text-white">
<Megaphone /> {label}
</Badge>
))}
</div>
)}
{headline && (
<div className={(isHero ? "text-xl" : "text-lg") + " font-bold text-white leading-tight tracking-tight"}>
{headline}
</div>
)}
{description && (
<p className="text-gray-200 text-xs leading-relaxed line-clamp-2">
{description}
</p>
)}
</div>
</CardContent>
</Card>
{/* Static carousel chrome — communicates "this sits inside a carousel," not functional */}
<div className="flex items-center justify-between mt-3">
<div className="flex items-center gap-2">
<Button variant="outline" size="icon-sm" className="rounded-lg" disabled>
<ChevronLeft />
</Button>
<Button variant="outline" size="icon-sm" className="rounded-lg" disabled>
<ChevronRight />
</Button>
</div>
<div className="flex-1 max-w-24 ml-4">
<Progress value={100} className="h-2" />
</div>
</div>
</div>
);
}
function cnRounded(isHero) {
return "border overflow-hidden pl-0 py-0 " + (isHero ? "rounded-2xl" : "rounded-xl");
}
function cnHeight(isHero) {
return isHero ? "h-56" : "h-48";
}