From 9dd4aff35e88905daf850113c8f589e32cfb3f51 Mon Sep 17 00:00:00 2001 From: chris Date: Wed, 10 Jun 2026 08:01:39 -0400 Subject: [PATCH] Remove dead code: unused components, duplicate logic, orphaned route - Delete Hero, ReviewsSection, TrustedBrands components (never imported) - Delete /api/admin/orders/[orderId]/complete route (never called; order state transitions go through /status instead) - Extract maxColorsFor() from ProductCard and CartDrawer into src/lib/colors.ts to eliminate the duplicated implementation Co-Authored-By: Claude Sonnet 4.6 --- .../admin/orders/[orderId]/complete/route.ts | 43 --------- estore/src/components/CartDrawer.tsx | 10 +-- estore/src/components/Hero.tsx | 87 ------------------- estore/src/components/ProductCard.tsx | 10 +-- estore/src/components/ReviewsSection.tsx | 68 --------------- estore/src/components/TrustedBrands.tsx | 40 --------- estore/src/lib/colors.ts | 8 ++ 7 files changed, 10 insertions(+), 256 deletions(-) delete mode 100644 estore/src/app/api/admin/orders/[orderId]/complete/route.ts delete mode 100644 estore/src/components/Hero.tsx delete mode 100644 estore/src/components/ReviewsSection.tsx delete mode 100644 estore/src/components/TrustedBrands.tsx create mode 100644 estore/src/lib/colors.ts diff --git a/estore/src/app/api/admin/orders/[orderId]/complete/route.ts b/estore/src/app/api/admin/orders/[orderId]/complete/route.ts deleted file mode 100644 index 0a9ad75..0000000 --- a/estore/src/app/api/admin/orders/[orderId]/complete/route.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { NextRequest, NextResponse } from 'next/server' -import { Client, Environment } from 'square' - -function getClient() { - return new Client({ - accessToken: process.env.SQUARE_ACCESS_TOKEN!, - environment: process.env.SQUARE_ENVIRONMENT === 'production' - ? Environment.Production - : Environment.Sandbox, - }) -} - -export async function POST( - _req: NextRequest, - { params }: { params: { orderId: string } } -) { - try { - const client = getClient() - const { orderId } = params - - // Retrieve current order to get version (required for optimistic concurrency) - const { result: { order } } = await client.ordersApi.retrieveOrder(orderId) - if (!order) return NextResponse.json({ error: 'Order not found' }, { status: 404 }) - - await client.ordersApi.updateOrder(orderId, { - order: { - locationId: order.locationId!, - state: 'COMPLETED', - version: order.version, - fulfillments: (order.fulfillments ?? []).map((f) => ({ - uid: f.uid, - state: 'COMPLETED', - })), - }, - idempotencyKey: `complete-${orderId}`, - }) - - return NextResponse.json({ ok: true }) - } catch (err) { - console.error('[admin/orders/complete]', err) - return NextResponse.json({ error: 'Failed to complete order' }, { status: 500 }) - } -} diff --git a/estore/src/components/CartDrawer.tsx b/estore/src/components/CartDrawer.tsx index 51c7168..4bf9abf 100644 --- a/estore/src/components/CartDrawer.tsx +++ b/estore/src/components/CartDrawer.tsx @@ -15,6 +15,7 @@ import ColorPicker from './ColorPicker' import BookingRequestPanel from './BookingRequestPanel' import CalendarPicker from './CalendarPicker' import type { CartEntry } from '@/context/CartContext' +import { maxColorsFor } from '@/lib/colors' /** Syncs a string state value to localStorage. Hydrates after mount. */ function useStoredString(key: string, initial: string): [string, (v: string) => void] { @@ -32,15 +33,6 @@ function useStoredString(key: string, initial: string): [string, (v: string) => return [value, set] } -function maxColorsFor(name: string): number | null { - const n = name.toLowerCase() - if (/arch|column/.test(n)) return 4 - if (/\b11["''โ€ณ]|\b11[- ]?inch/.test(n)) return 1 - if (/number.{0,10}sculpt|sculpt.{0,10}number/.test(n)) return 4 - if (/ultimate/.test(n)) return 4 - return null -} - type Step = 'cart' | 'delivery' | 'info' | 'payment' const STEP_TITLES: Record = { diff --git a/estore/src/components/Hero.tsx b/estore/src/components/Hero.tsx deleted file mode 100644 index 29923e8..0000000 --- a/estore/src/components/Hero.tsx +++ /dev/null @@ -1,87 +0,0 @@ -/** - * Hero section โ€” matches the layout of beachpartyballoons.com's index.html: - * full-width image with the logo overlaid, then centered address + CTA. - */ -export default function Hero() { - return ( - <> - {/* Scrolling announcement bar */} -
-
- ๐ŸŽˆ Walk-ins welcome! ยท Delivery available across CT ยท Over 70 latex colors in stock ยท Custom arrangements made while you wait ยท 203.283.5626 -
-
- - {/* Hero image with logo overlay */} -
-
- {/* eslint-disable-next-line @next/next/no-img-element */} - Beach Party Balloons - {/* eslint-disable-next-line @next/next/no-img-element */} - Beach Party Balloons logo -
-
- - {/* Address + contact */} -
-

- Shop Online -

-

- - 554 Boston Post Road, Milford, CT 06460 - -

-

- 203.283.5626 -

-
- - - -
-
- - {/* Intro image + copy */} -
- {/* eslint-disable-next-line @next/next/no-img-element */} - Organic balloon arrangement -
- -

Walk-ins welcome!

-

- Pick up a balloon arrangement for birthdays or any occasion. We will make - it while you wait! -

-

- We have hundreds of foil balloon choices in stock and over 70 latex colors! -

- -

- ...Or consult with one of our designers about your balloon decorating needs. -

- -
- {/* eslint-disable-next-line @next/next/no-img-element */} - Delivery balloon arrangement -
- -

Delivery available!

-

- Have your balloons delivered! Our delivery staff will make sure your order - arrives safe and sound! -

- -
- - ) -} diff --git a/estore/src/components/ProductCard.tsx b/estore/src/components/ProductCard.tsx index 99bd666..ccb408d 100644 --- a/estore/src/components/ProductCard.tsx +++ b/estore/src/components/ProductCard.tsx @@ -4,20 +4,12 @@ import { useState } from 'react' import type { CatalogItem } from '@/data/mock-catalog' import ColorPicker from './ColorPicker' import { fmt } from '@/lib/format' +import { maxColorsFor } from '@/lib/colors' interface Props { item: CatalogItem } -function maxColorsFor(name: string): number | null { - const n = name.toLowerCase() - if (/arch|column/.test(n)) return 4 - if (/\b11["''โ€ณ]|\b11[- ]?inch/.test(n)) return 1 - if (/number.{0,10}sculpt|sculpt.{0,10}number/.test(n)) return 4 - if (/ultimate/.test(n)) return 4 - return null -} - /** Lowest stock count across tracked variations. null = nothing tracked. */ function lowestTrackedInventory(item: CatalogItem): number | null { const tracked = item.variations.filter((v) => v.inventory !== null) diff --git a/estore/src/components/ReviewsSection.tsx b/estore/src/components/ReviewsSection.tsx deleted file mode 100644 index f2e7e8b..0000000 --- a/estore/src/components/ReviewsSection.tsx +++ /dev/null @@ -1,68 +0,0 @@ -const REVIEWS = [ - { - text: '"Stunning balloon arch and super easy to work with. Our guests loved it!"', - author: 'โ€” Jordan M., Corporate Event', - }, - { - text: '"Professional setup and gorgeous colors. Made our celebration unforgettable."', - author: 'โ€” Maria L., Birthday Party', - }, - { - text: '"Fast, friendly, and beautiful designs. Will book again for our next event."', - author: 'โ€” Alex T., School Event', - }, -] - -export default function ReviewsSection() { - return ( - <> -
-
-
-

Google Reviews

-

- See what clients are saying, or leave a review after your event. -

- -
-
- โ˜…โ˜…โ˜…โ˜…โ˜… -
-

- Rated 4.9 on Google -

-

Based on 100+ reviews

-
- -
- {REVIEWS.map((r, i) => ( -
-

{r.text}

-

{r.author}

-
- ))} -
- - -
-
- - ) -} diff --git a/estore/src/components/TrustedBrands.tsx b/estore/src/components/TrustedBrands.tsx deleted file mode 100644 index 414e27c..0000000 --- a/estore/src/components/TrustedBrands.tsx +++ /dev/null @@ -1,40 +0,0 @@ -const LOGOS = [ - { src: '/images/trusted/512px-Subway_icon.svg.webp', alt: 'Subway', dark: false }, - { src: '/images/trusted/Yale_press_logo.webp', alt: 'Yale', dark: false }, - { src: '/images/trusted/256px-Quinnipiac_University_logo_(2017).svg.webp', alt: 'Quinnipiac University', dark: false }, - { src: '/images/trusted/512px-University_of_New_Haven_logo.webp', alt: 'University of New Haven', dark: false }, - { src: '/images/trusted/Planet_Fitness_(2).webp', alt: 'Planet Fitness', dark: false }, - { src: '/images/trusted/Mohegan-Sun-Logo.webp', alt: 'Mohegan Sun', dark: false }, - { src: '/images/trusted/Post_university_of_conn_logo.webp', alt: 'Post University', dark: false }, - { src: '/images/trusted/logo-full-color.webp', alt: 'Edge Fitness', dark: false }, - { src: '/images/trusted/lincoln-culinary.webp', alt: 'Lincoln Culinary Institute', dark: false }, - { src: '/images/trusted/amazon.webp', alt: 'Amazon', dark: false }, - { src: '/images/trusted/woodwinds-2024-logo-white.webp', alt: 'The Woodwinds', dark: true }, - { src: '/images/trusted/sallys-apizza.webp', alt: "Sally's Apizza", dark: false }, -] - -export default function TrustedBrands() { - return ( -
-
-
-

Trusted by

-

- Brands and organizations we have had the joy of celebrating with. -

-
-
- {LOGOS.map((logo) => ( -
- {/* eslint-disable-next-line @next/next/no-img-element */} - {`${logo.alt} -
- ))} -
-
-
- ) -} diff --git a/estore/src/lib/colors.ts b/estore/src/lib/colors.ts new file mode 100644 index 0000000..f2753cf --- /dev/null +++ b/estore/src/lib/colors.ts @@ -0,0 +1,8 @@ +export function maxColorsFor(name: string): number | null { + const n = name.toLowerCase() + if (/arch|column/.test(n)) return 4 + if (/\b11["''โ€ณ]|\b11[- ]?inch/.test(n)) return 1 + if (/number.{0,10}sculpt|sculpt.{0,10}number/.test(n)) return 4 + if (/ultimate/.test(n)) return 4 + return null +}