fix(templates): show only real templates — drop hardcoded demo fallback
The public templates page and homepage gallery fell back to hardcoded demo templates (VIDEO_TEMPLATES_CATALOG / TEMPLATES) whenever the admin list was empty — so dummy templates showed even though the DB had none. Now both render only real admin-sourced templates (empty when there are none). Categories are untouched (kept as-is). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -15,7 +15,6 @@ import { SectionReveal } from "./SectionReveal";
|
|||||||
import { TemplateCard } from "./TemplateCard";
|
import { TemplateCard } from "./TemplateCard";
|
||||||
import {
|
import {
|
||||||
FILTER_TABS,
|
FILTER_TABS,
|
||||||
TEMPLATES,
|
|
||||||
filterTemplates,
|
filterTemplates,
|
||||||
getTemplateImageSrc,
|
getTemplateImageSrc,
|
||||||
type FilterTab,
|
type FilterTab,
|
||||||
@@ -61,11 +60,8 @@ export function TemplateGallery({ className, adminItems }: TemplateGalleryProps)
|
|||||||
const [activeTab, setActiveTab] = useState<FilterTab>("All");
|
const [activeTab, setActiveTab] = useState<FilterTab>("All");
|
||||||
const [usingTemplateId, setUsingTemplateId] = useState<string | null>(null);
|
const [usingTemplateId, setUsingTemplateId] = useState<string | null>(null);
|
||||||
|
|
||||||
// Use admin items when the service returned data; fall back to hardcoded list
|
// Real admin templates only — no hardcoded demo fallback.
|
||||||
const allItems: TemplateItem[] =
|
const allItems: TemplateItem[] = (adminItems ?? []).map(adminProjectToTemplateItem);
|
||||||
adminItems && adminItems.length > 0
|
|
||||||
? adminItems.map(adminProjectToTemplateItem)
|
|
||||||
: TEMPLATES;
|
|
||||||
|
|
||||||
const filtered = filterTemplates(activeTab, allItems);
|
const filtered = filterTemplates(activeTab, allItems);
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import {
|
|||||||
filterVideoCatalog,
|
filterVideoCatalog,
|
||||||
toProjectTemplate,
|
toProjectTemplate,
|
||||||
VIDEO_SIDEBAR_CATEGORIES,
|
VIDEO_SIDEBAR_CATEGORIES,
|
||||||
VIDEO_TEMPLATES_CATALOG,
|
|
||||||
type AspectRatioFilter,
|
type AspectRatioFilter,
|
||||||
type VideoCatalogTemplate,
|
type VideoCatalogTemplate,
|
||||||
type VideoSidebarCategoryId,
|
type VideoSidebarCategoryId,
|
||||||
@@ -64,11 +63,8 @@ export function VideoTemplatesPageContent({
|
|||||||
}
|
}
|
||||||
}, [categoryParam]);
|
}, [categoryParam]);
|
||||||
|
|
||||||
// Use admin-sourced templates when available, fall back to the demo catalog
|
// Real admin-sourced templates only — no hardcoded demo fallback.
|
||||||
const catalog =
|
const catalog = initialCatalog ?? [];
|
||||||
initialCatalog && initialCatalog.length > 0
|
|
||||||
? initialCatalog
|
|
||||||
: VIDEO_TEMPLATES_CATALOG;
|
|
||||||
|
|
||||||
const filtered = useMemo(
|
const filtered = useMemo(
|
||||||
() =>
|
() =>
|
||||||
|
|||||||
Reference in New Issue
Block a user