Procházet zdrojové kódy

Add store styles, ready-made looks and more fonts

- Six style options: buttons, cards, spacing, headings, backgrounds, motion
- Style box in Design tab: Minimal, Soft, Elegant, Bold, Playful, Classic
- 12 more fonts; heading-only fonts refused for body text
- Gentle fade-in on scroll; AI picks a style per brand and changes it by chat
redesign/part-4-style-options
fahmisaad před 1 dnem
rodič
revize
cfde15165b
33 změnil soubory, kde provedl 994 přidání a 123 odebrání
  1. 102
    89
      PROGRESS.md
  2. 2
    1
      README.md
  3. 10
    0
      app/Http/Controllers/StoreController.php
  4. 53
    0
      app/Http/Controllers/StoreStyleController.php
  5. 9
    2
      app/StorePlan/Ai/PlanPrompt.php
  6. 103
    0
      app/StorePlan/PlanSchema.php
  7. 9
    0
      app/StorePlan/PlanValidator.php
  8. 8
    0
      app/StorePlan/SamplePlan.php
  9. 129
    0
      resources/css/app.css
  10. 226
    0
      resources/js/components/stores/style-picker.tsx
  11. 15
    0
      resources/js/pages/stores/show.tsx
  12. 2
    2
      resources/js/storefront/pages/cart.tsx
  13. 2
    2
      resources/js/storefront/pages/checkout.tsx
  14. 1
    1
      resources/js/storefront/pages/order.tsx
  15. 3
    3
      resources/js/storefront/pages/product.tsx
  16. 1
    1
      resources/js/storefront/product-card.tsx
  17. 43
    3
      resources/js/storefront/renderer.tsx
  18. 61
    0
      resources/js/storefront/reveal.tsx
  19. 5
    2
      resources/js/storefront/sections/about.tsx
  20. 5
    2
      resources/js/storefront/sections/contact.tsx
  21. 4
    1
      resources/js/storefront/sections/faq.tsx
  22. 1
    1
      resources/js/storefront/sections/featured-product.tsx
  23. 2
    2
      resources/js/storefront/sections/hero.tsx
  24. 3
    1
      resources/js/storefront/sections/newsletter.tsx
  25. 4
    1
      resources/js/storefront/sections/product-grid.tsx
  26. 3
    3
      resources/js/storefront/sections/testimonials.tsx
  27. 2
    2
      resources/js/storefront/sections/trust-bar.tsx
  28. 33
    1
      resources/js/storefront/theme.ts
  29. 11
    0
      resources/js/storefront/types.ts
  30. 3
    3
      resources/js/storefront/ui.tsx
  31. 17
    0
      resources/js/types/store.ts
  32. 2
    0
      routes/web.php
  33. 120
    0
      tests/Feature/Stores/StoreStyleTest.php

+ 102
- 89
PROGRESS.md Zobrazit soubor

@@ -3,9 +3,9 @@
3 3
 This file is the single source of truth for the project plan and status.
4 4
 Update it at the end of every work session.
5 5
 
6
-**Last updated:** 2026-11-18
7
-**Current step:** Step 9 — Modern store design (parts 1–3 done; next: part 4, style options and motion)
8
-**Next action:** Commit part 3 on `redesign/part-3-product-page` (do not merge into `main` yet). Then create `redesign/part-4-style-options` from it and build style options and motion. Step 7 part 2 still waits for an EasyParcel API key
6
+**Last updated:** 2026-11-19
7
+**Current step:** Step 9 — Modern store design (parts 1–4 done; next: part 5, more layouts per section)
8
+**Next action:** Commit part 4 on `redesign/part-4-style-options` (do not merge into `main` yet). Then create `redesign/part-5-section-layouts` from it and add more layouts per section. Step 7 part 2 still waits for an EasyParcel API key
9 9
 
10 10
 Status marks: `[ ]` not started · `[~]` in progress · `[x]` done
11 11
 
@@ -219,12 +219,22 @@ Changing from Claude to another AI model (or back) must be a settings change, no
219 219
 - **Phone menu:** below tablet width both header layouts show a menu button that opens all links and the header button; Escape or a link closes it.
220 220
 - On wide screens the photos stay in view while the shopper scrolls the details.
221 221
 
222
+### How store styles work (added in Step 9 part 4)
223
+
224
+- `theme.style` in the store plan has six optional parts: `buttons` (solid, outline, shadow), `cards` (border, shadow, plain, hard), `spacing` (compact, normal, airy), `headings` (normal, uppercase, heavy), `backgrounds` (plain, alternate) and `motion` (none, gentle). A plan without it uses `PlanSchema::STYLE_DEFAULTS`, which look exactly like stores did before, so old designs need no change.
225
+- The storefront root carries `data-buttons`, `data-cards` and so on; `resources/css/app.css` turns them into looks. Components only carry five classes: `sf-btn-primary`, `sf-btn-outline`, `sf-card` (cards and photos), `sf-section` (section spacing) and `sf-band` (each section on a page). A new component gets every style by using those classes.
226
+- **Ready-made looks** (`PlanSchema::STYLE_PRESETS`): Minimal, Soft, Elegant, Bold, Playful and Classic. Each sets the style, corner roundness and fonts, never the colours. They are in the **Style** box of the Design tab, with a "Fine-tune" panel for single options.
227
+- **Fonts:** 20 in all. Archivo Black, Bebas Neue, Caveat and DM Serif Display are for headings only; the checker refuses them for body text.
228
+- **Alternate backgrounds** skip sections that bring their own background (hero, trust row, testimonials, newsletter).
229
+- **Gentle motion:** sections that start below the first screen fade up as they come into view. Anything on the first screen is never hidden, and nothing moves for visitors who ask their device for less motion. A scroll check is used instead of an intersection observer, for the same reason as the sticky cart bar.
230
+- **AI:** chooses a style that fits the brand when generating (with examples per kind of brand), and changes it by chat ("make it more premium", "bolder").
231
+
222 232
 ### Category guides for the AI (agreed 2026-11-17)
223 233
 
224 234
 - The category the merchant picks on the Create store page (Fashion, Beauty, Food, Home, Electronics, Health, Kids, Digital, Other) chooses a short design guide that is sent to the AI with the brand description.
225 235
 - A guide is a starting direction, not a template: for example Fashion = big photos, magazine feel, lookbook; Food = warm and appetising, "how it's made", reviews high up; Beauty = soft and clean, "shop by skin need". "Other" has no guide.
226 236
 - The brand description decides the details, so two stores in the same category still look different (bold streetwear versus elegant modest wear).
227
-- Guides live in our code and can be improved any time. They only suggest styles and layouts the store can really show, so they are written after the style options exist (Step 9 part 4).
237
+- Guides live in our code and can be improved any time. They only suggest styles and layouts the store can really show, so they are written after the style options and extra layouts exist (Step 9 parts 4 and 5).
228 238
 - To avoid repeats, the AI is told not to copy the example design and, for a merchant's second store, what their first store looks like.
229 239
 
230 240
 ### AI edits must really change something (added 2026-11-16)
