@tanstack/create 0.65.0 → 0.67.0
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/CHANGELOG.md +72 -0
- package/dist/frameworks/react/add-ons/powersync/README.md.ejs +26 -0
- package/dist/frameworks/react/add-ons/powersync/assets/_dot_env.local.append +3 -0
- package/dist/frameworks/react/add-ons/powersync/assets/powersync-vite-plugin.ts +17 -0
- package/dist/frameworks/react/add-ons/powersync/assets/src/integrations/powersync/provider.tsx +26 -0
- package/dist/frameworks/react/add-ons/powersync/assets/src/lib/powersync/AppSchema.ts +17 -0
- package/dist/frameworks/react/add-ons/powersync/assets/src/lib/powersync/BackendConnector.ts +52 -0
- package/dist/frameworks/react/add-ons/powersync/assets/src/routes/demo/powersync.tsx +129 -0
- package/dist/frameworks/react/add-ons/powersync/info.json +46 -0
- package/dist/frameworks/react/add-ons/powersync/package.json.ejs +7 -0
- package/dist/frameworks/react/add-ons/powersync/small-logo.svg +6 -0
- package/dist/frameworks/react/add-ons/shopify/README.md +86 -0
- package/dist/frameworks/react/add-ons/shopify/assets/_dot_env.local.append +19 -0
- package/dist/frameworks/react/add-ons/shopify/assets/src/components/shop/account-nav.tsx.ejs +41 -0
- package/dist/frameworks/react/add-ons/shopify/assets/src/components/shop/add-to-cart-button.tsx +48 -0
- package/dist/frameworks/react/add-ons/shopify/assets/src/components/shop/cart-line-item.tsx +94 -0
- package/dist/frameworks/react/add-ons/shopify/assets/src/components/shop/cart-summary.tsx +111 -0
- package/dist/frameworks/react/add-ons/shopify/assets/src/components/shop/empty-state.tsx +29 -0
- package/dist/frameworks/react/add-ons/shopify/assets/src/components/shop/money.tsx +11 -0
- package/dist/frameworks/react/add-ons/shopify/assets/src/components/shop/product-card.tsx +74 -0
- package/dist/frameworks/react/add-ons/shopify/assets/src/components/shop/product-grid.tsx +24 -0
- package/dist/frameworks/react/add-ons/shopify/assets/src/components/shop/shop-image.tsx +57 -0
- package/dist/frameworks/react/add-ons/shopify/assets/src/components/shop/shop.css +58 -0
- package/dist/frameworks/react/add-ons/shopify/assets/src/components/shop/variant-selector.tsx +79 -0
- package/dist/frameworks/react/add-ons/shopify/assets/src/hooks/use-cart.ts +276 -0
- package/dist/frameworks/react/add-ons/shopify/assets/src/hooks/use-customer.ts.ejs +22 -0
- package/dist/frameworks/react/add-ons/shopify/assets/src/integrations/shopify/header-cart.tsx +37 -0
- package/dist/frameworks/react/add-ons/shopify/assets/src/lib/shopify/customer-queries.ts.ejs +228 -0
- package/dist/frameworks/react/add-ons/shopify/assets/src/lib/shopify/format.ts +33 -0
- package/dist/frameworks/react/add-ons/shopify/assets/src/lib/shopify/queries.ts +684 -0
- package/dist/frameworks/react/add-ons/shopify/assets/src/routes/shop.account.addresses.tsx.ejs +67 -0
- package/dist/frameworks/react/add-ons/shopify/assets/src/routes/shop.account.callback.tsx.ejs +45 -0
- package/dist/frameworks/react/add-ons/shopify/assets/src/routes/shop.account.index.tsx.ejs +70 -0
- package/dist/frameworks/react/add-ons/shopify/assets/src/routes/shop.account.login.tsx.ejs +59 -0
- package/dist/frameworks/react/add-ons/shopify/assets/src/routes/shop.account.logout.tsx.ejs +16 -0
- package/dist/frameworks/react/add-ons/shopify/assets/src/routes/shop.account.orders.$id.tsx.ejs +126 -0
- package/dist/frameworks/react/add-ons/shopify/assets/src/routes/shop.account.orders.tsx.ejs +50 -0
- package/dist/frameworks/react/add-ons/shopify/assets/src/routes/shop.account.tsx.ejs +34 -0
- package/dist/frameworks/react/add-ons/shopify/assets/src/routes/shop.cart.tsx +45 -0
- package/dist/frameworks/react/add-ons/shopify/assets/src/routes/shop.collections.$handle.tsx +66 -0
- package/dist/frameworks/react/add-ons/shopify/assets/src/routes/shop.index.tsx +36 -0
- package/dist/frameworks/react/add-ons/shopify/assets/src/routes/shop.pages.$handle.tsx +39 -0
- package/dist/frameworks/react/add-ons/shopify/assets/src/routes/shop.policies.$handle.tsx +30 -0
- package/dist/frameworks/react/add-ons/shopify/assets/src/routes/shop.products.$handle.tsx +106 -0
- package/dist/frameworks/react/add-ons/shopify/assets/src/routes/shop.search.tsx +75 -0
- package/dist/frameworks/react/add-ons/shopify/assets/src/routes/shop.tsx +78 -0
- package/dist/frameworks/react/add-ons/shopify/assets/src/server/shopify/cart.functions.ts +207 -0
- package/dist/frameworks/react/add-ons/shopify/assets/src/server/shopify/catalog.functions.ts +244 -0
- package/dist/frameworks/react/add-ons/shopify/assets/src/server/shopify/cookies.ts +29 -0
- package/dist/frameworks/react/add-ons/shopify/assets/src/server/shopify/customer-client.ts.ejs +99 -0
- package/dist/frameworks/react/add-ons/shopify/assets/src/server/shopify/customer-cookies.ts.ejs +49 -0
- package/dist/frameworks/react/add-ons/shopify/assets/src/server/shopify/customer.functions.ts.ejs +168 -0
- package/dist/frameworks/react/add-ons/shopify/assets/src/server/shopify/env.ts +89 -0
- package/dist/frameworks/react/add-ons/shopify/assets/src/server/shopify/oauth.ts.ejs +301 -0
- package/dist/frameworks/react/add-ons/shopify/assets/src/server/shopify/storefront-client.ts +101 -0
- package/dist/frameworks/react/add-ons/shopify/info.json +104 -0
- package/dist/frameworks/react/add-ons/shopify/package.json +6 -0
- package/dist/frameworks/react/add-ons/shopify/small-logo.svg +1 -0
- package/dist/frameworks/react/examples/shopify-storefront/README.md +39 -0
- package/dist/frameworks/react/examples/shopify-storefront/assets/src/components/FeaturedCollections.tsx +43 -0
- package/dist/frameworks/react/examples/shopify-storefront/assets/src/components/ShopHero.tsx +39 -0
- package/dist/frameworks/react/examples/shopify-storefront/assets/src/routes/index.tsx +65 -0
- package/dist/frameworks/react/examples/shopify-storefront/info.json +18 -0
- package/dist/frameworks/react/examples/shopify-storefront/package.json +3 -0
- package/dist/frameworks/react/project/base/src/components/Header.tsx.ejs +34 -34
- package/package.json +1 -1
- package/src/frameworks/react/add-ons/powersync/README.md.ejs +26 -0
- package/src/frameworks/react/add-ons/powersync/assets/_dot_env.local.append +3 -0
- package/src/frameworks/react/add-ons/powersync/assets/powersync-vite-plugin.ts +17 -0
- package/src/frameworks/react/add-ons/powersync/assets/src/integrations/powersync/provider.tsx +26 -0
- package/src/frameworks/react/add-ons/powersync/assets/src/lib/powersync/AppSchema.ts +17 -0
- package/src/frameworks/react/add-ons/powersync/assets/src/lib/powersync/BackendConnector.ts +52 -0
- package/src/frameworks/react/add-ons/powersync/assets/src/routes/demo/powersync.tsx +129 -0
- package/src/frameworks/react/add-ons/powersync/info.json +46 -0
- package/src/frameworks/react/add-ons/powersync/package.json.ejs +7 -0
- package/src/frameworks/react/add-ons/powersync/small-logo.svg +6 -0
- package/src/frameworks/react/add-ons/shopify/README.md +86 -0
- package/src/frameworks/react/add-ons/shopify/assets/_dot_env.local.append +19 -0
- package/src/frameworks/react/add-ons/shopify/assets/src/components/shop/account-nav.tsx.ejs +41 -0
- package/src/frameworks/react/add-ons/shopify/assets/src/components/shop/add-to-cart-button.tsx +48 -0
- package/src/frameworks/react/add-ons/shopify/assets/src/components/shop/cart-line-item.tsx +94 -0
- package/src/frameworks/react/add-ons/shopify/assets/src/components/shop/cart-summary.tsx +111 -0
- package/src/frameworks/react/add-ons/shopify/assets/src/components/shop/empty-state.tsx +29 -0
- package/src/frameworks/react/add-ons/shopify/assets/src/components/shop/money.tsx +11 -0
- package/src/frameworks/react/add-ons/shopify/assets/src/components/shop/product-card.tsx +74 -0
- package/src/frameworks/react/add-ons/shopify/assets/src/components/shop/product-grid.tsx +24 -0
- package/src/frameworks/react/add-ons/shopify/assets/src/components/shop/shop-image.tsx +57 -0
- package/src/frameworks/react/add-ons/shopify/assets/src/components/shop/shop.css +58 -0
- package/src/frameworks/react/add-ons/shopify/assets/src/components/shop/variant-selector.tsx +79 -0
- package/src/frameworks/react/add-ons/shopify/assets/src/hooks/use-cart.ts +276 -0
- package/src/frameworks/react/add-ons/shopify/assets/src/hooks/use-customer.ts.ejs +22 -0
- package/src/frameworks/react/add-ons/shopify/assets/src/integrations/shopify/header-cart.tsx +37 -0
- package/src/frameworks/react/add-ons/shopify/assets/src/lib/shopify/customer-queries.ts.ejs +228 -0
- package/src/frameworks/react/add-ons/shopify/assets/src/lib/shopify/format.ts +33 -0
- package/src/frameworks/react/add-ons/shopify/assets/src/lib/shopify/queries.ts +684 -0
- package/src/frameworks/react/add-ons/shopify/assets/src/routes/shop.account.addresses.tsx.ejs +67 -0
- package/src/frameworks/react/add-ons/shopify/assets/src/routes/shop.account.callback.tsx.ejs +45 -0
- package/src/frameworks/react/add-ons/shopify/assets/src/routes/shop.account.index.tsx.ejs +70 -0
- package/src/frameworks/react/add-ons/shopify/assets/src/routes/shop.account.login.tsx.ejs +59 -0
- package/src/frameworks/react/add-ons/shopify/assets/src/routes/shop.account.logout.tsx.ejs +16 -0
- package/src/frameworks/react/add-ons/shopify/assets/src/routes/shop.account.orders.$id.tsx.ejs +126 -0
- package/src/frameworks/react/add-ons/shopify/assets/src/routes/shop.account.orders.tsx.ejs +50 -0
- package/src/frameworks/react/add-ons/shopify/assets/src/routes/shop.account.tsx.ejs +34 -0
- package/src/frameworks/react/add-ons/shopify/assets/src/routes/shop.cart.tsx +45 -0
- package/src/frameworks/react/add-ons/shopify/assets/src/routes/shop.collections.$handle.tsx +66 -0
- package/src/frameworks/react/add-ons/shopify/assets/src/routes/shop.index.tsx +36 -0
- package/src/frameworks/react/add-ons/shopify/assets/src/routes/shop.pages.$handle.tsx +39 -0
- package/src/frameworks/react/add-ons/shopify/assets/src/routes/shop.policies.$handle.tsx +30 -0
- package/src/frameworks/react/add-ons/shopify/assets/src/routes/shop.products.$handle.tsx +106 -0
- package/src/frameworks/react/add-ons/shopify/assets/src/routes/shop.search.tsx +75 -0
- package/src/frameworks/react/add-ons/shopify/assets/src/routes/shop.tsx +78 -0
- package/src/frameworks/react/add-ons/shopify/assets/src/server/shopify/cart.functions.ts +207 -0
- package/src/frameworks/react/add-ons/shopify/assets/src/server/shopify/catalog.functions.ts +244 -0
- package/src/frameworks/react/add-ons/shopify/assets/src/server/shopify/cookies.ts +29 -0
- package/src/frameworks/react/add-ons/shopify/assets/src/server/shopify/customer-client.ts.ejs +99 -0
- package/src/frameworks/react/add-ons/shopify/assets/src/server/shopify/customer-cookies.ts.ejs +49 -0
- package/src/frameworks/react/add-ons/shopify/assets/src/server/shopify/customer.functions.ts.ejs +168 -0
- package/src/frameworks/react/add-ons/shopify/assets/src/server/shopify/env.ts +89 -0
- package/src/frameworks/react/add-ons/shopify/assets/src/server/shopify/oauth.ts.ejs +301 -0
- package/src/frameworks/react/add-ons/shopify/assets/src/server/shopify/storefront-client.ts +101 -0
- package/src/frameworks/react/add-ons/shopify/info.json +104 -0
- package/src/frameworks/react/add-ons/shopify/package.json +6 -0
- package/src/frameworks/react/add-ons/shopify/small-logo.svg +1 -0
- package/src/frameworks/react/examples/shopify-storefront/README.md +39 -0
- package/src/frameworks/react/examples/shopify-storefront/assets/src/components/FeaturedCollections.tsx +43 -0
- package/src/frameworks/react/examples/shopify-storefront/assets/src/components/ShopHero.tsx +39 -0
- package/src/frameworks/react/examples/shopify-storefront/assets/src/routes/index.tsx +65 -0
- package/src/frameworks/react/examples/shopify-storefront/info.json +18 -0
- package/src/frameworks/react/examples/shopify-storefront/package.json +3 -0
- package/src/frameworks/react/project/base/src/components/Header.tsx.ejs +34 -34
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Link, createFileRoute } from '@tanstack/react-router'
|
|
2
|
+
|
|
3
|
+
import '#/components/shop/shop.css'
|
|
4
|
+
import { ProductGrid } from '#/components/shop/product-grid'
|
|
5
|
+
import { FeaturedCollections } from '#/components/FeaturedCollections'
|
|
6
|
+
import { ShopHero } from '#/components/ShopHero'
|
|
7
|
+
import {
|
|
8
|
+
getCollections,
|
|
9
|
+
getProducts,
|
|
10
|
+
getShop,
|
|
11
|
+
} from '#/server/shopify/catalog.functions'
|
|
12
|
+
|
|
13
|
+
export const Route = createFileRoute('/')({
|
|
14
|
+
loader: async () => {
|
|
15
|
+
const [shop, collections, products] = await Promise.all([
|
|
16
|
+
getShop(),
|
|
17
|
+
getCollections(),
|
|
18
|
+
getProducts({ data: { first: 8, sortKey: 'BEST_SELLING' } }),
|
|
19
|
+
])
|
|
20
|
+
return { shop, collections, featured: products.nodes }
|
|
21
|
+
},
|
|
22
|
+
head: ({ loaderData }) => ({
|
|
23
|
+
meta: loaderData
|
|
24
|
+
? [
|
|
25
|
+
{ title: loaderData.shop.name },
|
|
26
|
+
{ name: 'description', content: loaderData.shop.description ?? '' },
|
|
27
|
+
]
|
|
28
|
+
: [],
|
|
29
|
+
}),
|
|
30
|
+
component: HomePage,
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
function HomePage() {
|
|
34
|
+
const { shop, collections, featured } = Route.useLoaderData()
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<div className="shop-root min-h-screen">
|
|
38
|
+
<ShopHero
|
|
39
|
+
title={shop.name}
|
|
40
|
+
tagline={shop.description ?? 'A TanStack Start + Shopify storefront.'}
|
|
41
|
+
/>
|
|
42
|
+
|
|
43
|
+
{collections.length > 0 && (
|
|
44
|
+
<section className="mx-auto max-w-7xl px-4 pb-20 sm:px-6 lg:px-8">
|
|
45
|
+
<FeaturedCollections collections={collections.slice(0, 3)} />
|
|
46
|
+
</section>
|
|
47
|
+
)}
|
|
48
|
+
|
|
49
|
+
<section className="mx-auto max-w-7xl px-4 pb-24 sm:px-6 lg:px-8">
|
|
50
|
+
<div className="mb-8 flex items-baseline justify-between">
|
|
51
|
+
<h2 className="text-2xl font-medium tracking-tight sm:text-3xl">
|
|
52
|
+
Best sellers
|
|
53
|
+
</h2>
|
|
54
|
+
<Link
|
|
55
|
+
to="/shop"
|
|
56
|
+
className="text-sm underline underline-offset-4 hover:opacity-80"
|
|
57
|
+
>
|
|
58
|
+
Shop all →
|
|
59
|
+
</Link>
|
|
60
|
+
</div>
|
|
61
|
+
<ProductGrid products={featured} />
|
|
62
|
+
</section>
|
|
63
|
+
</div>
|
|
64
|
+
)
|
|
65
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Shopify Storefront",
|
|
3
|
+
"description": "A polished Shopify storefront starter — TanStack Start + Shopify Storefront API + optional customer accounts. Hosted checkout, deploy anywhere.",
|
|
4
|
+
"phase": "example",
|
|
5
|
+
"modes": ["file-router"],
|
|
6
|
+
"type": "example",
|
|
7
|
+
"category": "other",
|
|
8
|
+
"color": "#5A31F4",
|
|
9
|
+
"priority": 5,
|
|
10
|
+
"link": "https://shopify.dev/docs/storefronts/headless",
|
|
11
|
+
"dependsOn": ["shopify"],
|
|
12
|
+
"default": true,
|
|
13
|
+
"routes": [
|
|
14
|
+
{ "url": "/", "path": "src/routes/index.tsx", "jsName": "ShopHome" }
|
|
15
|
+
],
|
|
16
|
+
"integrations": [],
|
|
17
|
+
"variables": []
|
|
18
|
+
}
|
|
@@ -32,7 +32,40 @@ export default function Header() {
|
|
|
32
32
|
</Link>
|
|
33
33
|
</h2>
|
|
34
34
|
|
|
35
|
-
<div className="
|
|
35
|
+
<div className="order-3 flex w-full flex-wrap items-center gap-x-4 gap-y-1 pb-1 text-sm font-semibold sm:order-none sm:w-auto sm:flex-nowrap sm:pb-0">
|
|
36
|
+
<Link to="/" className="nav-link" activeProps={{ className: 'nav-link is-active' }}>
|
|
37
|
+
Home
|
|
38
|
+
</Link>
|
|
39
|
+
<Link
|
|
40
|
+
to="/about"
|
|
41
|
+
className="nav-link"
|
|
42
|
+
activeProps={{ className: 'nav-link is-active' }}
|
|
43
|
+
>
|
|
44
|
+
About
|
|
45
|
+
</Link>
|
|
46
|
+
<a
|
|
47
|
+
href="https://tanstack.com/start/latest/docs/framework/react/overview"
|
|
48
|
+
className="nav-link"
|
|
49
|
+
target="_blank"
|
|
50
|
+
rel="noreferrer"
|
|
51
|
+
>
|
|
52
|
+
Docs
|
|
53
|
+
</a>
|
|
54
|
+
<% if (demoRoutes.length > 0) { %><details className="relative w-full sm:w-auto">
|
|
55
|
+
<summary className="nav-link list-none cursor-pointer">Demos</summary>
|
|
56
|
+
<div className="mt-2 min-w-56 rounded-xl border border-[var(--line)] bg-[var(--header-bg)] p-2 shadow-lg sm:absolute sm:right-0">
|
|
57
|
+
<% for (const route of demoRoutes) { %><a
|
|
58
|
+
href="<%= route.url %>"
|
|
59
|
+
className="block rounded-lg px-3 py-2 text-sm text-[var(--sea-ink-soft)] no-underline transition hover:bg-[var(--link-bg-hover)] hover:text-[var(--sea-ink)]"
|
|
60
|
+
>
|
|
61
|
+
<%= route.name %>
|
|
62
|
+
</a>
|
|
63
|
+
<% } %>
|
|
64
|
+
</div>
|
|
65
|
+
</details><% } %>
|
|
66
|
+
</div>
|
|
67
|
+
|
|
68
|
+
<div className="ml-auto flex items-center gap-1.5 sm:gap-2">
|
|
36
69
|
<a
|
|
37
70
|
href="https://x.com/tan_stack"
|
|
38
71
|
target="_blank"
|
|
@@ -65,39 +98,6 @@ export default function Header() {
|
|
|
65
98
|
<% } %>
|
|
66
99
|
<ThemeToggle />
|
|
67
100
|
</div>
|
|
68
|
-
|
|
69
|
-
<div className="order-3 flex w-full flex-wrap items-center gap-x-4 gap-y-1 pb-1 text-sm font-semibold sm:order-2 sm:w-auto sm:flex-nowrap sm:pb-0">
|
|
70
|
-
<Link to="/" className="nav-link" activeProps={{ className: 'nav-link is-active' }}>
|
|
71
|
-
Home
|
|
72
|
-
</Link>
|
|
73
|
-
<Link
|
|
74
|
-
to="/about"
|
|
75
|
-
className="nav-link"
|
|
76
|
-
activeProps={{ className: 'nav-link is-active' }}
|
|
77
|
-
>
|
|
78
|
-
About
|
|
79
|
-
</Link>
|
|
80
|
-
<a
|
|
81
|
-
href="https://tanstack.com/start/latest/docs/framework/react/overview"
|
|
82
|
-
className="nav-link"
|
|
83
|
-
target="_blank"
|
|
84
|
-
rel="noreferrer"
|
|
85
|
-
>
|
|
86
|
-
Docs
|
|
87
|
-
</a>
|
|
88
|
-
<% if (demoRoutes.length > 0) { %><details className="relative w-full sm:w-auto">
|
|
89
|
-
<summary className="nav-link list-none cursor-pointer">Demos</summary>
|
|
90
|
-
<div className="mt-2 min-w-56 rounded-xl border border-[var(--line)] bg-[var(--header-bg)] p-2 shadow-lg sm:absolute sm:right-0">
|
|
91
|
-
<% for (const route of demoRoutes) { %><a
|
|
92
|
-
href="<%= route.url %>"
|
|
93
|
-
className="block rounded-lg px-3 py-2 text-sm text-[var(--sea-ink-soft)] no-underline transition hover:bg-[var(--link-bg-hover)] hover:text-[var(--sea-ink)]"
|
|
94
|
-
>
|
|
95
|
-
<%= route.name %>
|
|
96
|
-
</a>
|
|
97
|
-
<% } %>
|
|
98
|
-
</div>
|
|
99
|
-
</details><% } %>
|
|
100
|
-
</div>
|
|
101
101
|
</nav>
|
|
102
102
|
</header>
|
|
103
103
|
)
|
package/package.json
CHANGED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# PowerSync
|
|
2
|
+
|
|
3
|
+
This project includes the PowerSync Web SDK and React hooks.
|
|
4
|
+
|
|
5
|
+
## Environment
|
|
6
|
+
|
|
7
|
+
Set these variables in `.env.local`:
|
|
8
|
+
|
|
9
|
+
- `VITE_POWERSYNC_URL`
|
|
10
|
+
- `VITE_POWERSYNC_TOKEN` for local development only
|
|
11
|
+
|
|
12
|
+
## What The Add-on Includes
|
|
13
|
+
|
|
14
|
+
- `src/lib/powersync/AppSchema.ts`
|
|
15
|
+
- `src/lib/powersync/BackendConnector.ts`
|
|
16
|
+
- `src/integrations/powersync/provider.tsx`
|
|
17
|
+
- `src/routes/demo/powersync.tsx`
|
|
18
|
+
|
|
19
|
+
## Next Steps
|
|
20
|
+
|
|
21
|
+
1. Replace the development token flow in `src/lib/powersync/BackendConnector.ts` with your real auth flow.
|
|
22
|
+
2. Update the sample schema in `src/lib/powersync/AppSchema.ts` to match your synced tables.
|
|
23
|
+
3. Implement the upload logic in `uploadData()` so local mutations are written back to your backend.
|
|
24
|
+
|
|
25
|
+
PowerSync setup guidance:
|
|
26
|
+
https://docs.powersync.com/client-sdk-references/js-web
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Plugin } from 'vite'
|
|
2
|
+
|
|
3
|
+
export default function powersyncVite(): Plugin {
|
|
4
|
+
return {
|
|
5
|
+
name: 'powersync-vite',
|
|
6
|
+
config() {
|
|
7
|
+
return {
|
|
8
|
+
optimizeDeps: {
|
|
9
|
+
exclude: ['@powersync/web'],
|
|
10
|
+
},
|
|
11
|
+
worker: {
|
|
12
|
+
format: 'es',
|
|
13
|
+
},
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ReactNode } from 'react'
|
|
2
|
+
import { PowerSyncContext } from '@powersync/react'
|
|
3
|
+
import { PowerSyncDatabase, WASQLiteOpenFactory } from '@powersync/web'
|
|
4
|
+
|
|
5
|
+
import { AppSchema } from '#/lib/powersync/AppSchema'
|
|
6
|
+
import { BackendConnector } from '#/lib/powersync/BackendConnector'
|
|
7
|
+
|
|
8
|
+
const db = new PowerSyncDatabase({
|
|
9
|
+
database: new WASQLiteOpenFactory({
|
|
10
|
+
dbFilename: 'powersync.db',
|
|
11
|
+
}),
|
|
12
|
+
schema: AppSchema,
|
|
13
|
+
flags: {
|
|
14
|
+
disableSSRWarning: true,
|
|
15
|
+
},
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
void db.connect(new BackendConnector())
|
|
19
|
+
|
|
20
|
+
export default function PowerSyncProvider({
|
|
21
|
+
children,
|
|
22
|
+
}: {
|
|
23
|
+
children: ReactNode
|
|
24
|
+
}) {
|
|
25
|
+
return <PowerSyncContext.Provider value={db}>{children}</PowerSyncContext.Provider>
|
|
26
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Schema, Table, column } from '@powersync/web'
|
|
2
|
+
|
|
3
|
+
const todos = new Table(
|
|
4
|
+
{
|
|
5
|
+
created_at: column.text,
|
|
6
|
+
description: column.text,
|
|
7
|
+
completed: column.integer,
|
|
8
|
+
},
|
|
9
|
+
{ indexes: { created_at: ['created_at'] } },
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
export const AppSchema = new Schema({
|
|
13
|
+
todos,
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
export type Database = (typeof AppSchema)['types']
|
|
17
|
+
export type TodoRecord = Database['todos']
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type AbstractPowerSyncDatabase,
|
|
3
|
+
type PowerSyncBackendConnector,
|
|
4
|
+
UpdateType,
|
|
5
|
+
} from '@powersync/web'
|
|
6
|
+
|
|
7
|
+
export class BackendConnector implements PowerSyncBackendConnector {
|
|
8
|
+
private readonly powersyncUrl = import.meta.env.VITE_POWERSYNC_URL
|
|
9
|
+
private readonly powersyncToken = import.meta.env.VITE_POWERSYNC_TOKEN
|
|
10
|
+
|
|
11
|
+
async fetchCredentials() {
|
|
12
|
+
if (!this.powersyncUrl || !this.powersyncToken) {
|
|
13
|
+
return null
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return {
|
|
17
|
+
endpoint: this.powersyncUrl,
|
|
18
|
+
token: this.powersyncToken,
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async uploadData(database: AbstractPowerSyncDatabase): Promise<void> {
|
|
23
|
+
const transaction = await database.getNextCrudTransaction()
|
|
24
|
+
|
|
25
|
+
if (!transaction) {
|
|
26
|
+
return
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
try {
|
|
30
|
+
for (const op of transaction.crud) {
|
|
31
|
+
const record = { ...op.opData, id: op.id }
|
|
32
|
+
|
|
33
|
+
switch (op.op) {
|
|
34
|
+
case UpdateType.PUT:
|
|
35
|
+
console.info('TODO: create record remotely', record)
|
|
36
|
+
break
|
|
37
|
+
case UpdateType.PATCH:
|
|
38
|
+
console.info('TODO: patch record remotely', record)
|
|
39
|
+
break
|
|
40
|
+
case UpdateType.DELETE:
|
|
41
|
+
console.info('TODO: delete record remotely', record)
|
|
42
|
+
break
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
await transaction.complete()
|
|
47
|
+
} catch (error) {
|
|
48
|
+
console.error('PowerSync uploadData failed', error)
|
|
49
|
+
throw error
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import { createFileRoute } from '@tanstack/react-router'
|
|
3
|
+
import { usePowerSync, useQuery, useStatus } from '@powersync/react'
|
|
4
|
+
|
|
5
|
+
export const Route = createFileRoute('/demo/powersync')({
|
|
6
|
+
component: PowerSyncDemo,
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
type TodoRow = {
|
|
10
|
+
id: string
|
|
11
|
+
created_at: string
|
|
12
|
+
description: string
|
|
13
|
+
completed: number
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function PowerSyncDemo() {
|
|
17
|
+
const powerSync = usePowerSync()
|
|
18
|
+
const status = useStatus()
|
|
19
|
+
const { data } = useQuery(
|
|
20
|
+
'SELECT id, created_at, description, completed FROM todos ORDER BY created_at DESC',
|
|
21
|
+
)
|
|
22
|
+
const todos = (data ?? []) as Array<TodoRow>
|
|
23
|
+
const [description, setDescription] = useState('')
|
|
24
|
+
const [error, setError] = useState<string | null>(null)
|
|
25
|
+
|
|
26
|
+
async function addTodo(event: React.FormEvent<HTMLFormElement>) {
|
|
27
|
+
event.preventDefault()
|
|
28
|
+
|
|
29
|
+
const nextDescription = description.trim()
|
|
30
|
+
if (!nextDescription) {
|
|
31
|
+
return
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
try {
|
|
35
|
+
setError(null)
|
|
36
|
+
await powerSync.execute(
|
|
37
|
+
'INSERT INTO todos (id, created_at, description, completed) VALUES (?, ?, ?, ?)',
|
|
38
|
+
[crypto.randomUUID(), new Date().toISOString(), nextDescription, 0],
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
setDescription('')
|
|
42
|
+
} catch (error) {
|
|
43
|
+
console.error('Failed to insert PowerSync todo', error)
|
|
44
|
+
setError('Failed to insert row. Please try again.')
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<main className="page-wrap py-10">
|
|
50
|
+
<div className="max-w-3xl space-y-6">
|
|
51
|
+
<header className="space-y-2">
|
|
52
|
+
<p className="text-sm font-semibold uppercase tracking-[0.2em] text-[var(--sea-ink-soft)]">
|
|
53
|
+
Offline Sync
|
|
54
|
+
</p>
|
|
55
|
+
<h1 className="text-3xl font-semibold tracking-tight">PowerSync</h1>
|
|
56
|
+
<p className="text-sm text-[var(--sea-ink-soft)]">
|
|
57
|
+
This demo writes to the local SQLite database immediately. Replace the sample
|
|
58
|
+
schema and backend connector with your real PowerSync configuration.
|
|
59
|
+
</p>
|
|
60
|
+
</header>
|
|
61
|
+
|
|
62
|
+
<section className="rounded-3xl border border-[var(--line)] bg-white/70 p-5 shadow-sm">
|
|
63
|
+
<h2 className="text-sm font-semibold uppercase tracking-[0.16em] text-[var(--sea-ink-soft)]">
|
|
64
|
+
Connection State
|
|
65
|
+
</h2>
|
|
66
|
+
<pre className="mt-3 overflow-auto rounded-2xl bg-[var(--chip-bg)] p-4 text-xs leading-6 text-[var(--sea-ink)]">
|
|
67
|
+
{JSON.stringify(status, null, 2)}
|
|
68
|
+
</pre>
|
|
69
|
+
</section>
|
|
70
|
+
|
|
71
|
+
<section className="rounded-3xl border border-[var(--line)] bg-white/70 p-5 shadow-sm">
|
|
72
|
+
<h2 className="text-sm font-semibold uppercase tracking-[0.16em] text-[var(--sea-ink-soft)]">
|
|
73
|
+
Local Todos
|
|
74
|
+
</h2>
|
|
75
|
+
{error ? (
|
|
76
|
+
<p className="mt-3 rounded-2xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700">
|
|
77
|
+
{error}
|
|
78
|
+
</p>
|
|
79
|
+
) : null}
|
|
80
|
+
<form className="mt-4 flex flex-col gap-3 sm:flex-row" onSubmit={addTodo}>
|
|
81
|
+
<label className="sr-only" htmlFor="powersync-todo-description">
|
|
82
|
+
Todo description
|
|
83
|
+
</label>
|
|
84
|
+
<input
|
|
85
|
+
id="powersync-todo-description"
|
|
86
|
+
className="min-w-0 flex-1 rounded-2xl border border-[var(--line)] bg-white px-4 py-3 text-sm text-[var(--sea-ink)] outline-none"
|
|
87
|
+
onChange={(event) => setDescription(event.target.value)}
|
|
88
|
+
placeholder="Write to the local PowerSync database"
|
|
89
|
+
value={description}
|
|
90
|
+
/>
|
|
91
|
+
<button
|
|
92
|
+
className="rounded-2xl bg-[var(--sea-ink)] px-4 py-3 text-sm font-semibold text-white"
|
|
93
|
+
type="submit"
|
|
94
|
+
>
|
|
95
|
+
Insert Local Row
|
|
96
|
+
</button>
|
|
97
|
+
</form>
|
|
98
|
+
|
|
99
|
+
<ul className="mt-5 space-y-3">
|
|
100
|
+
{todos.length === 0 ? (
|
|
101
|
+
<li className="rounded-2xl border border-dashed border-[var(--line)] px-4 py-5 text-sm text-[var(--sea-ink-soft)]">
|
|
102
|
+
No rows yet. Insert one locally, then wire `uploadData()` to send it upstream.
|
|
103
|
+
</li>
|
|
104
|
+
) : (
|
|
105
|
+
todos.map((todo) => (
|
|
106
|
+
<li
|
|
107
|
+
className="rounded-2xl border border-[var(--line)] bg-[var(--chip-bg)] px-4 py-4"
|
|
108
|
+
key={todo.id}
|
|
109
|
+
>
|
|
110
|
+
<div className="flex items-start justify-between gap-4">
|
|
111
|
+
<div>
|
|
112
|
+
<p className="font-medium text-[var(--sea-ink)]">{todo.description}</p>
|
|
113
|
+
<p className="mt-1 text-xs text-[var(--sea-ink-soft)]">
|
|
114
|
+
{todo.created_at}
|
|
115
|
+
</p>
|
|
116
|
+
</div>
|
|
117
|
+
<span className="rounded-full border border-[var(--line)] px-2 py-1 text-xs font-semibold text-[var(--sea-ink-soft)]">
|
|
118
|
+
{todo.completed ? 'done' : 'pending'}
|
|
119
|
+
</span>
|
|
120
|
+
</div>
|
|
121
|
+
</li>
|
|
122
|
+
))
|
|
123
|
+
)}
|
|
124
|
+
</ul>
|
|
125
|
+
</section>
|
|
126
|
+
</div>
|
|
127
|
+
</main>
|
|
128
|
+
)
|
|
129
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "PowerSync",
|
|
3
|
+
"description": "Add PowerSync offline sync to your application.",
|
|
4
|
+
"phase": "add-on",
|
|
5
|
+
"type": "add-on",
|
|
6
|
+
"category": "database",
|
|
7
|
+
"color": "#2563EB",
|
|
8
|
+
"priority": 55,
|
|
9
|
+
"link": "https://docs.powersync.com/client-sdk-references/js-web",
|
|
10
|
+
"modes": ["file-router"],
|
|
11
|
+
"envVars": [
|
|
12
|
+
{
|
|
13
|
+
"name": "VITE_POWERSYNC_URL",
|
|
14
|
+
"description": "PowerSync instance URL",
|
|
15
|
+
"required": true,
|
|
16
|
+
"file": ".env.local"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"name": "VITE_POWERSYNC_TOKEN",
|
|
20
|
+
"description": "Client-visible development token for local testing; VITE_* env vars are exposed to the browser",
|
|
21
|
+
"required": false,
|
|
22
|
+
"file": ".env.local"
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"integrations": [
|
|
26
|
+
{
|
|
27
|
+
"type": "vite-plugin",
|
|
28
|
+
"path": "powersync-vite-plugin.ts",
|
|
29
|
+
"jsName": "powersyncVite",
|
|
30
|
+
"code": "powersyncVite()"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"type": "provider",
|
|
34
|
+
"path": "src/integrations/powersync/provider.tsx",
|
|
35
|
+
"jsName": "PowerSyncProvider"
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
"routes": [
|
|
39
|
+
{
|
|
40
|
+
"url": "/demo/powersync",
|
|
41
|
+
"name": "PowerSync",
|
|
42
|
+
"path": "src/routes/demo/powersync.tsx",
|
|
43
|
+
"jsName": "PowerSyncDemo"
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<rect width="64" height="64" rx="16" fill="#2563EB"/>
|
|
3
|
+
<path d="M20 21C20 18.7909 21.7909 17 24 17H39.5C45.299 17 50 21.701 50 27.5C50 33.299 45.299 38 39.5 38H29V47H20V21Z" fill="white"/>
|
|
4
|
+
<path d="M29 29H38.5C40.9853 29 43 26.9853 43 24.5C43 22.0147 40.9853 20 38.5 20H29V29Z" fill="#2563EB"/>
|
|
5
|
+
<circle cx="43" cy="44" r="7" fill="#93C5FD"/>
|
|
6
|
+
</svg>
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Shopify
|
|
2
|
+
|
|
3
|
+
Headless Shopify storefront for TanStack Start. Mounts `/shop/*` routes
|
|
4
|
+
alongside your existing app — your home page stays untouched.
|
|
5
|
+
|
|
6
|
+
The default `.env.local` points at Shopify's public Hydrogen demo store, so the
|
|
7
|
+
storefront renders real products on first run with zero setup.
|
|
8
|
+
|
|
9
|
+
## Routes
|
|
10
|
+
|
|
11
|
+
| Route | What it does |
|
|
12
|
+
|--------------------------------|---------------------------------------------|
|
|
13
|
+
| `/shop` | Shop landing — featured products + collections |
|
|
14
|
+
| `/shop/products/$handle` | Product detail (variants, images, options) |
|
|
15
|
+
| `/shop/collections/$handle` | Collection grid with sort + pagination |
|
|
16
|
+
| `/shop/cart` | Cart line items, discount codes, checkout |
|
|
17
|
+
| `/shop/search` | Product search |
|
|
18
|
+
| `/shop/pages/$handle` | Shopify CMS pages (about, etc.) |
|
|
19
|
+
| `/shop/policies/$handle` | Privacy, refund, terms, shipping |
|
|
20
|
+
|
|
21
|
+
If you opted into customer accounts during scaffold:
|
|
22
|
+
|
|
23
|
+
| Route | What it does |
|
|
24
|
+
|--------------------------------------|------------------------------------|
|
|
25
|
+
| `/shop/account/login` | Kick off Shopify OAuth |
|
|
26
|
+
| `/shop/account/callback` | OAuth callback handler |
|
|
27
|
+
| `/shop/account/logout` | End the customer session |
|
|
28
|
+
| `/shop/account` | Dashboard |
|
|
29
|
+
| `/shop/account/orders` | Order history |
|
|
30
|
+
| `/shop/account/orders/$id` | Order detail |
|
|
31
|
+
| `/shop/account/addresses` | Manage saved addresses |
|
|
32
|
+
|
|
33
|
+
## Connect your store
|
|
34
|
+
|
|
35
|
+
1. In Shopify admin, go to **Settings > Apps and sales channels > Develop apps**.
|
|
36
|
+
2. Create a new app, enable the **Storefront API**, and copy the public access token.
|
|
37
|
+
3. Set in `.env.local`:
|
|
38
|
+
```
|
|
39
|
+
SHOPIFY_STORE_DOMAIN=your-store.myshopify.com
|
|
40
|
+
SHOPIFY_PUBLIC_STOREFRONT_TOKEN=...
|
|
41
|
+
```
|
|
42
|
+
4. (Optional) For higher rate limits + buyer-IP forwarding, also create a private
|
|
43
|
+
token and set `SHOPIFY_PRIVATE_STOREFRONT_TOKEN`.
|
|
44
|
+
|
|
45
|
+
## Enable customer accounts
|
|
46
|
+
|
|
47
|
+
If `customerAccount=enabled` was selected during scaffold:
|
|
48
|
+
|
|
49
|
+
1. In Shopify admin, go to **Settings > Customer accounts > Headless**.
|
|
50
|
+
2. Register a public client. Add `http://localhost:3000/shop/account/callback`
|
|
51
|
+
*and* your production callback URL to the redirect URIs.
|
|
52
|
+
3. Copy the Client ID and Shop ID into `.env.local`:
|
|
53
|
+
```
|
|
54
|
+
SHOPIFY_CUSTOMER_ACCOUNT_CLIENT_ID=...
|
|
55
|
+
SHOPIFY_CUSTOMER_ACCOUNT_SHOP_ID=...
|
|
56
|
+
SHOPIFY_SESSION_SECRET=$(openssl rand -hex 32)
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
The Hydrogen demo store doesn't have customer accounts configured, so the
|
|
60
|
+
default demo creds won't work for `/shop/account/*` — you'll need a real store.
|
|
61
|
+
|
|
62
|
+
## Architecture
|
|
63
|
+
|
|
64
|
+
- **Storefront API client** — server-only fetch in `src/server/shopify/storefront-client.ts`.
|
|
65
|
+
All product/cart reads go through the server (private token never reaches the browser).
|
|
66
|
+
- **Cart state** — Cart ID stored in an httpOnly cookie (`tanstack_cart_id`). React
|
|
67
|
+
Query owns the cache (single key `['shopify', 'cart']`); optimistic updates with
|
|
68
|
+
a module-level mutation counter to batch invalidations.
|
|
69
|
+
- **GraphQL queries** — hand-written strings in `src/lib/shopify/queries.ts`, types
|
|
70
|
+
sliced from `@shopify/hydrogen-react/storefront-api-types` (type-only import; zero runtime).
|
|
71
|
+
- **Customer accounts** — hand-rolled OAuth 2.1 PKCE with `.well-known` discovery
|
|
72
|
+
(no usable npm client exists yet). Tokens in a signed httpOnly cookie.
|
|
73
|
+
- **Checkout** — redirects to `cart.checkoutUrl` (Shopify-hosted).
|
|
74
|
+
|
|
75
|
+
## Deployment
|
|
76
|
+
|
|
77
|
+
Works anywhere TanStack Start runs:
|
|
78
|
+
|
|
79
|
+
- **Node** — `npm run build && npm start`
|
|
80
|
+
- **Cloudflare Workers / Shopify Oxygen** — Oxygen is just Workers under the hood;
|
|
81
|
+
build with the Workers preset and deploy to either platform.
|
|
82
|
+
- **Vercel / Netlify** — set the env vars in the dashboard.
|
|
83
|
+
- **Bun, Deno** — supported via Start's adapters.
|
|
84
|
+
|
|
85
|
+
For the customer-account flow, register both your local *and* production
|
|
86
|
+
callback URLs in the Shopify admin's headless app config.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# ─── Shopify ─────────────────────────────────────────────────────────────────
|
|
2
|
+
# These defaults point to Shopify's public Hydrogen demo store so the storefront
|
|
3
|
+
# works on first run with zero config. Replace with your store's values to go live.
|
|
4
|
+
# Get tokens at: Shopify admin > Settings > Apps and sales channels > Develop apps.
|
|
5
|
+
SHOPIFY_STORE_DOMAIN=hydrogen-preview.myshopify.com
|
|
6
|
+
SHOPIFY_STOREFRONT_API_VERSION=2026-01
|
|
7
|
+
SHOPIFY_PUBLIC_STOREFRONT_TOKEN=3b580e70970c4528da70c98e097c2fa0
|
|
8
|
+
# Optional — set to a private storefront token for higher rate limits + buyer-IP forwarding.
|
|
9
|
+
SHOPIFY_PRIVATE_STOREFRONT_TOKEN=
|
|
10
|
+
|
|
11
|
+
# ─── Shopify Customer Account API ────────────────────────────────────────────
|
|
12
|
+
# Required only if you opted into customer accounts during scaffold.
|
|
13
|
+
# Register a public client in Shopify admin > Settings > Customer accounts > Headless,
|
|
14
|
+
# then paste the client ID and your numeric shop ID below.
|
|
15
|
+
SHOPIFY_CUSTOMER_ACCOUNT_CLIENT_ID=
|
|
16
|
+
SHOPIFY_CUSTOMER_ACCOUNT_SHOP_ID=
|
|
17
|
+
SHOPIFY_CUSTOMER_ACCOUNT_REDIRECT_URI=http://localhost:3000/shop/account/callback
|
|
18
|
+
# 32+ random chars, e.g. `openssl rand -hex 32`. Used to sign customer session cookies.
|
|
19
|
+
SHOPIFY_SESSION_SECRET=
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<% if (addOnOption.shopify.customerAccount !== 'enabled') { ignoreFile(); return; } %>
|
|
2
|
+
import { Link } from '@tanstack/react-router'
|
|
3
|
+
|
|
4
|
+
const ITEMS = [
|
|
5
|
+
{ to: '/shop/account', label: 'Overview', exact: true },
|
|
6
|
+
{ to: '/shop/account/orders', label: 'Orders', exact: false },
|
|
7
|
+
{ to: '/shop/account/addresses', label: 'Addresses', exact: false },
|
|
8
|
+
] as const
|
|
9
|
+
|
|
10
|
+
export function AccountNav() {
|
|
11
|
+
return (
|
|
12
|
+
<nav className="flex flex-col gap-1 text-sm">
|
|
13
|
+
{ITEMS.map((item) => (
|
|
14
|
+
<Link
|
|
15
|
+
key={item.to}
|
|
16
|
+
to={item.to}
|
|
17
|
+
activeOptions={{ exact: item.exact }}
|
|
18
|
+
className="rounded-md px-2 py-1.5 text-[var(--storefront-fg-muted)] hover:bg-[var(--storefront-line)]/40 hover:text-[var(--storefront-fg)]"
|
|
19
|
+
activeProps={{
|
|
20
|
+
className:
|
|
21
|
+
'rounded-md px-2 py-1.5 bg-[var(--storefront-line)]/60 text-[var(--storefront-fg)] font-medium',
|
|
22
|
+
}}
|
|
23
|
+
>
|
|
24
|
+
{item.label}
|
|
25
|
+
</Link>
|
|
26
|
+
))}
|
|
27
|
+
<form
|
|
28
|
+
action="/shop/account/logout"
|
|
29
|
+
method="post"
|
|
30
|
+
className="mt-4 border-t border-[var(--storefront-line)] pt-4"
|
|
31
|
+
>
|
|
32
|
+
<button
|
|
33
|
+
type="submit"
|
|
34
|
+
className="rounded-md px-2 py-1.5 text-left text-sm text-[var(--storefront-fg-muted)] hover:text-[var(--storefront-fg)]"
|
|
35
|
+
>
|
|
36
|
+
Sign out
|
|
37
|
+
</button>
|
|
38
|
+
</form>
|
|
39
|
+
</nav>
|
|
40
|
+
)
|
|
41
|
+
}
|