Explorar el Código

Add our own home page with hero motion and section animations

feature/homepage
fahmisaad hace 4 días
padre
commit
ae9f1467e7

+ 29
- 4
PROGRESS.md Ver fichero

3
 This file is the single source of truth for the project plan and status.
3
 This file is the single source of truth for the project plan and status.
4
 Update it at the end of every work session.
4
 Update it at the end of every work session.
5
 
5
 
6
-**Last updated:** 2026-11-21
7
-**Current step:** Step 9 — Modern store design (parts 1–7 done; next: part 8, real reviews)
8
-**Next action:** Commit part 7 on `redesign/part-7-collections-bento-video` (do not merge into `main`; it stays separate for comparison). Then create `redesign/part-8-reviews` from it and build real reviews. Step 7 part 2 still waits for an EasyParcel API key
6
+**Last updated:** 2026-11-22
7
+**Current step:** Our own home page (built on `feature/homepage`); Step 9 parts 1–7 done, part 8 on hold
8
+**Next action:** Commit the home page on `feature/homepage`. Then choose: Step 10 (before launch), Step 7 part 2 (needs an EasyParcel API key), or part 8 (reviews). `main` and the redesign branches stay apart for comparison
9
 
9
 
10
 Status marks: `[ ]` not started · `[~]` in progress · `[x]` done
10
 Status marks: `[ ]` not started · `[~]` in progress · `[x]` done
11
 
11
 
255
 - **Video** section (`video`): a YouTube or Vimeo address only (`PlanSchema::VIDEO_PATTERN`, which refuses look-alike addresses). Only a picture shows until the shopper presses play; then a privacy-friendly player loads (youtube-nocookie, Vimeo with do-not-track). The AI may only use a video address the merchant wrote in the chat or the brand description; any other is refused. The sample design has no video on purpose, so the AI never copies one. Uploading video files is not supported yet.
255
 - **Video** section (`video`): a YouTube or Vimeo address only (`PlanSchema::VIDEO_PATTERN`, which refuses look-alike addresses). Only a picture shows until the shopper presses play; then a privacy-friendly player loads (youtube-nocookie, Vimeo with do-not-track). The AI may only use a video address the merchant wrote in the chat or the brand description; any other is refused. The sample design has no video on purpose, so the AI never copies one. Uploading video files is not supported yet.
256
 - **Design tab boxes (added 2026-11-22):** a **Video** box (paste a YouTube or Vimeo link, heading, short text, layout, and where to put it; edit or remove later, with a preview picture) and a **Bento tiles** box ("Add tiles" puts in 3 starter tiles: the whole range with a product photo, the first collection or the products section, and the brand story; then edit each tile's title, text, link (with suggested links), photo and colour, add or remove tiles between 3 and 6, or remove the set). Both use `App\StorePlan\SectionEditor` and go through the plan checker, so a broken link or a photo from another store is refused.
256
 - **Design tab boxes (added 2026-11-22):** a **Video** box (paste a YouTube or Vimeo link, heading, short text, layout, and where to put it; edit or remove later, with a preview picture) and a **Bento tiles** box ("Add tiles" puts in 3 starter tiles: the whole range with a product photo, the first collection or the products section, and the brand story; then edit each tile's title, text, link (with suggested links), photo and colour, add or remove tiles between 3 and 6, or remove the set). Both use `App\StorePlan\SectionEditor` and go through the plan checker, so a broken link or a photo from another store is refused.
257
 
257
 
258
+### Our home page (added 2026-11-22)
259
+
260
+- The page at `/` sells AI Commerce to merchants (`resources/js/pages/home.tsx`, `HomeController`). Its content follows the outline of afilink.app (hero with a "name your store" box, the two sides, 3 steps, chat example, styles, features, pricing, questions, final call), but the look is our own: pandan green, turmeric yellow and a little hibiscus red on a mint-white, with Plus Jakarta Sans for headings and Instrument Sans for text (afilink uses Bricolage Grotesque, Nunito and lavender).
261
+- Prices come from the `plans` table, so the page always matches the Billing page. The store address preview uses `STOREFRONT_DOMAIN`.
262
+- "Start free" goes to sign-up (or the dashboard when signed in). The store name typed in the hero is kept in the browser and fills in the "Create a store" form (`?name=` or a saved name), and is forgotten once a store is created.
263
+- Every claim is true today: no FPX, own domains or real reviews are promised (the questions say own domains are not available yet). Update the page when those arrive.
264
+- The page has no dashboard frame (it replaces the starter "welcome" page) and keeps its own colours in light and dark mode.
265
+- The hero picture moves, in the way afilink's does (studied 2026-11-22): on wide screens (1024px and up) the hero stays pinned while the visitor scrolls, and scrolling puts the sample store together (the merchant's words, the store's banner and three products fly into place, then the frame and the feature tags appear). A hint says "Scroll to watch your store come together". On phones and tablets it plays once by itself after the page opens. The feature tags float gently up and down afterwards (CSS `h-bob`, 6 and 8 seconds, out of step). Visitors whose device asks for less motion see the finished picture with nothing moving.
266
+- The sample store and the "You write" bubble also float slowly up and down all the time, like afilink's phone (CSS `h-float`, 7 and 9 seconds, out of step). It moves `transform`, so it adds to the hover lift instead of fighting it.
267
+- More motion (2026-11-22), helpers in `resources/js/components/home/motion.ts`, styles `h-*` in `app.css`:
268
+  1. Sections fade up as they come into view (`data-reveal` on headings and cards, cards one after another). Things already on the first screen never hide.
269
+  2. The "You write" bubble types itself out first; on phones the store builds once the typing ends. The full words hold the bubble's size so nothing jumps.
270
+  3. The chat example plays like a real chat when it comes into view: message, typing dots, reply, the change waiting for an OK, then "Confirmed". A "Play again" button replays it.
271
+  4. The styles section has one big sample store that changes look every 3.2 seconds, with a timer bar under the look that is showing. Clicking a look shows it and stops the changing.
272
+  5. A line runs through the 3 steps (across on wide screens, down the left on phones) and fills in green as the visitor scrolls; each number lights up when the line reaches it.
273
+  6. A strip of Malaysian shop types (Sambal, Batik, Skincare, Kek lapis…) drifts sideways under the hero; hovering stops it.
274
+  Everything shows its finished state, with nothing moving, when the device asks for less motion.
275
+- Hovering lifts things: the sample store or the "You write" bubble rises and moves in front of the other (the bubble also straightens), and each pricing card rises with a deeper shadow. Uses the separate CSS `translate` and `scale` properties so it does not fight the scroll animation; skipped when the device asks for less motion, and phones have no hover.
276
+- The tags are placed so they never cover the store's words or its button (the WhatsApp tag sits beside "Shop the jars" inside the banner), and the flying pieces stay on the right so the store-name form is never covered.
277
+
258
 ### Category guides for the AI (agreed 2026-11-17)
278
 ### Category guides for the AI (agreed 2026-11-17)
259
 
279
 
260
 - 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.
280
 - 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.
404
 - [x] Part 5 — More layouts per section (done 2026-11-19): 7 new layouts, so the main sections have 3 or 4 each, and a Layouts box in the Design tab
424
 - [x] Part 5 — More layouts per section (done 2026-11-19): 7 new layouts, so the main sections have 3 or 4 each, and a Layouts box in the Design tab
405
 - [x] Part 6 — Category guides for the AI (done 2026-11-21): one guide per category with 2 or 3 directions each, plus the merchant's other stores (and the current design on a redesign) as looks not to repeat
425
 - [x] Part 6 — Category guides for the AI (done 2026-11-21): one guide per category with 2 or 3 directions each, plus the merchant's other stores (and the current design on a redesign) as looks not to repeat
406
 - [x] Part 7 — Collections, "shop by" section, bento grid and video (done 2026-11-22): collections managed in the Products tab or by chat, collection pages and links, "shop by" section (round photos or tiles), bento section (3 to 6 tiles), video section (YouTube or Vimeo, loads on play), and Video and Bento boxes in the Design tab so no chat is needed
426
 - [x] Part 7 — Collections, "shop by" section, bento grid and video (done 2026-11-22): collections managed in the Products tab or by chat, collection pages and links, "shop by" section (round photos or tiles), bento section (3 to 6 tiles), video section (YouTube or Vimeo, loads on play), and Video and Bento boxes in the Design tab so no chat is needed
407
-- [ ] Part 8 — Real reviews from buyers after delivery: review email, review form, merchant approval, stars on products (split out of part 7 on 2026-11-21)
427
+- [ ] Part 8 — Real reviews from buyers after delivery: review email, review form, merchant approval, stars on products (split out of part 7 on 2026-11-21). On hold since 2026-11-22 (the merchant chose to skip it for now); when picked up, branch `redesign/part-8-reviews` from part 7
408
 
428
 
409
 Branches (agreed 2026-11-18):
429
 Branches (agreed 2026-11-18):
410
 
430
 
420
 
440
 
421
 ### Step 10 — Before launch
441
 ### Step 10 — Before launch
422
 
442
 
443
+- [x] Our own home page at `/` (done 2026-11-22, branch `feature/homepage`, made from the part 7 branch)
444
+
423
 - [ ] Choose hosting and deploy
445
 - [ ] Choose hosting and deploy
424
 - [ ] Privacy policy and terms of service (name the AI providers)
446
 - [ ] Privacy policy and terms of service (name the AI providers)
425
 - [ ] Backup AI provider in case one is down
447
 - [ ] Backup AI provider in case one is down
521
 | Category guides                        | `app/StorePlan/Ai/CategoryGuides.php`, `PlanPrompt::categoryGuide()` and `looksToAvoid()`                                                                                              |
543
 | Category guides                        | `app/StorePlan/Ai/CategoryGuides.php`, `PlanPrompt::categoryGuide()` and `looksToAvoid()`                                                                                              |
522
 | Collections, bento, video              | `app/Models/Collection.php`, `CollectionController`, `storefront/sections/shop-by.tsx`, `bento.tsx`, `video.tsx`, `storefront/pages/shop.tsx`                                          |
544
 | Collections, bento, video              | `app/Models/Collection.php`, `CollectionController`, `storefront/sections/shop-by.tsx`, `bento.tsx`, `video.tsx`, `storefront/pages/shop.tsx`                                          |
523
 | Video and Bento boxes                  | `app/StorePlan/SectionEditor.php`, `VideoSectionController`, `BentoSectionController`, `components/stores/video-box.tsx`, `bento-box.tsx`                                              |
545
 | Video and Bento boxes                  | `app/StorePlan/SectionEditor.php`, `VideoSectionController`, `BentoSectionController`, `components/stores/video-box.tsx`, `bento-box.tsx`                                              |
546
+| Home page                              | `resources/js/pages/home.tsx`, `app/Http/Controllers/HomeController.php`                                                                                                               |
524
 | Storefront words (English, Malay)      | `resources/js/storefront/text.ts`                                                                                                                                                      |
547
 | Storefront words (English, Malay)      | `resources/js/storefront/text.ts`                                                                                                                                                      |
525
 | Store plan format (frontend types)     | `resources/js/storefront/types.ts`                                                                                                                                                     |
548
 | Store plan format (frontend types)     | `resources/js/storefront/types.ts`                                                                                                                                                     |
526
 | Storefront renderer and sections       | `resources/js/storefront/renderer.tsx`, `resources/js/storefront/sections/`                                                                                                            |
549
 | Storefront renderer and sections       | `resources/js/storefront/renderer.tsx`, `resources/js/storefront/sections/`                                                                                                            |
586
 | 2026-11-21 | Step 9 part 6 on branch `redesign/part-6-category-guides` (from part 5): category design guides and "looks to avoid" for the AI. 275 tests pass; generated two real test stores with Claude Sonnet (Dapur Mak Teh, food; Seri Anggun, fashion) and they came out clearly different.                                                                                                                                                                                    | Commit; then part 7 or merge                                    |
609
 | 2026-11-21 | Step 9 part 6 on branch `redesign/part-6-category-guides` (from part 5): category design guides and "looks to avoid" for the AI. 275 tests pass; generated two real test stores with Claude Sonnet (Dapur Mak Teh, food; Seri Anggun, fashion) and they came out clearly different.                                                                                                                                                                                    | Commit; then part 7 or merge                                    |
587
 | 2026-11-21 | Decided to keep `main` and the redesign apart for comparison. Split reviews out as part 8. Step 9 part 7 on branch `redesign/part-7-collections-bento-video` (from part 6): collections (Products tab, chat, pages, links), shop by, bento and video sections, with AI checks for collection names and video addresses. 282 tests pass; real DeepSeek created two collections for Luna Skin (confirmed) and added shop by and bento correctly; checked in the browser. | Commit; part 8 branches from part 7                             |
610
 | 2026-11-21 | Decided to keep `main` and the redesign apart for comparison. Split reviews out as part 8. Step 9 part 7 on branch `redesign/part-7-collections-bento-video` (from part 6): collections (Products tab, chat, pages, links), shop by, bento and video sections, with AI checks for collection names and video addresses. 282 tests pass; real DeepSeek created two collections for Luna Skin (confirmed) and added shop by and bento correctly; checked in the browser. | Commit; part 8 branches from part 7                             |
588
 | 2026-11-22 | Added Video and Bento boxes to the Design tab (same branch, part 7), so both can be added and edited without chat. The merchant added a real YouTube video to Luna Skin by chat; it plays in the preview. 286 tests pass.                                                                                                                                                                                                                                              | Commit part 7; then part 8                                      |
611
 | 2026-11-22 | Added Video and Bento boxes to the Design tab (same branch, part 7), so both can be added and edited without chat. The merchant added a real YouTube video to Luna Skin by chat; it plays in the preview. 286 tests pass.                                                                                                                                                                                                                                              | Commit part 7; then part 8                                      |
612
+| 2026-11-22 | Part 7 committed on `redesign/part-7-collections-bento-video`. Part 8 (real reviews) put on hold by the merchant.                                                                                                                                                                                                                                                                                                                                                      | Choose next step                                                |
613
+| 2026-11-22 | Built our own home page on branch `feature/homepage`: content outline like afilink.app with our own look, real plan prices, store-name box that fills the Create store form. 288 tests pass; checked on desktop and phone. Then made the hero picture move like afilink's (pinned scroll on wide screens, plays once on phones, floating tags), fixed tags covering text, added hover lift on the hero pieces and pricing cards, made the store and bubble float, and added six more animations (fade-up, typing bubble, playing chat, changing styles, steps line, shop-types strip).  | Commit; choose next step                                        |

+ 1
- 0
README.md Ver fichero

26
 
26
 
27
 ## What works today
27
 ## What works today
28
 
28
 
29
+- A home page that explains AI Commerce, with real plan prices and a "name your store" box that leads into sign-up
29
 - Register, log in, log out, email verification and two-factor login
30
 - Register, log in, log out, email verification and two-factor login
30
 - Create a store (name, category, language, description)
31
 - Create a store (name, category, language, description)
31
 - Dashboard that lists your own stores. Other people's stores show "not found"
32
 - Dashboard that lists your own stores. Other people's stores show "not found"

+ 33
- 0
app/Http/Controllers/HomeController.php Ver fichero

1
+<?php
2
+
3
+namespace App\Http\Controllers;
4
+
5
+use App\Models\Plan;
6
+use Inertia\Inertia;
7
+use Inertia\Response;
8
+
9
+/**
10
+ * Our own home page, the one that sells AI Commerce to merchants. Prices come from the plans table,
11
+ * so the page always shows what the Billing page charges.
12
+ */
13
+class HomeController extends Controller
14
+{
15
+    public function __invoke(): Response
16
+    {
17
+        return Inertia::render('home', [
18
+            'plans' => Plan::query()->orderBy('sort')->get()->map(fn (Plan $plan) => [
19
+                'key' => $plan->key,
20
+                'name' => $plan->name,
21
+                // In ringgit.
22
+                'price' => $plan->price / 100,
23
+                'stores' => $plan->stores,
24
+                'regenerations' => $plan->regenerations,
25
+                'edits' => $plan->edits,
26
+                'period' => $plan->period,
27
+            ]),
28
+            'trialDays' => (int) config('plans.trial_days'),
29
+            // Stores live at "<name>.<this>", so the hero can show a shop's future address.
30
+            'storeDomain' => config('storefront.domain'),
31
+        ]);
32
+    }
33
+}

+ 135
- 0
resources/css/app.css Ver fichero

333
         transform: translateY(-3px);
333
         transform: translateY(-3px);
334
     }
334
     }
