"use client";
import { useReducer, useEffect, useRef } from "react";
import Link from "next/link";
import Image from "next/image";
import { m as motion, useInView } from "framer-motion";
import TuxedoVideoHero from "@/components/storefront/TuxedoVideoHero";
import CinematicShowcase from "@/components/storefront/CinematicShowcase";
import LayoutContainer from "@/components/layout/LayoutContainer";
import ProductCard from "@/components/storefront/ProductCard";
import PaginatedStops from "@/components/storefront/PaginatedStops";
import StorefrontHeader from "@/components/storefront/StorefrontHeader";
import StorefrontFooter from "@/components/storefront/StorefrontFooter";
import BrandStylesProvider from "@/components/storefront/BrandStylesProvider";
import { ScrollReveal, ParallaxLayer, FadeOnScroll } from "@/components/ui/ScrollAnimations";
import { supabase } from "@/lib/supabase";
function scrollToStops() {
document.getElementById("stops")?.scrollIntoView({ behavior: "smooth" });
}
function scrollToStory() {
document.getElementById("story")?.scrollIntoView({ behavior: "smooth" });
}
function scrollToProducts() {
document.getElementById("products")?.scrollIntoView({ behavior: "smooth" });
}
import { getBrandSettingsPublic } from "@/actions/brand-settings";
import { gsap } from "gsap";
import { ScrollTrigger } from "gsap/ScrollTrigger";
// Register GSAP plugins
if (typeof window !== "undefined") {
gsap.registerPlugin(ScrollTrigger);
}
type Brand = {
id: string;
name: string;
slug: string;
};
type Stop = {
id: string;
city: string;
state: string;
date: string;
time: string;
location: string;
slug: string;
brand_id: string;
};
type Product = {
id: string;
name: string;
description: string | null;
price: number;
type: string;
image_url: string | null;
brand_id: string;
is_taxable?: boolean;
pickup_type?: "scheduled_stop" | "shed";
};
type State = {
brand: Brand | null;
stops: Stop[];
products: Product[];
wholesaleEnabled: boolean;
logoUrl: string | null;
logoUrlDark: string | null;
olatheSweetLogoUrl: string | null;
olatheSweetLogoUrlDark: string | null;
showSchedulePdf: boolean;
showWholesaleLink: boolean;
heroTagline: string | null;
heroImageUrl: string | null;
heroVideoUrl: string | null;
isAdmin: boolean;
customFooterText: string | null;
contactEmail: string | null;
contactPhone: string | null;
brandPrimaryColor: string | null;
brandBgColor: string | null;
brandTextColor: string | null;
};
type Action =
| { type: "SET_BRAND"; brand: Brand | null }
| { type: "SET_STOPS"; stops: Stop[] }
| { type: "SET_PRODUCTS"; products: Product[] }
| {
type: "SET_SETTINGS";
wholesaleEnabled: boolean;
logoUrl: string | null;
logoUrlDark: string | null;
olatheSweetLogoUrl: string | null;
olatheSweetLogoUrlDark: string | null;
showSchedulePdf: boolean;
showWholesaleLink: boolean;
heroTagline: string | null;
heroImageUrl: string | null;
heroVideoUrl: string | null;
customFooterText: string | null;
contactEmail: string | null;
contactPhone: string | null;
brandPrimaryColor: string | null;
brandBgColor: string | null;
brandTextColor: string | null;
}
| { type: "SET_IS_ADMIN"; isAdmin: boolean };
const initialState: State = {
brand: null,
stops: [],
products: [],
wholesaleEnabled: false,
logoUrl: null,
logoUrlDark: null,
olatheSweetLogoUrl: null,
olatheSweetLogoUrlDark: null,
showSchedulePdf: true,
showWholesaleLink: true,
heroTagline: null,
heroImageUrl: null,
heroVideoUrl: null,
isAdmin: false,
customFooterText: null,
contactEmail: null,
contactPhone: null,
brandPrimaryColor: null,
brandBgColor: null,
brandTextColor: null,
};
/**
* Editorial imagery for the Tuxedo storefront, sourced from the original
* tuxedocorn.com WordPress library and re-hosted on our MinIO bucket so
* the brand controls its own media. These are stable, brand-specific
* assets — they don't need to be admin-configurable yet. (If we ever
* add more brands, lift these into `brand_settings` columns.)
*/
const WP_IMAGES = {
/** Wide panoramic corn row with irrigation canal + Colorado sky — the
* hero poster. Replaces the earlier tight corn-cob macro. */
heroField: "https://s3.crispygoat.com/videos/wp-import/images/tuxedo-field-irrigation.jpg",
/** Pre-storm purple sky over deep-green tasseled rows receding to
* mountains — the editorial pull-quote band. */
stormField: "https://s3.crispygoat.com/videos/wp-import/images/tuxedo-field-storm.jpg",
/** White-haired founder inspecting tassels — the Our Story anchor.
* Editorial-graded version of the original WP shot — golden-hour
* lighting, shallow DOF, sharper focus on the face. Same man,
* same overalls, same tassels — just the photo he deserves. */
founderPortrait: "https://s3.crispygoat.com/videos/wp-import/images/tuxedo-founder-john-editorial.jpg",
/** Single yellow ear with silk and dark green bokeh — the product
* moment in the editorial "Why" replacement. */
earMacro: "https://s3.crispygoat.com/videos/wp-import/images/tuxedo-ear-macro.jpg",
/** Packing-shed packshot — dozens of husked cobs piled on the table
* the morning of pick. Documentary, not styled; reads like a
* magazine harvest spread rather than a styled product photo. Used
* as the full-bleed anchor of the "Harvest, by the numbers" section. */
piledCobs: "https://s3.crispygoat.com/videos/wp-import/images/corn-field-zane-original.jpg",
} as const;
function reducer(state: State, action: Action): State {
switch (action.type) {
case "SET_BRAND":
return { ...state, brand: action.brand };
case "SET_STOPS":
return { ...state, stops: action.stops };
case "SET_PRODUCTS":
return { ...state, products: action.products };
case "SET_SETTINGS":
return {
...state,
wholesaleEnabled: action.wholesaleEnabled,
logoUrl: action.logoUrl,
logoUrlDark: action.logoUrlDark,
olatheSweetLogoUrl: action.olatheSweetLogoUrl,
olatheSweetLogoUrlDark: action.olatheSweetLogoUrlDark,
showSchedulePdf: action.showSchedulePdf,
showWholesaleLink: action.showWholesaleLink,
heroTagline: action.heroTagline,
heroImageUrl: action.heroImageUrl,
heroVideoUrl: action.heroVideoUrl,
customFooterText: action.customFooterText,
contactEmail: action.contactEmail,
contactPhone: action.contactPhone,
brandPrimaryColor: action.brandPrimaryColor,
brandBgColor: action.brandBgColor,
brandTextColor: action.brandTextColor,
};
case "SET_IS_ADMIN":
return { ...state, isAdmin: action.isAdmin };
}
}
// ── Pull-quote band — full-bleed editorial interlude ────────────────
// A single Fraunces italic quote floating over the pre-storm field.
// No chrome. The image does the talking.
function PullQuoteBand() {
return (
{/* Layered tints: top darkens the sky, bottom grounds the type. */}
{/* One warm amber rim along the lower edge to echo the corn. */}
“The best sweet corn doesn’t travel.
It shouldn’t have to.”
— Tuxedo Corn · Olathe, Colorado
);
}
// ── The Corn — single editorial moment replacing the feature grid ───
// One paragraph. One image. The feature-card grid read as a templated
// list of icons; an honest photograph of a single ear communicates
// everything those eight tiles couldn't.
function TheCorn() {
return (
{/* Left: copy column, 5/12 */}
The Corn
You can taste the altitude.
Olathe Sweet was developed for the Uncompahgre Valley — five thousand,
three hundred and sixty feet above the sea, where the daytime sun hits
the husk and the nights cool it back down before sunrise. That diurnal
swing is what loads every kernel with sugar; nothing we do in the
kitchen can replicate it, and nothing in a greenhouse can grow it.
The ear in the photograph was picked the morning it was shot. The
silk on the right is still damp. We don’t airbrush the field
because we don’t need to.
{/* Right: macro photo, 7/12 — the photograph carries the section. */}
{/* Subtle amber rim light along the bottom — picks up the corn. */}
{/* Provenance plate, lower-left, hairline border. */}
Olathe Sweet · Day of pick
);
}
// ── Founder strip — Our Story anchor ─────────────────────────────────
// Image + narrative. The previous "Our Story" was a centered text block;
// here the founder's portrait grounds the timeline that follows.
function FounderStrip() {
return (
{/* A single amber rim along the top so this section reads as the
hinge between The Corn (warm cream) and the dark Story panel. */}
{/* Soft amber wash on the bottom — matches The Corn plate. */}
John Harold · Olathe, CO
The family behind the row
John Harold’s great-grandchildren still walk
the same rows he cleared in 1982.
The Olathe Sweet parent line was rescued from a retiring farmer
who believed his valley could grow sugar in a husk. We brought
it back to the same soil, learned how it liked the water, and
kept the seed — by hand, ear by ear — for forty summers. The
name on the cooler is the name on the deed.
Est. 1982·3 generations on the row·~60 hands at peak
);
}
// ── Harvest editorial — magazine "by the numbers" spread ─────────
//
// One packshot + one data strip. The strip is the brand voice — it
// treats the farm's actual numbers (years, generations, altitude, hands)
// as magazine sidebar content, not as a feature-card grid. Hairline
// rules, large tabular numerals, and a single editorial caption beneath.
// No icons, no boxes, no color highlights. Reads as Cereal magazine
// did a feature on this farm, not as a farm-stand template.
function HarvestEditorial() {
return (
{/* Hairline top rule — single amber line so the section reads as
a magazine spread opener. */}
{/* Section header */}
Harvest · 2026
The shape of an Olathe summer.
Forty summers of the same seed, the same soil, and the same
row. The diurnal swing that loads the kernel with sugar is
a property of this valley — not a recipe we can take with us.
{/* Full-bleed packshot */}
{/* A single warm tint along the bottom to echo the existing
amber-wash treatment used in The Corn and FounderStrip so
the three sections feel like one editorial system. */}
{/* Provenance plate, lower-left, hairline-bordered, matching
the editorial chrome used elsewhere on the page. */}
Harvest morning · August · Olathe, CO
{/* Subtle photo credit on the right — like a magazine spread */}
Frame 014 · zane
{/* Magazine data strip — four columns, hairline-ruled, tabular
numerals count up on scroll-in (uses the existing .counter-animate
GSAP setup). Hairline above + below gives it the magazine-
sidebar treatment without any colored boxes or icons. */}
{/* Editor's caption — italic display serif, the editorial
footnote that makes the section feel like a feature story. */}
“You can’t replicate the diurnal swing in a
greenhouse. You can’t replicate it on a flat field.
You can’t replicate it in a hurry.”
— John Harold, second generation
);
}
// One column of the "by the numbers" strip. The number is a
// 0 so the
// existing GSAP setup in this page's useEffect picks it up and counts
// up from 0 to N when the column scrolls into view. Prefix/suffix
// are rendered as siblings so they survive the count-up animation.
function DataPoint({
value,
prefix,
suffix,
label,
detail,
}: {
value: number;
prefix?: string;
suffix?: string;
label: string;
detail: string;
}) {
return (
{/* Top hairline per column so the strip reads as four magazine
sidebar cells, not four feature cards. */}
{products.length - 3} more products available in the full catalog.
)}
);
}
// ── Story section — slim timeline (founder portrait now lives above) ─
function StorySection() {
return (
{/* Single soft golden-hour glow behind the headline. */}
Our Story
Three generations of sweet corn excellence.
Tuxedo Corn is the exclusive grower and shipper of Olathe Sweet Sweet Corn — developed for Colorado's high-altitude mountain climate and grown by the same family for over 40 years.
{/* Timeline — kept as the trust signal. */}
{[
{
year: "1982",
head: "A seed saved",
body: "The original Olathe Sweet parent line was kept by a farmer who believed his valley could grow sugar in a husk.",
},
{
year: "2003",
head: "A field retired, then revived",
body: "After a five-year pause the family brought the same seed back to the same soil — and the sweetness came back with it.",
},
{
year: "Today",
head: "Three generations on the row",
body: "Grandparents, parents, and kids all work the summer pick — a workforce of about sixty hands during peak season.",
},
].map((item) => (