'use client'; import React, { useEffect, useState } from 'react'; import Link from 'next/link'; import { Mail, MapPin, Phone, Smartphone, Wrench } from 'lucide-react'; import { AnnouncementBar } from '@/layout/AnnouncementBar'; import { Header } from '@/layout/Header'; import { Navbar } from '@/layout/Navbar'; import { Footer } from '@/layout/Footer'; import { StickyHeaderSpacer } from '@/components/StickyHeaderSpacer'; import { FloatingButtons } from '@/components/FloatingButtons'; import { storefrontService, type FooterInfo, type StorefrontSettings, MOCK_FOOTER_INFO, } from '@/services/api/storefrontService'; export default function AboutPage() { const [footer, setFooter] = useState(MOCK_FOOTER_INFO); const [settings, setSettings] = useState({ store_name: 'iFixKart' }); const [layoutSections, setLayoutSections] = useState([]); useEffect(() => { let cancelled = false; Promise.all([ storefrontService.getFooterInfo(), storefrontService.getSettings(), storefrontService.getPageLayout('about'), ]).then(([info, store, layout]) => { if (cancelled) return; if (info) setFooter(info); if (store) setSettings(store); if (layout && layout.length > 0) setLayoutSections(layout); }); return () => { cancelled = true; }; }, []); const storeName = settings.store_name || 'iFixKart'; const heroSec = layoutSections.find((s) => s.region === 'about_hero' || s.type === 'about_hero'); const featuresSec = layoutSections.find((s) => s.region === 'about_features' || s.type === 'about_features'); const contactSec = layoutSections.find((s) => s.region === 'about_contact' || s.type === 'about_contact'); const pageTitle = heroSec?.title || 'About Us'; const pageSubtitle = heroSec?.subtitle || ''; const heroMeta = heroSec?.metadata || heroSec?.metadata_json || {}; const storyParagraphs: string[] = Array.isArray(heroMeta.story_paragraphs) && heroMeta.story_paragraphs.length > 0 ? heroMeta.story_paragraphs : [ `${storeName} sells tested refurbished phones and accessories, and books device repairs. You can shop online, get a screen or battery replaced, or exchange the phone you already have.`, `Repairs are done at our Bengaluru service center or at your doorstep. Refurbished phones are checked before listing and sold with a limited warranty.`, ]; const featureCards: any[] = Array.isArray(featuresSec?.metadata?.cards || featuresSec?.metadata_json?.cards) && (featuresSec?.metadata?.cards || featuresSec?.metadata_json?.cards).length > 0 ? (featuresSec?.metadata?.cards || featuresSec?.metadata_json?.cards) : [ { id: '1', title: 'Shop', desc: 'Refurbished phones, spare parts, and accessories.', link: '/shop', icon: 'smartphone' }, { id: '2', title: 'Repair', desc: 'Screens, batteries, charging ports, and other common jobs.', link: '/repair-services', icon: 'wrench' }, ]; const contactMeta = contactSec?.metadata || contactSec?.metadata_json || {}; const phone = contactMeta.phone || footer.phone || settings.support_phone || ''; const email = contactMeta.email || footer.email || ''; const address = contactMeta.address || footer.address || ''; const hours = contactMeta.hours || ''; return (

{pageTitle}

{pageSubtitle ? (

{pageSubtitle}

) : null} {storyParagraphs.map((para, i) => (

{para}

))}
{featureCards.map((card, i) => { const isRepair = (card.icon || '').toLowerCase().includes('wrench') || (card.title || '').toLowerCase().includes('repair'); const to = card.link || (isRepair ? '/repair-services' : '/shop'); return ( {isRepair ? ( ) : ( )}

{card.title}

{card.desc}

); })}
{address ? (

{address}

) : null} {hours ? (
⏱

{hours}

) : null} {phone ? ( {phone} ) : null} {email ? ( {email} ) : null}
); }