/* Down The Cove homepage — chrome: promo, header, quick-nav, tab bar, toast */
const Icon = window.DtcIcon;
function PromoBar({ promo, onClose, onShop }) {
if (!promo) return null;
return (
Father's Day · gifts dads actually use — order by Thu 18 June
);
}
function Header({ stuck, cartCount, wishCount, onSearch, onCart, onTab }) {
return (
{ e.preventDefault(); onTab("home"); }}>
{ if (e.key === "Enter") onSearch(); }}>
Search the cove — gifts, gear, guides…
/
{ if (e.key === "Enter") onSearch(); }}>
What are you after today?
);
}
function QuickNav({ items, active, onPick }) {
return (
);
}
function BottomTabBar({ active, cartCount, onTab, onCart }) {
const tabs = [
{ id: "home", label: "Home", icon: "waves" },
{ id: "shop", label: "Shop", icon: "shopping-bag" },
{ id: "guides", label: "Guides", icon: "anchor" },
{ id: "account", label: "Account", icon: "user" },
];
return (
);
}
function Toast({ show, text }) {
return (
{text}
);
}
/* ── Desktop nav row — two-pane mega-menus with hover intent ── */
const WORLD_BLURBS = {
"Fishing Gear": "Rods, reels & tackle for UK shores",
"Cook Shop": "Seafood tools & proper kitchen kit",
"Food Smoking": "Ovens, wood chips & smoking kits",
"Home Decor": "Coastal living, art & gifts",
"Coastal": "Crabbing, safety & days by the sea",
};
const KNOWLEDGE_BLURBS = {
Fishing: "How-tos, marks and methods for UK sea fishing.",
Fish: "Species guides — what it is, where it lives, how to catch it.",
Recipes: "Cook the catch — simple, honest coastal recipes.",
Seafood: "Buying, prepping and cooking fish & shellfish.",
Foraging: "Safe, seasonal foraging along the shoreline.",
Smoking: "Hot & cold smoking at home, from first kit to pro.",
Places: "Cornish harbours, beaches and coastal spots worth the trip.",
Stories: "Cornwall's history, sea songs and salty tales.",
};
function DesktopNav() {
const M = window.DTC.MENU;
const K = window.DTC.KNOWLEDGE_MENU;
const L = window.DTC.NAV_LINKS;
const [open, setOpen] = React.useState(null); // 'collections' | 'knowledge' | 'offers'
const [wi, setWi] = React.useState(0); // active world in Collections
const [ki, setKi] = React.useState(0); // active category in Knowledge
const closeT = React.useRef(null);
const enter = (k) => { clearTimeout(closeT.current); if (open !== k) { setOpen(k); setWi(0); setKi(0); } };
const hold = () => clearTimeout(closeT.current);
const leave = () => { clearTimeout(closeT.current); closeT.current = setTimeout(() => setOpen(null), 160); };
const w = M[wi];
const k = K[ki];
return (
);
}
/* ── Mobile menu sheet — Shop = 5 worlds → sub-menus; Guides = knowledge ── */
function MenuSheet({ kind, onClose, onBrowsePreview }) {
const [openAcc, setOpenAcc] = React.useState(null);
React.useEffect(() => { setOpenAcc(null); }, [kind]);
if (!kind) return null;
const L = window.DTC.NAV_LINKS;
const isShop = kind === "shop";
const rows = isShop ? window.DTC.MENU : window.DTC.KNOWLEDGE_MENU;
return (
{isShop ? "Shop the cove" : "Knowledge & guides"}
{isShop ? (
) : (
)}
{rows.map((r) => {
const open = openAcc === r.title;
return (
);
})}
);
}
Object.assign(window, { PromoBar, Header, QuickNav, BottomTabBar, Toast, DesktopNav, MenuSheet });