"use client"; import { useEffect, useState, useMemo } from "react"; import Link from "next/link"; import { motion } from "framer-motion"; import StorefrontHeader from "@/components/storefront/StorefrontHeader"; import StorefrontFooter from "@/components/storefront/StorefrontFooter"; import LayoutContainer from "@/components/layout/LayoutContainer"; import { getBrandSettingsPublic } from "@/actions/brand-settings"; type FAQCategory = { category: string; items: FAQItem[]; }; type FAQItem = { question: string; answer: string }; function buildFaqCategories(phone: string): FAQCategory[] { return [ { category: "Ordering & Pickup", items: [ { question: "How does preordering work?", answer: "Select your preferred pickup stop from our schedule, then browse our available products. Add items to your cart and select your stop at checkout. Preordering helps us know how much to bring to each stop — and ensures you get what you want." }, { question: "When do I need to order by?", answer: "We recommend ordering at least 2 days before your selected pickup date. Orders placed after the cutoff may still be accepted if space allows — contact us to check." }, { question: "Can I change my pickup stop after ordering?", answer: "Yes — as long as your order hasn't been marked 'fulfilled,' contact us and we can move your order to a different stop. Log into the portal or call us to make the change." }, { question: "What if I need to cancel my order?", answer: `Contact us at least 24 hours before your pickup date for a full refund. Cancellations within 24 hours may be subject to a 50% fee. Email Info@indianriverdirect.com or call ${phone}.` }, ], }, { category: "Product & Season", items: [ { question: "What citrus is available when?", answer: "Our season runs year-round with different fruits at different times: Navels (Dec–Mar), Ruby Red Grapefruit (Jan–Apr), Honeybells (Jan–Feb), Super Sweet Tangerines (Jan–Mar), Temples (Mar–Apr), Peaches (Jun–Aug), Blueberries (Jun–Jul). Check the homepage or contact us for this season's exact availability." }, { question: "Do you offer organic citrus?", answer: "Our growers use integrated pest management and sustainable farming practices. Some items may be certified organic — contact us for current availability and certifications." }, { question: "How do I store my citrus after pickup?", answer: "Citrus should be stored in the refrigerator to maintain freshness. Most varieties keep 1–2 weeks when refrigerated. Do not freeze citrus unless you plan to use it in cooking." }, { question: "Why are some items by preorder only?", answer: "Preordering helps us manage inventory and ensures we bring enough product to each stop. Preordered items are prioritized for fulfillment — if you show up without preordering, some items may sell out." }, ], }, { category: "Shipping & Delivery", items: [ { question: "Can I have my order shipped instead of picked up?", answer: `Currently we offer pickup-only ordering through this site. For bulk or wholesale shipping inquiries, please contact us directly at ${phone}.` }, { question: "Do you deliver to my area?", answer: "We operate pickup stops across the Southeast and Midwest — Ohio, Indiana, Kentucky, West Virginia, Wisconsin, and Illinois. Enter your ZIP code on our homepage to find stops near you. We do not offer residential delivery." }, { question: "What if no stops are near me?", answer: "If you don't see any stops near your location, we're not currently serving your area. Contact us and we can note your interest for future route expansion. Wholesale customers may also qualify for direct delivery." }, ], }, { category: "Wholesale", items: [ { question: "How do I apply for a wholesale account?", answer: "Visit /wholesale/register to apply. We review applications and typically respond within 1–2 business days. Wholesale accounts are available to retailers, restaurants, farm stands, and other businesses." }, { question: "Is there a minimum order for wholesale?", answer: "Minimum wholesale order is $150 per order. We also require orders to meet a per-item minimum in some categories. Contact us for details." }, { question: "Do you offer recurring standing orders?", answer: "Yes — wholesale accounts can set up recurring orders for weekly or biweekly delivery to their stop. Contact your wholesale representative to set up a standing order schedule." }, ], }, ]; } const DEFAULT_PHONE = "772-971-4484"; function FAQAccordion({ items, searchQuery }: { items: FAQItem[]; searchQuery: string }) { const [open, setOpen] = useState(null); const filtered = useMemo(() => { if (!searchQuery.trim()) return items; const q = searchQuery.toLowerCase(); return items.filter( (item) => item.question.toLowerCase().includes(q) || item.answer.toLowerCase().includes(q) ); }, [items, searchQuery]); if (filtered.length === 0) { return (

No results for "{searchQuery}"

Try a different term or browse all categories below.

); } return (
{filtered.map((item) => { const isOpen = open === item.question; return (

{item.answer}

); })}
); } export default function IndianRiverFAQPage() { const [faqCategories, setFaqCategories] = useState(buildFaqCategories(DEFAULT_PHONE)); const [searchQuery, setSearchQuery] = useState(""); useEffect(() => { getBrandSettingsPublic("indian-river-direct").then((result) => { if (result.success && result.settings?.phone) { setFaqCategories(buildFaqCategories(result.settings.phone)); } }); }, []); return (
{/* Page header */}

Questions

FAQ

Everything you need to know about ordering, pickup, and our seasonal fruits.

{/* Search input */}
setSearchQuery(e.target.value)} className="w-full rounded-2xl border-2 border-stone-200 bg-white px-12 py-4 text-base text-stone-900 placeholder:text-stone-400 outline-none focus:border-blue-400 focus:ring-2 focus:ring-blue-400/20 transition-colors shadow-lg" /> {searchQuery && ( )}
{/* FAQ categories */}
{faqCategories.map((cat) => (

{cat.category}

))}
{/* Still have questions CTA */}
{/* Decorative elements */}

Still have questions?

We're happy to help — reach out anytime.

Contact Us
); }