"use client"; import Image from "next/image"; import Link from "next/link"; import { useState } from "react"; import type { BusinessDetail, BusinessTabId } from "@/data/business"; import { businessTabs } from "@/data/business"; import styles from "./BusinessDetail.module.css"; function Stars({ rating }: { rating: string }) { return (
{Array.from({ length: 5 }, (_, i) => ( ★ ))} {rating}
); } function CategoryPills({ items, active, onChange, }: { items: string[]; active: string; onChange: (value: string) => void; }) { return (
{items.map((item) => ( ))}
); } function FiltersBar({ fields, tags, }: { fields: { label: string; value: string }[]; tags: { label: string; value: string }[]; }) { return ( <>
Filters A better focus
{fields.map((field) => ( ))}
{tags.length ? (
{tags.map((tag) => ( {tag.label}: {tag.value} ))}
) : null} ); } export default function BusinessDetailView({ business, }: { business: BusinessDetail; }) { const [tab, setTab] = useState("products"); const [productCategory, setProductCategory] = useState("All"); const [blogCategory, setBlogCategory] = useState("All"); const [portfolioCategory, setPortfolioCategory] = useState("All"); const [hoveredPortfolio, setHoveredPortfolio] = useState( business.portfolios[2]?.id ?? null, ); const products = productCategory === "All" ? business.products : business.products.filter((p) => p.category === productCategory); return (

{business.name}

{business.name}

{business.tagline}

since {business.since}
province {business.province}
{business.activeProducts} active
product
Telephone {business.telephone}

{business.description}

{tab === "products" ? ( <>
{products.map((product) => (

{product.title}

{product.minOrder} pcs, min
order
{product.shipsIn} days
to ship
))}
) : null} {tab === "contact" ? (
⌖
Address

{business.contact.address}

☎
land line

{business.contact.landlines.join(" , ")}

{business.contact.socials.map((social) => ( {social.network} {social.handle} ))}
Business location map
) : null} {tab === "blog" ? ( <>
{business.posts.map((post) => (

{post.title}

{post.excerpt}

{post.date} {post.author}
))}
) : null} {tab === "gallery" ? (
{business.gallery.map((item) => (
))}
) : null} {tab === "portfolios" ? ( <>
{business.portfolios.map((item) => { const showOverlay = hoveredPortfolio === item.id || (hoveredPortfolio === null && item.id === business.portfolios[2]?.id); return ( setHoveredPortfolio(item.id)} onMouseLeave={() => setHoveredPortfolio(null)} >

{item.title}

{item.description}

); })}
) : null}
); }