ifixkart-storefront/lib/homepageDefaults.ts

209 lines
7 KiB
TypeScript

/**
* Homepage section defaults aligned with
* ikixkart-dashboard storefront-sections INITIAL_SECTIONS (page: home).
* Used when CMS metadata is empty but the section is Visible.
*/
import { TECHSHOP_HOME_ORDER } from './techshopHome';
export const HOMEPAGE_SECTION_KEYS = [
...TECHSHOP_HOME_ORDER.map((s) => s.key),
'announcement_bar',
'nav_links',
] as const;
export type HomepageSectionKey = (typeof HOMEPAGE_SECTION_KEYS)[number];
/** Default Visible=true for every homepage section (matches admin INITIAL_SECTIONS). */
export const DEFAULT_SECTION_ACTIVE: Record<string, boolean> =
Object.fromEntries(HOMEPAGE_SECTION_KEYS.map((k) => [k, true]));
export const DEFAULT_HERO_SLIDES = [
{
id: '1',
badge: 'Limited Time Offer',
title: 'Ultimate Virtual Reality\nExperience Box',
subtitle: 'Experience the Future of Entertainment Today',
image: '',
buttonText: 'Shop Now',
buttonUrl: '/shop',
gradient: 'from-[#0b1b3a] via-[#12356f] to-[#1976F3]',
},
{
id: '2',
badge: 'Exclusive Launch',
title: 'Next-Gen Performance\nPro Gaming Gear',
subtitle: 'Unleash Your Full Creative Power Everywhere',
image: '',
buttonText: 'Shop Now',
buttonUrl: '/shop',
gradient: 'from-slate-950 via-blue-950 to-[#1565C0]',
},
{
id: '3',
badge: 'Hot Deal',
title: 'Smart Wearables\nFor Everyday Life',
subtitle: 'Track fitness, stay connected, look sharp',
image: '',
buttonText: 'Explore Now',
buttonUrl: '/shop',
gradient: 'from-[#071428] via-[#0d2f66] to-[#1e88e5]',
},
];
export const DEFAULT_PROMO_CARDS: any[] = [];
export const DEFAULT_PROMO_BANNERS: any[] = [];
export const DEFAULT_TRUST_FEATURES = [
{ title: 'Free Shipping', desc: 'On orders over ₹1,000', icon: 'Truck' },
{ title: 'Flexible & Easy Return', desc: 'Return within 14 days', icon: 'RefreshCcw' },
{ title: '24/7 Support Services', desc: 'Any Time Customer Support', icon: 'Headphones' },
{ title: 'Secure payment', desc: '100% Fast & Secure Payment', icon: 'CreditCard' },
];
export const DEFAULT_BLOG_ARTICLES = [
{
id: 'b-1',
title: 'iPhone Screen Replacement: What To Expect Before You Book',
excerpt:
'From original vs compatible glass to turnaround time and warranty — a clear guide before you book a doorstep screen repair.',
date: '10 Sep 2026',
author: 'iFixKart Staff',
readTime: '5 min read',
image:
'https://images.unsplash.com/photo-1511707171634-5f897ff02aa9?w=800&auto=format&fit=crop&q=80',
link: '/blog/iphone-screen-replacement-what-to-expect',
},
{
id: 'b-2',
title: 'How We Test Refurbished Phones Before They Go On Sale',
excerpt:
'Every listed device is checked for display, battery, cameras, charging, and connectivity.',
date: '8 Sep 2026',
author: 'Quality Team',
readTime: '6 min read',
image:
'https://images.unsplash.com/photo-1580910051074-3eb694886505?w=800&auto=format&fit=crop&q=80',
link: '/blog/how-we-test-refurbished-phones',
},
{
id: 'b-3',
title: 'Best Budget Phones Under ₹20,000 In India Right Now',
excerpt:
'A practical shortlist for everyday Android phones — battery, cameras, and software support.',
date: '6 Sep 2026',
author: 'Editorial',
readTime: '7 min read',
image:
'https://images.unsplash.com/photo-1511707171634-5f897ff02aa9?w=800&auto=format&fit=crop&q=80',
link: '/blog/best-budget-phones-under-20000',
},
{
id: 'b-4',
title: 'When Should You Replace A Phone Battery?',
excerpt:
'If the phone dies by evening or shuts down at 20%, a battery swap is often cheaper than a new device.',
date: '3 Sep 2026',
author: 'Repair Desk',
readTime: '4 min read',
image:
'https://images.unsplash.com/photo-1583863788434-e58a36330cf0?w=800&auto=format&fit=crop&q=80',
link: '/blog/when-to-replace-a-phone-battery',
},
];
export const DEFAULT_ANNOUNCEMENT_LINKS = [
{ label: 'Track Order', url: '/services/tracking', icon: 'package' },
{ label: 'About Us', url: '/about' },
{ label: 'Blog', url: '/blog' },
{ label: 'Contact Us', url: '/contact' },
{ label: 'FAQs', url: '/faqs' },
];
export const DEFAULT_NAV_LINKS = [
{ label: 'Home', url: '/' },
{ label: 'Shop', url: '/shop', hasDropdown: true },
{ label: 'Service', url: '/repair-services' },
{ label: 'Top Deals', url: '/shop?tag=deals', hasDropdown: true },
{ label: 'Featured Products', url: '/shop?featured=true', hasDropdown: true },
];
export const DEFAULT_SECTION_TITLES: Record<string, { title: string; subtitle: string }> = {
hero_slider: {
title: 'Next-Gen Electronics & OEM Repair Hub',
subtitle: 'Up to 40% Off on Top Smartphones, Laptops & Certified Spare Parts',
},
promo_cards: {
title: 'Top Category Promos',
subtitle: 'Featured discounts on VR boxes, audio gear, and accessories',
},
featured_categories: {
title: 'Shop By Categories',
subtitle: 'Explore high-performance electronics and replacement hardware',
},
editorial_story: {
title: 'New Arrivals Products',
subtitle: 'Explore the latest smartphones, accessories, and certified OEM spare parts',
},
promo_banners: {
title: 'Featured Banners',
subtitle: 'Spotlight on sound systems and power banks',
},
deal_of_the_day: {
title: 'Deals Of The Day',
subtitle: 'Limited-time discounts on certified OEM screens & batteries',
},
recently_launched: {
title: 'Recently Launched',
subtitle: 'Latest smartphone accessories & travel gear',
},
official_brands: {
title: 'Official Tech Brands',
subtitle: 'Authorized brand partners',
},
ultimate_tech: {
title: 'Ultimate Tech Gadgets',
subtitle: 'High-end smart home appliances, wearables, and audio gear',
},
tech_blog: {
title: 'From Our Articles',
subtitle: 'Latest tech news, repair guides, and trends',
},
trust_badges: {
title: 'Certified Quality Guarantee',
subtitle: 'Free Shipping, 1-Year Warranty & 24/7 Technical Support',
},
announcement_bar: {
title: 'Top Navigation Links',
subtitle: 'Links displayed in the announcement bar above the header',
},
nav_links: {
title: 'Main Navigation Menu',
subtitle: 'Links displayed in the primary navigation bar',
},
};
/** Normalize metadata from either public `metadata` or admin `metadata_json`. */
export function getSectionMeta(config?: any): Record<string, any> {
if (!config) return {};
let raw = config.metadata_json ?? config.metadata ?? {};
if (typeof raw === 'string') {
try {
raw = JSON.parse(raw);
} catch {
return {};
}
}
return raw && typeof raw === 'object' ? raw : {};
}
export function getSectionTitle(config: any, key: string, fallback?: string): string {
if (config?.title && String(config.title).trim()) return String(config.title);
return (
fallback ||
DEFAULT_SECTION_TITLES[key]?.title ||
key
);
}