335
 }
335
 }
336
+
337
+/* Our home page: tags in the hero picture float up and down, out of step with each other. */
338
+@keyframes h-bob {
339
+    0%,
340
+    100% {
341
+        translate: 0 0;
342
+    }
343
+
344
+    50% {
345
+        translate: 0 -10px;
346
+    }
347
+}
348
+
349
+@media (prefers-reduced-motion: no-preference) {
350
+    .h-bob {
351
+        animation: h-bob 6s ease-in-out infinite;
352
+    }
353
+
354
+    .h-bob-slow {
355
+        animation-duration: 8s;
356
+        animation-delay: -3s;
357
+    }
358
+}
359
+
360
+/*
361
+ * Our home page: the sample store and the "You write" bubble float slowly. This moves `transform`, so it
362
+ * never fights the hover lift (which moves `translate` and `scale`).
363
+ */
364
+@keyframes h-float {
365
+    0%,
366
+    100% {
367
+        transform: translateY(0);
368
+    }
369
+
370
+    50% {
371
+        transform: translateY(-8px);
372
+    }
373
+}
374
+
375
+@media (prefers-reduced-motion: no-preference) {
376
+    .h-float {
377
+        animation: h-float 7s ease-in-out infinite;
378
+    }
379
+
380
+    .h-float-late {
381
+        animation-duration: 9s;
382
+        animation-delay: -4s;
383
+    }
384
+}
385
+
386
+/*
387
+ * Our home page, more motion (resources/js/components/home/motion.ts). All of it is off when the
388
+ * visitor's device asks for less motion.
389
+ *
390
+ * Fade up: sections below the first screen rise into place. It moves `transform`, and keeps short
391
+ * transitions for `translate`, `scale` and shadows so cards still lift smoothly on hover.
392
+ */
393
+@media (prefers-reduced-motion: no-preference) {
394
+    .h-reveal {
395
+        opacity: 0;
396
+        transform: translateY(32px);
397
+        transition:
398
+            opacity 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) var(--d, 0ms),
399
+            transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) var(--d, 0ms),
400
+            translate 0.3s ease-out,
401
+            scale 0.3s ease-out,
402
+            box-shadow 0.3s ease-out;
403
+    }
404
+
405
+    .h-reveal.h-revealed {
406
+        opacity: 1;
407
+        transform: none;
408
+    }
409
+
410
+    /* The AI's "typing" dots in the chat example. */
411
+    .h-dot {
412
+        animation: h-dot 1s ease-in-out infinite;
413
+    }
414
+
415
+    /* The timer bar under the look that is showing in the styles section. */
416
+    .h-bar {
417
+        animation: h-bar linear forwards;
418
+    }
419
+
420
+    /* The "Style: Soft" badge pops in when the look changes. */
421
+    .h-pop {
422
+        animation: h-pop 0.4s ease-out;
423
+    }
424
+
425
+    /* The strip of shop types drifts sideways; hovering stops it so a word can be read. */
426
+    .h-marquee {
427
+        animation: h-marquee 50s linear infinite;
428
+    }
429
+
430
+    .h-marquee:hover {
431
+        animation-play-state: paused;
432
+    }
433
+}
434
+
435
+@keyframes h-dot {
436
+    0%,
437
+    80%,
438
+    100% {
439
+        opacity: 0.3;
440
+        translate: 0 0;
441
+    }
442
+
443
+    40% {
444
+        opacity: 1;
445
+        translate: 0 -3px;
446
+    }
447
+}
448
+
449
+@keyframes h-bar {
450
+    from {
451
+        width: 0;
452
+    }
453
+
454
+    to {
455
+        width: 100%;
456
+    }
457
+}
458
+
459
+@keyframes h-pop {
460
+    from {
461
+        opacity: 0;
462
+        scale: 0.8;
463
+    }
464
+}
465
+
466
+@keyframes h-marquee {
467
+    to {
468
+        transform: translateX(-50%);
469
+    }
470
+}

