Refactor homepage storefront into modular tenant-configurable sections#109
Draft
Refactor homepage storefront into modular tenant-configurable sections#109
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- Created StorefrontConfig types with HeroConfig, CategoriesConfig, FeaturedProductsConfig, NewsletterConfig, TrustBadgesConfig - Implemented getDefaultStorefrontConfig generator for dynamic defaults - Created modular homepage components: * HeroSection with gradient/image/minimal styles * TrustBadges with configurable badges and icons * CategoriesSection with configurable grid columns (2/3/4) * FeaturedSection with empty state and product count config * NewsletterSection with client-side form validation - Added newsletter subscription API route - Refactored page.tsx to use modular components - All TypeScript type checks pass - Build completes successfully Co-authored-by: syed-reza98 <71028588+syed-reza98@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Refactor and enhance homepage storefront layout for tenant customization
Refactor homepage storefront into modular tenant-configurable sections
Dec 6, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The homepage was monolithic and lacked tenant customization. This refactors it into five modular sections with a configuration system and adds newsletter subscription functionality.
Architecture Changes
Type System
src/types/storefront-config.ts: Configuration types for hero styles (gradient/image/minimal), category grid columns (2/3/4), featured product counts (8/12/16), and newsletter settingssrc/lib/storefront/get-default-config.ts: Dynamic default generator using store name/descriptionModular Components (
src/app/store/[slug]/components/homepage/)hero-section.tsx: Three style variants with configurable CTAs and backgroundstrust-badges.tsx: Icon-mapped badges with enable/disable togglecategories-section.tsx: Configurable grid layout with product countsfeatured-section.tsx: Wraps ProductGrid with empty state handlingnewsletter-section.tsx: Client component with email validation and state managementAPI Route
src/app/store/[slug]/actions/subscribe/route.ts: Newsletter subscription endpoint with validation (ready for Resend integration via TODOs)Homepage Refactor
Newsletter Form States
The form implements loading → success/error → auto-reset flow:
Configuration System
Future tenant customization ready:
Currently uses defaults; add
storefrontConfigJSON field to Store model for per-tenant overrides.Visual Results
Desktop (1280px)

Mobile (375px)

Tablet (768px)

Newsletter Validation

Notes
backgroundImageprop ready for future upload featureOriginal prompt
Overview
Refactor and enhance the Homepage Storefront Layout at
src/app/store/[slug]/page.tsxto be more modular, tenant-configurable, and feature-complete. The layout should support hero, categories grid, featured products, and newsletter sections with per-tenant customization.Current State
The existing
src/app/store/[slug]/page.tsxhas:Requirements
1. Tenant-Configurable Layout System
Create a layout configuration type that allows each store/tenant to customize:
2. Refactored Homepage Sections
Hero Section (Enhanced)
gradient,image,minimalCategories Grid Section (Enhanced)
Featured Products Section (Enhanced)
Newsletter Section (NEW)
Create a new newsletter subscription section with:
3. Component Architecture
Create modular section components in
src/app/store/[slug]/components/:4. Tenant Configuration Types
Create
src/types/storefront-config.tswith:5. Default Configuration
Provide sensible defaults for stores that don't have custom configuration, using the store's name and description dynamically.
6. Technical Requirements
7. Files to Create/Modify
Create:
src/types/storefront-config.ts- Tenant configuration typessrc/app/store/[slug]/components/homepage/hero-section.tsxsrc/app/store/[slug]/components/homepage/categories-section.tsxsrc/app/store/[slug]/components/homepage/featured-section.tsxsrc/app/store/[slug]/components/homepage/newsletter-section.tsxsrc/app/store/[slug]/components/homepage/trust-badges.tsxsrc/app/store/[slug]/components/homepage/types.tssrc/lib/storefront/get-default-config.ts- Default config generatorModify:
src/app/store/[slug]/page.tsx- Refactor to use new modular components8. Newsletter API Integration
Create a server action or API route for newsletter subscription:
src/app/store/[slug]/actions/subscribe.ts- Server action for newsletterAcceptance Criteria
This pull request was created as a result of the following prompt from Copilot chat.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.