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:
soroush.asadi
2026-06-04 00:16:10 +03:30
parent 08d2de8e92
commit 222aa078b1
2 changed files with 4 additions and 12 deletions
+2 -6
View File
@@ -15,7 +15,6 @@ import { SectionReveal } from "./SectionReveal";
import { TemplateCard } from "./TemplateCard";
import {
FILTER_TABS,
TEMPLATES,
filterTemplates,
getTemplateImageSrc,
type FilterTab,
@@ -61,11 +60,8 @@ export function TemplateGallery({ className, adminItems }: TemplateGalleryProps)
const [activeTab, setActiveTab] = useState<FilterTab>("All");
const [usingTemplateId, setUsingTemplateId] = useState<string | null>(null);
// Use admin items when the service returned data; fall back to hardcoded list
const allItems: TemplateItem[] =
adminItems && adminItems.length > 0
? adminItems.map(adminProjectToTemplateItem)
: TEMPLATES;
// Real admin templates only — no hardcoded demo fallback.
const allItems: TemplateItem[] = (adminItems ?? []).map(adminProjectToTemplateItem);
const filtered = filterTemplates(activeTab, allItems);
@@ -22,7 +22,6 @@ import {
filterVideoCatalog,
toProjectTemplate,
VIDEO_SIDEBAR_CATEGORIES,
VIDEO_TEMPLATES_CATALOG,
type AspectRatioFilter,
type VideoCatalogTemplate,
type VideoSidebarCategoryId,
@@ -64,11 +63,8 @@ export function VideoTemplatesPageContent({
}
}, [categoryParam]);
// Use admin-sourced templates when available, fall back to the demo catalog
const catalog =
initialCatalog && initialCatalog.length > 0
? initialCatalog
: VIDEO_TEMPLATES_CATALOG;
// Real admin-sourced templates only — no hardcoded demo fallback.
const catalog = initialCatalog ?? [];
const filtered = useMemo(
() =>