+ 1
- 1
resources/js/app.tsx Ver fichero

20
     },
20
     },
21
     layout: (name) => {
21
     layout: (name) => {
22
         switch (true) {
22
         switch (true) {
23
-            case name === 'welcome':
23
+            case name === 'home':
24
             case name === 'stores/preview':
24
             case name === 'stores/preview':
25
                 // Full pages with no dashboard around them.
25
                 // Full pages with no dashboard around them.
26
                 return null;
26
                 return null;

+ 142
- 0
resources/js/components/home/motion.ts Ver fichero

1
+import type { CSSProperties, RefObject } from 'react';
2
+import { useEffect, useState } from 'react';
3
+
4
+/*
5
+ * Small motion helpers for our home page. Every one of them shows the finished state straight away for
6
+ * visitors whose device asks for less motion.
7
+ *
8
+ * They check positions on scroll instead of using IntersectionObserver, because its margins were not
9
+ * reliable in the embedded browser we test with (the storefront's reveal.tsx does the same).
10
+ */
11
+
12
+/** True when the visitor's device asks for less motion. */
13
+export function lessMotion(): boolean {
14
+    return (
15
+        typeof window !== 'undefined' &&
16
+        window.matchMedia('(prefers-reduced-motion: reduce)').matches
17
+    );
18
+}
19
+
20
+/** Runs `check` once now and then at most once a frame while the page scrolls or resizes. Returns a stop function. */
21
+export function onScroll(check: () => void): () => void {
22
+    let frame = 0;
23
+    const run = () => {
24
+        cancelAnimationFrame(frame);
25
+        frame = requestAnimationFrame(check);
26
+    };
27
+
28
+    check();
29
+    window.addEventListener('scroll', run, { passive: true });
30
+    window.addEventListener('resize', run);
31
+
32
+    return () => {
33
+        cancelAnimationFrame(frame);
34
+        window.removeEventListener('scroll', run);
35
+        window.removeEventListener('resize', run);
36
+    };
37
+}
38
+
39
+/** How long a revealed item waits after the one before it, so a row of cards comes in one by one. */
40
+export function revealDelay(index: number): CSSProperties {
41
+    return { '--d': `${index * 90}ms` } as CSSProperties;
42
+}
43
+
44
+/**
45
+ * Items marked `data-reveal` inside `root` fade up when they come into view. Items already on the first
46
+ * screen are left alone, so nothing the visitor can already see disappears.
47
+ */
48
+export function usePageReveal(root: RefObject<HTMLElement | null>): void {
49
+    useEffect(() => {
50
+        const page = root.current;
51
+
52
+        if (!page || lessMotion()) {
53
+            return;
54
+        }
55
+
56
+        let waiting = Array.from(
57
+            page.querySelectorAll<HTMLElement>('[data-reveal]'),
58
+        ).filter(
59
+            (item) => item.getBoundingClientRect().top > window.innerHeight,
60
+        );
61
+
62
+        waiting.forEach((item) => item.classList.add('h-reveal'));
63
+
64
+        return onScroll(() => {
65
+            waiting = waiting.filter((item) => {
66
+                if (
67
+                    item.getBoundingClientRect().top <
68
+                    window.innerHeight * 0.9
69
+                ) {
70
+                    item.classList.add('h-revealed');
71
+
72
+                    return false;
73
+                }
74
+
75
+                return true;
76
+            });
77
+        });
78
+    }, [root]);
79
+}
80
+
81
+/** True once the top of `ref` has come up to `at` of the screen's height (0.8 is 80% of the way down). Stays true. */
82
+export function useSeen(ref: RefObject<HTMLElement | null>, at = 0.8): boolean {
83
+    const [seen, setSeen] = useState(lessMotion);
84
+
85
+    useEffect(() => {
86
+        if (seen) {
87
+            return;
88
+        }
89
+
90
+        return onScroll(() => {
91
+            const element = ref.current;
92
+
93
+            if (
94
+                element &&
95
+                element.getBoundingClientRect().top < window.innerHeight * at
96
+            ) {
97
+                setSeen(true);
98
+            }
99
+        });
100
+    }, [seen, ref, at]);
101
+
102
+    return seen;
103
+}
104
+
105
+/**
106
+ * Types `text` out letter by letter, like someone typing, after `delay` milliseconds. Returns how many
107
+ * letters show and whether it has finished. With `enabled` false the whole text shows at once.
108
+ */
109
+export function useTyping(
110
+    text: string,
111
+    enabled: boolean,
112
+    delay = 500,
113
+): { shown: number; done: boolean } {
114
+    const [shown, setShown] = useState(enabled ? 0 : text.length);
115
+
116
+    useEffect(() => {
117
+        if (!enabled) {
118
+            return;
119
+        }
120
+
121
+        let count = 0;
122
+        let timer = 0;
123
+        const next = () => {
124
+            count += 1;
125
+            setShown(count);
126
+
127
+            if (count < text.length) {
128
+                // A short pause after a full stop or comma, otherwise a slightly uneven, human pace.
129
+                const pause = /[.,]/.test(text[count - 1])
130
+                    ? 240
131
+                    : 16 + Math.random() * 22;
132
+                timer = window.setTimeout(next, pause);
133
+            }
134
+        };
135
+
136
+        timer = window.setTimeout(next, delay);
137
+
138
+        return () => window.clearTimeout(timer);
139
+    }, [enabled, text, delay]);
140
+
141
+    return { shown, done: shown >= text.length };
142
+}

+ 1821
- 0
resources/js/pages/home.tsx
La diferencia del archivo ha sido suprimido porque es demasiado grande
Ver fichero


+ 39
- 1
resources/js/pages/stores/create.tsx Ver fichero

12
 const fieldClass =
12
 const fieldClass =
13
     'w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm';
13
     'w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm';
14
 
14
 
15
+/**
16
+ * The store name typed on our home page, if any: from the address (?name=...) or, after signing up,
17
+ * kept in this browser. Empty otherwise.
18
+ */
19
+function pendingName(): string {
20
+    if (typeof window === 'undefined') {
21
+        return '';
22
+    }
23
+
24
+    const fromAddress = new URLSearchParams(window.location.search).get('name');
25
+
26
+    if (fromAddress) {
27
+        return fromAddress.slice(0, 60);
28
+    }
29
+
30
+    try {
31
+        return (window.localStorage.getItem('pending-store-name') ?? '').slice(
32
+            0,
33
+            60,
34
+        );
35
+    } catch {
36
+        return '';
37
+    }
38
+}
39
+
40
+function forgetPendingName(): void {
41
+    try {
42
+        window.localStorage.removeItem('pending-store-name');
43
+    } catch {
44
+        // Nothing to forget when storage is blocked.
45
+    }
46
+}
47
+
15
 export default function CreateStore({
48
 export default function CreateStore({
16
     categories,
49
     categories,
17
     languages,
50
     languages,
29
                     description="Tell us about your brand. The AI will use this to design your store."
62
                     description="Tell us about your brand. The AI will use this to design your store."
30
                 />
63
                 />
31
 
64
 
32
-                <Form {...StoreController.store.form()} className="space-y-6">
65
+                <Form
66
+                    {...StoreController.store.form()}
67
+                    onSuccess={forgetPendingName}
68
+                    className="space-y-6"
69
+                >
33
                     {({ processing, errors }) => (
70
                     {({ processing, errors }) => (
34
                         <>
71
                         <>
35
                             <div className="grid gap-2">
72
                             <div className="grid gap-2">
40
                                     required
77
                                     required
41
                                     maxLength={60}
78
                                     maxLength={60}
42
                                     autoFocus
79
                                     autoFocus
80
+                                    defaultValue={pendingName()}
43
                                     placeholder="e.g. Sambal Nenek"
81
                                     placeholder="e.g. Sambal Nenek"
44
                                 />
82
                                 />
45
                                 <InputError message={errors.name} />
83
                                 <InputError message={errors.name} />

+ 0
- 389
resources/js/pages/welcome.tsx Ver fichero

1
-import { Head, Link, usePage } from '@inertiajs/react';
2
-import { dashboard, login } from '@/routes';
3
-import { register } from '@/routes';
4
-
5
-export default function Welcome() {
6
-    const { auth } = usePage().props;
7
-
8
-    return (
9
-        <>
10
-            <Head title="Welcome" />
11
-            <div className="flex min-h-screen flex-col items-center bg-[#FDFDFC] p-6 text-[#1b1b18] lg:justify-center lg:p-8 dark:bg-[#0a0a0a]">
12
-                <header className="mb-6 w-full max-w-[335px] text-sm not-has-[nav]:hidden lg:max-w-4xl">
13
-                    <nav className="flex items-center justify-end gap-4">
14
-                        {auth.user ? (
15
-                            <Link
16
-                                href={dashboard()}
17
-                                className="inline-block rounded-sm border border-[#19140035] px-5 py-1.5 text-sm leading-normal text-[#1b1b18] hover:border-[#1915014a] dark:border-[#3E3E3A] dark:text-[#EDEDEC] dark:hover:border-[#62605b]"
18
-                            >
19
-                                Dashboard
20
-                            </Link>
21
-                        ) : (
22
-                            <>
23
-                                <Link
24
-                                    href={login()}
25
-                                    className="inline-block rounded-sm border border-transparent px-5 py-1.5 text-sm leading-normal text-[#1b1b18] hover:border-[#19140035] dark:text-[#EDEDEC] dark:hover:border-[#3E3E3A]"
26
-                                >
27
-                                    Log in
28
-                                </Link>
29
-                                <Link
30
-                                    href={register()}
31
-                                    className="inline-block rounded-sm border border-[#19140035] px-5 py-1.5 text-sm leading-normal text-[#1b1b18] hover:border-[#1915014a] dark:border-[#3E3E3A] dark:text-[#EDEDEC] dark:hover:border-[#62605b]"
32
-                                >
33
-                                    Register
34
-                                </Link>
35
-                            </>
36
-                        )}
37
-                    </nav>
38
-                </header>
39
-                <div className="flex w-full items-center justify-center opacity-100 transition-opacity duration-750 lg:grow starting:opacity-0">
40
-                    <main className="flex w-full max-w-[335px] flex-col-reverse lg:max-w-4xl lg:flex-row">
41
-                        <div className="flex-1 rounded-br-lg rounded-bl-lg bg-white p-6 pb-12 text-[13px] leading-[20px] shadow-[inset_0px_0px_0px_1px_rgba(26,26,0,0.16)] lg:rounded-tl-lg lg:rounded-br-none lg:p-20 dark:bg-[#161615] dark:text-[#EDEDEC] dark:shadow-[inset_0px_0px_0px_1px_#fffaed2d]">
42
-                            <h1 className="mb-1 font-medium">
43
-                                Let's get started
44
-                            </h1>
45
-                            <p className="mb-2 text-[#706f6c] dark:text-[#A1A09A]">
46
-                                Laravel has an incredibly rich ecosystem.
47
-                                <br />
48
-                                We suggest starting with the following.
49
-                            </p>
50
-                            <ul className="mb-4 flex flex-col lg:mb-6">
51
-                                <li className="relative flex items-center gap-4 py-2 before:absolute before:top-1/2 before:bottom-0 before:left-[0.4rem] before:border-l before:border-[#e3e3e0] dark:before:border-[#3E3E3A]">
52
-                                    <span className="relative bg-white py-1 dark:bg-[#161615]">
53
-                                        <span className="flex h-3.5 w-3.5 items-center justify-center rounded-full border border-[#e3e3e0] bg-[#FDFDFC] shadow-[0px_0px_1px_0px_rgba(0,0,0,0.03),0px_1px_2px_0px_rgba(0,0,0,0.06)] dark:border-[#3E3E3A] dark:bg-[#161615]">
54
-                                            <span className="h-1.5 w-1.5 rounded-full bg-[#dbdbd7] dark:bg-[#3E3E3A]" />
55
-                                        </span>
56
-                                    </span>
57
-                                    <span>
58
-                                        Read the
59
-                                        <a
60
-                                            href="https://laravel.com/docs"
61
-                                            target="_blank"
62
-                                            className="ml-1 inline-flex items-center space-x-1 font-medium text-[#f53003] underline underline-offset-4 dark:text-[#FF4433]"
63
-                                        >
64
-                                            <span>Documentation</span>
65
-                                            <svg
66
-                                                width={10}
67
-                                                height={11}
68
-                                                viewBox="0 0 10 11"
69
-                                                fill="none"
70
-                                                xmlns="http://www.w3.org/2000/svg"
71
-                                                className="h-2.5 w-2.5"
72
-                                            >
73
-                                                <path
74
-                                                    d="M7.70833 6.95834V2.79167H3.54167M2.5 8L7.5 3.00001"
75
-                                                    stroke="currentColor"
76
-                                                    strokeLinecap="square"
77
-                                                />
78
-                                            </svg>
79
-                                        </a>
80
-                                    </span>
81
-                                </li>
82
-                                <li className="relative flex items-center gap-4 py-2 before:absolute before:top-0 before:bottom-1/2 before:left-[0.4rem] before:border-l before:border-[#e3e3e0] dark:before:border-[#3E3E3A]">
83
-                                    <span className="relative bg-white py-1 dark:bg-[#161615]">
84
-                                        <span className="flex h-3.5 w-3.5 items-center justify-center rounded-full border border-[#e3e3e0] bg-[#FDFDFC] shadow-[0px_0px_1px_0px_rgba(0,0,0,0.03),0px_1px_2px_0px_rgba(0,0,0,0.06)] dark:border-[#3E3E3A] dark:bg-[#161615]">
85
-                                            <span className="h-1.5 w-1.5 rounded-full bg-[#dbdbd7] dark:bg-[#3E3E3A]" />
86
-                                        </span>
87
-                                    </span>
88
-                                    <span>
89
-                                        Watch video tutorials at
90
-                                        <a
91
-                                            href="https://laracasts.com"
92
-                                            target="_blank"
93
-                                            className="ml-1 inline-flex items-center space-x-1 font-medium text-[#f53003] underline underline-offset-4 dark:text-[#FF4433]"
94
-                                        >
95
-                                            <span>Laracasts</span>
96
-                                            <svg
97
-                                                width={10}
98
-                                                height={11}
99
-                                                viewBox="0 0 10 11"
100
-                                                fill="none"
101
-                                                xmlns="http://www.w3.org/2000/svg"
102
-                                                className="h-2.5 w-2.5"
103
-                                            >
104
-                                                <path
105
-                                                    d="M7.70833 6.95834V2.79167H3.54167M2.5 8L7.5 3.00001"
106
-                                                    stroke="currentColor"
107
-                                                    strokeLinecap="square"
108
-                                                />
109
-                                            </svg>
110
-                                        </a>
111
-                                    </span>
112
-                                </li>
113
-                            </ul>
114
-                            <ul className="flex gap-3 text-sm leading-normal">
115
-                                <li>
116
-                                    <a
117
-                                        href="https://cloud.laravel.com"
118
-                                        target="_blank"
119
-                                        className="inline-block rounded-sm border border-black bg-[#1b1b18] px-5 py-1.5 text-sm leading-normal text-white hover:border-black hover:bg-black dark:border-[#eeeeec] dark:bg-[#eeeeec] dark:text-[#1C1C1A] dark:hover:border-white dark:hover:bg-white"
120
-                                    >
121
-                                        Deploy now
122
-                                    </a>
123
-                                </li>
124
-                            </ul>
125
-                        </div>
126
-                        <div className="relative -mb-px aspect-[335/364] w-full shrink-0 overflow-hidden rounded-t-lg bg-[#fff2f2] lg:mb-0 lg:-ml-px lg:aspect-auto lg:w-[438px] lg:rounded-t-none lg:rounded-r-lg dark:bg-[#1D0002]">
127
-                            {/* Laravel Logo */}
128
-                            <svg
129
-                                className="w-full max-w-none translate-y-0 text-[#F53003] opacity-100 transition-all duration-750 dark:text-[#F61500] starting:opacity-0 motion-safe:starting:translate-y-6"
130
-                                viewBox="0 0 438 104"
131
-                                fill="none"
132
-                                xmlns="http://www.w3.org/2000/svg"
133
-                            >
134
-                                <path
135
-                                    d="M17.2036 -3H0V102.197H49.5189V86.7187H17.2036V-3Z"
136
-                                    fill="currentColor"
137
-                                />
138
-                                <path
139
-                                    d="M110.256 41.6337C108.061 38.1275 104.945 35.3731 100.905 33.3681C96.8667 31.3647 92.8016 30.3618 88.7131 30.3618C83.4247 30.3618 78.5885 31.3389 74.201 33.2923C69.8111 35.2456 66.0474 37.928 62.9059 41.3333C59.7643 44.7401 57.3198 48.6726 55.5754 53.1293C53.8287 57.589 52.9572 62.274 52.9572 67.1813C52.9572 72.1925 53.8287 76.8995 55.5754 81.3069C57.3191 85.7173 59.7636 89.6241 62.9059 93.0293C66.0474 96.4361 69.8119 99.1155 74.201 101.069C78.5885 103.022 83.4247 103.999 88.7131 103.999C92.8016 103.999 96.8667 102.997 100.905 100.994C104.945 98.9911 108.061 96.2359 110.256 92.7282V102.195H126.563V32.1642H110.256V41.6337ZM108.76 75.7472C107.762 78.4531 106.366 80.8078 104.572 82.8112C102.776 84.8161 100.606 86.4183 98.0637 87.6206C95.5202 88.823 92.7004 89.4238 89.6103 89.4238C86.5178 89.4238 83.7252 88.823 81.2324 87.6206C78.7388 86.4183 76.5949 84.8161 74.7998 82.8112C73.004 80.8078 71.6319 78.4531 70.6856 75.7472C69.7356 73.0421 69.2644 70.1868 69.2644 67.1821C69.2644 64.1758 69.7356 61.3205 70.6856 58.6154C71.6319 55.9102 73.004 53.5571 74.7998 51.5522C76.5949 49.5495 78.738 47.9451 81.2324 46.7427C83.7252 45.5404 86.5178 44.9396 89.6103 44.9396C92.7012 44.9396 95.5202 45.5404 98.0637 46.7427C100.606 47.9451 102.776 49.5487 104.572 51.5522C106.367 53.5571 107.762 55.9102 108.76 58.6154C109.756 61.3205 110.256 64.1758 110.256 67.1821C110.256 70.1868 109.756 73.0421 108.76 75.7472Z"
140
-                                    fill="currentColor"
141
-                                />
142
-                                <path
143
-                                    d="M242.805 41.6337C240.611 38.1275 237.494 35.3731 233.455 33.3681C229.416 31.3647 225.351 30.3618 221.262 30.3618C215.974 30.3618 211.138 31.3389 206.75 33.2923C202.36 35.2456 198.597 37.928 195.455 41.3333C192.314 44.7401 189.869 48.6726 188.125 53.1293C186.378 57.589 185.507 62.274 185.507 67.1813C185.507 72.1925 186.378 76.8995 188.125 81.3069C189.868 85.7173 192.313 89.6241 195.455 93.0293C198.597 96.4361 202.361 99.1155 206.75 101.069C211.138 103.022 215.974 103.999 221.262 103.999C225.351 103.999 229.416 102.997 233.455 100.994C237.494 98.9911 240.611 96.2359 242.805 92.7282V102.195H259.112V32.1642H242.805V41.6337ZM241.31 75.7472C240.312 78.4531 238.916 80.8078 237.122 82.8112C235.326 84.8161 233.156 86.4183 230.614 87.6206C228.07 88.823 225.251 89.4238 222.16 89.4238C219.068 89.4238 216.275 88.823 213.782 87.6206C211.289 86.4183 209.145 84.8161 207.35 82.8112C205.554 80.8078 204.182 78.4531 203.236 75.7472C202.286 73.0421 201.814 70.1868 201.814 67.1821C201.814 64.1758 202.286 61.3205 203.236 58.6154C204.182 55.9102 205.554 53.5571 207.35 51.5522C209.145 49.5495 211.288 47.9451 213.782 46.7427C216.275 45.5404 219.068 44.9396 222.16 44.9396C225.251 44.9396 228.07 45.5404 230.614 46.7427C233.156 47.9451 235.326 49.5487 237.122 51.5522C238.917 53.5571 240.312 55.9102 241.31 58.6154C242.306 61.3205 242.806 64.1758 242.806 67.1821C242.805 70.1868 242.305 73.0421 241.31 75.7472Z"
144
-                                    fill="currentColor"
145
-                                />
146
-                                <path
147
-                                    d="M438 -3H421.694V102.197H438V-3Z"
148
-                                    fill="currentColor"
149
-                                />
150
-                                <path
151
-                                    d="M139.43 102.197H155.735V48.2834H183.712V32.1665H139.43V102.197Z"
152
-                                    fill="currentColor"
153
-                                />
154
-                                <path
155
-                                    d="M324.49 32.1665L303.995 85.794L283.498 32.1665H266.983L293.748 102.197H314.242L341.006 32.1665H324.49Z"
156
-                                    fill="currentColor"
157
-                                />
158
-                                <path
159
-                                    d="M376.571 30.3656C356.603 30.3656 340.797 46.8497 340.797 67.1828C340.797 89.6597 356.094 104 378.661 104C391.29 104 399.354 99.1488 409.206 88.5848L398.189 80.0226C398.183 80.031 389.874 90.9895 377.468 90.9895C363.048 90.9895 356.977 79.3111 356.977 73.269H411.075C413.917 50.1328 398.775 30.3656 376.571 30.3656ZM357.02 61.0967C357.145 59.7487 359.023 43.3761 376.442 43.3761C393.861 43.3761 395.978 59.7464 396.099 61.0967H357.02Z"
160
-                                    fill="currentColor"
161
-                                />
162
-                            </svg>
163
-
164
-                            {/* 13 */}
165
-                            <svg
166
-                                className="relative -mt-[6.6rem] -ml-8 w-[438px] max-w-none [--stroke-color:#1B1B18] lg:ml-0 dark:[--stroke-color:#FF750F]"
167
-                                viewBox="0 0 440 392"
168
-                                fill="none"
169
-                                xmlns="http://www.w3.org/2000/svg"
170
-                            >
171
-                                <g className="text-[#1B1B18] opacity-100 mix-blend-darken transition-all delay-300 duration-750 dark:text-black dark:mix-blend-normal starting:opacity-0">
172
-                                    <mask
173
-                                        id="path-1-mask"
174
-                                        maskUnits="userSpaceOnUse"
175
-                                        x="-0.328613"
176
-                                        y="103"
177
-                                        width="338"
178
-                                        height="299"
179
-                                        fill="black"
180
-                                    >
181
-                                        <rect
182
-                                            fill="white"
183
-                                            x="-0.328613"
184
-                                            y="103"
185
-                                            width="338"
186
-                                            height="299"
187
-                                        />
188
-                                        <path d="M234.936 400.8C204.136 400.8 178.936 392.4 159.336 375.6C140.136 358.8 130.536 337 130.536 310.2H200.736C200.736 318.2 203.736 324.8 209.736 330C215.736 335.2 223.736 337.8 233.736 337.8C243.336 337.8 251.136 335 257.136 329.4C263.536 323.8 266.736 316.6 266.736 307.8C266.736 299.8 263.936 293.2 258.336 288C252.736 282.8 245.536 280.2 236.736 280.2H199.536V218.4H236.736C243.536 218.4 249.336 216 254.136 211.2C258.936 206.4 261.336 200.4 261.336 193.2C261.336 184.8 258.736 178.2 253.536 173.4C248.336 168.6 241.736 166.2 233.736 166.2C226.536 166.2 220.336 168.4 215.136 172.8C210.336 177.2 207.936 182.8 207.936 189.6H141.336C141.336 164.8 150.136 144.6 167.736 129C185.336 113 207.936 105 235.536 105C263.136 105 285.536 112.2 302.736 126.6C320.336 141 329.136 160 329.136 183.6C329.136 200.8 324.536 214.8 315.336 225.6C306.136 236 294.336 243.2 279.936 247.2C297.136 252 310.736 260.2 320.736 271.8C331.136 283.4 336.336 298 336.336 315.6C336.336 340.4 326.936 360.8 308.136 376.8C289.336 392.8 264.936 400.8 234.936 400.8Z" />
189
-                                        <path d="M26.8714 167.6H1.67139V105.2H94.6714V400.2H26.8714V167.6Z" />
190
-                                    </mask>
191
-                                    <path
192
-                                        d="M234.936 400.8C204.136 400.8 178.936 392.4 159.336 375.6C140.136 358.8 130.536 337 130.536 310.2H200.736C200.736 318.2 203.736 324.8 209.736 330C215.736 335.2 223.736 337.8 233.736 337.8C243.336 337.8 251.136 335 257.136 329.4C263.536 323.8 266.736 316.6 266.736 307.8C266.736 299.8 263.936 293.2 258.336 288C252.736 282.8 245.536 280.2 236.736 280.2H199.536V218.4H236.736C243.536 218.4 249.336 216 254.136 211.2C258.936 206.4 261.336 200.4 261.336 193.2C261.336 184.8 258.736 178.2 253.536 173.4C248.336 168.6 241.736 166.2 233.736 166.2C226.536 166.2 220.336 168.4 215.136 172.8C210.336 177.2 207.936 182.8 207.936 189.6H141.336C141.336 164.8 150.136 144.6 167.736 129C185.336 113 207.936 105 235.536 105C263.136 105 285.536 112.2 302.736 126.6C320.336 141 329.136 160 329.136 183.6C329.136 200.8 324.536 214.8 315.336 225.6C306.136 236 294.336 243.2 279.936 247.2C297.136 252 310.736 260.2 320.736 271.8C331.136 283.4 336.336 298 336.336 315.6C336.336 340.4 326.936 360.8 308.136 376.8C289.336 392.8 264.936 400.8 234.936 400.8Z"
193
-                                        fill="currentColor"
194
-                                    />
195
-                                    <path
196
-                                        d="M26.8714 167.6H1.67139V105.2H94.6714V400.2H26.8714V167.6Z"
197
-                                        fill="currentColor"
198
-                                    />
199
-                                    <path
200
-                                        d="M234.936 400.8C204.136 400.8 178.936 392.4 159.336 375.6C140.136 358.8 130.536 337 130.536 310.2H200.736C200.736 318.2 203.736 324.8 209.736 330C215.736 335.2 223.736 337.8 233.736 337.8C243.336 337.8 251.136 335 257.136 329.4C263.536 323.8 266.736 316.6 266.736 307.8C266.736 299.8 263.936 293.2 258.336 288C252.736 282.8 245.536 280.2 236.736 280.2H199.536V218.4H236.736C243.536 218.4 249.336 216 254.136 211.2C258.936 206.4 261.336 200.4 261.336 193.2C261.336 184.8 258.736 178.2 253.536 173.4C248.336 168.6 241.736 166.2 233.736 166.2C226.536 166.2 220.336 168.4 215.136 172.8C210.336 177.2 207.936 182.8 207.936 189.6H141.336C141.336 164.8 150.136 144.6 167.736 129C185.336 113 207.936 105 235.536 105C263.136 105 285.536 112.2 302.736 126.6C320.336 141 329.136 160 329.136 183.6C329.136 200.8 324.536 214.8 315.336 225.6C306.136 236 294.336 243.2 279.936 247.2C297.136 252 310.736 260.2 320.736 271.8C331.136 283.4 336.336 298 336.336 315.6C336.336 340.4 326.936 360.8 308.136 376.8C289.336 392.8 264.936 400.8 234.936 400.8Z"
201
-                                        stroke="var(--stroke-color)"
202
-                                        strokeWidth="2.4"
203
-                                        mask="url(#path-1-mask)"
204
-                                    />
205
-                                    <path
206
-                                        d="M26.8714 167.6H1.67139V105.2H94.6714V400.2H26.8714V167.6Z"
207
-                                        stroke="var(--stroke-color)"
208
-                                        strokeWidth="2.4"
209
-                                        mask="url(#path-1-mask)"
210
-                                    />
211
-                                </g>
212
-
213
-                                <g className="text-[#F3BEC7] opacity-100 transition-all delay-400 duration-750 dark:text-[#4B0600] starting:opacity-0 motion-safe:starting:-translate-x-[26px]">
214
-                                    <mask
215
-                                        id="path-2-mask"
216
-                                        maskUnits="userSpaceOnUse"
217
-                                        x="25.3357"
218
-                                        y="103"
219
-                                        width="338"
220
-                                        height="299"
221
-                                        fill="black"
222
-                                    >
223
-                                        <rect
224
-                                            fill="white"
225
-                                            x="25.3357"
226
-                                            y="103"
227
-                                            width="338"
228
-                                            height="299"
229
-                                        />
230
-                                        <path d="M260.6 400.8C229.8 400.8 204.6 392.4 185 375.6C165.8 358.8 156.2 337 156.2 310.2H226.4C226.4 318.2 229.4 324.8 235.4 330C241.4 335.2 249.4 337.8 259.4 337.8C269 337.8 276.8 335 282.8 329.4C289.2 323.8 292.4 316.6 292.4 307.8C292.4 299.8 289.6 293.2 284 288C278.4 282.8 271.2 280.2 262.4 280.2H225.2V218.4H262.4C269.2 218.4 275 216 279.8 211.2C284.6 206.4 287 200.4 287 193.2C287 184.8 284.4 178.2 279.2 173.4C274 168.6 267.4 166.2 259.4 166.2C252.2 166.2 246 168.4 240.8 172.8C236 177.2 233.6 182.8 233.6 189.6H167C167 164.8 175.8 144.6 193.4 129C211 113 233.6 105 261.2 105C288.8 105 311.2 112.2 328.4 126.6C346 141 354.8 160 354.8 183.6C354.8 200.8 350.2 214.8 341 225.6C331.8 236 320 243.2 305.6 247.2C322.8 252 336.4 260.2 346.4 271.8C356.8 283.4 362 298 362 315.6C362 340.4 352.6 360.8 333.8 376.8C315 392.8 290.6 400.8 260.6 400.8Z" />
231
-                                        <path d="M52.5357 167.6H27.3357V105.2H120.336V400.2H52.5357V167.6Z" />
232
-                                    </mask>
233
-                                    <path
234
-                                        d="M260.6 400.8C229.8 400.8 204.6 392.4 185 375.6C165.8 358.8 156.2 337 156.2 310.2H226.4C226.4 318.2 229.4 324.8 235.4 330C241.4 335.2 249.4 337.8 259.4 337.8C269 337.8 276.8 335 282.8 329.4C289.2 323.8 292.4 316.6 292.4 307.8C292.4 299.8 289.6 293.2 284 288C278.4 282.8 271.2 280.2 262.4 280.2H225.2V218.4H262.4C269.2 218.4 275 216 279.8 211.2C284.6 206.4 287 200.4 287 193.2C287 184.8 284.4 178.2 279.2 173.4C274 168.6 267.4 166.2 259.4 166.2C252.2 166.2 246 168.4 240.8 172.8C236 177.2 233.6 182.8 233.6 189.6H167C167 164.8 175.8 144.6 193.4 129C211 113 233.6 105 261.2 105C288.8 105 311.2 112.2 328.4 126.6C346 141 354.8 160 354.8 183.6C354.8 200.8 350.2 214.8 341 225.6C331.8 236 320 243.2 305.6 247.2C322.8 252 336.4 260.2 346.4 271.8C356.8 283.4 362 298 362 315.6C362 340.4 352.6 360.8 333.8 376.8C315 392.8 290.6 400.8 260.6 400.8Z"
235
-                                        fill="currentColor"
236
-                                    />
237
-                                    <path
238
-                                        d="M52.5357 167.6H27.3357V105.2H120.336V400.2H52.5357V167.6Z"
239
-                                        fill="currentColor"
240
-                                    />
241
-                                    <path
242
-                                        d="M260.6 400.8C229.8 400.8 204.6 392.4 185 375.6C165.8 358.8 156.2 337 156.2 310.2H226.4C226.4 318.2 229.4 324.8 235.4 330C241.4 335.2 249.4 337.8 259.4 337.8C269 337.8 276.8 335 282.8 329.4C289.2 323.8 292.4 316.6 292.4 307.8C292.4 299.8 289.6 293.2 284 288C278.4 282.8 271.2 280.2 262.4 280.2H225.2V218.4H262.4C269.2 218.4 275 216 279.8 211.2C284.6 206.4 287 200.4 287 193.2C287 184.8 284.4 178.2 279.2 173.4C274 168.6 267.4 166.2 259.4 166.2C252.2 166.2 246 168.4 240.8 172.8C236 177.2 233.6 182.8 233.6 189.6H167C167 164.8 175.8 144.6 193.4 129C211 113 233.6 105 261.2 105C288.8 105 311.2 112.2 328.4 126.6C346 141 354.8 160 354.8 183.6C354.8 200.8 350.2 214.8 341 225.6C331.8 236 320 243.2 305.6 247.2C322.8 252 336.4 260.2 346.4 271.8C356.8 283.4 362 298 362 315.6C362 340.4 352.6 360.8 333.8 376.8C315 392.8 290.6 400.8 260.6 400.8Z"
243
-                                        stroke="var(--stroke-color)"
244
-                                        strokeWidth="2.4"
245
-                                        mask="url(#path-2-mask)"
246
-                                    />
247
-                                    <path
248
-                                        d="M52.5357 167.6H27.3357V105.2H120.336V400.2H52.5357V167.6Z"
249
-                                        stroke="var(--stroke-color)"
250
-                                        strokeWidth="2.4"
251
-                                        mask="url(#path-2-mask)"
252
-                                    />
253
-                                </g>
254
-
255
-                                <g className="text-[#F8B803] opacity-100 mix-blend-color transition-all delay-400 duration-750 dark:text-[#391800] dark:mix-blend-hard-light starting:opacity-0 motion-safe:starting:-translate-x-[51px]">
256
-                                    <mask
257
-                                        id="path-3-mask"
258
-                                        maskUnits="userSpaceOnUse"
259
-                                        x="51"
260
-                                        y="103"
261
-                                        width="338"
262
-                                        height="299"
263
-                                        fill="black"
264
-                                    >
265
-                                        <rect
266
-                                            fill="white"
267
-                                            x="51"
268
-                                            y="103"
269
-                                            width="338"
270
-                                            height="299"
271
-                                        />
272
-                                        <path d="M286.264 400.8C255.464 400.8 230.264 392.4 210.664 375.6C191.464 358.8 181.864 337 181.864 310.2H252.064C252.064 318.2 255.064 324.8 261.064 330C267.064 335.2 275.064 337.8 285.064 337.8C294.664 337.8 302.464 335 308.464 329.4C314.864 323.8 318.064 316.6 318.064 307.8C318.064 299.8 315.264 293.2 309.664 288C304.064 282.8 296.864 280.2 288.064 280.2H250.864V218.4H288.064C294.864 218.4 300.664 216 305.464 211.2C310.264 206.4 312.664 200.4 312.664 193.2C312.664 184.8 310.064 178.2 304.864 173.4C299.664 168.6 293.064 166.2 285.064 166.2C277.864 166.2 271.664 168.4 266.464 172.8C261.664 177.2 259.264 182.8 259.264 189.6H192.664C192.664 164.8 201.464 144.6 219.064 129C236.664 113 259.264 105 286.864 105C314.464 105 336.864 112.2 354.064 126.6C371.664 141 380.464 160 380.464 183.6C380.464 200.8 375.864 214.8 366.664 225.6C357.464 236 345.664 243.2 331.264 247.2C348.464 252 362.064 260.2 372.064 271.8C382.464 283.4 387.664 298 387.664 315.6C387.664 340.4 378.264 360.8 359.464 376.8C340.664 392.8 316.264 400.8 286.264 400.8Z" />
273
-                                        <path d="M78.2 167.6H53V105.2H146V400.2H78.2V167.6Z" />
274
-                                    </mask>
275
-                                    <path
276
-                                        d="M286.264 400.8C255.464 400.8 230.264 392.4 210.664 375.6C191.464 358.8 181.864 337 181.864 310.2H252.064C252.064 318.2 255.064 324.8 261.064 330C267.064 335.2 275.064 337.8 285.064 337.8C294.664 337.8 302.464 335 308.464 329.4C314.864 323.8 318.064 316.6 318.064 307.8C318.064 299.8 315.264 293.2 309.664 288C304.064 282.8 296.864 280.2 288.064 280.2H250.864V218.4H288.064C294.864 218.4 300.664 216 305.464 211.2C310.264 206.4 312.664 200.4 312.664 193.2C312.664 184.8 310.064 178.2 304.864 173.4C299.664 168.6 293.064 166.2 285.064 166.2C277.864 166.2 271.664 168.4 266.464 172.8C261.664 177.2 259.264 182.8 259.264 189.6H192.664C192.664 164.8 201.464 144.6 219.064 129C236.664 113 259.264 105 286.864 105C314.464 105 336.864 112.2 354.064 126.6C371.664 141 380.464 160 380.464 183.6C380.464 200.8 375.864 214.8 366.664 225.6C357.464 236 345.664 243.2 331.264 247.2C348.464 252 362.064 260.2 372.064 271.8C382.464 283.4 387.664 298 387.664 315.6C387.664 340.4 378.264 360.8 359.464 376.8C340.664 392.8 316.264 400.8 286.264 400.8Z"
277
-                                        fill="currentColor"
278
-                                    />
279
-                                    <path
280
-                                        d="M78.2 167.6H53V105.2H146V400.2H78.2V167.6Z"
281
-                                        fill="currentColor"
282
-                                    />
283
-                                    <path
284
-                                        d="M286.264 400.8C255.464 400.8 230.264 392.4 210.664 375.6C191.464 358.8 181.864 337 181.864 310.2H252.064C252.064 318.2 255.064 324.8 261.064 330C267.064 335.2 275.064 337.8 285.064 337.8C294.664 337.8 302.464 335 308.464 329.4C314.864 323.8 318.064 316.6 318.064 307.8C318.064 299.8 315.264 293.2 309.664 288C304.064 282.8 296.864 280.2 288.064 280.2H250.864V218.4H288.064C294.864 218.4 300.664 216 305.464 211.2C310.264 206.4 312.664 200.4 312.664 193.2C312.664 184.8 310.064 178.2 304.864 173.4C299.664 168.6 293.064 166.2 285.064 166.2C277.864 166.2 271.664 168.4 266.464 172.8C261.664 177.2 259.264 182.8 259.264 189.6H192.664C192.664 164.8 201.464 144.6 219.064 129C236.664 113 259.264 105 286.864 105C314.464 105 336.864 112.2 354.064 126.6C371.664 141 380.464 160 380.464 183.6C380.464 200.8 375.864 214.8 366.664 225.6C357.464 236 345.664 243.2 331.264 247.2C348.464 252 362.064 260.2 372.064 271.8C382.464 283.4 387.664 298 387.664 315.6C387.664 340.4 378.264 360.8 359.464 376.8C340.664 392.8 316.264 400.8 286.264 400.8Z"
285
-                                        stroke="var(--stroke-color)"
286
-                                        strokeWidth="2.4"
287
-                                        mask="url(#path-3-mask)"
288
-                                    />
289
-                                    <path
290
-                                        d="M78.2 167.6H53V105.2H146V400.2H78.2V167.6Z"
291
-                                        stroke="var(--stroke-color)"
292
-                                        strokeWidth="2.4"
293
-                                        mask="url(#path-3-mask)"
294
-                                    />
295
-                                </g>
296
-
297
-                                <g className="text-[#F3BEC7] opacity-100 mix-blend-multiply transition-all delay-400 duration-750 dark:text-[#733000] dark:mix-blend-normal starting:opacity-0 motion-safe:starting:-translate-x-[78px]">
298
-                                    <mask
299
-                                        id="path-4-mask"
300
-                                        maskUnits="userSpaceOnUse"
301
-                                        x="76.6643"
302
-                                        y="103"
303
-                                        width="338"
304
-                                        height="299"
305
-                                        fill="black"
306
-                                    >
307
-                                        <rect
308
-                                            fill="white"
309
-                                            x="76.6643"
310
-                                            y="103"
311
-                                            width="338"
312
-                                            height="299"
313
-                                        />
314
-                                        <path d="M311.929 400.8C281.129 400.8 255.929 392.4 236.329 375.6C217.129 358.8 207.529 337 207.529 310.2H277.729C277.729 318.2 280.729 324.8 286.729 330C292.729 335.2 300.729 337.8 310.729 337.8C320.329 337.8 328.129 335 334.129 329.4C340.529 323.8 343.729 316.6 343.729 307.8C343.729 299.8 340.929 293.2 335.329 288C329.729 282.8 322.529 280.2 313.729 280.2H276.529V218.4H313.729C320.529 218.4 326.329 216 331.129 211.2C335.929 206.4 338.329 200.4 338.329 193.2C338.329 184.8 335.729 178.2 330.529 173.4C325.329 168.6 318.729 166.2 310.729 166.2C303.529 166.2 297.329 168.4 292.129 172.8C287.329 177.2 284.929 182.8 284.929 189.6H218.329C218.329 164.8 227.129 144.6 244.729 129C262.329 113 284.929 105 312.529 105C340.129 105 362.529 112.2 379.729 126.6C397.329 141 406.129 160 406.129 183.6C406.129 200.8 401.529 214.8 392.329 225.6C383.129 236 371.329 243.2 356.929 247.2C374.129 252 387.729 260.2 397.729 271.8C408.129 283.4 413.329 298 413.329 315.6C413.329 340.4 403.929 360.8 385.129 376.8C366.329 392.8 341.929 400.8 311.929 400.8Z" />
315
-                                        <path d="M103.864 167.6H78.6643V105.2H171.664V400.2H103.864V167.6Z" />
316
-                                    </mask>
317
-                                    <path
318
-                                        d="M311.929 400.8C281.129 400.8 255.929 392.4 236.329 375.6C217.129 358.8 207.529 337 207.529 310.2H277.729C277.729 318.2 280.729 324.8 286.729 330C292.729 335.2 300.729 337.8 310.729 337.8C320.329 337.8 328.129 335 334.129 329.4C340.529 323.8 343.729 316.6 343.729 307.8C343.729 299.8 340.929 293.2 335.329 288C329.729 282.8 322.529 280.2 313.729 280.2H276.529V218.4H313.729C320.529 218.4 326.329 216 331.129 211.2C335.929 206.4 338.329 200.4 338.329 193.2C338.329 184.8 335.729 178.2 330.529 173.4C325.329 168.6 318.729 166.2 310.729 166.2C303.529 166.2 297.329 168.4 292.129 172.8C287.329 177.2 284.929 182.8 284.929 189.6H218.329C218.329 164.8 227.129 144.6 244.729 129C262.329 113 284.929 105 312.529 105C340.129 105 362.529 112.2 379.729 126.6C397.329 141 406.129 160 406.129 183.6C406.129 200.8 401.529 214.8 392.329 225.6C383.129 236 371.329 243.2 356.929 247.2C374.129 252 387.729 260.2 397.729 271.8C408.129 283.4 413.329 298 413.329 315.6C413.329 340.4 403.929 360.8 385.129 376.8C366.329 392.8 341.929 400.8 311.929 400.8Z"
319
-                                        fill="currentColor"
320
-                                    />
321
-                                    <path
322
-                                        d="M103.864 167.6H78.6643V105.2H171.664V400.2H103.864V167.6Z"
323
-                                        fill="currentColor"
324
-                                    />
325
-                                    <path
326
-                                        d="M311.929 400.8C281.129 400.8 255.929 392.4 236.329 375.6C217.129 358.8 207.529 337 207.529 310.2H277.729C277.729 318.2 280.729 324.8 286.729 330C292.729 335.2 300.729 337.8 310.729 337.8C320.329 337.8 328.129 335 334.129 329.4C340.529 323.8 343.729 316.6 343.729 307.8C343.729 299.8 340.929 293.2 335.329 288C329.729 282.8 322.529 280.2 313.729 280.2H276.529V218.4H313.729C320.529 218.4 326.329 216 331.129 211.2C335.929 206.4 338.329 200.4 338.329 193.2C338.329 184.8 335.729 178.2 330.529 173.4C325.329 168.6 318.729 166.2 310.729 166.2C303.529 166.2 297.329 168.4 292.129 172.8C287.329 177.2 284.929 182.8 284.929 189.6H218.329C218.329 164.8 227.129 144.6 244.729 129C262.329 113 284.929 105 312.529 105C340.129 105 362.529 112.2 379.729 126.6C397.329 141 406.129 160 406.129 183.6C406.129 200.8 401.529 214.8 392.329 225.6C383.129 236 371.329 243.2 356.929 247.2C374.129 252 387.729 260.2 397.729 271.8C408.129 283.4 413.329 298 413.329 315.6C413.329 340.4 403.929 360.8 385.129 376.8C366.329 392.8 341.929 400.8 311.929 400.8Z"
327
-                                        stroke="var(--stroke-color)"
328
-                                        strokeWidth="2.4"
329
-                                        mask="url(#path-4-mask)"
330
-                                    />
331
-                                    <path
332
-                                        d="M103.864 167.6H78.6643V105.2H171.664V400.2H103.864V167.6Z"
333
-                                        stroke="var(--stroke-color)"
334
-                                        strokeWidth="2.4"
335
-                                        mask="url(#path-4-mask)"
336
-                                    />
337
-                                </g>
338
-
339
-                                <g className="text-[#F3BEC7] opacity-100 mix-blend-hard-light transition-all delay-400 duration-750 dark:text-[#4B0600] starting:opacity-0 motion-safe:starting:-translate-x-[102px]">
340
-                                    <mask
341
-                                        id="path-5-mask"
342
-                                        maskUnits="userSpaceOnUse"
343
-                                        x="102.329"
344
-                                        y="103"
345
-                                        width="338"
346
-                                        height="299"
347
-                                        fill="black"
348
-                                    >
349
-                                        <rect
350
-                                            fill="white"
351
-                                            x="102.329"
352
-                                            y="103"
353
-                                            width="338"
354
-                                            height="299"
355
-                                        />
356
-                                        <path d="M337.593 400.8C306.793 400.8 281.593 392.4 261.993 375.6C242.793 358.8 233.193 337 233.193 310.2H303.393C303.393 318.2 306.393 324.8 312.393 330C318.393 335.2 326.393 337.8 336.393 337.8C345.993 337.8 353.793 335 359.793 329.4C366.193 323.8 369.393 316.6 369.393 307.8C369.393 299.8 366.593 293.2 360.993 288C355.393 282.8 348.193 280.2 339.393 280.2H302.193V218.4H339.393C346.193 218.4 351.993 216 356.793 211.2C361.593 206.4 363.993 200.4 363.993 193.2C363.993 184.8 361.393 178.2 356.193 173.4C350.993 168.6 344.393 166.2 336.393 166.2C329.193 166.2 322.993 168.4 317.793 172.8C312.993 177.2 310.593 182.8 310.593 189.6H243.993C243.993 164.8 252.793 144.6 270.393 129C287.993 113 310.593 105 338.193 105C365.793 105 388.193 112.2 405.393 126.6C422.993 141 431.793 160 431.793 183.6C431.793 200.8 427.193 214.8 417.993 225.6C408.793 236 396.993 243.2 382.593 247.2C399.793 252 413.393 260.2 423.393 271.8C433.793 283.4 438.993 298 438.993 315.6C438.993 340.4 429.593 360.8 410.793 376.8C391.993 392.8 367.593 400.8 337.593 400.8Z" />
357
-                                        <path d="M129.529 167.6H104.329V105.2H197.329V400.2H129.529V167.6Z" />
358
-                                    </mask>
359
-                                    <path
360
-                                        d="M337.593 400.8C306.793 400.8 281.593 392.4 261.993 375.6C242.793 358.8 233.193 337 233.193 310.2H303.393C303.393 318.2 306.393 324.8 312.393 330C318.393 335.2 326.393 337.8 336.393 337.8C345.993 337.8 353.793 335 359.793 329.4C366.193 323.8 369.393 316.6 369.393 307.8C369.393 299.8 366.593 293.2 360.993 288C355.393 282.8 348.193 280.2 339.393 280.2H302.193V218.4H339.393C346.193 218.4 351.993 216 356.793 211.2C361.593 206.4 363.993 200.4 363.993 193.2C363.993 184.8 361.393 178.2 356.193 173.4C350.993 168.6 344.393 166.2 336.393 166.2C329.193 166.2 322.993 168.4 317.793 172.8C312.993 177.2 310.593 182.8 310.593 189.6H243.993C243.993 164.8 252.793 144.6 270.393 129C287.993 113 310.593 105 338.193 105C365.793 105 388.193 112.2 405.393 126.6C422.993 141 431.793 160 431.793 183.6C431.793 200.8 427.193 214.8 417.993 225.6C408.793 236 396.993 243.2 382.593 247.2C399.793 252 413.393 260.2 423.393 271.8C433.793 283.4 438.993 298 438.993 315.6C438.993 340.4 429.593 360.8 410.793 376.8C391.993 392.8 367.593 400.8 337.593 400.8Z"
361
-                                        fill="currentColor"
362
-                                    />
363
-                                    <path
364
-                                        d="M129.529 167.6H104.329V105.2H197.329V400.2H129.529V167.6Z"
365
-                                        fill="currentColor"
366
-                                    />
367
-                                    <path
368
-                                        d="M337.593 400.8C306.793 400.8 281.593 392.4 261.993 375.6C242.793 358.8 233.193 337 233.193 310.2H303.393C303.393 318.2 306.393 324.8 312.393 330C318.393 335.2 326.393 337.8 336.393 337.8C345.993 337.8 353.793 335 359.793 329.4C366.193 323.8 369.393 316.6 369.393 307.8C369.393 299.8 366.593 293.2 360.993 288C355.393 282.8 348.193 280.2 339.393 280.2H302.193V218.4H339.393C346.193 218.4 351.993 216 356.793 211.2C361.593 206.4 363.993 200.4 363.993 193.2C363.993 184.8 361.393 178.2 356.193 173.4C350.993 168.6 344.393 166.2 336.393 166.2C329.193 166.2 322.993 168.4 317.793 172.8C312.993 177.2 310.593 182.8 310.593 189.6H243.993C243.993 164.8 252.793 144.6 270.393 129C287.993 113 310.593 105 338.193 105C365.793 105 388.193 112.2 405.393 126.6C422.993 141 431.793 160 431.793 183.6C431.793 200.8 427.193 214.8 417.993 225.6C408.793 236 396.993 243.2 382.593 247.2C399.793 252 413.393 260.2 423.393 271.8C433.793 283.4 438.993 298 438.993 315.6C438.993 340.4 429.593 360.8 410.793 376.8C391.993 392.8 367.593 400.8 337.593 400.8Z"
369
-                                        stroke="var(--stroke-color)"
370
-                                        strokeWidth="2.4"
371
-                                        mask="url(#path-5-mask)"
372
-                                    />
373
-                                    <path
374
-                                        d="M129.529 167.6H104.329V105.2H197.329V400.2H129.529V167.6Z"
375
-                                        stroke="var(--stroke-color)"
376
-                                        strokeWidth="2.4"
377
-                                        mask="url(#path-5-mask)"
378
-                                    />
379
-                                </g>
380
-                            </svg>
381
-                            <div className="absolute inset-0 rounded-t-lg shadow-[inset_0px_0px_0px_1px_rgba(26,26,0,0.16)] lg:rounded-t-none lg:rounded-r-lg dark:shadow-[inset_0px_0px_0px_1px_#fffaed2d]"></div>
382
-                        </div>
383
-                    </main>
384
-                </div>
385
-                <div className="hidden h-14.5 lg:block"></div>
386
-            </div>
387
-        </>
388
-    );
389
-}

+ 2
- 1
routes/web.php Ver fichero

9
 use App\Http\Controllers\DiscountCodeController;
9
 use App\Http\Controllers\DiscountCodeController;
10
 use App\Http\Controllers\FeaturedProductController;
10
 use App\Http\Controllers\FeaturedProductController;
11
 use App\Http\Controllers\HeroImageController;
11
 use App\Http\Controllers\HeroImageController;
12
+use App\Http\Controllers\HomeController;
12
 use App\Http\Controllers\OrderController;
13
 use App\Http\Controllers\OrderController;
13
 use App\Http\Controllers\ProductController;
14
 use App\Http\Controllers\ProductController;
14
 use App\Http\Controllers\SectionLayoutController;
15
 use App\Http\Controllers\SectionLayoutController;
59
         Route::any('{any}', fn () => abort(404))->where('any', '.*')->name('missing');
60
         Route::any('{any}', fn () => abort(404))->where('any', '.*')->name('missing');
60
     });
61
     });
61
 
62
 
62
-Route::inertia('/', 'welcome')->name('home');
63
+Route::get('/', HomeController::class)->name('home');
63
 
64
 
64
 // Called by Stripe, not by a browser, so it has no login. Each message is checked with a signing secret.
65
 // Called by Stripe, not by a browser, so it has no login. Each message is checked with a signing secret.
65
 Route::post('stripe/webhook', StripeWebhookController::class)->name('stripe.webhook');
66
 Route::post('stripe/webhook', StripeWebhookController::class)->name('stripe.webhook');

+ 37
- 0
tests/Feature/HomePageTest.php Ver fichero

1
+<?php
2
+
3
+namespace Tests\Feature;
4
+
5
+use App\Models\User;
6
+use Illuminate\Foundation\Testing\RefreshDatabase;
7
+use Inertia\Testing\AssertableInertia as Assert;
8
+use Tests\TestCase;
9
+
10
+class HomePageTest extends TestCase
11
+{
12
+    use RefreshDatabase;
13
+
14
+    public function test_visitors_see_the_home_page_with_real_prices()
15
+    {
16
+        $this->get(route('home'))
17
+            ->assertOk()
18
+            ->assertInertia(fn (Assert $page) => $page
19
+                ->component('home')
20
+                ->where('trialDays', 14)
21
+                ->where('storeDomain', config('storefront.domain'))
22
+                ->where('plans.0.key', 'trial')
23
+                ->where('plans.0.price', 0)
24
+                ->where('plans.1.name', 'Starter')
25
+                ->where('plans.1.price', 39)
26
+                ->where('plans.2.stores', 3)
27
+                ->has('plans', 4));
28
+    }
29
+
30
+    public function test_signed_in_merchants_see_it_too()
31
+    {
32
+        $this->actingAs(User::factory()->create())
33
+            ->get(route('home'))
34
+            ->assertOk()
35
+            ->assertInertia(fn (Assert $page) => $page->component('home'));
36
+    }
37
+}

Loading…
Cancelar
Guardar