@@ -360,9 +370,10 @@ Agreed on 2026-11-17 after comparing our stores with 2026 design trends (researc
360 370
 - [x] Part 1 — Photos first (done 2026-11-18): hero layouts with a big photo (full width, and split photo and text), a hero photo the merchant uploads in the Design tab or one of their product photos, second product photo on hover, nicer placeholders when there is no photo
361 371
 - [x] Part 2 — Announcement bar and trust row (done 2026-11-18): a slim bar above the header and a row of trust points, filled in by themselves from free shipping, automatic discounts, secure payment and WhatsApp
362 372
 - [x] Part 3 — Product page upgrade (done 2026-11-18): trust points under the button, folding sections (the product's own, such as "How to use", plus shipping from real fees), sticky add-to-cart bar on phones, "pairs well with", photos that stay in view on wide screens, and a phone menu for the header
363
-- [ ] Part 4 — Style options and motion: style presets the AI picks (minimal, bold, dark and elegant, soft, playful), buttons (solid, outline, pill), borders and shadows, spacing (compact or airy), section backgrounds, more fonts, more layouts per section, and gentle motion (always off for visitors who ask their device for less motion)
364
-- [ ] Part 5 — Category guides for the AI (see section 2)
365
-- [ ] Part 6 — Collections ("shop by need" tiles and menu links), bento grid section, video section, real reviews from buyers after delivery
373
+- [x] Part 4 — Style options and motion (done 2026-11-19): six style options (buttons, cards, spacing, headings, backgrounds, motion), six ready-made looks in a Style box in the Design tab, 12 more fonts (20 in all), gentle fade-in motion, and AI rules so each brand gets a fitting style
374
+- [ ] Part 5 — More layouts per section: 3 to 4 layouts instead of 2 for the main sections (moved out of part 4 on 2026-11-19)
375
+- [ ] Part 6 — Category guides for the AI (see section 2)
376
+- [ ] Part 7 — Collections ("shop by need" tiles and menu links), bento grid section, video section, real reviews from buyers after delivery
366 377
 
367 378
 Branches (agreed 2026-11-18):
368 379
 
@@ -424,58 +435,59 @@ Then, from the project folder:
424 435
 
425 436
 ## 4b. Where things are in the code
426 437
 
427
-| Thing                                  | Location                                                                                                                                       |
428
-| -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
429
-| Store model                            | `app/Models/Store.php`                                                                                                                         |
430
-| Store screens logic                    | `app/Http/Controllers/StoreController.php`                                                                                                     |
431
-| Store categories, languages, statuses  | `app/Enums/`                                                                                                                                   |
432
-| Store form rules                       | `app/Http/Requests/Stores/CreateStoreRequest.php`                                                                                              |
433
-| Screens                                | `resources/js/pages/dashboard.tsx`, `resources/js/pages/stores/`                                                                               |
434
-| Store tests                            | `tests/Feature/Stores/`                                                                                                                        |
435
-| Store plan format (the rules)          | `app/StorePlan/PlanSchema.php`                                                                                                                 |
436
-| Store plan checker                     | `app/StorePlan/PlanValidator.php`                                                                                                              |
437
-| Sample plan                            | `app/StorePlan/SamplePlan.php`                                                                                                                 |
438
-| Preview logic                          | `app/Http/Controllers/StoreDesignController.php`                                                                                               |
439
-| AI settings                            | `config/ai.php` (providers, models per task)                                                                                                   |
440
-| AI layer and providers                 | `app/Ai/`, `app/Ai/Drivers/`                                                                                                                   |
441
-| AI prompts, generation and chat edits  | `app/StorePlan/Ai/`                                                                                                                            |
442
-| Start an AI job (buttons)              | `app/Http/Controllers/StoreGenerationController.php`                                                                                           |
443
-| Background AI job                      | `app/Jobs/RunStoreGeneration.php`                                                                                                              |
444
-| Plan limits and usage counting         | `config/plans.php`, `app/Billing/UsageLimits.php`                                                                                              |
445
-| Progress screen and chat box           | `resources/js/components/stores/`                                                                                                              |
446
-| Product model and photos               | `app/Models/Product.php`, `app/Models/ProductImage.php`                                                                                        |
447
-| Product screens logic                  | `app/Http/Controllers/ProductController.php`                                                                                                   |
448
-| Product screens                        | `resources/js/pages/stores/products/`                                                                                                          |
449
-| Storefront Shop and product pages      | `resources/js/storefront/pages/`                                                                                                               |
450
-| Checkout and order logic               | `app/Commerce/Checkout.php`, `app/Http/Controllers/CheckoutController.php`                                                                     |
451
-| Payment providers                      | `app/Commerce/Payments/` (interface and Stripe)                                                                                                |
452
-| Stripe webhook                         | `app/Http/Controllers/StripeWebhookController.php` (address: `/stripe/webhook`)                                                                |
453
-| Orders for the merchant                | `app/Http/Controllers/OrderController.php`, `resources/js/pages/stores/orders/`                                                                |
454
-| Order email                            | `app/Mail/OrderConfirmation.php`, `resources/views/mail/orders/`                                                                               |
455
-| Live store or preview (the difference) | `app/Storefront/Storefront.php`                                                                                                                |
456
-| Live store addresses                   | top of `routes/web.php`, `config/storefront.php`                                                                                               |
457
-| Publish and take offline               | `app/Http/Controllers/StorePublishController.php`                                                                                              |
458
-| Plans, trial and limits                | `app/Models/Plan.php`, `app/Models/User.php` (`currentPlan`), `app/Billing/UsageLimits.php`                                                    |
459
-| Subscriptions with Stripe              | `app/Billing/` (`Billing`, `SubscriptionGateway`, `StripeSubscriptionGateway`)                                                                 |
460
-| Billing page                           | `app/Http/Controllers/BillingController.php`, `resources/js/pages/billing/`                                                                    |
461
-| Shipping fees                          | `app/Commerce/Shipping/`, store settings in `app/Http/Controllers/StoreSettingsController.php`                                                 |
462
-| Store settings page                    | `resources/js/pages/stores/settings.tsx`                                                                                                       |
463
-| Mark as shipped and its email          | `OrderController::ship`, `app/Mail/OrderShipped.php`                                                                                           |
464
-| WhatsApp links and phone cleaning      | `app/Support/MalaysianPhone.php`, `resources/js/storefront/whatsapp.tsx`                                                                       |
465
-| Shopper messages in English and Malay  | `app/Storefront/StorefrontText.php`, `resources/js/storefront/text.ts`                                                                         |
466
-| Discount codes                         | `app/Models/DiscountCode.php`, `app/Http/Controllers/DiscountCodeController.php`, `resources/js/pages/stores/discounts/`                       |
467
-| Discount in the cart and checkout      | `Cart::applyCode` and `Cart::discount`, `Checkout::placeOrder`                                                                                 |
468
-| Product variants                       | `app/Models/ProductVariant.php`, `SaveProductRequest`, `ProductController::syncVariants`, `resources/js/components/stores/variant-editor.tsx`  |
469
-| Cart logic                             | `app/Commerce/Cart.php`, `app/Http/Controllers/CartController.php`                                                                             |
470
-| Bundles                                | `app/Models/BundleItem.php`, `app/Commerce/BundleStock.php`, `resources/js/components/stores/bundle-editor.tsx`                                |
471
-| Chat commands                          | `app/Commerce/ChatActions.php`, `StoreGenerationController::confirm`, `resources/js/components/stores/design-chat.tsx`                         |
472
-| Automatic discounts                    | `app/Models/AutomaticDiscount.php`, `app/Commerce/AutomaticDiscountRules.php`, `Cart::applied`, `AutomaticDiscountController`                  |
473
-| Hero photos                            | `app/StorePlan/HeroImages.php`, `HeroImageController`, `resources/js/storefront/sections/hero.tsx`, `components/stores/hero-picker.tsx`        |
474
-| Announcement bar and trust row         | `app/Storefront/Announcements.php`, `storefront/sections/announcement-bar.tsx`, `storefront/sections/trust-bar.tsx`                            |
475
-| Product page, phone menu               | `storefront/pages/product.tsx`, `app/Storefront/RelatedProducts.php`, `components/stores/details-editor.tsx`, `storefront/sections/header.tsx` |
476
-| Storefront words (English, Malay)      | `resources/js/storefront/text.ts`                                                                                                              |
477
-| Store plan format (frontend types)     | `resources/js/storefront/types.ts`                                                                                                             |
478
-| Storefront renderer and sections       | `resources/js/storefront/renderer.tsx`, `resources/js/storefront/sections/`                                                                    |
438
+| Thing                                  | Location                                                                                                                                                                               |
439
+| -------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
440
+| Store model                            | `app/Models/Store.php`                                                                                                                                                                 |
441
+| Store screens logic                    | `app/Http/Controllers/StoreController.php`                                                                                                                                             |
442
+| Store categories, languages, statuses  | `app/Enums/`                                                                                                                                                                           |
443
+| Store form rules                       | `app/Http/Requests/Stores/CreateStoreRequest.php`                                                                                                                                      |
444
+| Screens                                | `resources/js/pages/dashboard.tsx`, `resources/js/pages/stores/`                                                                                                                       |
445
+| Store tests                            | `tests/Feature/Stores/`                                                                                                                                                                |
446
+| Store plan format (the rules)          | `app/StorePlan/PlanSchema.php`                                                                                                                                                         |
447
+| Store plan checker                     | `app/StorePlan/PlanValidator.php`                                                                                                                                                      |
448
+| Sample plan                            | `app/StorePlan/SamplePlan.php`                                                                                                                                                         |
449
+| Preview logic                          | `app/Http/Controllers/StoreDesignController.php`                                                                                                                                       |
450
+| AI settings                            | `config/ai.php` (providers, models per task)                                                                                                                                           |
451
+| AI layer and providers                 | `app/Ai/`, `app/Ai/Drivers/`                                                                                                                                                           |
452
+| AI prompts, generation and chat edits  | `app/StorePlan/Ai/`                                                                                                                                                                    |
453
+| Start an AI job (buttons)              | `app/Http/Controllers/StoreGenerationController.php`                                                                                                                                   |
454
+| Background AI job                      | `app/Jobs/RunStoreGeneration.php`                                                                                                                                                      |
455
+| Plan limits and usage counting         | `config/plans.php`, `app/Billing/UsageLimits.php`                                                                                                                                      |
456
+| Progress screen and chat box           | `resources/js/components/stores/`                                                                                                                                                      |
457
+| Product model and photos               | `app/Models/Product.php`, `app/Models/ProductImage.php`                                                                                                                                |
458
+| Product screens logic                  | `app/Http/Controllers/ProductController.php`                                                                                                                                           |
459
+| Product screens                        | `resources/js/pages/stores/products/`                                                                                                                                                  |
460
+| Storefront Shop and product pages      | `resources/js/storefront/pages/`                                                                                                                                                       |
461
+| Checkout and order logic               | `app/Commerce/Checkout.php`, `app/Http/Controllers/CheckoutController.php`                                                                                                             |
462
+| Payment providers                      | `app/Commerce/Payments/` (interface and Stripe)                                                                                                                                        |
463
+| Stripe webhook                         | `app/Http/Controllers/StripeWebhookController.php` (address: `/stripe/webhook`)                                                                                                        |
464
+| Orders for the merchant                | `app/Http/Controllers/OrderController.php`, `resources/js/pages/stores/orders/`                                                                                                        |
465
+| Order email                            | `app/Mail/OrderConfirmation.php`, `resources/views/mail/orders/`                                                                                                                       |
466
+| Live store or preview (the difference) | `app/Storefront/Storefront.php`                                                                                                                                                        |
467
+| Live store addresses                   | top of `routes/web.php`, `config/storefront.php`                                                                                                                                       |
468
+| Publish and take offline               | `app/Http/Controllers/StorePublishController.php`                                                                                                                                      |
469
+| Plans, trial and limits                | `app/Models/Plan.php`, `app/Models/User.php` (`currentPlan`), `app/Billing/UsageLimits.php`                                                                                            |
470
+| Subscriptions with Stripe              | `app/Billing/` (`Billing`, `SubscriptionGateway`, `StripeSubscriptionGateway`)                                                                                                         |
471
+| Billing page                           | `app/Http/Controllers/BillingController.php`, `resources/js/pages/billing/`                                                                                                            |
472
+| Shipping fees                          | `app/Commerce/Shipping/`, store settings in `app/Http/Controllers/StoreSettingsController.php`                                                                                         |
473
+| Store settings page                    | `resources/js/pages/stores/settings.tsx`                                                                                                                                               |
474
+| Mark as shipped and its email          | `OrderController::ship`, `app/Mail/OrderShipped.php`                                                                                                                                   |
475
+| WhatsApp links and phone cleaning      | `app/Support/MalaysianPhone.php`, `resources/js/storefront/whatsapp.tsx`                                                                                                               |
476
+| Shopper messages in English and Malay  | `app/Storefront/StorefrontText.php`, `resources/js/storefront/text.ts`                                                                                                                 |
477
+| Discount codes                         | `app/Models/DiscountCode.php`, `app/Http/Controllers/DiscountCodeController.php`, `resources/js/pages/stores/discounts/`                                                               |
478
+| Discount in the cart and checkout      | `Cart::applyCode` and `Cart::discount`, `Checkout::placeOrder`                                                                                                                         |
479
+| Product variants                       | `app/Models/ProductVariant.php`, `SaveProductRequest`, `ProductController::syncVariants`, `resources/js/components/stores/variant-editor.tsx`                                          |
480
+| Cart logic                             | `app/Commerce/Cart.php`, `app/Http/Controllers/CartController.php`                                                                                                                     |
481
+| Bundles                                | `app/Models/BundleItem.php`, `app/Commerce/BundleStock.php`, `resources/js/components/stores/bundle-editor.tsx`                                                                        |
482
+| Chat commands                          | `app/Commerce/ChatActions.php`, `StoreGenerationController::confirm`, `resources/js/components/stores/design-chat.tsx`                                                                 |
483
+| Automatic discounts                    | `app/Models/AutomaticDiscount.php`, `app/Commerce/AutomaticDiscountRules.php`, `Cart::applied`, `AutomaticDiscountController`                                                          |
484
+| Hero photos                            | `app/StorePlan/HeroImages.php`, `HeroImageController`, `resources/js/storefront/sections/hero.tsx`, `components/stores/hero-picker.tsx`                                                |
485
+| Announcement bar and trust row         | `app/Storefront/Announcements.php`, `storefront/sections/announcement-bar.tsx`, `storefront/sections/trust-bar.tsx`                                                                    |
486
+| Product page, phone menu               | `storefront/pages/product.tsx`, `app/Storefront/RelatedProducts.php`, `components/stores/details-editor.tsx`, `storefront/sections/header.tsx`                                         |
487
+| Store styles                           | `PlanSchema::STYLE_OPTIONS` and `STYLE_PRESETS`, `StoreStyleController`, `storefront/theme.ts`, `storefront/reveal.tsx`, `resources/css/app.css`, `components/stores/style-picker.tsx` |
488
+| Storefront words (English, Malay)      | `resources/js/storefront/text.ts`                                                                                                                                                      |
489
+| Store plan format (frontend types)     | `resources/js/storefront/types.ts`                                                                                                                                                     |
490
+| Storefront renderer and sections       | `resources/js/storefront/renderer.tsx`, `resources/js/storefront/sections/`                                                                                                            |
479 491
 
480 492
 ## 5. Open questions
481 493
 
@@ -503,33 +515,34 @@ Moved into **Step 9 — Modern store design** on 2026-11-17.
503 515
 
504 516
 Add one line per work session: date, what was done, what is next.
505 517
 
506
-| Date       | Done                                                                                                                                                                                                                                                                                                                                                                                                                               | Next                                                            |
507
-| ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- |
508
-| 2026-11-14 | Planning. Chose stack, market, payments, AI models, plan prices. Checked local tools. Created this file. All proposed decisions confirmed. Added the rule that the AI model must be easy to change.                                                                                                                                                                                                                                | Install PHP 8.4, create the Laravel project (Step 0 and Step 1) |
509
-| 2026-11-14 | Installed PHP 8.4. Created the Laravel 13 + React project, MySQL database and git repo. Built create-a-store flow and dashboard. 51 tests pass; login and store creation checked in the browser. Step 0 and Step 1 done.                                                                                                                                                                                                           | Step 2: store plan format, sections, renderer                   |
510
-| 2026-11-14 | Step 2 done on branch `feature/store-sections-renderer`: store plan format and validator, 10 sections with 2 variants each, renderer, dashboard preview, sample design. 69 tests pass; storefront checked in the browser on desktop and mobile.                                                                                                                                                                                    | Step 3: swappable AI layer and store generation                 |
511
-| 2026-11-14 | First commit made and pushed to the private repository on git.mirfalah.my (branch `feature/store-sections-renderer`).                                                                                                                                                                                                                                                                                                              | Step 3: swappable AI layer and store generation                 |
512
-| 2026-11-14 | Step 3 built on branch `feature/ai-generation`: swappable AI layer (Claude, DeepSeek, fake), full store generation, chat edits, background job with progress screen, plan limits. 92 tests pass; whole flow checked in the browser with the fake provider. Not yet run against real Claude or DeepSeek.                                                                                                                            | Add API keys, run the real test, then Step 4                    |
513
-| 2026-11-14 | Split settings into `.env` (uploaded, no secrets, AI settings blank) and `.env.local` (private, complete). Removed `.env.example`.                                                                                                                                                                                                                                                                                                 | Real AI test, then Step 4                                       |
514
-| 2026-11-14 | Real AI test passed: Claude Sonnet 5.5 generated two stores, DeepSeek made two chat edits. Tuned the prompt for more varied layouts. Step 3 done.                                                                                                                                                                                                                                                                                  | Merge into `main`, then Step 4: products                        |
515
-| 2026-11-14 | Step 4 part 1 on branch `feature/commerce`: store plan version 2 with pages, products with photos, Shop page, product page, real products on the home page. 108 tests pass; checked in the browser; real Claude and DeepSeek re-tested with the new format.                                                                                                                                                                        | Step 4 part 2: cart, Stripe checkout, orders, email             |
516
-| 2026-11-14 | Cart built on branch `feature/commerce`: add to cart, quantity, remove, subtotal, header count, stock limits. 118 tests pass; checked in the browser.                                                                                                                                                                                                                                                                              | Stripe checkout (needs test keys), orders, email                |
517
-| 2026-11-15 | Step 4 finished on branch `feature/commerce`: checkout with Stripe (test mode), orders for the merchant, order confirmation email. 133 tests pass. A real Stripe test payment worked end to end: order paid, stock lowered, email written to the log.                                                                                                                                                                              | Merge into `main`, then Step 5: publishing                      |
518
-| 2026-11-15 | Merged Steps 3 and 4 into `main` and pushed.                                                                                                                                                                                                                                                                                                                                                                                       | Step 5: publishing                                              |
519
-| 2026-11-15 | Content pages by chat on branch `feature/content-pages`: add, rename and remove pages, each page at its own address, menu links guaranteed by the app. 139 tests pass; tested with real DeepSeek and in the browser. Step 4 is now complete except the known gaps.                                                                                                                                                                 | Step 5: publishing                                              |
520
-| 2026-11-15 | Planning only. Added Step 8 (discount codes, product variants, bundles with linked stock, chat commands with a confirm step), placed after Malaysia features. "Before launch" is now Step 9. Cart items redesigned as cards.                                                                                                                                                                                                       | Step 5: publishing                                              |
521
-| 2026-11-15 | Step 5 on branch `feature/publishing`: publish and take offline, live stores on their own address, design changes private until published again, dashboard blocked on store addresses. 150 tests pass; Luna Skin published and checked in the browser at `luna-skin.localhost:8000`.                                                                                                                                               | Step 6: subscription billing                                    |
522
-| 2026-11-16 | Step 6 on branch `feature/billing`: plans table, 14-day trial, Stripe subscriptions (subscribe, switch, cancel, undo), Billing page, limits enforced, live stores offline when there is no plan. 164 tests pass; real Stripe test subscription to Growth, cancel and undo all worked. Switched the session model from Fable 5.2 to Opus 5.5.                                                                                       | Merge into `main`, then Step 7                                  |
523
-| 2026-11-16 | Step 7 part 1 on branch `feature/malaysia-shipping`: store settings, flat shipping fees (west, east, free over), mark as shipped with tracking and email, WhatsApp buttons, Malay checkout messages, Malaysian phone check. Fixed live-store menu links on pages other than home (bug from Step 5). 178 tests pass; real Stripe test payment with shipping to Sabah worked.                                                        | Merge, then Step 7 part 2 or Step 8                             |
524
-| 2026-11-16 | Featured product fix on branch `feature/featured-product-link` (built on `feature/malaysia-shipping`): the section links to a real product (Design tab picker or chat), shows its real name, price, photo and page, and hides the made-up price otherwise. Added a check that marks chat edits that changed nothing. 191 tests pass; checked in the browser and with real DeepSeek.                                                | Merge both branches, then Step 7 part 2 or Step 8               |
525
-| 2026-11-16 | Planning only. Added "more design styles" to later improvements: style options (effects, backgrounds, buttons, spacing, motion), more fonts, more layouts per section, more section types.                                                                                                                                                                                                                                         | Merge branches, then Step 7 part 2 or Step 8                    |
526
-| 2026-11-16 | Step 8 part 1 on branch `feature/discount-codes`: discount codes (merchant Discounts tab, cart code box, order record, Stripe coupon, use counted when paid). 207 tests pass; real Stripe test payment with a 20% code worked.                                                                                                                                                                                                     | Merge, then product variants                                    |
527
-| 2026-11-16 | Step 8 part 2 on branch `feature/product-variants` (built on `feature/discount-codes`): product options and variants, option buttons on the product page, variant cart lines, orders and stock. 217 tests pass; real Stripe test payment for a 100ml variant with a discount code worked.                                                                                                                                          | Merge both branches, then bundles                               |
528
-| 2026-11-16 | Step 8 part 3 on branch `feature/bundles`: bundles with linked stock (bundle editor in the product form, "What's inside" on the product page, shared stock check at checkout, order shows what to pack). 223 tests pass; real Stripe test payment for "Glow Starter Set" (cleanser + 50ml moisturiser, RM 69 + RM 8 shipping) lowered both items' stock.                                                                           | Merge, then chat commands                                       |
529
-| 2026-11-17 | Step 8 part 4 on branch `feature/chat-commands`: chat commands for products, discount codes and bundles, with Confirm and Cancel in the chat. Shared discount rules. Fixed a test that failed by chance (random stock). 233 tests pass; with real DeepSeek, "GLOW15 until end of month + 100ml to RM 52" was proposed, confirmed and saved; a product + bundle request was proposed correctly and cancelled.                       | Merge; then automatic discounts, Step 7 part 2 or Step 9        |
530
-| 2026-11-17 | Step 8 part 5 on branch `feature/automatic-discounts`: automatic discounts (Discounts tab form, best-of-one rule with codes, cart nudge, product page note, order/Stripe/email name, chat command). Step 8 is done. 243 tests pass; real Stripe test payment with "Glow Week" (2 cleansers, −RM 8.40, total RM 83.60) worked, GLOW15 correctly won when typed; real DeepSeek proposed a sunscreen-only sale correctly (cancelled). | Merge; then Step 7 part 2 or Step 9                             |
531
-| 2026-11-17 | Chat commands can write product descriptions from the product name (same branch, `feature/automatic-discounts`). Real DeepSeek test found the AI guessing bundle contents, so bundle contents are now listed for it; second try was accurate. 244 tests pass.                                                                                                                                                                      | Merge; then Step 7 part 2 or Step 9                             |
532
-| 2026-11-17 | Researched 2026 store design trends and published a comparison page. Added Step 9 — Modern store design (6 parts) and the category guides decision; "Before launch" is now Step 10.                                                                                                                                                                                                                                                | Step 9 part 1: photos first                                     |
533
-| 2026-11-18 | Step 9 part 1 on branch `redesign/part-1-photo-hero`: full-width and split photo heroes, hero photo upload and picker in the Design tab, automatic product photo, second photo on hover, letter placeholders, AI told about photos. 251 tests pass; checked in the browser at desktop and phone width with a test banner on Luna Skin.                                                                                             | Merge, then part 2                                              |
534
-| 2026-11-18 | Step 9 part 2 on branch `redesign/part-2-announcement-bar` (from part 1): announcement bar (automatic lines + merchant lines, Settings card) and trust row section with live facts. Plan checker now supports "required if" rules. 257 tests pass; real DeepSeek added a trust row to Luna Skin correctly; checked in the browser.                                                                                                 | Commit; part 3 branches from part 2                             |
535
-| 2026-11-18 | Step 9 part 3 on branch `redesign/part-3-product-page` (from part 2): folding sections (form, chat with merge by title), trust points, sticky phone add-to-cart bar, pairs well with, phone menu, sticky photos. Found and fixed the sticky bar hiding under the header. 261 tests pass; real DeepSeek wrote a sensible "How to use" for the sunscreen (confirmed); checked at phone width.                                        | Commit; part 4 branches from part 3                             |
518
+| Date       | Done                                                                                                                                                                                                                                                                                                                                                                                                                                                               | Next                                                            |
519
+| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------- |
520
+| 2026-11-14 | Planning. Chose stack, market, payments, AI models, plan prices. Checked local tools. Created this file. All proposed decisions confirmed. Added the rule that the AI model must be easy to change.                                                                                                                                                                                                                                                                | Install PHP 8.4, create the Laravel project (Step 0 and Step 1) |
521
+| 2026-11-14 | Installed PHP 8.4. Created the Laravel 13 + React project, MySQL database and git repo. Built create-a-store flow and dashboard. 51 tests pass; login and store creation checked in the browser. Step 0 and Step 1 done.                                                                                                                                                                                                                                           | Step 2: store plan format, sections, renderer                   |
522
+| 2026-11-14 | Step 2 done on branch `feature/store-sections-renderer`: store plan format and validator, 10 sections with 2 variants each, renderer, dashboard preview, sample design. 69 tests pass; storefront checked in the browser on desktop and mobile.                                                                                                                                                                                                                    | Step 3: swappable AI layer and store generation                 |
523
+| 2026-11-14 | First commit made and pushed to the private repository on git.mirfalah.my (branch `feature/store-sections-renderer`).                                                                                                                                                                                                                                                                                                                                              | Step 3: swappable AI layer and store generation                 |
524
+| 2026-11-14 | Step 3 built on branch `feature/ai-generation`: swappable AI layer (Claude, DeepSeek, fake), full store generation, chat edits, background job with progress screen, plan limits. 92 tests pass; whole flow checked in the browser with the fake provider. Not yet run against real Claude or DeepSeek.                                                                                                                                                            | Add API keys, run the real test, then Step 4                    |
525
+| 2026-11-14 | Split settings into `.env` (uploaded, no secrets, AI settings blank) and `.env.local` (private, complete). Removed `.env.example`.                                                                                                                                                                                                                                                                                                                                 | Real AI test, then Step 4                                       |
526
+| 2026-11-14 | Real AI test passed: Claude Sonnet 5.5 generated two stores, DeepSeek made two chat edits. Tuned the prompt for more varied layouts. Step 3 done.                                                                                                                                                                                                                                                                                                                  | Merge into `main`, then Step 4: products                        |
527
+| 2026-11-14 | Step 4 part 1 on branch `feature/commerce`: store plan version 2 with pages, products with photos, Shop page, product page, real products on the home page. 108 tests pass; checked in the browser; real Claude and DeepSeek re-tested with the new format.                                                                                                                                                                                                        | Step 4 part 2: cart, Stripe checkout, orders, email             |
528
+| 2026-11-14 | Cart built on branch `feature/commerce`: add to cart, quantity, remove, subtotal, header count, stock limits. 118 tests pass; checked in the browser.                                                                                                                                                                                                                                                                                                              | Stripe checkout (needs test keys), orders, email                |
529
+| 2026-11-15 | Step 4 finished on branch `feature/commerce`: checkout with Stripe (test mode), orders for the merchant, order confirmation email. 133 tests pass. A real Stripe test payment worked end to end: order paid, stock lowered, email written to the log.                                                                                                                                                                                                              | Merge into `main`, then Step 5: publishing                      |
530
+| 2026-11-15 | Merged Steps 3 and 4 into `main` and pushed.                                                                                                                                                                                                                                                                                                                                                                                                                       | Step 5: publishing                                              |
531
+| 2026-11-15 | Content pages by chat on branch `feature/content-pages`: add, rename and remove pages, each page at its own address, menu links guaranteed by the app. 139 tests pass; tested with real DeepSeek and in the browser. Step 4 is now complete except the known gaps.                                                                                                                                                                                                 | Step 5: publishing                                              |
532
+| 2026-11-15 | Planning only. Added Step 8 (discount codes, product variants, bundles with linked stock, chat commands with a confirm step), placed after Malaysia features. "Before launch" is now Step 9. Cart items redesigned as cards.                                                                                                                                                                                                                                       | Step 5: publishing                                              |
533
+| 2026-11-15 | Step 5 on branch `feature/publishing`: publish and take offline, live stores on their own address, design changes private until published again, dashboard blocked on store addresses. 150 tests pass; Luna Skin published and checked in the browser at `luna-skin.localhost:8000`.                                                                                                                                                                               | Step 6: subscription billing                                    |
534
+| 2026-11-16 | Step 6 on branch `feature/billing`: plans table, 14-day trial, Stripe subscriptions (subscribe, switch, cancel, undo), Billing page, limits enforced, live stores offline when there is no plan. 164 tests pass; real Stripe test subscription to Growth, cancel and undo all worked. Switched the session model from Fable 5.2 to Opus 5.5.                                                                                                                       | Merge into `main`, then Step 7                                  |
535
+| 2026-11-16 | Step 7 part 1 on branch `feature/malaysia-shipping`: store settings, flat shipping fees (west, east, free over), mark as shipped with tracking and email, WhatsApp buttons, Malay checkout messages, Malaysian phone check. Fixed live-store menu links on pages other than home (bug from Step 5). 178 tests pass; real Stripe test payment with shipping to Sabah worked.                                                                                        | Merge, then Step 7 part 2 or Step 8                             |
536
+| 2026-11-16 | Featured product fix on branch `feature/featured-product-link` (built on `feature/malaysia-shipping`): the section links to a real product (Design tab picker or chat), shows its real name, price, photo and page, and hides the made-up price otherwise. Added a check that marks chat edits that changed nothing. 191 tests pass; checked in the browser and with real DeepSeek.                                                                                | Merge both branches, then Step 7 part 2 or Step 8               |
537
+| 2026-11-16 | Planning only. Added "more design styles" to later improvements: style options (effects, backgrounds, buttons, spacing, motion), more fonts, more layouts per section, more section types.                                                                                                                                                                                                                                                                         | Merge branches, then Step 7 part 2 or Step 8                    |
538
+| 2026-11-16 | Step 8 part 1 on branch `feature/discount-codes`: discount codes (merchant Discounts tab, cart code box, order record, Stripe coupon, use counted when paid). 207 tests pass; real Stripe test payment with a 20% code worked.                                                                                                                                                                                                                                     | Merge, then product variants                                    |
539
+| 2026-11-16 | Step 8 part 2 on branch `feature/product-variants` (built on `feature/discount-codes`): product options and variants, option buttons on the product page, variant cart lines, orders and stock. 217 tests pass; real Stripe test payment for a 100ml variant with a discount code worked.                                                                                                                                                                          | Merge both branches, then bundles                               |
540
+| 2026-11-16 | Step 8 part 3 on branch `feature/bundles`: bundles with linked stock (bundle editor in the product form, "What's inside" on the product page, shared stock check at checkout, order shows what to pack). 223 tests pass; real Stripe test payment for "Glow Starter Set" (cleanser + 50ml moisturiser, RM 69 + RM 8 shipping) lowered both items' stock.                                                                                                           | Merge, then chat commands                                       |
541
+| 2026-11-17 | Step 8 part 4 on branch `feature/chat-commands`: chat commands for products, discount codes and bundles, with Confirm and Cancel in the chat. Shared discount rules. Fixed a test that failed by chance (random stock). 233 tests pass; with real DeepSeek, "GLOW15 until end of month + 100ml to RM 52" was proposed, confirmed and saved; a product + bundle request was proposed correctly and cancelled.                                                       | Merge; then automatic discounts, Step 7 part 2 or Step 9        |
542
+| 2026-11-17 | Step 8 part 5 on branch `feature/automatic-discounts`: automatic discounts (Discounts tab form, best-of-one rule with codes, cart nudge, product page note, order/Stripe/email name, chat command). Step 8 is done. 243 tests pass; real Stripe test payment with "Glow Week" (2 cleansers, −RM 8.40, total RM 83.60) worked, GLOW15 correctly won when typed; real DeepSeek proposed a sunscreen-only sale correctly (cancelled).                                 | Merge; then Step 7 part 2 or Step 9                             |
543
+| 2026-11-17 | Chat commands can write product descriptions from the product name (same branch, `feature/automatic-discounts`). Real DeepSeek test found the AI guessing bundle contents, so bundle contents are now listed for it; second try was accurate. 244 tests pass.                                                                                                                                                                                                      | Merge; then Step 7 part 2 or Step 9                             |
544
+| 2026-11-17 | Researched 2026 store design trends and published a comparison page. Added Step 9 — Modern store design (6 parts) and the category guides decision; "Before launch" is now Step 10.                                                                                                                                                                                                                                                                                | Step 9 part 1: photos first                                     |
545
+| 2026-11-18 | Step 9 part 1 on branch `redesign/part-1-photo-hero`: full-width and split photo heroes, hero photo upload and picker in the Design tab, automatic product photo, second photo on hover, letter placeholders, AI told about photos. 251 tests pass; checked in the browser at desktop and phone width with a test banner on Luna Skin.                                                                                                                             | Merge, then part 2                                              |
546
+| 2026-11-18 | Step 9 part 2 on branch `redesign/part-2-announcement-bar` (from part 1): announcement bar (automatic lines + merchant lines, Settings card) and trust row section with live facts. Plan checker now supports "required if" rules. 257 tests pass; real DeepSeek added a trust row to Luna Skin correctly; checked in the browser.                                                                                                                                 | Commit; part 3 branches from part 2                             |
547
+| 2026-11-18 | Step 9 part 3 on branch `redesign/part-3-product-page` (from part 2): folding sections (form, chat with merge by title), trust points, sticky phone add-to-cart bar, pairs well with, phone menu, sticky photos. Found and fixed the sticky bar hiding under the header. 261 tests pass; real DeepSeek wrote a sensible "How to use" for the sunscreen (confirmed); checked at phone width.                                                                        | Commit; part 4 branches from part 3                             |
548
+| 2026-11-19 | Step 9 part 4 on branch `redesign/part-4-style-options` (from part 3): style options, six ready-made looks with a Style box, 12 more fonts, gentle motion, AI style rules. Fixed fade-in hiding a section that was already partly on screen. "More layouts per section" moved to a new part 5; category guides are now part 6 and collections part 7. 266 tests pass; Bold look and a real DeepSeek "more premium and elegant" change both checked in the browser. | Commit; part 5 branches from part 4                             |

+ 2
- 1
README.md Zobrazit soubor

@@ -21,7 +21,7 @@ An AI store generator for ecommerce. A customer describes their brand, and the A
21 21
 | 6    | Our own subscription billing                            | Done                                                           |
22 22
 | 7    | Malaysia features: FPX, DuitNow, EasyParcel, WhatsApp   | Part 1 done (shipping fees, WhatsApp); EasyParcel and FPX next |
23 23
 | 8    | Discounts and product options: codes, variants, bundles | Done                                                           |
24
-| 9    | Modern store design: photos, styles, category guides    | In progress: parts 1–3 done; part 4 next                       |
24
+| 9    | Modern store design: photos, styles, category guides    | In progress: parts 1–4 done; part 5 next                       |
25 25
 | 10   | Before launch: hosting, legal pages, backups            | Not started                                                    |
26 26
 
27 27
 ## What works today
@@ -40,6 +40,7 @@ An AI store generator for ecommerce. A customer describes their brand, and the A
40 40
 - Trust row under the hero: shipping, secure payment and WhatsApp, always taken from the store's real settings
41 41
 - Product page: folding sections such as "How to use" (written in the form or by chat) plus shipping from real fees, trust points, "Pairs well with", and an add-to-cart bar that stays at the bottom on phones
42 42
 - Phone menu for the store header
43
+- Store styles: six ready-made looks (Minimal, Soft, Elegant, Bold, Playful, Classic) in the Design tab, with fine-tuning for buttons, cards, spacing, headings, backgrounds and motion; 20 fonts. The AI picks a style that fits the brand and changes it by chat
43 44
 - Change the store by chat, for example "make a 10% code RAYA10 until the end of the month" or "set the 100ml moisturiser to RM 52", or "write descriptions for my products". The AI shows what it will do, and nothing changes until you press Confirm
44 45
 - Add or remove whole pages by chat, for example "add an About page". The menu link is added automatically
45 46
 - "Regenerate" for a completely new design, limited by the plan

+ 10
- 0
app/Http/Controllers/StoreController.php Zobrazit soubor

@@ -13,6 +13,7 @@ use App\Models\StoreGeneration;
13 13
 use App\Storefront\Storefront;
14 14
 use App\StorePlan\FeaturedProducts;
15 15
 use App\StorePlan\HeroImages;
16
+use App\StorePlan\PlanSchema;
16 17
 use Illuminate\Http\RedirectResponse;
17 18
 use Illuminate\Http\Request;
18 19
 use Inertia\Inertia;
@@ -92,6 +93,15 @@ class StoreController extends Controller
92 93
             // Hero sections of the working design, and the photos they can use.
93 94
             'heroSections' => $store->plan !== null ? HeroImages::sections($store->plan) : [],
94 95
             'heroChoices' => HeroImages::choices($store),
96
+            // The design's style with every option filled in, and the ready-made looks to choose from.
97
+            'style' => $store->plan !== null ? [
98
+                'options' => [...PlanSchema::STYLE_DEFAULTS, ...($store->plan['theme']['style'] ?? [])],
99
+                'radius' => $store->plan['theme']['radius'] ?? 'medium',
100
+                'fonts' => $store->plan['theme']['fonts'] ?? null,
101
+            ] : null,
102
+            'stylePresets' => collect(PlanSchema::STYLE_PRESETS)
103
+                ->map(fn (array $preset, string $key) => ['key' => $key, ...$preset])
104
+                ->values(),
95 105
             'productOptions' => $store->products()
96 106
                 ->active()
97 107
                 ->orderBy('name')

+ 53
- 0
app/Http/Controllers/StoreStyleController.php Zobrazit soubor

@@ -0,0 +1,53 @@
1
+<?php
2
+
3
+namespace App\Http\Controllers;
4
+
5
+use App\StorePlan\PlanSchema;
6
+use App\StorePlan\PlanValidator;
7
+use Illuminate\Http\RedirectResponse;
8
+use Illuminate\Http\Request;
9
+use Illuminate\Validation\Rule;
10
+use Inertia\Inertia;
11
+
12
+/**
13
+ * The Design tab's Style box: a ready-made look (style, corner roundness and fonts), or single style options.
14
+ * Colours are never touched. This changes the working design, so a live store shows it after "Publish changes".
15
+ */
16
+class StoreStyleController extends Controller
17
+{
18
+    public function update(Request $request, PlanValidator $validator, string $slug): RedirectResponse
19
+    {
20
+        $store = $request->user()->stores()->where('slug', $slug)->firstOrFail();
21
+
22
+        abort_if($store->plan === null, 404);
23
+
24
+        $rules = ['preset' => ['nullable', Rule::in(array_keys(PlanSchema::STYLE_PRESETS))], 'style' => ['nullable', 'array']];
25
+
26
+        foreach (PlanSchema::STYLE_OPTIONS as $option => $values) {
27
+            $rules["style.$option"] = ['nullable', Rule::in($values)];
28
+        }
29
+
30
+        $validated = $request->validate($rules);
31
+        $plan = $store->plan;
32
+        $preset = PlanSchema::STYLE_PRESETS[$validated['preset'] ?? ''] ?? null;
33
+
34
+        if ($preset !== null) {
35
+            $plan['theme']['radius'] = $preset['radius'];
36
+            $plan['theme']['fonts'] = $preset['fonts'];
37
+            $plan['theme']['style'] = $preset['style'];
38
+        }
39
+
40
+        if (is_array($validated['style'] ?? null)) {
41
+            $plan['theme']['style'] = [...PlanSchema::STYLE_DEFAULTS, ...($plan['theme']['style'] ?? []), ...array_filter($validated['style'])];
42
+        }
43
+
44
+        $store->plan = $validator->validate($plan);
45
+        $store->save();
46
+
47
+        Inertia::flash('toast', ['type' => 'success', 'message' => $store->isPublished()
48
+            ? __('Saved. Click "Publish changes" to show it on your live store.')
49
+            : __('Style saved.')]);
50
+
51
+        return to_route('stores.show', $store->slug);
52
+    }
53
+}

+ 9
- 2
app/StorePlan/Ai/PlanPrompt.php Zobrazit soubor

@@ -38,7 +38,7 @@ final class PlanPrompt
38 38
 
39 39
         - Design one page for now: the home page (id "home", title "Home"), with 5 to 8 sections. Start it with a "hero". Pick the other sections to suit the brand.
40 40
         - The header and footer are written once, at the top of the plan. Do not put them inside a page.
41
-        - Choose a colour palette and fonts that fit the brand's mood. Do not default to the same look for every store.
41
+        - Choose a colour palette, fonts and a "style" that fit the brand's mood. Do not default to the same look for every store. The style changes buttons, cards, spacing, headings, backgrounds and motion, so two stores with similar colours still feel different. For example: a quiet skincare or homeware brand suits plain cards, airy spacing and outline or solid buttons; a premium or fashion brand suits spaced-capital headings, no-edge cards and a serif heading font; a loud streetwear, snack or kids brand suits heavy headings, bold shadow buttons, hard cards and alternating bands. Gentle motion suits most stores.
42 42
         - Make the structure fit the brand too. Decide which sections this brand really needs, in which order, and pick each variant on purpose. You do not need every section type. A store with one main product may put "featured_product" right after the hero; a brand with a strong story may put "about" early; a small catalogue suits "product_grid" with the "minimal" variant. Do not reuse the section order or variants of the example below.
43 43
         - Text must be easy to read: strong contrast between "foreground" and "background", and between "primaryForeground" and "primary".
44 44
         - Write specific, warm, concrete copy for this brand. Avoid generic filler.
@@ -223,6 +223,8 @@ final class PlanPrompt
223 223
 
224 224
         Trust row: a "trust_bar" section shows short reassurances. Items of kind "shipping", "payment" and "whatsapp" are filled in by the store from its real settings, so never write their text. A "custom" item needs a "title" and must only state what the merchant told you. To add one under the hero: {"add": [{"page": "home", "after": "hero id", "section": {"id": "trust", "type": "trust_bar", "variant": "row", "content": {"items": [{"kind": "shipping"}, {"kind": "payment"}, {"kind": "whatsapp"}]}}}]}
225 225
 
226
+        Style: to make the store feel different ("more premium", "bolder", "more playful", "futuristic"), change "theme": "style", "fonts", "radius" and, if it fits, "colors". For example {"theme": {"style": {"buttons": "shadow", "cards": "hard", "headings": "heavy"}, "fonts": {"heading": "archivo-black"}, "radius": "none"}}. The merchant can also pick a ready-made look in the Style box of the Design tab.
227
+
226 228
         Hero photos: a hero with the "split" or "image-full" layout shows a photo. Its "image" is a name from the photo list you are given, or null to use the store's product photos automatically. Never make up a photo name. If the merchant asks for their own banner photo, tell them to upload it in the "Hero" box of the Design tab.
227 229
 
228 230
         Featured products: when the merchant asks to feature one of their products, set "productSlug" on the "featured_product" section (or add one) using the product list you are given. Also rewrite that section's "eyebrow", "description" and "bullets" so they describe the new product. For example, to feature the product "light-water-gel-moisturiser" in the section with id "sunscreen":
@@ -324,6 +326,8 @@ final class PlanPrompt
324 326
         $colors = implode(', ', PlanSchema::COLORS);
325 327
         $fonts = implode(', ', array_keys(PlanSchema::FONTS));
326 328
         $radii = implode(', ', PlanSchema::RADII);
329
+        $headingOnly = implode(', ', PlanSchema::HEADING_ONLY_FONTS);
330
+        $styles = collect(PlanSchema::STYLE_OPTIONS)->map(fn (array $values, string $key) => "$key: ".implode('|', $values))->implode('; ');
327 331
         $max = PlanSchema::MAX_SECTIONS;
328 332
         $maxPages = PlanSchema::MAX_PAGES;
329 333
         $reserved = implode(', ', PlanSchema::RESERVED_PAGE_IDS);
@@ -354,7 +358,8 @@ final class PlanPrompt
354 358
           "theme": {
355 359
             "colors": { one 6-digit hex colour such as "#1A2B3C" for each of: {$colors} },
356 360
             "fonts": { "heading": font, "body": font },
357
-            "radius": radius
361
+            "radius": radius,
362
+            "style": { "buttons": ..., "cards": ..., "spacing": ..., "headings": ..., "backgrounds": ..., "motion": ... }
358 363
           },
359 364
           "header": { "variant": "...", "content": { ... } },
360 365
           "footer": { "variant": "...", "content": { ... } },
@@ -367,7 +372,9 @@ final class PlanPrompt
367 372
         - The first page must have the id "home". Other page ids follow the same rules as section ids, and become the page's address ("about" is opened at "/about").
368 373
         - At most {$maxPages} pages. These page ids are taken by the store's own pages and cannot be used: {$reserved}.
369 374
         - Allowed fonts: {$fonts}
375
+        - These fonts are for headings only, never for "body": {$headingOnly}
370 376
         - Allowed radius values: {$radii}
377
+        - "style" (every part optional): {$styles}. buttons: solid, outline (a line, filled on hover) or shadow (solid offset shadow, bold and playful). cards: border (thin line), shadow (soft lift), plain (no edge) or hard (thick line with offset shadow). spacing: room between sections. headings: normal, uppercase (spaced capitals, elegant) or heavy (extra bold). backgrounds: plain, or alternate (every other section on a soft band). motion: none, or gentle (sections fade up as they come into view).
371 378
         - Colour roles: "background" is the page, "surface" is cards and soft panels, "foreground" is main text, "muted" is secondary text, "primary" is buttons and highlights, "primaryForeground" is text on primary, "accent" is small details, "border" is thin lines.
372 379
         - Section "id": unique in the whole plan, lowercase letters, digits and dashes, starting with a letter, at most 40 characters.
373 380
         - At most {$max} sections on a page. A section type may be used more than once. "header" and "footer" are not allowed inside a page.

+ 103
- 0
app/StorePlan/PlanSchema.php Zobrazit soubor

@@ -48,6 +48,109 @@ final class PlanSchema
48 48
         'playfair-display' => 'Playfair Display',
49 49
         'lora' => 'Lora',
50 50
         'fraunces' => 'Fraunces',
51
+        // Added in Step 9 part 4, for more personality.
52
+        'cormorant-garamond' => 'Cormorant Garamond',
53
+        'dm-serif-display' => 'DM Serif Display',
54
+        'libre-baskerville' => 'Libre Baskerville',
55
+        'bricolage-grotesque' => 'Bricolage Grotesque',
56
+        'syne' => 'Syne',
57
+        'unbounded' => 'Unbounded',
58
+        'archivo-black' => 'Archivo Black',
59
+        'bebas-neue' => 'Bebas Neue',
60
+        'outfit' => 'Outfit',
61
+        'jost' => 'Jost',
62
+        'nunito' => 'Nunito',
63
+        'caveat' => 'Caveat',
64
+    ];
65
+
66
+    /**
67
+     * Fonts that only suit big headings: one weight, all capitals or handwriting. Never for body text.
68
+     *
69
+     * @var list<string>
70
+     */
71
+    public const array HEADING_ONLY_FONTS = ['archivo-black', 'bebas-neue', 'caveat', 'dm-serif-display'];
72
+
73
+    /**
74
+     * The look of the whole store, beyond colours and fonts. Every option is optional; an old plan without
75
+     * "style" uses the defaults, which look exactly like stores did before.
76
+     *
77
+     * - buttons: solid, outline (a line around, filled on hover) or shadow (a solid offset shadow, playful and bold)
78
+     * - cards: border (thin line), shadow (soft lift), plain (no edge) or hard (thick line and solid offset shadow)
79
+     * - spacing: compact, normal or airy (room between sections)
80
+     * - headings: normal, uppercase (spaced capitals, elegant) or heavy (extra bold and tight)
81
+     * - backgrounds: plain, or alternate (every other section on a soft band)
82
+     * - motion: none, or gentle (sections fade up as they come into view; never for visitors who ask for less motion)
83
+     *
84
+     * @var array<string, list<string>>
85
+     */
86
+    public const array STYLE_OPTIONS = [
87
+        'buttons' => ['solid', 'outline', 'shadow'],
88
+        'cards' => ['border', 'shadow', 'plain', 'hard'],
89
+        'spacing' => ['compact', 'normal', 'airy'],
90
+        'headings' => ['normal', 'uppercase', 'heavy'],
91
+        'backgrounds' => ['plain', 'alternate'],
92
+        'motion' => ['none', 'gentle'],
93
+    ];
94
+
95
+    /** @var array<string, string> */
96
+    public const array STYLE_DEFAULTS = [
97
+        'buttons' => 'solid',
98
+        'cards' => 'border',
99
+        'spacing' => 'normal',
100
+        'headings' => 'normal',
101
+        'backgrounds' => 'plain',
102
+        'motion' => 'none',
103
+    ];
104
+
105
+    /**
106
+     * Ready-made looks for the Design tab's Style box. Each sets the style, corner roundness and fonts;
107
+     * colours stay as they are.
108
+     *
109
+     * @var array<string, array{label: string, hint: string, radius: string, fonts: array{heading: string, body: string}, style: array<string, string>}>
110
+     */
111
+    public const array STYLE_PRESETS = [
112
+        'minimal' => [
113
+            'label' => 'Minimal',
114
+            'hint' => 'Clean, lots of space, quiet details',
115
+            'radius' => 'small',
116
+            'fonts' => ['heading' => 'manrope', 'body' => 'inter'],
117
+            'style' => ['buttons' => 'solid', 'cards' => 'plain', 'spacing' => 'airy', 'headings' => 'normal', 'backgrounds' => 'plain', 'motion' => 'gentle'],
118
+        ],
119
+        'soft' => [
120
+            'label' => 'Soft',
121
+            'hint' => 'Rounded, gentle shadows, friendly',
122
+            'radius' => 'large',
123
+            'fonts' => ['heading' => 'outfit', 'body' => 'nunito'],
124
+            'style' => ['buttons' => 'solid', 'cards' => 'shadow', 'spacing' => 'airy', 'headings' => 'normal', 'backgrounds' => 'alternate', 'motion' => 'gentle'],
125
+        ],
126
+        'elegant' => [
127
+            'label' => 'Elegant',
128
+            'hint' => 'Serif headings, fine lines, premium',
129
+            'radius' => 'none',
130
+            'fonts' => ['heading' => 'cormorant-garamond', 'body' => 'jost'],
131
+            'style' => ['buttons' => 'outline', 'cards' => 'plain', 'spacing' => 'airy', 'headings' => 'uppercase', 'backgrounds' => 'plain', 'motion' => 'gentle'],
132
+        ],
133
+        'bold' => [
134
+            'label' => 'Bold',
135
+            'hint' => 'Heavy type, hard shadows, loud',
136
+            'radius' => 'none',
137
+            'fonts' => ['heading' => 'archivo-black', 'body' => 'space-grotesk'],
138
+            'style' => ['buttons' => 'shadow', 'cards' => 'hard', 'spacing' => 'normal', 'headings' => 'heavy', 'backgrounds' => 'alternate', 'motion' => 'gentle'],
139
+        ],
140
+        'playful' => [
141
+            'label' => 'Playful',
142
+            'hint' => 'Round shapes, fun type, lively',
143
+            'radius' => 'full',
144
+            'fonts' => ['heading' => 'bricolage-grotesque', 'body' => 'dm-sans'],
145
+            'style' => ['buttons' => 'shadow', 'cards' => 'shadow', 'spacing' => 'normal', 'headings' => 'heavy', 'backgrounds' => 'alternate', 'motion' => 'gentle'],
146
+        ],
147
+        'classic' => [
148
+            'label' => 'Classic',
149
+            'hint' => 'How stores looked before: simple and safe',
150
+            'radius' => 'medium',
151
+            'fonts' => ['heading' => 'manrope', 'body' => 'inter'],
152
+            'style' => self::STYLE_DEFAULTS,
153
+        ],
51 154
     ];
52 155
 
53 156
     /**

+ 9
- 0
app/StorePlan/PlanValidator.php Zobrazit soubor

@@ -32,6 +32,8 @@ final class PlanValidator
32 32
             'theme.fonts.heading' => ['required', Rule::in(array_keys(PlanSchema::FONTS))],
33 33
             'theme.fonts.body' => ['required', Rule::in(array_keys(PlanSchema::FONTS))],
34 34
             'theme.radius' => ['required', Rule::in(PlanSchema::RADII)],
35
+            // Optional: an old plan without it uses PlanSchema::STYLE_DEFAULTS.
36
+            'theme.style' => ['nullable', 'array'],
35 37
             'pages' => ['required', 'array', 'min:1', 'max:'.PlanSchema::MAX_PAGES],
36 38
             'pages.*' => ['required', 'array'],
37 39
             'pages.*.id' => ['required', 'string', 'distinct', 'regex:'.PlanSchema::SECTION_ID_PATTERN, Rule::notIn(PlanSchema::RESERVED_PAGE_IDS)],
@@ -45,6 +47,13 @@ final class PlanValidator
45 47
             'pages.0.id' => ['required', Rule::in([PlanSchema::HOME_PAGE])],
46 48
         ];
47 49
 
50
+        // A heading-only font (all capitals or handwriting) would make paragraphs hard to read.
51
+        $rules['theme.fonts.body'][] = Rule::notIn(PlanSchema::HEADING_ONLY_FONTS);
52
+
53
+        foreach (PlanSchema::STYLE_OPTIONS as $option => $values) {
54
+            $rules['theme.style.'.$option] = ['nullable', Rule::in($values)];
55
+        }
56
+
48 57
         foreach (PlanSchema::COLORS as $color) {
49 58
             $rules['theme.colors.'.$color] = ['required', 'string', 'regex:'.PlanSchema::COLOR_PATTERN];
50 59
         }

+ 8
- 0
app/StorePlan/SamplePlan.php Zobrazit soubor

@@ -50,6 +50,14 @@ final class SamplePlan
50 50
                 ],
51 51
                 'fonts' => ['heading' => 'fraunces', 'body' => 'dm-sans'],
52 52
                 'radius' => 'medium',
53
+                'style' => [
54
+                    'buttons' => 'solid',
55
+                    'cards' => 'shadow',
56
+                    'spacing' => 'normal',
57
+                    'headings' => 'normal',
58
+                    'backgrounds' => 'alternate',
59
+                    'motion' => 'gentle',
60
+                ],
53 61
             ],
54 62
             'sections' => [
55 63
                 [

+ 129
- 0
resources/css/app.css Zobrazit soubor

@@ -204,3 +204,132 @@
204 204
         bottom: 5.5rem;
205 205
     }
206 206
 }
207
+
208
+/*
209
+ * Store styles (theme.style in the store plan). The storefront root carries data-buttons, data-cards,
210
+ * data-spacing, data-headings, data-backgrounds and data-motion; components only carry the classes
211
+ * sf-btn-primary, sf-btn-outline, sf-card, sf-section and sf-band. "Normal" values change nothing, so
212
+ * stores without a style look as they always did.
213
+ */
214
+
215
+/* Buttons: outline */
216
+.sf-root[data-buttons='outline'] .sf-btn-primary {
217
+    background-color: transparent;
218
+    color: var(--sf-primary);
219
+    box-shadow: inset 0 0 0 1.5px var(--sf-primary);
220
+}
221
+
222
+.sf-root[data-buttons='outline'] .sf-btn-primary:hover:not(:disabled) {
223
+    background-color: var(--sf-primary);
224
+    color: var(--sf-primary-fg);
225
+    opacity: 1;
226
+}
227
+
228
+/* On a full-width photo an outline button would vanish, so it stays solid there. */
229
+.sf-root[data-buttons='outline'] .sf-on-photo .sf-btn-primary {
230
+    background-color: var(--sf-primary);
231
+    color: var(--sf-primary-fg);
232
+    box-shadow: none;
233
+}
234
+
235
+/* Buttons: shadow (a solid offset shadow that presses in when clicked) */
236
+.sf-root[data-buttons='shadow'] :is(.sf-btn-primary, .sf-btn-outline) {
237
+    border: 2px solid var(--sf-fg);
238
+    box-shadow: 3px 3px 0 var(--sf-fg);
239
+    transition:
240
+        transform 0.15s ease,
241
+        box-shadow 0.15s ease;
242
+}
243
+
244
+.sf-root[data-buttons='shadow']
245
+    :is(.sf-btn-primary, .sf-btn-outline):hover:not(:disabled) {
246
+    opacity: 1;
247
+    transform: translate(-1px, -1px);
248
+    box-shadow: 4px 4px 0 var(--sf-fg);
249
+}
250
+
251
+.sf-root[data-buttons='shadow']
252
+    :is(.sf-btn-primary, .sf-btn-outline):active:not(:disabled) {
253
+    transform: translate(2px, 2px);
254
+    box-shadow: 1px 1px 0 var(--sf-fg);
255
+}
256
+
257
+/* Cards and photos */
258
+.sf-root[data-cards='shadow'] .sf-card {
259
+    border-color: transparent;
260
+    box-shadow:
261
+        0 1px 2px rgb(0 0 0 / 0.04),
262
+        0 10px 28px -10px rgb(0 0 0 / 0.16);
263
+}
264
+
265
+.sf-root[data-cards='plain'] .sf-card {
266
+    border-color: transparent;
267
+    box-shadow: none;
268
+}
269
+
270
+.sf-root[data-cards='hard'] .sf-card {
271
+    border: 2px solid var(--sf-fg);
272
+    box-shadow: 4px 4px 0 var(--sf-fg);
273
+}
274
+
275
+/* Spacing between sections */
276
+.sf-root[data-spacing='compact'] .sf-section {
277
+    padding-block: 2.5rem;
278
+}
279
+
280
+.sf-root[data-spacing='airy'] .sf-section {
281
+    padding-block: 5.5rem;
282
+}
283
+
284
+@media (min-width: 768px) {
285
+    .sf-root[data-spacing='compact'] .sf-section {
286
+        padding-block: 3.5rem;
287
+    }
288
+
289
+    .sf-root[data-spacing='airy'] .sf-section {
290
+        padding-block: 8rem;
291
+    }
292
+}
293
+
294
+/* Headings */
295
+.sf-root[data-headings='uppercase'] .sf-heading {
296
+    text-transform: uppercase;
297
+    letter-spacing: 0.06em;
298
+    font-weight: 500;
299
+}
300
+
301
+.sf-root[data-headings='heavy'] .sf-heading {
302
+    font-weight: 800;
303
+    letter-spacing: -0.03em;
304
+}
305
+
306
+/* Backgrounds: every other section on a soft band */
307
+.sf-root[data-backgrounds='alternate'] .sf-band-alt {
308
+    background-color: var(--sf-surface);
309
+}
310
+
311
+/* Motion: sections below the first screen fade up as they come into view (see reveal.tsx). */
312
+@media (prefers-reduced-motion: no-preference) {
313
+    .sf-root[data-motion='gentle'] .sf-band.sf-reveal {
314
+        opacity: 0;
315
+        transform: translateY(28px);
316
+        transition:
317
+            opacity 0.7s ease,
318
+            transform 0.7s ease;
319
+    }
320
+
321
+    .sf-root[data-motion='gentle'] .sf-band.sf-reveal.sf-revealed {
322
+        opacity: 1;
323
+        transform: none;
324
+    }
325
+
326
+    .sf-root[data-motion='gentle'] .sf-card {
327
+        transition:
328
+            transform 0.3s ease,
329
+            box-shadow 0.3s ease;
330
+    }
331
+
332
+    .sf-root[data-motion='gentle'] a:hover .sf-card {
333
+        transform: translateY(-3px);
334
+    }
335
+}

+ 226
- 0
resources/js/components/stores/style-picker.tsx Zobrazit soubor

@@ -0,0 +1,226 @@
1
+import { router } from '@inertiajs/react';
2
+import { Check, Palette } from 'lucide-react';
3
+import type { CSSProperties } from 'react';
4
+import { useState } from 'react';
5
+import StoreStyleController from '@/actions/App/Http/Controllers/StoreStyleController';
6
+import { cn } from '@/lib/utils';
7
+import type { Store, StoreStyleInfo, StylePreset } from '@/types';
8
+
9
+const fieldClass =
10
+    'h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50 md:text-sm';
11
+
12
+/** The fine-tune choices, in plain words. Keys and values match PlanSchema::STYLE_OPTIONS. */
13
+const fineTune: {
14
+    key: string;
15
+    label: string;
16
+    choices: Record<string, string>;
17
+}[] = [
18
+    {
19
+        key: 'buttons',
20
+        label: 'Buttons',
21
+        choices: { solid: 'Solid', outline: 'Outline', shadow: 'Bold shadow' },
22
+    },
23
+    {
24
+        key: 'cards',
25
+        label: 'Cards and photos',
26
+        choices: {
27
+            border: 'Thin line',
28
+            shadow: 'Soft shadow',
29
+            plain: 'No edge',
30
+            hard: 'Bold line and shadow',
31
+        },
32
+    },
33
+    {
34
+        key: 'spacing',
35
+        label: 'Spacing',
36
+        choices: { compact: 'Compact', normal: 'Normal', airy: 'Airy' },
37
+    },
38
+    {
39
+        key: 'headings',
40
+        label: 'Headings',
41
+        choices: {
42
+            normal: 'Normal',
43
+            uppercase: 'Spaced capitals',
44
+            heavy: 'Extra bold',
45
+        },
46
+    },
47
+    {
48
+        key: 'backgrounds',
49
+        label: 'Backgrounds',
50
+        choices: { plain: 'Plain', alternate: 'Alternating bands' },
51
+    },
52
+    {
53
+        key: 'motion',
54
+        label: 'Motion',
55
+        choices: { none: 'None', gentle: 'Gentle fade-in' },
56
+    },
57
+];
58
+
59
+const radiusPx: Record<string, string> = {
60
+    none: '0px',
61
+    small: '4px',
62
+    medium: '10px',
63
+    large: '16px',
64
+    full: '9999px',
65
+};
66
+
67
+/**
68
+ * The Design tab's Style box: pick a ready-made look, or fine-tune one option at a time.
69
+ * Colours are kept as they are.
70
+ */
71
+export default function StylePicker({
72
+    store,
73
+    current,
74
+    presets,
75
+    busy,
76
+}: {
77
+    store: Store;
78
+    current: StoreStyleInfo | null;
79
+    presets: StylePreset[];
80
+    busy: boolean;
81
+}) {
82
+    const [saving, setSaving] = useState(false);
83
+
84
+    if (!current) {
85
+        return null;
86
+    }
87
+
88
+    function send(data: { preset?: string; style?: Record<string, string> }) {
89
+        router.put(StoreStyleController.update.url(store.slug), data, {
90
+            preserveScroll: true,
91
+            onStart: () => setSaving(true),
92
+            onFinish: () => setSaving(false),
93
+        });
94
+    }
95
+
96
+    const active = presets.find(
97
+        (preset) =>
98
+            preset.radius === current.radius &&
99
+            preset.fonts.heading === current.fonts?.heading &&
100
+            preset.fonts.body === current.fonts?.body &&
101
+            Object.entries(preset.style).every(
102
+                ([key, value]) => current.options[key] === value,
103
+            ),
104
+    );
105
+    const disabled = busy || saving;
106
+
107
+    return (
108
+        <div
109
+            className="space-y-5 rounded-xl border p-4"
110
+            data-test="style-picker"
111
+        >
112
+            <div className="flex items-start gap-3">
113
+                <Palette className="mt-0.5 size-5 shrink-0 text-muted-foreground" />
114
+                <div>
115
+                    <h3 className="font-medium">Style</h3>
116
+                    <p className="mt-0.5 text-sm text-muted-foreground">
117
+                        The feel of your whole store: buttons, cards, fonts,
118
+                        spacing and motion. Your colours stay the same.
119
+                    </p>
120
+                </div>
121
+            </div>
122
+
123
+            <ul className="grid grid-cols-2 gap-2 sm:grid-cols-3">
124
+                {presets.map((preset) => {
125
+                    const selected = active?.key === preset.key;
126
+
127
+                    return (
128
+                        <li key={preset.key}>
129
+                            <button
130
+                                type="button"
131
+                                disabled={disabled}
132
+                                aria-pressed={selected}
133
+                                onClick={() => send({ preset: preset.key })}
134
+                                className={cn(
135
+                                    'relative flex h-full w-full flex-col gap-2 rounded-lg border p-3 text-left transition-colors hover:bg-muted/50 disabled:opacity-50',
136
+                                    selected &&
137
+                                        'border-foreground ring-1 ring-foreground',
138
+                                )}
139
+                            >
140
+                                <span
141
+                                    aria-hidden="true"
142
+                                    className="inline-flex w-fit px-3 py-1 text-xs font-semibold"
143
+                                    style={sample(preset)}
144
+                                >
145
+                                    Shop now
146
+                                </span>
147
+                                <span className="text-sm font-medium">
148
+                                    {preset.label}
149
+                                </span>
150
+                                <span className="text-xs text-muted-foreground">
151
+                                    {preset.hint}
152
+                                </span>
153
+                                {selected && (
154
+                                    <Check className="absolute top-2 right-2 size-4" />
155
+                                )}
156
+                            </button>
157
+                        </li>
158
+                    );
159
+                })}
160
+            </ul>
161
+
162
+            <details className="rounded-lg border px-3 py-2">
163
+                <summary className="cursor-pointer text-sm font-medium">
164
+                    Fine-tune
165
+                </summary>
166
+                <div className="grid gap-3 py-3 sm:grid-cols-2">
167
+                    {fineTune.map((option) => (
168
+                        <div key={option.key} className="grid gap-1.5">
169
+                            <label
170
+                                htmlFor={`style-${option.key}`}
171
+                                className="text-sm"
172
+                            >
173
+                                {option.label}
174
+                            </label>
175
+                            <select
176
+                                id={`style-${option.key}`}
177
+                                value={current.options[option.key]}
178
+                                disabled={disabled}
179
+                                onChange={(event) =>
180
+                                    send({
181
+                                        style: {
182
+                                            [option.key]: event.target.value,
183
+                                        },
184
+                                    })
185
+                                }
186
+                                className={fieldClass}
187
+                            >
188
+                                {Object.entries(option.choices).map(
189
+                                    ([value, label]) => (
190
+                                        <option key={value} value={value}>
191
+                                            {label}
192
+                                        </option>
193
+                                    ),
194
+                                )}
195
+                            </select>
196
+                        </div>
197
+                    ))}
198
+                </div>
199
+            </details>
200
+        </div>
201
+    );
202
+}
203
+
204
+/** A tiny button in the preset's shape, in neutral colours. */
205
+function sample(preset: StylePreset): CSSProperties {
206
+    const radius = radiusPx[preset.radius] ?? '10px';
207
+
208
+    if (preset.style.buttons === 'outline') {
209
+        return {
210
+            borderRadius: radius,
211
+            boxShadow: 'inset 0 0 0 1.5px currentColor',
212
+        };
213
+    }
214
+
215
+    if (preset.style.buttons === 'shadow') {
216
+        return {
217
+            borderRadius: radius,
218
+            background: '#facc15',
219
+            color: '#111',
220
+            border: '2px solid #111',
221
+            boxShadow: '2px 2px 0 #111',
222
+        };
223
+    }
224
+
225
+    return { borderRadius: radius, background: '#111', color: '#fff' };
226
+}

+ 15
- 0
resources/js/pages/stores/show.tsx Zobrazit soubor

@@ -13,6 +13,7 @@ import StoreGenerationController from '@/actions/App/Http/Controllers/StoreGener
13 13
 import DesignChat from '@/components/stores/design-chat';
14 14
 import FeaturedPicker from '@/components/stores/featured-picker';
15 15
 import HeroPicker from '@/components/stores/hero-picker';
16
+import StylePicker from '@/components/stores/style-picker';
16 17
 import DesignProgress from '@/components/stores/design-progress';
17 18
 import PublishPanel from '@/components/stores/publish-panel';
18 19
 import StoreNav from '@/components/stores/store-nav';
@@ -44,6 +45,8 @@ import type {
44 45
     HeroChoice,
45 46
     HeroSectionInfo,
46 47
     ProductOption,
48
+    StoreStyleInfo,
49
+    StylePreset,
47 50
     Store,
48 51
     StoreGeneration,
49 52
     Usage,
@@ -60,6 +63,8 @@ type Props = {
60 63
     productOptions: ProductOption[];
61 64
     heroSections: HeroSectionInfo[];
62 65
     heroChoices: HeroChoice[];
66
+    style: StoreStyleInfo | null;
67
+    stylePresets: StylePreset[];
63 68
 };
64 69
 
65 70
 export default function ShowStore({
@@ -71,6 +76,8 @@ export default function ShowStore({
71 76
     productOptions,
72 77
     heroSections,
73 78
     heroChoices,
79
+    style,
80
+    stylePresets,
74 81
 }: Props) {
75 82
     const [device, setDevice] = useState<Device>('desktop');
76 83
     const [confirmOpen, setConfirmOpen] = useState(false);
@@ -101,6 +108,7 @@ export default function ShowStore({
101 108
                     'usage',
102 109
                     'featuredSections',
103 110
                     'heroSections',
111
+                    'style',
104 112
                 ],
105 113
             });
106 114
         }, 2000);
@@ -288,6 +296,13 @@ export default function ShowStore({
288 296
                             />
289 297
                         </div>
290 298
 
299
+                        <StylePicker
300
+                            store={store}
301
+                            current={style}
302
+                            presets={stylePresets}
303
+                            busy={busy}
304
+                        />
305
+
291 306
                         <HeroPicker
292 307
                             store={store}
293 308
                             sections={heroSections}

+ 2
- 2
resources/js/storefront/pages/cart.tsx Zobrazit soubor

@@ -67,7 +67,7 @@ export function CartPage() {
67 67
                             {cart.lines.map((line, index) => (
68 68
                                 <li
69 69
                                     key={line.key}
70
-                                    className="flex gap-4 rounded-(--sf-radius-card) border border-(--sf-border) bg-(--sf-bg) p-4 shadow-[0_1px_2px_rgb(0_0_0/0.04)] transition-shadow hover:shadow-[0_4px_16px_rgb(0_0_0/0.06)] sm:gap-5 sm:p-5"
70
+                                    className="sf-card flex gap-4 rounded-(--sf-radius-card) border border-(--sf-border) bg-(--sf-bg) p-4 shadow-[0_1px_2px_rgb(0_0_0/0.04)] transition-shadow hover:shadow-[0_4px_16px_rgb(0_0_0/0.06)] sm:gap-5 sm:p-5"
71 71
                                 >
72 72
                                     <SfLink
73 73
                                         href={`/products/${line.product.slug}`}
@@ -142,7 +142,7 @@ export function CartPage() {
142 142
                             ))}
143 143
                         </ul>
144 144
 
145
-                        <aside className="h-fit rounded-(--sf-radius-card) border border-(--sf-border) bg-(--sf-surface) p-6">
145
+                        <aside className="sf-card h-fit rounded-(--sf-radius-card) border border-(--sf-border) bg-(--sf-surface) p-6">
146 146
                             <DiscountBox />
147 147
 
148 148
                             {cart.applied && (

+ 2
- 2
resources/js/storefront/pages/checkout.tsx Zobrazit soubor

@@ -197,7 +197,7 @@ export function CheckoutPage({
197 197
                             <button
198 198
                                 type="submit"
199 199
                                 disabled={form.processing}
200
-                                className="inline-flex w-full items-center justify-center rounded-(--sf-radius) bg-(--sf-primary) px-6 py-3 text-sm font-semibold text-(--sf-primary-fg) transition-opacity hover:opacity-85 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--sf-primary) disabled:cursor-not-allowed disabled:opacity-50 sm:w-auto"
200
+                                className="sf-btn-primary inline-flex w-full items-center justify-center rounded-(--sf-radius) bg-(--sf-primary) px-6 py-3 text-sm font-semibold text-(--sf-primary-fg) transition-opacity hover:opacity-85 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--sf-primary) disabled:cursor-not-allowed disabled:opacity-50 sm:w-auto"
201 201
                             >
202 202
                                 {t.payNow}
203 203
                             </button>
@@ -207,7 +207,7 @@ export function CheckoutPage({
207 207
                         </div>
208 208
                     </form>
209 209
 
210
-                    <aside className="h-fit rounded-(--sf-radius-card) border border-(--sf-border) bg-(--sf-surface) p-6">
210
+                    <aside className="sf-card h-fit rounded-(--sf-radius-card) border border-(--sf-border) bg-(--sf-surface) p-6">
211 211
                         <h2 className="font-medium">{t.orderSummary}</h2>
212 212
                         <ul className="mt-4 space-y-3 text-sm">
213 213
                             {cart.lines.map((line) => (

+ 1
- 1
resources/js/storefront/pages/order.tsx Zobrazit soubor

@@ -24,7 +24,7 @@ export function OrderPage({ order }: { order: StoreOrder }) {
24 24
                         : t.orderPending(order.number)}
25 25
                 </p>
26 26
 
27
-                <div className="mt-10 rounded-(--sf-radius-card) border border-(--sf-border) bg-(--sf-surface) p-6">
27
+                <div className="sf-card mt-10 rounded-(--sf-radius-card) border border-(--sf-border) bg-(--sf-surface) p-6">
28 28
                     <h2 className="font-medium">{t.orderSummary}</h2>
29 29
                     <ul className="mt-4 space-y-3 text-sm">
30 30
                         {order.items.map((item) => (

+ 3
- 3
resources/js/storefront/pages/product.tsx Zobrazit soubor

@@ -207,7 +207,7 @@ export function ProductPage({
207 207
                                 <h2 className="text-sm font-medium">
208 208
                                     {t.whatsInside}
209 209
                                 </h2>
210
-                                <ul className="mt-2 divide-y divide-(--sf-border) rounded-(--sf-radius-card) border border-(--sf-border)">
210
+                                <ul className="sf-card mt-2 divide-y divide-(--sf-border) rounded-(--sf-radius-card) border border-(--sf-border)">
211 211
                                     {product.bundle.map((item) => (
212 212
                                         <li
213 213
                                             key={item.name}
@@ -515,7 +515,7 @@ function AddToCart({
515 515
                 type="button"
516 516
                 onClick={add}
517 517
                 disabled={!canAdd || busy}
518
-                className="inline-flex w-full items-center justify-center rounded-(--sf-radius) bg-(--sf-primary) px-6 py-3 text-sm font-semibold text-(--sf-primary-fg) transition-opacity hover:opacity-85 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--sf-primary) disabled:cursor-not-allowed disabled:opacity-50 sm:w-auto"
518
+                className="sf-btn-primary inline-flex w-full items-center justify-center rounded-(--sf-radius) bg-(--sf-primary) px-6 py-3 text-sm font-semibold text-(--sf-primary-fg) transition-opacity hover:opacity-85 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--sf-primary) disabled:cursor-not-allowed disabled:opacity-50 sm:w-auto"
519 519
             >
520 520
                 {label}
521 521
             </button>
@@ -551,7 +551,7 @@ function AddToCart({
551 551
                                       })
552 552
                             }
553 553
                             disabled={busy || (!canAdd && !needsChoice)}
554
-                            className="shrink-0 rounded-(--sf-radius) bg-(--sf-primary) px-5 py-2.5 text-sm font-semibold text-(--sf-primary-fg) disabled:opacity-50"
554
+                            className="sf-btn-primary shrink-0 rounded-(--sf-radius) bg-(--sf-primary) px-5 py-2.5 text-sm font-semibold text-(--sf-primary-fg) disabled:opacity-50"
555 555
                         >
556 556
                             {needsChoice ? t.chooseShort : label}
557 557
                         </button>

+ 1
- 1
resources/js/storefront/product-card.tsx Zobrazit soubor

@@ -27,7 +27,7 @@ export function ProductImage({
27 27
             src={src}
28 28
             alt={alt}
29 29
             loading="lazy"
30
-            className={`rounded-(--sf-radius-card) border border-(--sf-border) object-cover ${className ?? ''}`}
30
+            className={`sf-card rounded-(--sf-radius-card) border border-(--sf-border) object-cover ${className ?? ''}`}
31 31
         />
32 32
     );
33 33
 }

+ 43
- 3
resources/js/storefront/renderer.tsx Zobrazit soubor

@@ -1,4 +1,5 @@
1 1
 import type { ReactNode } from 'react';
2
+import { cn } from '@/lib/utils';
2 3
 import { StorefrontProvider } from './context';
3 4
 import { CartPage } from './pages/cart';
4 5
 import { CheckoutPage } from './pages/checkout';
@@ -17,7 +18,8 @@ import { Newsletter } from './sections/newsletter';
17 18
 import { ProductGrid } from './sections/product-grid';
18 19
 import { Testimonials } from './sections/testimonials';
19 20
 import { TrustBar } from './sections/trust-bar';
20
-import { themeStyle } from './theme';
21
+import { styleAttributes, styleOf, themeStyle } from './theme';
22
+import { Reveal } from './reveal';
21 23
 import { WhatsAppButton } from './whatsapp';
22 24
 import type {
23 25
     FontMap,
@@ -91,6 +93,7 @@ function PageBody({ plan, view }: { plan: StorePlan; view: StorefrontView }) {
91 93
     const page =
92 94
         plan.pages.find((candidate) => candidate.id === view.pageId) ??
93 95
         plan.pages[0];
96
+    const alternate = alternateBands(page?.sections ?? []);
94 97
 
95 98
     return (
96 99
         <main>
@@ -98,13 +101,48 @@ function PageBody({ plan, view }: { plan: StorePlan; view: StorefrontView }) {
98 101
             {page && page.id !== 'home' && (
99 102
                 <h1 className="sr-only">{page.title}</h1>
100 103
             )}
101
-            {page?.sections.map((section) => (
102
-                <Section key={section.id} section={section} />
104
+            {page?.sections.map((section, index) => (
105
+                <div
106
+                    key={section.id}
107
+                    className={cn(
108
+                        'sf-band',
109
+                        alternate.has(index) && 'sf-band-alt',
110
+                    )}
111
+                >
112
+                    <Section section={section} />
113
+                </div>
103 114
             ))}
104 115
         </main>
105 116
     );
106 117
 }
107 118
 
119
+/** Sections that bring their own background, so "alternate" bands skip them. */
120
+const OWN_BACKGROUND = ['hero', 'trust_bar', 'testimonials', 'newsletter'];
121
+
122
+/**
123
+ * For the "alternate" background style: every other section without its own background gets a soft band.
124
+ */
125
+function alternateBands(sections: PlanSection[]): Set<number> {
126
+    const bands = new Set<number>();
127
+    let next = false;
128
+
129
+    sections.forEach((section, index) => {
130
+        if (OWN_BACKGROUND.includes(section.type)) {
131
+            next = false;
132
+
133
+            return;
134
+        }
135
+
136
+        if (next) {
137
+            bands.add(index);
138
+        }
139
+
140
+        next = !next;
141
+    });
142
+
143
+    return bands;
144
+}
145
+
108 146
 /**
109 147
  * Turn a store plan into one storefront page: the shared header, the page itself, the shared footer.
110 148
  */
@@ -152,7 +190,9 @@ export function StorefrontRenderer({
152 190
             <div
153 191
                 className="sf-root flex min-h-screen flex-col"
154 192
                 style={themeStyle(plan.theme, fonts)}
193
+                {...styleAttributes(plan.theme)}
155 194
             >
195
+                <Reveal enabled={styleOf(plan.theme).motion === 'gentle'} />
156 196
                 <AnnouncementBar />
157 197
                 <Header section={plan.header} />
158 198
                 <div className="flex-1">

+ 61
- 0
resources/js/storefront/reveal.tsx Zobrazit soubor

@@ -0,0 +1,61 @@
1
+import { usePage } from '@inertiajs/react';
2
+import { useEffect } from 'react';
3
+
4
+/**
5
+ * Gentle motion: sections below the first screen fade up as they come into view.
6
+ *
7
+ * Only sections the shopper cannot see yet are hidden, so the first screen is always complete, and
8
+ * nothing moves for visitors who ask their device for less motion. A scroll check is used rather than
9
+ * an intersection observer, because some embedded browsers do not report those reliably.
10
+ */
11
+export function Reveal({ enabled }: { enabled: boolean }) {
12
+    const { url } = usePage();
13
+
14
+    useEffect(() => {
15
+        if (
16
+            !enabled ||
17
+            window.matchMedia('(prefers-reduced-motion: reduce)').matches
18
+        ) {
19
+            return;
20
+        }
21
+
22
+        const bands = Array.from(
23
+            document.querySelectorAll<HTMLElement>('.sf-band'),
24
+        ).filter(
25
+            // Only sections that start below the first screen. Anything already showing stays put.
26
+            (band) => band.getBoundingClientRect().top >= window.innerHeight,
27
+        );
28
+
29
+        bands.forEach((band) => band.classList.add('sf-reveal'));
30
+
31
+        let frame = 0;
32
+        const check = () => {
33
+            cancelAnimationFrame(frame);
34
+            frame = requestAnimationFrame(() => {
35
+                for (const band of bands) {
36
+                    if (
37
+                        band.getBoundingClientRect().top <
38
+                        window.innerHeight * 0.92
39
+                    ) {
40
+                        band.classList.add('sf-revealed');
41
+                    }
42
+                }
43
+            });
44
+        };
45
+
46
+        check();
47
+        window.addEventListener('scroll', check, { passive: true });
48
+        window.addEventListener('resize', check);
49
+
50
+        return () => {
51
+            cancelAnimationFrame(frame);
52
+            window.removeEventListener('scroll', check);
53
+            window.removeEventListener('resize', check);
54
+            bands.forEach((band) =>
55
+                band.classList.remove('sf-reveal', 'sf-revealed'),
56
+            );
57
+        };
58
+    }, [enabled, url]);
59
+
60
+    return null;
61
+}

+ 5
- 2
resources/js/storefront/sections/about.tsx Zobrazit soubor

@@ -6,7 +6,10 @@ export function About({ section }: { section: AboutSection }) {
6 6
     const showStats = section.variant === 'with-stats' && stats.length > 0;
7 7
 
8 8
     return (
9
-        <section id={section.id} className="scroll-mt-20 py-16 md:py-24">
9
+        <section
10
+            id={section.id}
11
+            className="sf-section scroll-mt-20 py-16 md:py-24"
12
+        >
10 13
             <Container
11 14
                 className={showStats ? 'grid gap-12 md:grid-cols-2' : ''}
12 15
             >
@@ -22,7 +25,7 @@ export function About({ section }: { section: AboutSection }) {
22 25
                 </div>
23 26
 
24 27
                 {showStats && (
25
-                    <dl className="grid content-center gap-px overflow-hidden rounded-(--sf-radius-card) border border-(--sf-border) bg-(--sf-border) sm:grid-cols-3 md:grid-cols-1">
28
+                    <dl className="sf-card grid content-center gap-px overflow-hidden rounded-(--sf-radius-card) border border-(--sf-border) bg-(--sf-border) sm:grid-cols-3 md:grid-cols-1">
26 29
                         {stats.map((stat) => (
27 30
                             <div
28 31
                                 key={stat.label}

+ 5
- 2
resources/js/storefront/sections/contact.tsx Zobrazit soubor

@@ -43,13 +43,16 @@ export function Contact({ section }: { section: ContactSection }) {
43 43
     const card = section.variant === 'card';
44 44
 
45 45
     return (
46
-        <section id={section.id} className="scroll-mt-20 py-16 md:py-20">
46
+        <section
47
+            id={section.id}
48
+            className="sf-section scroll-mt-20 py-16 md:py-20"
49
+        >
47 50
             <Container>
48 51
                 <div
49 52
                     className={cn(
50 53
                         'grid gap-8 md:grid-cols-2',
51 54
                         card &&
52
-                            'rounded-(--sf-radius-card) border border-(--sf-border) p-8 sm:p-10',
55
+                            'sf-card rounded-(--sf-radius-card) border border-(--sf-border) p-8 sm:p-10',
53 56
                     )}
54 57
                 >
55 58
                     <SectionHeading heading={heading} subheading={body} />

+ 4
- 1
resources/js/storefront/sections/faq.tsx Zobrazit soubor

@@ -8,7 +8,10 @@ export function Faq({ section }: { section: FaqSection }) {
8 8
     const twoColumn = section.variant === 'two-column';
9 9
 
10 10
     return (
11
-        <section id={section.id} className="scroll-mt-20 py-16 md:py-20">
11
+        <section
12
+            id={section.id}
13
+            className="sf-section scroll-mt-20 py-16 md:py-20"
14
+        >
12 15
             <Container
13 16
                 className={cn(
14 17
                     twoColumn

+ 1
- 1
resources/js/storefront/sections/featured-product.tsx Zobrazit soubor

@@ -30,7 +30,7 @@ export function FeaturedProduct({
30 30
 
31 31
     return (
32 32
         <section id={section.id} className="scroll-mt-20 bg-(--sf-surface)">
33
-            <Container className="grid items-center gap-10 py-16 md:grid-cols-2 md:py-20">
33
+            <Container className="sf-section grid items-center gap-10 py-16 md:grid-cols-2 md:py-20">
34 34
                 <div
35 35
                     className={cn(
36 36
                         'relative',

+ 2
- 2
resources/js/storefront/sections/hero.tsx Zobrazit soubor

@@ -73,7 +73,7 @@ function FullPhotoHero({
73 73
     return (
74 74
         <section
75 75
             id={section.id}
76
-            className="relative isolate scroll-mt-20 overflow-hidden"
76
+            className="sf-on-photo relative isolate scroll-mt-20 overflow-hidden"
77 77
             data-hero="image-full"
78 78
         >
79 79
             {photo ? (
@@ -142,7 +142,7 @@ function SplitHero({
142 142
                         <img
143 143
                             src={photo}
144 144
                             alt=""
145
-                            className="aspect-[4/5] w-full rounded-(--sf-radius-card) object-cover md:aspect-[5/6]"
145
+                            className="sf-card aspect-[4/5] w-full rounded-(--sf-radius-card) object-cover md:aspect-[5/6]"
146 146
                         />
147 147
                     ) : (
148 148
                         <ImagePlaceholder

+ 3
- 1
resources/js/storefront/sections/newsletter.tsx Zobrazit soubor

@@ -11,7 +11,9 @@ export function Newsletter({ section }: { section: NewsletterSection }) {
11 11
             id={section.id}
12 12
             className={cn(
13 13
                 'scroll-mt-20',
14
-                card ? 'py-16' : 'bg-(--sf-primary) text-(--sf-primary-fg)',
14
+                card
15
+                    ? 'sf-section py-16'
16
+                    : 'bg-(--sf-primary) text-(--sf-primary-fg)',
15 17
             )}
16 18
         >
17 19
             <Container

+ 4
- 1
resources/js/storefront/sections/product-grid.tsx Zobrazit soubor

@@ -20,7 +20,10 @@ export function ProductGrid({ section }: { section: ProductGridSection }) {
20 20
     const hasProducts = products.length > 0;
21 21
 
22 22
     return (
23
-        <section id={section.id} className="scroll-mt-20 py-16 md:py-20">
23
+        <section
24
+            id={section.id}
25
+            className="sf-section scroll-mt-20 py-16 md:py-20"
26
+        >
24 27
             <Container>
25 28
                 <div
26 29
                     className={

+ 3
- 3
resources/js/storefront/sections/testimonials.tsx Zobrazit soubor

@@ -10,7 +10,7 @@ export function Testimonials({ section }: { section: TestimonialsSection }) {
10 10
         return (
11 11
             <section
12 12
                 id={section.id}
13
-                className="scroll-mt-20 bg-(--sf-surface) py-16 md:py-24"
13
+                className="sf-section scroll-mt-20 bg-(--sf-surface) py-16 md:py-24"
14 14
             >
15 15
                 <Container className="max-w-3xl text-center">
16 16
                     <p className="text-sm font-semibold text-(--sf-primary)">
@@ -31,7 +31,7 @@ export function Testimonials({ section }: { section: TestimonialsSection }) {
31 31
     return (
32 32
         <section
33 33
             id={section.id}
34
-            className="scroll-mt-20 bg-(--sf-surface) py-16 md:py-20"
34
+            className="sf-section scroll-mt-20 bg-(--sf-surface) py-16 md:py-20"
35 35
         >
36 36
             <Container>
37 37
                 <SectionHeading heading={heading} />
@@ -39,7 +39,7 @@ export function Testimonials({ section }: { section: TestimonialsSection }) {
39 39
                     {items.map((item) => (
40 40
                         <li
41 41
                             key={item.name + item.quote}
42
-                            className="flex flex-col justify-between gap-6 rounded-(--sf-radius-card) border border-(--sf-border) bg-(--sf-bg) p-6"
42
+                            className="sf-card flex flex-col justify-between gap-6 rounded-(--sf-radius-card) border border-(--sf-border) bg-(--sf-bg) p-6"
43 43
                         >
44 44
                             <blockquote className="leading-relaxed">
45 45
                                 “{item.quote}”

+ 2
- 2
resources/js/storefront/sections/trust-bar.tsx Zobrazit soubor

@@ -107,13 +107,13 @@ export function TrustBar({ section }: { section: TrustBarSection }) {
107 107
 
108 108
     if (section.variant === 'boxed') {
109 109
         return (
110
-            <section id={section.id} className="scroll-mt-20 py-10">
110
+            <section id={section.id} className="sf-section scroll-mt-20 py-10">
111 111
                 <Container>
112 112
                     <ul className={cn('grid grid-cols-2 gap-3', columns)}>
113 113
                         {items.map((item) => (
114 114
                             <li
115 115
                                 key={item.title}
116
-                                className="flex flex-col gap-3 rounded-(--sf-radius-card) border border-(--sf-border) p-5"
116
+                                className="sf-card flex flex-col gap-3 rounded-(--sf-radius-card) border border-(--sf-border) p-5"
117 117
                             >
118 118
                                 <item.icon
119 119
                                     className="size-6 text-(--sf-primary)"

+ 33
- 1
resources/js/storefront/theme.ts Zobrazit soubor

@@ -1,5 +1,37 @@
1 1
 import type { CSSProperties } from 'react';
2
-import type { FontMap, Theme, ThemeRadius } from './types';
2
+import type { FontMap, Theme, ThemeRadius, ThemeStyle } from './types';
3
+
4
+/** Keep in step with PlanSchema::STYLE_DEFAULTS. They look like stores did before styles existed. */
5
+export const STYLE_DEFAULTS: ThemeStyle = {
6
+    buttons: 'solid',
7
+    cards: 'border',
8
+    spacing: 'normal',
9
+    headings: 'normal',
10
+    backgrounds: 'plain',
11
+    motion: 'none',
12
+};
13
+
14
+/** The theme's style with every part filled in. */
15
+export function styleOf(theme: Theme): ThemeStyle {
16
+    return { ...STYLE_DEFAULTS, ...theme.style };
17
+}
18
+
19
+/**
20
+ * Data attributes for the storefront's root element. app.css reads them, so a style changes
21
+ * every button, card and section at once without each component knowing about it.
22
+ */
23
+export function styleAttributes(theme: Theme): Record<string, string> {
24
+    const style = styleOf(theme);
25
+
26
+    return {
27
+        'data-buttons': style.buttons,
28
+        'data-cards': style.cards,
29
+        'data-spacing': style.spacing,
30
+        'data-headings': style.headings,
31
+        'data-backgrounds': style.backgrounds,
32
+        'data-motion': style.motion,
33
+    };
34
+}
3 35
 
4 36
 const buttonRadius: Record<ThemeRadius, string> = {
5 37
     none: '0px',

+ 11
- 0
resources/js/storefront/types.ts Zobrazit soubor

@@ -18,10 +18,21 @@ export type ThemeColors = {
18 18
 
19 19
 export type ThemeRadius = 'none' | 'small' | 'medium' | 'large' | 'full';
20 20
 
21
+/** The look beyond colours and fonts. Every part is optional; see STYLE_DEFAULTS in theme.ts. */
22
+export type ThemeStyle = {
23
+    buttons: 'solid' | 'outline' | 'shadow';
24
+    cards: 'border' | 'shadow' | 'plain' | 'hard';
25
+    spacing: 'compact' | 'normal' | 'airy';
26
+    headings: 'normal' | 'uppercase' | 'heavy';
27
+    backgrounds: 'plain' | 'alternate';
28
+    motion: 'none' | 'gentle';
29
+};
30
+
21 31
 export type Theme = {
22 32
     colors: ThemeColors;
23 33
     fonts: { heading: string; body: string };
24 34
     radius: ThemeRadius;
35
+    style?: Partial<ThemeStyle> | null;
25 36
 };
26 37
 
27 38
 type SectionOf<Type extends string, Variant extends string, Content> = {

+ 3
- 3
resources/js/storefront/ui.tsx Zobrazit soubor

@@ -36,8 +36,8 @@ export function SfButton({
36 36
             className={cn(
37 37
                 'inline-flex items-center justify-center rounded-(--sf-radius) px-5 py-2.5 text-sm font-semibold transition-opacity hover:opacity-85 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--sf-primary)',
38 38
                 variant === 'primary'
39
-                    ? 'bg-(--sf-primary) text-(--sf-primary-fg)'
40
-                    : 'border border-(--sf-border) text-(--sf-fg)',
39
+                    ? 'sf-btn-primary bg-(--sf-primary) text-(--sf-primary-fg)'
40
+                    : 'sf-btn-outline border border-(--sf-border) text-(--sf-fg)',
41 41
                 className,
42 42
             )}
43 43
         >
@@ -177,7 +177,7 @@ export function ImagePlaceholder({
177 177
                 label ? `Placeholder image: ${label}` : 'Placeholder image'
178 178
             }
179 179
             className={cn(
180
-                'relative grid place-items-center overflow-hidden rounded-(--sf-radius-card) border border-(--sf-border)',
180
+                'sf-card relative grid place-items-center overflow-hidden rounded-(--sf-radius-card) border border-(--sf-border)',
181 181
                 className,
182 182
             )}
183 183
             style={{

+ 17
- 0
resources/js/types/store.ts Zobrazit soubor

@@ -182,6 +182,23 @@ export type HeroSectionInfo = {
182 182
     image: string | null;
183 183
 };
184 184
 
185
+/** The working design's style, with every option filled in. */
186
+export type StoreStyleInfo = {
187
+    options: Record<string, string>;
188
+    radius: string;
189
+    fonts: { heading: string; body: string } | null;
190
+};
191
+
192
+/** A ready-made look in the Design tab's Style box. */
193
+export type StylePreset = {
194
+    key: string;
195
+    label: string;
196
+    hint: string;
197
+    radius: string;
198
+    fonts: { heading: string; body: string };
199
+    style: Record<string, string>;
200
+};
201
+
185 202
 /** A photo a hero can use. */
186 203
 export type HeroChoice = {
187 204
     ref: string;

+ 2
- 0
routes/web.php Zobrazit soubor

@@ -14,6 +14,7 @@ use App\Http\Controllers\StoreDesignController;
14 14
 use App\Http\Controllers\StoreGenerationController;
15 15
 use App\Http\Controllers\StorePublishController;
16 16
 use App\Http\Controllers\StoreSettingsController;
17
+use App\Http\Controllers\StoreStyleController;
17 18
 use App\Http\Controllers\StripeWebhookController;
18 19
 use Illuminate\Support\Facades\Route;
19 20
 
@@ -113,6 +114,7 @@ Route::middleware(['auth', 'verified'])->group(function () {
113 114
     Route::delete('stores/{slug}/products/{product}/images/{image}', [ProductController::class, 'destroyImage'])->name('stores.products.images.destroy')->whereNumber(['product', 'image']);
114 115
     Route::put('stores/{slug}/featured/{sectionId}', [FeaturedProductController::class, 'update'])->name('stores.featured.update');
115 116
     Route::put('stores/{slug}/hero/{sectionId}', [HeroImageController::class, 'update'])->name('stores.hero.update');
117
+    Route::put('stores/{slug}/style', [StoreStyleController::class, 'update'])->name('stores.style.update');
116 118
     Route::post('stores/{slug}/hero/{sectionId}/photo', [HeroImageController::class, 'upload'])->name('stores.hero.upload');
117 119
     Route::get('stores/{slug}/settings', [StoreSettingsController::class, 'edit'])->name('stores.settings');
118 120
     Route::put('stores/{slug}/settings', [StoreSettingsController::class, 'update'])->name('stores.settings.update');

+ 120
- 0
tests/Feature/Stores/StoreStyleTest.php Zobrazit soubor

@@ -0,0 +1,120 @@
1
+<?php
2
+
3
+namespace Tests\Feature\Stores;
4
+
5
+use App\Models\Store;
6
+use App\Models\User;
7
+use App\StorePlan\PlanSchema;
8
+use App\StorePlan\PlanValidator;
9
+use App\StorePlan\SamplePlan;
10
+use Illuminate\Foundation\Testing\RefreshDatabase;
11
+use Inertia\Testing\AssertableInertia as Assert;
12
+use Tests\Support\ScriptedDriver;
13
+use Tests\TestCase;
14
+
15
+class StoreStyleTest extends TestCase
16
+{
17
+    use RefreshDatabase;
18
+
19
+    private User $user;
20
+
21
+    private Store $store;
22
+
23
+    protected function setUp(): void
24
+    {
25
+        parent::setUp();
26
+
27
+        $this->user = User::factory()->create();
28
+        $this->store = Store::factory()->for($this->user)->create();
29
+        $this->store->plan = SamplePlan::for($this->store);
30
+        $this->store->save();
31
+        $this->actingAs($this->user);
32
+    }
33
+
34
+    public function test_a_ready_made_look_sets_style_fonts_and_corners_but_keeps_colours()
35
+    {
36
+        $colours = $this->store->plan['theme']['colors'];
37
+
38
+        $this->put(route('stores.style.update', $this->store->slug), ['preset' => 'bold'])
39
+            ->assertRedirect(route('stores.show', $this->store->slug));
40
+
41
+        $theme = $this->store->fresh()->plan['theme'];
42
+        $bold = PlanSchema::STYLE_PRESETS['bold'];
43
+
44
+        $this->assertSame($bold['style'], $theme['style']);
45
+        $this->assertSame($bold['fonts'], $theme['fonts']);
46
+        $this->assertSame('none', $theme['radius']);
47
+        $this->assertSame($colours, $theme['colors']);
48
+
49
+        $this->get(route('stores.show', $this->store->slug))
50
+            ->assertInertia(fn (Assert $page) => $page
51
+                ->where('style.options.buttons', 'shadow')
52
+                ->where('style.fonts.heading', 'archivo-black')
53
+                ->has('stylePresets', count(PlanSchema::STYLE_PRESETS)));
54
+    }
55
+
56
+    public function test_one_option_can_be_fine_tuned()
57
+    {
58
+        $this->put(route('stores.style.update', $this->store->slug), ['style' => ['spacing' => 'airy']])->assertSessionHasNoErrors();
59
+
60
+        $style = $this->store->fresh()->plan['theme']['style'];
61
+        $this->assertSame('airy', $style['spacing']);
62
+        // The others keep their values.
63
+        $this->assertSame('shadow', $style['cards']);
64
+
65
+        $this->put(route('stores.style.update', $this->store->slug), ['style' => ['spacing' => 'enormous']])->assertSessionHasErrors('style.spacing');
66
+        $this->put(route('stores.style.update', $this->store->slug), ['preset' => 'retro-80s'])->assertSessionHasErrors('preset');
67
+
68
+        $this->actingAs(User::factory()->create())
69
+            ->put(route('stores.style.update', $this->store->slug), ['preset' => 'bold'])
70
+            ->assertNotFound();
71
+    }
72
+
73
+    public function test_old_designs_without_a_style_still_pass_and_look_the_same()
74
+    {
75
+        $plan = $this->store->plan;
76
+        unset($plan['theme']['style']);
77
+
78
+        $clean = app(PlanValidator::class)->validate($plan);
79
+
80
+        $this->assertArrayNotHasKey('style', $clean['theme']);
81
+
82
+        $this->store->plan = $clean;
83
+        $this->store->save();
84
+
85
+        $this->get(route('stores.show', $this->store->slug))
86
+            ->assertInertia(fn (Assert $page) => $page->where('style.options', PlanSchema::STYLE_DEFAULTS));
87
+    }
88
+
89
+    public function test_the_checker_refuses_unknown_styles_and_heading_fonts_for_body_text()
90
+    {
91
+        $validator = app(PlanValidator::class);
92
+        $plan = $this->store->plan;
93
+
94
+        $this->assertFalse($validator->passes([...$plan, 'theme' => [...$plan['theme'], 'style' => ['buttons' => 'neon']]]));
95
+        $this->assertFalse($validator->passes([...$plan, 'theme' => [...$plan['theme'], 'fonts' => ['heading' => 'inter', 'body' => 'bebas-neue']]]));
96
+        $this->assertTrue($validator->passes([...$plan, 'theme' => [...$plan['theme'], 'fonts' => ['heading' => 'bebas-neue', 'body' => 'jost']]]));
97
+
98
+        // Unknown style parts are thrown away.
99
+        $clean = $validator->validate([...$plan, 'theme' => [...$plan['theme'], 'style' => ['cards' => 'hard', 'sparkles' => 'yes']]]);
100
+        $this->assertSame(['cards' => 'hard'], $clean['theme']['style']);
101
+    }
102
+
103
+    public function test_the_ai_can_change_the_style_by_chat()
104
+    {
105
+        ScriptedDriver::use([(string) json_encode([
106
+            'reply' => 'I made the store bolder.',
107
+            'theme' => ['style' => ['buttons' => 'shadow', 'headings' => 'heavy'], 'fonts' => ['heading' => 'unbounded']],
108
+        ])]);
109
+
110
+        $this->post(route('stores.edits', $this->store->slug), ['instruction' => 'Make it look bolder and more futuristic']);
111
+
112
+        $theme = $this->store->fresh()->plan['theme'];
113
+        $this->assertSame('shadow', $theme['style']['buttons']);
114
+        $this->assertSame('heavy', $theme['style']['headings']);
115
+        // Untouched parts stay.
116
+        $this->assertSame('alternate', $theme['style']['backgrounds']);
117
+        $this->assertSame('unbounded', $theme['fonts']['heading']);
118
+        $this->assertStringContainsString('These fonts are for headings only', ScriptedDriver::$requests[0]->system);
119
+    }
120
+}

Načítá se…
Zrušit
Uložit