import { useState } from 'react'; import { Link } from 'react-router-dom'; import { useBrand } from '../context/BrandContext'; import RegisterBusinessModal from '../components/RegisterBusinessModal'; import apiClient from '../api/client'; const NAV_CARDS = [ { to: '/events', label: 'Events', icon: '⚑', desc: 'Manage order events and generate templates' }, { to: '/templates', label: 'Templates', icon: 'πŸ“„', desc: 'Review and configure approved templates' }, { to: '/providers', label: 'Providers', icon: '🏒', desc: 'Save your SMS provider DLT details' }, ]; function DeleteConfirmModal({ brandName, onCancel, onConfirm, deleting }) { return (
πŸ—‘

Delete Brand?

This will permanently delete {brandName} and all associated events, templates, and images. This cannot be undone.

); } export default function Brand() { const { brand, loading, refetch } = useBrand(); const [showModal, setShowModal] = useState(false); const [showDeleteConfirm, setShowDeleteConfirm] = useState(false); const [deleting, setDeleting] = useState(false); const [deleteError, setDeleteError] = useState(''); async function handleDelete() { setDeleting(true); setDeleteError(''); try { await apiClient.delete('/api/brand'); setShowDeleteConfirm(false); await refetch(); } catch (err) { setDeleteError(err.response?.data?.error || 'Failed to delete brand'); setDeleting(false); } } if (loading) { return (
); } // β€” WELCOME SCREEN β€” if (!brand) { return (
S

SMS Template Extension

Generate TRAI-compliant SMS templates for your Fynd store. We'll scrape your website and use AI to extract your brand context automatically.

{showModal && { setShowModal(false); refetch(); }} />}
); } // β€” BRAND DETAIL PAGE β€” return (
{/* Brand header card */}

{brand.brandName}

{brand.domain}

{brand.tone} Registered {new Date(brand.scrapedAt).toLocaleDateString('en-IN', { day: 'numeric', month: 'short', year: 'numeric' })}
{/* Taglines */} {brand.taglines?.length > 0 && (

Taglines

{brand.taglines.map((t, i) => (

"{t}"

))}
)} {/* Colors */} {brand.colors?.length > 0 && (

Brand Colors

{brand.colors.map((c, i) => (
{c}
))}
)}
{/* Brand images */} {brand.relevantImagePaths?.length > 0 && (

Brand Images

{brand.relevantImagePaths.map((url, i) => (
{`brand { e.target.style.opacity = '0.3'; }} />

{url}

))}
)} {/* Navigation cards */}
{NAV_CARDS.map(card => (
{card.icon}

{card.label}

{card.desc}

))}
{deleteError && (

{deleteError}

)}
{showDeleteConfirm && ( setShowDeleteConfirm(false)} onConfirm={handleDelete} deleting={deleting} /> )}
); }