mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
32 lines
2.0 KiB
JavaScript
32 lines
2.0 KiB
JavaScript
// data/placement.data.js
|
|
//
|
|
// Mirrors the backend placement registry (models/advertisements/advertisements.placements.js
|
|
// in new_starr). Each entry is a page + position slot; the format (hero/banner/popup/sidebar)
|
|
// is derived from the placement, never chosen independently. Keep this list in sync with the
|
|
// backend registry when adding a new placement — same pattern as ADVERTISEMENT_TYPES already
|
|
// mirroring the backend type ENUM.
|
|
|
|
// TODO(ads-1): Re-categorize placements — Hero -> Dashboard, Banner -> Tier Plans.
|
|
// Remove the "popup" and "sidebar" formats entirely (dashboard.popup,
|
|
// course_details.sidebar). Keep in sync with the backend registry at
|
|
// new_starr/models/advertisements/advertisements.placements.js.
|
|
export const PLACEMENTS = [
|
|
{ key: "dashboard.hero", format: "hero", page: "dashboard", pageLabel: "Dashboard", slotLabel: "Hero (top of page)" },
|
|
{ key: "dashboard.popup", format: "popup", page: "dashboard", pageLabel: "Dashboard", slotLabel: "Popup (on load)" },
|
|
{ key: "course_list.banner", format: "banner", page: "course_list", pageLabel: "Courses", slotLabel: "Banner (above course grid)" },
|
|
{ key: "course_details.banner", format: "banner", page: "course_details", pageLabel: "Course Details", slotLabel: "Banner (below hero)" },
|
|
{ key: "course_details.sidebar", format: "sidebar", page: "course_details", pageLabel: "Course Details", slotLabel: "Sidebar (beside course content)" },
|
|
{ key: "plans.banner", format: "banner", page: "plans", pageLabel: "Plans", slotLabel: "Banner (above plan cards)" },
|
|
];
|
|
|
|
export const PLACEMENT_MAP = Object.fromEntries(PLACEMENTS.map((p) => [p.key, p]));
|
|
|
|
// Grouped by page — powers the cascading Page → Position picker in Add/EditAdvertisement.
|
|
export const AD_PAGES = Object.values(
|
|
PLACEMENTS.reduce((acc, p) => {
|
|
if (!acc[p.page]) acc[p.page] = { page: p.page, pageLabel: p.pageLabel, placements: [] };
|
|
acc[p.page].placements.push(p);
|
|
return acc;
|
|
}, {})
|
|
);
|