create-magic-storefront 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/template/.claude/skills/design-taste-frontend/LICENSE +21 -0
- package/template/.claude/skills/design-taste-frontend/SKILL.md +1206 -0
- package/template/.claude/skills/design-taste-frontend/SOURCE.md +9 -0
- package/template/.claude/skills/storefront-design/SKILL.md +170 -0
- package/template/.claude/skills/storefront-verify/SKILL.md +85 -0
- package/template/.claude/skills/vercel-react-best-practices/AGENTS.md +3810 -0
- package/template/.claude/skills/vercel-react-best-practices/README.md +123 -0
- package/template/.claude/skills/vercel-react-best-practices/SKILL.md +149 -0
- package/template/.claude/skills/vercel-react-best-practices/SOURCE.md +7 -0
- package/template/.claude/skills/vercel-react-best-practices/metadata.json +15 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/_sections.md +46 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/_template.md +28 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/advanced-effect-event-deps.md +56 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/advanced-event-handler-refs.md +55 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/advanced-init-once.md +42 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/advanced-use-latest.md +39 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/async-api-routes.md +38 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/async-cheap-condition-before-await.md +37 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/async-defer-await.md +82 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/async-dependencies.md +51 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/async-parallel.md +28 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/async-suspense-boundaries.md +99 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/bundle-analyzable-paths.md +63 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/bundle-barrel-imports.md +60 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/bundle-conditional.md +31 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/bundle-defer-third-party.md +49 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/bundle-dynamic-imports.md +35 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/bundle-preload.md +50 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/client-event-listeners.md +74 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/client-localstorage-schema.md +71 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/client-passive-event-listeners.md +48 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/client-swr-dedup.md +56 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/js-batch-dom-css.md +107 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/js-cache-function-results.md +80 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/js-cache-property-access.md +28 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/js-cache-storage.md +70 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/js-combine-iterations.md +32 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/js-early-exit.md +50 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/js-flatmap-filter.md +60 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/js-hoist-regexp.md +45 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/js-index-maps.md +37 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/js-length-check-first.md +49 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/js-min-max-loop.md +82 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/js-request-idle-callback.md +105 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/js-set-map-lookups.md +24 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/js-tosorted-immutable.md +57 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/rendering-activity.md +26 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/rendering-animate-svg-wrapper.md +47 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/rendering-conditional-render.md +40 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/rendering-content-visibility.md +38 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/rendering-hoist-jsx.md +46 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/rendering-hydration-no-flicker.md +82 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/rendering-hydration-suppress-warning.md +30 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/rendering-resource-hints.md +85 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/rendering-script-defer-async.md +68 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/rendering-svg-precision.md +28 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/rendering-usetransition-loading.md +75 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/rerender-defer-reads.md +39 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/rerender-dependencies.md +45 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/rerender-derived-state-no-effect.md +40 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/rerender-derived-state.md +29 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/rerender-functional-setstate.md +74 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/rerender-lazy-state-init.md +58 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/rerender-memo-with-default-value.md +38 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/rerender-memo.md +44 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/rerender-move-effect-to-event.md +45 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/rerender-no-inline-components.md +82 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/rerender-simple-expression-in-memo.md +35 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/rerender-split-combined-hooks.md +64 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/rerender-transitions.md +40 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/rerender-use-deferred-value.md +59 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/rerender-use-ref-transient-values.md +73 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/server-after-nonblocking.md +73 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/server-auth-actions.md +96 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/server-cache-lru.md +41 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/server-cache-react.md +76 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/server-dedup-props.md +65 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/server-hoist-static-io.md +149 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/server-no-shared-module-state.md +50 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/server-parallel-fetching.md +83 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/server-parallel-nested-fetching.md +34 -0
- package/template/.claude/skills/vercel-react-best-practices/rules/server-serialization.md +38 -0
- package/template/.claude/skills/web-interface-guidelines/LICENSE +21 -0
- package/template/.claude/skills/web-interface-guidelines/SKILL.md +40 -0
- package/template/.claude/skills/web-interface-guidelines/SOURCE.md +9 -0
- package/template/.claude/skills/web-interface-guidelines/guidelines.md +155 -0
- package/template/AGENTS.md +16 -0
- package/template/PAGES.md +11 -3
- package/template/_gitignore +1 -0
- package/template/app/account/page.tsx +31 -11
- package/template/app/cart/page.tsx +50 -54
- package/template/app/checkout/page.tsx +86 -38
- package/template/app/collections/[handle]/page.tsx +3 -2
- package/template/app/error.tsx +6 -4
- package/template/app/globals.css +46 -4
- package/template/app/layout.tsx +14 -4
- package/template/app/not-found.tsx +5 -2
- package/template/app/pages/[handle]/page.tsx +3 -2
- package/template/app/search/page.tsx +11 -6
- package/template/components/buy-box.tsx +7 -4
- package/template/components/cart-link.tsx +8 -2
- package/template/components/pager.tsx +3 -1
- package/template/components/product-grid.tsx +30 -2
- package/template/components/sections/banner.tsx +7 -1
- package/template/components/sections/deal-of-day.tsx +16 -5
- package/template/components/sections/product-shelves.tsx +8 -7
- package/template/components/sections/store-reviews.tsx +7 -5
- package/template/lib/brand.ts +60 -0
- package/template/lib/errors.ts +1 -4
- package/template/lib/i18n.ts +315 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Source
|
|
2
|
+
|
|
3
|
+
Vendored unchanged from [Leonxlnx/taste-skill](https://github.com/Leonxlnx/taste-skill),
|
|
4
|
+
`skills/taste-skill/SKILL.md` at commit `ce26fc25c0e5e8cab638f883de62d9a86ee5e45b` (MIT, see
|
|
5
|
+
`LICENSE`).
|
|
6
|
+
|
|
7
|
+
Do not edit `SKILL.md` here: storefront-specific rules and overrides live in
|
|
8
|
+
`../storefront-design/SKILL.md`. To update, copy the upstream file over this one and record the
|
|
9
|
+
new commit above.
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: storefront-design
|
|
3
|
+
description: >-
|
|
4
|
+
Visual design for this MagicStore storefront: brand tokens from the shop's branding, a design
|
|
5
|
+
direction per merchant, commerce page patterns (product card, collection, product page, cart,
|
|
6
|
+
checkout, account), and a pre-flight check. Load it before any work that changes how the
|
|
7
|
+
storefront looks: a new design, a redesign, restyling a page or a home section, a new component.
|
|
8
|
+
It drives the `design-taste-frontend` skill and overrides it wherever the two disagree.
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Storefront design
|
|
12
|
+
|
|
13
|
+
The storefront renders one merchant's shop from the MagicStore API. Its design must look like that
|
|
14
|
+
merchant's own store, not like a template and not like an AI landing page. The data is real and the
|
|
15
|
+
server owns it: prices, stock, discounts, images, reviews. Design never invents or recomputes any of
|
|
16
|
+
it.
|
|
17
|
+
|
|
18
|
+
The design skills work together (all in `.claude/skills/`):
|
|
19
|
+
|
|
20
|
+
- **This skill** decides what a store needs and what is off limits.
|
|
21
|
+
- **`design-taste-frontend`** supplies taste: the design read, the three dials, the anti-slop
|
|
22
|
+
rules (its Sections 0, 1, 4, 9). Load it too.
|
|
23
|
+
- **`web-interface-guidelines`**: keyboard, focus, forms, touch targets. Apply it to every
|
|
24
|
+
interactive part (options, cart, checkout, account).
|
|
25
|
+
- **`vercel-react-best-practices`**: keep the design fast; server components stay server
|
|
26
|
+
components, no client JS for what CSS can do.
|
|
27
|
+
- **`storefront-verify`**: run last. Screenshots of every page type at 390 and 1280px, checked
|
|
28
|
+
against the pre-flight below.
|
|
29
|
+
|
|
30
|
+
When they disagree, **this skill wins**. The overrides are listed in [Overrides](#overrides).
|
|
31
|
+
|
|
32
|
+
## 1. Read the shop before designing
|
|
33
|
+
|
|
34
|
+
Design from the merchant's data, not from a guess. Read, through `lib/api.ts`:
|
|
35
|
+
|
|
36
|
+
| What | Why |
|
|
37
|
+
| ------------------------------------------------- | ----------------------------------------------------------------- |
|
|
38
|
+
| `api.shop()`: `name`, `description`, `branding` | Identity: logo, favicon, colors, theme |
|
|
39
|
+
| `api.home()`: the sections in the merchant's order | What the home page must hold; a design never drops or reorders them |
|
|
40
|
+
| `api.collectionsIndex()`, a few `api.productsIndex()` | Category, price range, how many products, how good the photos are |
|
|
41
|
+
|
|
42
|
+
`shop.branding`:
|
|
43
|
+
|
|
44
|
+
- `logo`, `favicon`: `Image | null`. With a logo, the header shows it (via `<Image>`), not the
|
|
45
|
+
shop name in bold text. Without one, set the name as a wordmark in the display face.
|
|
46
|
+
- `colors.main`, `navbarBackground`, `navbarText`, `buttonText`, `labelBackground`, `labelText`:
|
|
47
|
+
each a CSS color **or `null`**. `main` is the accent.
|
|
48
|
+
- `theme`: a free-form name from the merchant's admin. Treat it as a hint, not an enum.
|
|
49
|
+
|
|
50
|
+
Then write the design read from `design-taste-frontend` Section 0.B, in store terms:
|
|
51
|
+
|
|
52
|
+
> Reading this as: a _category_ store for _audience_, with a _vibe_ language, accent from
|
|
53
|
+
> `branding.colors.main`, leaning toward _type pairing + density_.
|
|
54
|
+
|
|
55
|
+
Category and audience come from the catalog (products, collections, price range), not from the
|
|
56
|
+
shop name. A kids' store, a hardware store and a jewellery store must not come out looking alike.
|
|
57
|
+
|
|
58
|
+
## 2. Brand tokens: from the API, at runtime
|
|
59
|
+
|
|
60
|
+
The merchant changes colors in the admin, and `SHOP_UPDATED` revalidates the shop. So:
|
|
61
|
+
|
|
62
|
+
- **Never hard-code the merchant's colors** into CSS. The starter does this already:
|
|
63
|
+
`app/layout.tsx` puts `brandStyle(shop.branding)` (`lib/brand.ts`) on `<html style>`, and
|
|
64
|
+
`app/globals.css` declares every token with the design's own fallback, used when a color is `null`.
|
|
65
|
+
Keep that wiring; restyle through the tokens.
|
|
66
|
+
- Tokens: `--accent` / `--on-accent` (`colors.main` / `buttonText`), `--nav-bg` / `--nav-fg`
|
|
67
|
+
(header), `--label-bg` / `--label-fg` (badges: "New", "Sale", "Pre-order").
|
|
68
|
+
- One accent, used the same way on every page (the taste skill's Color Consistency Lock).
|
|
69
|
+
- A text color the merchant didn't set is picked by contrast (`readableTextOn`), never assumed
|
|
70
|
+
white. Only hex colors are accepted: anything else is dropped, never written into the style.
|
|
71
|
+
- A pair the merchant did set is theirs, even when its contrast is low; point it out to the owner
|
|
72
|
+
rather than overriding it.
|
|
73
|
+
- Merchant colors are unknown at design time, so check contrast with a light, a dark and a
|
|
74
|
+
saturated accent, not only the one shop you are looking at.
|
|
75
|
+
- Everything else (neutrals, radius, spacing, type scale, shadows) belongs to the design and lives
|
|
76
|
+
in `globals.css` as tokens.
|
|
77
|
+
|
|
78
|
+
## 3. Page patterns
|
|
79
|
+
|
|
80
|
+
Every page handles its empty, error and not-found states (see `PAGES.md`). The patterns below are
|
|
81
|
+
about how pages look.
|
|
82
|
+
|
|
83
|
+
**Header.** Logo or wordmark, top collections, search, account, cart with a live count. One line at
|
|
84
|
+
desktop. On mobile: logo, search, cart visible; the rest in a menu. Sticky is fine; the header stays
|
|
85
|
+
at most 64px high on mobile.
|
|
86
|
+
|
|
87
|
+
**Product card** (`components/product-grid.tsx`). Image with a fixed aspect ratio (no layout
|
|
88
|
+
shift), title (at most 2 lines), price via `<Money>`, `compareAtPrice` struck through when present.
|
|
89
|
+
Badges come only from data: `isNew`, a `compareAtPrice` above `price`, `preOrder`,
|
|
90
|
+
`availableForSale: false`. At most two badges. `rating` only when present, with its real value.
|
|
91
|
+
The whole card is one link; a quick-add button, if any, is a separate control.
|
|
92
|
+
|
|
93
|
+
**Collection.** Title, product count, then the grid straight away: no hero blocks pushing products
|
|
94
|
+
below the fold. Grid: 2 columns on mobile, 3 to 5 on desktop depending on density. Sorting and
|
|
95
|
+
filters sit above the grid; pagination via `<Pagination>`.
|
|
96
|
+
|
|
97
|
+
**Product page** (`app/products/[handle]`, `components/buy-box.tsx`). Gallery left, buy box right
|
|
98
|
+
on desktop; on mobile gallery, then title, price, options, add to cart. Price and add to cart are
|
|
99
|
+
visible without scrolling on a 390×844 screen. Options: sold-out values stay visible but disabled
|
|
100
|
+
(`isOptionValueAvailable`), never hidden. Stock text comes from `quantityAvailable`; do not add
|
|
101
|
+
urgency the API didn't send. Attributes (SKU, weight, vendor, option values) are allowed and
|
|
102
|
+
wanted: set them as a clean definition list.
|
|
103
|
+
|
|
104
|
+
**Cart.** Lines with a thumbnail (`<Image width={64} height={64}>`), quantity stepper, remove, line
|
|
105
|
+
total from the cart. Subtotal and checkout button visible without scrolling. The empty cart links
|
|
106
|
+
back to the catalog.
|
|
107
|
+
|
|
108
|
+
**Checkout.** Conventional and calm: one column, clear labels above the fields, visible
|
|
109
|
+
errors next to the field (`error.detail`), a summary of lines and totals from the checkout. No
|
|
110
|
+
animation, no decorative imagery, no experimental layout. Trust beats taste here.
|
|
111
|
+
|
|
112
|
+
**Account, search, content pages.** Same tokens, quiet layout. Search results reuse the product
|
|
113
|
+
card.
|
|
114
|
+
|
|
115
|
+
**Home** (`app/page.tsx`, `components/sections/`). The one place for a strong visual idea. Each
|
|
116
|
+
section type keeps its renderer; restyle it, do not replace the data it renders. The merchant's
|
|
117
|
+
banners and stories are the hero imagery.
|
|
118
|
+
|
|
119
|
+
## 4. Telegram Mini App
|
|
120
|
+
|
|
121
|
+
The same app runs inside Telegram's in-app browser. Design mobile-first for a 360–430px viewport:
|
|
122
|
+
tap targets at least 44px, no hover-only controls, no information that only appears on hover,
|
|
123
|
+
`env(safe-area-inset-*)` padding on fixed bars. `min-height: 100dvh`, never `100vh`.
|
|
124
|
+
|
|
125
|
+
## 5. Stack
|
|
126
|
+
|
|
127
|
+
Keep the starter's approach: plain CSS with custom properties in `app/globals.css`, no UI
|
|
128
|
+
framework. Add Tailwind v4 or Motion only when the owner of this storefront asks for it. If you add
|
|
129
|
+
Motion, use it only in `'use client'` leaf components on the home page and content pages. Fonts via
|
|
130
|
+
`next/font`. Before importing any package, check `package.json` (taste skill Section 3.F).
|
|
131
|
+
|
|
132
|
+
## Overrides
|
|
133
|
+
|
|
134
|
+
Where `design-taste-frontend` says otherwise, this is what applies here:
|
|
135
|
+
|
|
136
|
+
| Taste skill | In this storefront |
|
|
137
|
+
| ----------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
138
|
+
| 4.8: generate images, use Picsum, stock photos | **Never** for products, collections, banners or stories: those images come from the API only. A missing image renders `<Image fallback>`. Generated imagery only for decoration the merchant has no data for, and only when asked. |
|
|
139
|
+
| 4.8 / 9.F: logo walls, "Trusted by", testimonials | Only real data: `api.reviewsSite()` / the store-reviews section, the shop's own logo. No invented brands, customers, ratings or review counts. |
|
|
140
|
+
| 9.D: invent realistic content | Never. Real product titles, prices and copy only. Placeholder copy in a shipped page is a bug. |
|
|
141
|
+
| 4.6 / 13: forms and multi-step flows out of scope | Cart, checkout and account follow Section 3 here: conventional, accessible, no creative layout. |
|
|
142
|
+
| 4.9 / 9.F: spec sheets banned | Product attributes are allowed, as a definition list without a border on every row. |
|
|
143
|
+
| 5: sticky-stack, horizontal pan, GSAP | Home and content pages only. Never on collection, product, cart or checkout pages. |
|
|
144
|
+
| 6.C / 8: dark mode mandatory | One theme per store, chosen from `branding` (Theme Lock still holds). Add a dark variant only if the brand colors pass contrast in it. |
|
|
145
|
+
| 3.A: Tailwind v4 + Motion by default | Section 5 here. |
|
|
146
|
+
| 12: block library files | Ignore: blocks are not shipped with this storefront. |
|
|
147
|
+
| Urgency: countdowns, "only N left", "X people viewing" | Only from data: the deal-of-day and flash-sale sections' end dates, `quantityAvailable`. Never invented. |
|
|
148
|
+
|
|
149
|
+
## Pre-flight
|
|
150
|
+
|
|
151
|
+
Before calling a design done, tick every box:
|
|
152
|
+
|
|
153
|
+
- [ ] Design read written; category and audience taken from the catalog.
|
|
154
|
+
- [ ] Brand colors read from `shop.branding` at runtime; every token has a fallback for `null`.
|
|
155
|
+
- [ ] Contrast AA for text on accent, on the header and on badges, checked with light, dark and
|
|
156
|
+
saturated accents.
|
|
157
|
+
- [ ] All images from the API via `<Image>`, fixed aspect ratios, no layout shift; the LCP image
|
|
158
|
+
(hero banner or first product image) is not lazy-loaded.
|
|
159
|
+
- [ ] No invented data: prices, badges, ratings, reviews, stock, urgency, customer logos.
|
|
160
|
+
- [ ] Money only through `<Money>` / `formatMoney`.
|
|
161
|
+
- [ ] Every home section type from `api.home()` still renders, in the merchant's order.
|
|
162
|
+
- [ ] Product page: price and add to cart visible without scrolling at 390×844.
|
|
163
|
+
- [ ] Cart and checkout: one column on mobile, labelled fields, errors next to fields, no motion.
|
|
164
|
+
- [ ] Mobile 360px: no horizontal scroll, tap targets ≥ 44px, nothing hover-only.
|
|
165
|
+
- [ ] Keyboard: visible focus ring on every control, logical tab order; `prefers-reduced-motion`
|
|
166
|
+
respected.
|
|
167
|
+
- [ ] Empty, error and not-found states styled, not bare text.
|
|
168
|
+
- [ ] Taste skill Section 14 run for the home page and content pages.
|
|
169
|
+
- [ ] `npm run typecheck`, `npm run build` and `npx create-magic-storefront check` pass.
|
|
170
|
+
- [ ] `storefront-verify` done: every page type looked at, at 390 and 1280px.
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: storefront-verify
|
|
3
|
+
description: >-
|
|
4
|
+
Look at the storefront before calling visual work done: build it, run it against the real shop,
|
|
5
|
+
screenshot every page type at phone and desktop width, check the screenshots against the
|
|
6
|
+
`storefront-design` pre-flight and the Web Interface Guidelines, fix, repeat. Use after any change
|
|
7
|
+
to how the storefront looks or behaves (a design, a restyle, a new section or component), and
|
|
8
|
+
whenever asked to "check", "verify", "screenshot" or "show" the storefront.
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Verify the storefront
|
|
12
|
+
|
|
13
|
+
Code that type-checks can still look broken. After visual work, **look at the result** before
|
|
14
|
+
saying it is done. Never describe a page you have not looked at.
|
|
15
|
+
|
|
16
|
+
## 1. Build and run
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm run typecheck
|
|
20
|
+
npm run build
|
|
21
|
+
npx create-magic-storefront check
|
|
22
|
+
npm start -- -p 3100 # in the background; needs .env.local (MAGICSTORE_SHOP_DOMAIN)
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
A build or `check` failure is fixed first; screenshots of a broken build prove nothing. Stop the
|
|
26
|
+
server when you are done.
|
|
27
|
+
|
|
28
|
+
## 2. Pick the pages
|
|
29
|
+
|
|
30
|
+
Real data only, from the running shop:
|
|
31
|
+
|
|
32
|
+
| Page | URL |
|
|
33
|
+
| ---------- | ----------------------------------------------------------------- |
|
|
34
|
+
| Home | `/` |
|
|
35
|
+
| Collection | the first `/collections/…` link in the home page's HTML |
|
|
36
|
+
| Product | the first `/products/…` link, plus one sold out or with options if the shop has one |
|
|
37
|
+
| Search | `/search?q=<a word from a product title>` and one with no results |
|
|
38
|
+
| Cart | `/cart` (empty), then again after adding a product |
|
|
39
|
+
| Checkout | `/checkout` with that cart |
|
|
40
|
+
| Not found | `/products/this-does-not-exist` |
|
|
41
|
+
|
|
42
|
+
Never place an order while verifying: stop at the checkout form.
|
|
43
|
+
|
|
44
|
+
## 3. Screenshot at two widths
|
|
45
|
+
|
|
46
|
+
Phone **390×844** (also the Telegram Mini App) and desktop **1280×800**, full page.
|
|
47
|
+
|
|
48
|
+
- With a browser tool in your environment (Playwright MCP, Chrome DevTools, Claude in Chrome), use
|
|
49
|
+
it: resize, navigate, screenshot. It can also click through the cart and read the console.
|
|
50
|
+
- Otherwise, with the Playwright CLI (the first run downloads Chromium,
|
|
51
|
+
`npx -y playwright install chromium`):
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
mkdir -p .screenshots
|
|
55
|
+
npx -y playwright screenshot --viewport-size "390,844" --full-page \
|
|
56
|
+
http://localhost:3100/ .screenshots/home-390.png
|
|
57
|
+
npx -y playwright screenshot --viewport-size "1280,800" --full-page \
|
|
58
|
+
http://localhost:3100/ .screenshots/home-1280.png
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Then open each image and look at it. `.screenshots/` is ignored by git.
|
|
62
|
+
|
|
63
|
+
In a browser tool, also check each phone-width page for horizontal scroll:
|
|
64
|
+
`document.documentElement.scrollWidth > window.innerWidth` must be `false`. And read the console:
|
|
65
|
+
no errors, no hydration warnings.
|
|
66
|
+
|
|
67
|
+
## 4. Check what you see
|
|
68
|
+
|
|
69
|
+
For every screenshot, against `storefront-design`'s pre-flight:
|
|
70
|
+
|
|
71
|
+
- Nothing overflows, overlaps or is cut off; no horizontal scroll at 390px.
|
|
72
|
+
- Product page at 390×844: price and add to cart visible in the first screen.
|
|
73
|
+
- Header readable on the merchant's colors; logo not stretched; badges readable.
|
|
74
|
+
- Images keep their aspect ratio; a missing image shows the fallback, not a broken icon.
|
|
75
|
+
- Empty cart, no search results and not found look designed, not like bare text.
|
|
76
|
+
- Text is in the storefront's language, with no placeholder or invented copy.
|
|
77
|
+
|
|
78
|
+
Then run a `web-interface-guidelines` review of the files you changed.
|
|
79
|
+
|
|
80
|
+
## 5. Fix and repeat
|
|
81
|
+
|
|
82
|
+
Fix what you found, rebuild, re-shoot only the affected pages. At most three rounds; if something
|
|
83
|
+
still fails after that, report it with the screenshot's path instead of looping.
|
|
84
|
+
|
|
85
|
+
Finish with a short report: pages checked, at which widths, what was fixed, what is left.
|