Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7045ef8bff | ||
|
|
0a075632c3 | ||
|
|
5bf3f8694c | ||
|
|
365fcf0cae | ||
|
|
8960ffd844 | ||
|
|
f3782a0dbf | ||
|
|
566e8117e2 | ||
|
|
b76ebac099 | ||
|
|
1cf9a7271d |
No files matched your search
@@ -1,16 +1,61 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Questrial&display=swap"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>parfum-shop</title>
|
||||
|
||||
<title>atmos · Konzeptionelle Düfte aus der Schweiz</title>
|
||||
<meta
|
||||
name="description"
|
||||
content="atmos — konzeptionelle Nischendüfte zwischen Materialität, Raum und Charakter. Sechs Düfte als Discovery Set oder 50 ml Flakon. Made in Switzerland."
|
||||
/>
|
||||
<meta name="theme-color" content="#262626" />
|
||||
<meta name="color-scheme" content="dark light" />
|
||||
|
||||
<!-- TODO: replace https://atmos.example with the real production domain -->
|
||||
<link rel="canonical" href="https://atmos.example/" />
|
||||
|
||||
<!-- Open Graph -->
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:site_name" content="atmos" />
|
||||
<meta property="og:title" content="atmos · Konzeptionelle Düfte" />
|
||||
<meta
|
||||
property="og:description"
|
||||
content="Konzeptionelle Nischendüfte zwischen Materialität, Raum und Charakter. Made in Switzerland."
|
||||
/>
|
||||
<meta property="og:url" content="https://atmos.example/" />
|
||||
<meta property="og:image" content="https://atmos.example/og-image.jpg" />
|
||||
<meta property="og:image:width" content="1200" />
|
||||
<meta property="og:image:height" content="630" />
|
||||
<meta property="og:locale" content="de_CH" />
|
||||
|
||||
<!-- Twitter / X -->
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
<meta name="twitter:title" content="atmos · Konzeptionelle Düfte" />
|
||||
<meta
|
||||
name="twitter:description"
|
||||
content="Konzeptionelle Nischendüfte zwischen Materialität, Raum und Charakter."
|
||||
/>
|
||||
<meta name="twitter:image" content="https://atmos.example/og-image.jpg" />
|
||||
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||
<link
|
||||
rel="preload"
|
||||
href="/fonts/questrial/questrial-latin.woff2"
|
||||
as="font"
|
||||
type="font/woff2"
|
||||
crossorigin
|
||||
/>
|
||||
|
||||
<!-- Preload LCP image of the landing hero -->
|
||||
<link
|
||||
rel="preload"
|
||||
as="image"
|
||||
href="/images/hero/768/blasse-seide-hero-product.webp"
|
||||
imagesrcset="/images/hero/480/blasse-seide-hero-product.webp 480w, /images/hero/768/blasse-seide-hero-product.webp 768w, /images/hero/960/blasse-seide-hero-product.webp 960w, /blasse-seide-hero-product.webp 1078w"
|
||||
imagesizes="(max-width: 760px) 92vw, (max-width: 1180px) 45vw, 768px"
|
||||
fetchpriority="high"
|
||||
/>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
|
||||
|
Before Width: | Height: | Size: 215 KiB |
|
Before Width: | Height: | Size: 2.0 MiB |
|
Before Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 341 KiB |
|
Before Width: | Height: | Size: 338 KiB |
|
Before Width: | Height: | Size: 270 KiB |
|
Before Width: | Height: | Size: 446 KiB |
|
Before Width: | Height: | Size: 289 KiB |
|
Before Width: | Height: | Size: 1.8 MiB |
|
After Width: | Height: | Size: 111 KiB |
|
Before Width: | Height: | Size: 952 KiB |
|
After Width: | Height: | Size: 47 KiB |
|
Before Width: | Height: | Size: 179 KiB |
|
After Width: | Height: | Size: 27 KiB |
|
After Width: | Height: | Size: 178 KiB |
|
After Width: | Height: | Size: 102 KiB |
|
After Width: | Height: | Size: 171 KiB |
|
After Width: | Height: | Size: 85 KiB |
@@ -0,0 +1,93 @@
|
||||
Copyright 2011 The Questrial Project Authors (https://github.com/googlefonts/questrial)
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
https://scripts.sil.org/OFL
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 51 KiB |
|
After Width: | Height: | Size: 67 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 957 KiB |
|
After Width: | Height: | Size: 49 KiB |
|
Before Width: | Height: | Size: 138 KiB |
|
After Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 365 KiB |
|
After Width: | Height: | Size: 105 KiB |
|
After Width: | Height: | Size: 159 KiB |
|
After Width: | Height: | Size: 279 KiB |
|
After Width: | Height: | Size: 175 KiB |
|
Before Width: | Height: | Size: 952 KiB |
|
After Width: | Height: | Size: 47 KiB |
|
Before Width: | Height: | Size: 169 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 131 KiB |
|
After Width: | Height: | Size: 96 KiB |
|
After Width: | Height: | Size: 83 KiB |
|
After Width: | Height: | Size: 122 KiB |
|
Before Width: | Height: | Size: 48 KiB |
@@ -0,0 +1,8 @@
|
||||
# robots.txt — atmos parfum-shop
|
||||
# TODO: replace https://atmos.example with the real production domain
|
||||
|
||||
User-agent: *
|
||||
Allow: /
|
||||
Disallow: /api/
|
||||
|
||||
Sitemap: https://atmos.example/sitemap.xml
|
||||
|
Before Width: | Height: | Size: 933 KiB |
|
After Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 154 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 124 KiB |
|
After Width: | Height: | Size: 186 KiB |
|
After Width: | Height: | Size: 201 KiB |
|
After Width: | Height: | Size: 141 KiB |
@@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
<url>
|
||||
<loc>https://atmos.ch/</loc>
|
||||
<changefreq>weekly</changefreq>
|
||||
<priority>1.0</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://atmos.ch/about</loc>
|
||||
<changefreq>monthly</changefreq>
|
||||
<priority>0.7</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://atmos.ch/discovery-set</loc>
|
||||
<changefreq>monthly</changefreq>
|
||||
<priority>0.9</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://atmos.ch/small-batch</loc>
|
||||
<changefreq>monthly</changefreq>
|
||||
<priority>0.7</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://atmos.ch/support</loc>
|
||||
<changefreq>yearly</changefreq>
|
||||
<priority>0.4</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://atmos.ch/impressum</loc>
|
||||
<changefreq>yearly</changefreq>
|
||||
<priority>0.2</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://atmos.ch/datenschutz</loc>
|
||||
<changefreq>yearly</changefreq>
|
||||
<priority>0.2</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://atmos.ch/duft/kalter-beton</loc>
|
||||
<changefreq>monthly</changefreq>
|
||||
<priority>0.8</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://atmos.ch/duft/nasser-marmor</loc>
|
||||
<changefreq>monthly</changefreq>
|
||||
<priority>0.8</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://atmos.ch/duft/blasse-seide</loc>
|
||||
<changefreq>monthly</changefreq>
|
||||
<priority>0.8</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://atmos.ch/duft/weisse-asche</loc>
|
||||
<changefreq>monthly</changefreq>
|
||||
<priority>0.8</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://atmos.ch/duft/verbranntes-chrom</loc>
|
||||
<changefreq>monthly</changefreq>
|
||||
<priority>0.8</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://atmos.ch/duft/schwarzes-benzin</loc>
|
||||
<changefreq>monthly</changefreq>
|
||||
<priority>0.8</priority>
|
||||
</url>
|
||||
</urlset>
|
||||
|
Before Width: | Height: | Size: 951 KiB |
|
After Width: | Height: | Size: 50 KiB |
|
After Width: | Height: | Size: 273 KiB |
|
After Width: | Height: | Size: 331 KiB |
|
After Width: | Height: | Size: 270 KiB |
|
After Width: | Height: | Size: 203 KiB |
|
Before Width: | Height: | Size: 138 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 933 KiB |
|
After Width: | Height: | Size: 46 KiB |
|
Before Width: | Height: | Size: 175 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 214 KiB |
|
After Width: | Height: | Size: 164 KiB |
|
After Width: | Height: | Size: 209 KiB |
|
After Width: | Height: | Size: 220 KiB |
@@ -11,7 +11,7 @@ export const catalogProducts = [
|
||||
slug: "discovery-set",
|
||||
name: "Discovery Set",
|
||||
kind: "discovery_set",
|
||||
size_label: "6 x 2ml",
|
||||
size_label: "6 x 2 ml",
|
||||
price_cents: 4800,
|
||||
discovery_credit_cents: 4800,
|
||||
},
|
||||
@@ -19,18 +19,18 @@ export const catalogProducts = [
|
||||
{
|
||||
id: `${perfume.slug}-sample`,
|
||||
slug: perfume.slug,
|
||||
name: `${perfume.name} Sample`,
|
||||
name: `${perfume.name} Probe`,
|
||||
kind: "sample",
|
||||
size_label: "2ml",
|
||||
size_label: "2 ml Probe",
|
||||
price_cents: parsePriceCents(perfume.prices.sample),
|
||||
discovery_credit_cents: 0,
|
||||
},
|
||||
{
|
||||
id: `${perfume.slug}-full`,
|
||||
slug: perfume.slug,
|
||||
name: `${perfume.name} Full Size`,
|
||||
name: `${perfume.name} 50 ml Flakon`,
|
||||
kind: "full_size",
|
||||
size_label: "50ml",
|
||||
size_label: "50 ml Flakon",
|
||||
price_cents: parsePriceCents(perfume.prices.full),
|
||||
discovery_credit_cents: 0,
|
||||
},
|
||||
|
||||
@@ -25,7 +25,7 @@ const readBody = async (req) =>
|
||||
req.on("data", (chunk) => {
|
||||
raw += chunk;
|
||||
if (raw.length > 1_000_000) {
|
||||
reject(new Error("Request body too large"));
|
||||
reject(new Error("Anfrage ist zu gross."));
|
||||
req.destroy();
|
||||
}
|
||||
});
|
||||
@@ -37,7 +37,7 @@ const readBody = async (req) =>
|
||||
try {
|
||||
resolve(JSON.parse(raw));
|
||||
} catch {
|
||||
reject(new Error("Invalid JSON"));
|
||||
reject(new Error("Ungültiges JSON."));
|
||||
}
|
||||
});
|
||||
req.on("error", reject);
|
||||
@@ -130,7 +130,7 @@ const authenticate = (req) => {
|
||||
const requireAuth = (req, res) => {
|
||||
const auth = authenticate(req);
|
||||
if (!auth) {
|
||||
json(res, 401, { error: "Please log in to continue." });
|
||||
json(res, 401, { error: "Bitte melde dich an, um fortzufahren." });
|
||||
return null;
|
||||
}
|
||||
return auth;
|
||||
@@ -175,7 +175,7 @@ const getAvailableDiscounts = (userId, rows) => {
|
||||
type: "discovery",
|
||||
creditId: discovery.id,
|
||||
amount_cents: Math.min(discovery.amount_cents, fullTotal),
|
||||
label: "Discovery Set credit",
|
||||
label: "Discovery-Set-Gutschrift",
|
||||
});
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ const getAvailableDiscounts = (userId, rows) => {
|
||||
slug: row.slug,
|
||||
product_id: row.product_id,
|
||||
amount_cents: Math.min(sample.amount_cents, row.price_cents * row.quantity),
|
||||
label: `${row.name.replace(" Full Size", "")} sample credit`,
|
||||
label: `Proben-Gutschrift für ${row.name.replace(" 50 ml Flakon", "")}`,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -355,13 +355,13 @@ const register = async (req, res) => {
|
||||
const surname = String(body.surname || "").trim();
|
||||
|
||||
if (!firstName || !surname || !email || !password) {
|
||||
json(res, 400, { error: "First name, surname, email, and password are required." });
|
||||
json(res, 400, { error: "Vorname, Nachname, E-Mail und Passwort sind erforderlich." });
|
||||
return;
|
||||
}
|
||||
|
||||
const existing = db.prepare("SELECT id FROM users WHERE email = ?").get(email);
|
||||
if (existing) {
|
||||
json(res, 409, { error: "An account with this email already exists." });
|
||||
json(res, 409, { error: "Mit dieser E-Mail existiert bereits ein Konto." });
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -389,7 +389,7 @@ const login = async (req, res) => {
|
||||
const user = db.prepare("SELECT * FROM users WHERE email = ?").get(email);
|
||||
|
||||
if (!user || !verifyPassword(password, user.password_salt, user.password_hash)) {
|
||||
json(res, 401, { error: "Invalid email or password." });
|
||||
json(res, 401, { error: "E-Mail oder Passwort ist ungültig." });
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -415,7 +415,7 @@ const patchProfile = async (req, res, user) => {
|
||||
});
|
||||
|
||||
if (!firstName || !surname) {
|
||||
json(res, 400, { error: "First name and surname are required." });
|
||||
json(res, 400, { error: "Vorname und Nachname sind erforderlich." });
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -459,7 +459,7 @@ const addCartItem = async (req, res, user) => {
|
||||
const quantity = Math.max(1, Number(body.quantity || 1));
|
||||
const product = db.prepare("SELECT * FROM products WHERE id = ?").get(productId);
|
||||
if (!product) {
|
||||
json(res, 404, { error: "Product not found." });
|
||||
json(res, 404, { error: "Produkt nicht gefunden." });
|
||||
return;
|
||||
}
|
||||
const timestamp = now();
|
||||
@@ -472,7 +472,7 @@ const addCartItem = async (req, res, user) => {
|
||||
).run(user.id, productId, quantity, timestamp, timestamp);
|
||||
json(res, 200, {
|
||||
cart: getCart(user.id),
|
||||
message: `${quantity} x ${product.name} added.`,
|
||||
message: `${quantity} x ${product.name} wurde in den Warenkorb gelegt.`,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -480,7 +480,7 @@ const patchCartItem = async (req, res, user, productId) => {
|
||||
const body = await readBody(req);
|
||||
const quantity = Number(body.quantity);
|
||||
if (!Number.isFinite(quantity)) {
|
||||
json(res, 400, { error: "Quantity is required." });
|
||||
json(res, 400, { error: "Die Menge ist erforderlich." });
|
||||
return;
|
||||
}
|
||||
if (quantity <= 0) {
|
||||
@@ -502,7 +502,7 @@ const checkout = async (req, res, user) => {
|
||||
const body = await readBody(req);
|
||||
const rows = getCartRows(user.id);
|
||||
if (rows.length === 0) {
|
||||
json(res, 400, { error: "Your cart is empty." });
|
||||
json(res, 400, { error: "Dein Warenkorb ist leer." });
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -514,11 +514,11 @@ const checkout = async (req, res, user) => {
|
||||
};
|
||||
const paymentMethod = String(body.payment_method || body.paymentMethod || "").trim();
|
||||
if (!addressFields.street_name || !addressFields.house_number || !addressFields.zip_code || !addressFields.city) {
|
||||
json(res, 400, { error: "Street name, house number, ZIP code, and city are required." });
|
||||
json(res, 400, { error: "Strasse, Hausnummer, PLZ und Ort sind erforderlich." });
|
||||
return;
|
||||
}
|
||||
if (!["Bill", "Card", "Twint", "PayPal"].includes(paymentMethod)) {
|
||||
json(res, 400, { error: "Choose a payment method." });
|
||||
json(res, 400, { error: "Wähle eine Zahlungsmethode." });
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -611,7 +611,7 @@ const subscribeProduct = async (req, res, user) => {
|
||||
const type = String(body.type || "restock").trim();
|
||||
const product = db.prepare("SELECT * FROM products WHERE id = ?").get(productId);
|
||||
if (!product) {
|
||||
json(res, 404, { error: "Product not found." });
|
||||
json(res, 404, { error: "Produkt nicht gefunden." });
|
||||
return;
|
||||
}
|
||||
db.prepare(
|
||||
@@ -620,7 +620,7 @@ const subscribeProduct = async (req, res, user) => {
|
||||
).run(user.id, productId, type, now());
|
||||
json(res, 200, {
|
||||
ok: true,
|
||||
message: `${product.name} ${type} subscription saved.`,
|
||||
message: `${product.name}: Benachrichtigung gespeichert.`,
|
||||
subscriptions: getProductSubscriptions(user.id),
|
||||
});
|
||||
};
|
||||
@@ -719,13 +719,13 @@ const route = async (req, res) => {
|
||||
return deleteCartItem(res, user, decodeURIComponent(itemMatch[1]));
|
||||
}
|
||||
|
||||
json(res, 404, { error: "Route not found." });
|
||||
json(res, 404, { error: "Route nicht gefunden." });
|
||||
};
|
||||
|
||||
createServer((req, res) => {
|
||||
route(req, res).catch((error) => {
|
||||
console.error(error);
|
||||
json(res, 500, { error: "Server error." });
|
||||
json(res, 500, { error: "Serverfehler." });
|
||||
});
|
||||
}).listen(PORT, () => {
|
||||
console.log(`Shop API listening on http://localhost:${PORT}`);
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
html,
|
||||
body,
|
||||
#root {
|
||||
margin: 0;
|
||||
min-height: 100%;
|
||||
font-family: "Questrial", Arial, Helvetica, sans-serif;
|
||||
}
|
||||
|
||||
#root {
|
||||
@@ -55,7 +49,7 @@ main {
|
||||
top: clamp(0.75rem, 2.1vw, 1.4rem);
|
||||
right: 0;
|
||||
left: 0;
|
||||
z-index: 998;
|
||||
z-index: var(--z-nav);
|
||||
margin-bottom: 0;
|
||||
padding-top: 0;
|
||||
pointer-events: none;
|
||||
@@ -74,14 +68,18 @@ main {
|
||||
.navbar--light .nav-pill,
|
||||
.navbar--light .nav-link,
|
||||
.shell,
|
||||
[class*="-page"],
|
||||
[class*="-shell"],
|
||||
[class*="-card"],
|
||||
[class*="-panel"],
|
||||
[class*="-box"],
|
||||
.page,
|
||||
.detail-page,
|
||||
.discovery-page,
|
||||
.about-page,
|
||||
.support-page,
|
||||
.small-page,
|
||||
.impressum-page,
|
||||
.datenschutz-page,
|
||||
button,
|
||||
input,
|
||||
textarea {
|
||||
textarea,
|
||||
select {
|
||||
transition:
|
||||
background-color var(--duration-med) var(--ease-out),
|
||||
border-color var(--duration-med) var(--ease-out),
|
||||
|
||||
@@ -16,6 +16,7 @@ import CartToast from "./components/CartToast";
|
||||
import { ProductTransitionProvider } from "./components/ProductTransition";
|
||||
import useLenisSmoothScroll from "./hooks/useLenisSmoothScroll";
|
||||
import useScrollTextReveal from "./hooks/useScrollTextReveal";
|
||||
import useButtonInteractions from "./hooks/useButtonInteractions";
|
||||
import { ThemeProvider } from "./theme/ThemeContext";
|
||||
import "./style/textReveal.css";
|
||||
|
||||
@@ -35,6 +36,7 @@ function App() {
|
||||
|
||||
useLenisSmoothScroll(location.pathname);
|
||||
useScrollTextReveal(routeContentRef, location.pathname);
|
||||
useButtonInteractions();
|
||||
|
||||
useEffect(() => {
|
||||
if (typeof document === "undefined") return;
|
||||
@@ -59,6 +61,10 @@ function App() {
|
||||
<ProductTransitionProvider>
|
||||
<ScrollToTop />
|
||||
|
||||
<a href="#main-content" className="skip-link">
|
||||
Zum Inhalt springen
|
||||
</a>
|
||||
|
||||
<div ref={routeContentRef} data-route-content>
|
||||
<Routes>
|
||||
<Route path="/" element={<LandingPage />} />
|
||||
|
||||
@@ -22,14 +22,23 @@ function CartToast() {
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="cart-toast">
|
||||
<button className="cart-toast-close" type="button" onClick={dismissToast}>
|
||||
x
|
||||
<div className="cart-toast" role="status" aria-live="polite">
|
||||
<button
|
||||
type="button"
|
||||
className="atmos-btn atmos-btn--outline atmos-btn--icon atmos-btn--sm cart-toast-close"
|
||||
onClick={dismissToast}
|
||||
aria-label="Hinweis schliessen"
|
||||
>
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<strong>{cartToast.title}</strong>
|
||||
<p>{cartToast.message}</p>
|
||||
{cartToast.actionLabel && (
|
||||
<button type="button" onClick={runAction}>
|
||||
<button
|
||||
type="button"
|
||||
className="atmos-btn atmos-btn--primary atmos-btn--block atmos-btn--sm"
|
||||
onClick={runAction}
|
||||
>
|
||||
{cartToast.actionLabel}
|
||||
</button>
|
||||
)}
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
overflow: hidden;
|
||||
background:
|
||||
radial-gradient(circle at 82% 10%, rgba(var(--theme-accent-rgb) / 0.15), transparent 22rem),
|
||||
#171717;
|
||||
color: #f5f5f5;
|
||||
border-top: 1px solid rgba(255, 255, 255, 0.08);
|
||||
var(--footer-bg);
|
||||
color: var(--footer-text);
|
||||
border-top: 1px solid var(--footer-border);
|
||||
}
|
||||
|
||||
.site-footer--flush {
|
||||
@@ -18,7 +18,7 @@
|
||||
position: absolute;
|
||||
right: var(--page-x);
|
||||
bottom: -0.16em;
|
||||
color: rgba(255, 255, 255, 0.035);
|
||||
color: var(--footer-watermark);
|
||||
font-size: clamp(5.5rem, 18vw, 20rem);
|
||||
line-height: 0.8;
|
||||
letter-spacing: 0;
|
||||
@@ -45,7 +45,7 @@
|
||||
|
||||
.site-footer__logo {
|
||||
width: fit-content;
|
||||
color: #fff;
|
||||
color: var(--theme-accent-contrast);
|
||||
font-size: clamp(1rem, 1.5vw, 1.2rem);
|
||||
letter-spacing: 0.22em;
|
||||
text-decoration: none;
|
||||
@@ -54,7 +54,7 @@
|
||||
.site-footer__text {
|
||||
max-width: 32rem;
|
||||
margin: 0;
|
||||
color: rgba(255, 255, 255, 0.7);
|
||||
color: var(--footer-text-muted);
|
||||
font-size: var(--text-base);
|
||||
line-height: 1.65;
|
||||
}
|
||||
@@ -67,21 +67,28 @@
|
||||
}
|
||||
|
||||
.site-footer__heading {
|
||||
color: rgba(255, 255, 255, 0.52);
|
||||
color: var(--footer-text-faint);
|
||||
font-size: var(--text-xs);
|
||||
letter-spacing: 0.22em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.site-footer__nav {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.site-footer__nav ul {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.72rem;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.site-footer__nav a {
|
||||
width: fit-content;
|
||||
color: #f5f5f5;
|
||||
color: var(--footer-text);
|
||||
font-size: var(--text-sm);
|
||||
line-height: 1.2;
|
||||
text-decoration: none;
|
||||
@@ -97,7 +104,7 @@
|
||||
transform: translateX(0.25rem);
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
@media (max-width: 1023px) {
|
||||
.site-footer__inner {
|
||||
grid-template-columns: 1fr 1fr;
|
||||
}
|
||||
@@ -107,7 +114,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
@media (max-width: 767px) {
|
||||
.site-footer__inner {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,28 @@
|
||||
import { Link } from "react-router";
|
||||
import "./Footer.css";
|
||||
|
||||
const footerLinkGroups = [
|
||||
{
|
||||
heading: "Navigation",
|
||||
ariaLabel: "Footer Navigation",
|
||||
links: [
|
||||
{ to: "/", label: "Startseite" },
|
||||
{ to: "/#dufte", label: "D\u00FCfte" },
|
||||
{ to: "/discovery-set", label: "Discovery Set" },
|
||||
],
|
||||
},
|
||||
{
|
||||
heading: "Rechtliches & Info",
|
||||
ariaLabel: "Footer Rechtliches und Info",
|
||||
links: [
|
||||
{ to: "/about", label: "About Us" },
|
||||
{ to: "/support", label: "Support" },
|
||||
{ to: "/impressum", label: "Impressum" },
|
||||
{ to: "/datenschutz", label: "Datenschutz" },
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
function Footer({ flushTop = false }) {
|
||||
return (
|
||||
<footer className={`site-footer${flushTop ? " site-footer--flush" : ""}`}>
|
||||
@@ -10,28 +32,24 @@ function Footer({ flushTop = false }) {
|
||||
ATMOS
|
||||
</Link>
|
||||
<p className="site-footer__text">
|
||||
Konzeptuelle Düfte zwischen Materialität, Raum und Charakter.
|
||||
{"Konzeptuelle D\u00FCfte zwischen Materialit\u00E4t, Raum und Charakter."}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="site-footer__nav-group">
|
||||
<span className="site-footer__heading">Navigation</span>
|
||||
<nav className="site-footer__nav">
|
||||
<Link to="/">Startseite</Link>
|
||||
<Link to="/#dufte">Düfte</Link>
|
||||
<Link to="/discovery-set">Discovery Set</Link>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<div className="site-footer__nav-group">
|
||||
<span className="site-footer__heading">Rechtliches & Info</span>
|
||||
<nav className="site-footer__nav">
|
||||
<Link to="/about">About Us</Link>
|
||||
<Link to="/support">Support</Link>
|
||||
<Link to="/impressum">Impressum</Link>
|
||||
<Link to="/datenschutz">Datenschutz</Link>
|
||||
</nav>
|
||||
</div>
|
||||
{footerLinkGroups.map((group) => (
|
||||
<div className="site-footer__nav-group" key={group.heading}>
|
||||
<span className="site-footer__heading">{group.heading}</span>
|
||||
<nav className="site-footer__nav" aria-label={group.ariaLabel}>
|
||||
<ul>
|
||||
{group.links.map((link) => (
|
||||
<li key={link.to}>
|
||||
<Link to={link.to}>{link.label}</Link>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</footer>
|
||||
);
|
||||
|
||||
@@ -5,6 +5,15 @@
|
||||
background: var(--theme-bg);
|
||||
}
|
||||
|
||||
.detail-body-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.detail-sections {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.eyebrow,
|
||||
.label-title {
|
||||
font-size: var(--text-xs);
|
||||
@@ -94,7 +103,7 @@
|
||||
height: auto;
|
||||
object-fit: contain;
|
||||
display: block;
|
||||
filter: drop-shadow(0 34px 72px rgba(0, 0, 0, 0.42));
|
||||
filter: var(--shadow-product);
|
||||
}
|
||||
|
||||
.is-transition-arriving .product-hero-image,
|
||||
@@ -195,24 +204,13 @@
|
||||
}
|
||||
|
||||
.product-purchase-panel {
|
||||
position: relative;
|
||||
grid-column: 10 / -1;
|
||||
grid-row: 1;
|
||||
z-index: 4;
|
||||
justify-self: end;
|
||||
align-self: center;
|
||||
width: min(100%, 390px);
|
||||
max-height: none;
|
||||
overflow: visible;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: clamp(1rem, 1.8vw, 1.45rem);
|
||||
width: 100%;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
backdrop-filter: none;
|
||||
-webkit-backdrop-filter: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.purchase-price-row {
|
||||
@@ -250,46 +248,75 @@
|
||||
}
|
||||
|
||||
.size-card {
|
||||
min-height: 112px;
|
||||
padding: clamp(0.85rem, 1.4vw, 1.05rem);
|
||||
position: relative;
|
||||
min-height: 116px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.35rem;
|
||||
padding: clamp(0.95rem, 1.6vw, 1.2rem);
|
||||
border: 1px solid var(--theme-border);
|
||||
background: var(--theme-paper);
|
||||
background: transparent;
|
||||
color: var(--theme-text);
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
isolation: isolate;
|
||||
transition:
|
||||
transform var(--duration-med) var(--ease-out),
|
||||
border-color var(--duration-med) var(--ease-out),
|
||||
background-color var(--duration-med) var(--ease-out),
|
||||
box-shadow var(--duration-med) var(--ease-out);
|
||||
color var(--duration-med) var(--ease-out);
|
||||
}
|
||||
|
||||
/* Top accent line — appears on hover, stays on active. */
|
||||
.size-card::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 2px;
|
||||
background: var(--theme-accent);
|
||||
transform: scaleX(0);
|
||||
transform-origin: left center;
|
||||
transition: transform var(--duration-med) var(--ease-out);
|
||||
}
|
||||
|
||||
.size-card:hover,
|
||||
.size-card:focus-visible {
|
||||
transform: translateY(-2px);
|
||||
border-color: rgba(var(--theme-accent-rgb) / 0.58);
|
||||
box-shadow: var(--theme-shadow-soft);
|
||||
border-color: var(--theme-border-strong);
|
||||
}
|
||||
|
||||
.size-card:hover::before,
|
||||
.size-card:focus-visible::before {
|
||||
transform: scaleX(0.45);
|
||||
}
|
||||
|
||||
.size-card.active {
|
||||
border-color: var(--theme-accent);
|
||||
background:
|
||||
linear-gradient(135deg, rgba(var(--theme-accent-rgb) / 0.12), transparent 62%),
|
||||
var(--theme-paper);
|
||||
background: rgba(var(--theme-accent-rgb) / 0.06);
|
||||
}
|
||||
|
||||
.size-card.active::before {
|
||||
transform: scaleX(1);
|
||||
}
|
||||
|
||||
.size-title {
|
||||
display: block;
|
||||
margin-bottom: 0.65rem;
|
||||
color: var(--theme-text);
|
||||
font-size: var(--text-sm);
|
||||
color: var(--theme-text-muted);
|
||||
font-size: var(--text-xs);
|
||||
letter-spacing: 0.18em;
|
||||
text-transform: uppercase;
|
||||
transition: color var(--duration-med) var(--ease-out);
|
||||
}
|
||||
|
||||
.size-card.active .size-title {
|
||||
color: var(--theme-accent);
|
||||
}
|
||||
|
||||
.size-card strong {
|
||||
display: block;
|
||||
margin-bottom: 0.35rem;
|
||||
margin-top: auto;
|
||||
color: var(--theme-text);
|
||||
font-size: clamp(1.05rem, 1.4vw, 1.38rem);
|
||||
font-size: clamp(1.1rem, 1.55vw, 1.45rem);
|
||||
font-weight: 400;
|
||||
letter-spacing: 0;
|
||||
line-height: 1.05;
|
||||
@@ -333,67 +360,9 @@
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.purchase-discovery-note a {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 44px;
|
||||
padding: 0 1rem;
|
||||
border-radius: var(--radius-lg);
|
||||
background: var(--theme-accent);
|
||||
color: #fff;
|
||||
text-decoration: none;
|
||||
white-space: nowrap;
|
||||
font-size: var(--text-sm);
|
||||
transition:
|
||||
transform var(--duration-med) var(--ease-out),
|
||||
box-shadow var(--duration-med) var(--ease-out);
|
||||
}
|
||||
|
||||
.purchase-discovery-note a:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 16px 36px rgba(0, 0, 0, 0.24);
|
||||
}
|
||||
|
||||
.buy-button,
|
||||
.restock-button,
|
||||
.detail-bottom-actions button,
|
||||
.review-toggle,
|
||||
.review-write-button {
|
||||
min-height: 48px;
|
||||
border: 1px solid var(--theme-border);
|
||||
border-radius: var(--radius-lg);
|
||||
cursor: pointer;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.12em;
|
||||
transition:
|
||||
transform var(--duration-med) var(--ease-out),
|
||||
border-color var(--duration-med) var(--ease-out),
|
||||
background-color var(--duration-med) var(--ease-out),
|
||||
box-shadow var(--duration-med) var(--ease-out);
|
||||
}
|
||||
|
||||
.buy-button {
|
||||
border-color: var(--theme-accent);
|
||||
background: var(--theme-accent);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.restock-button {
|
||||
background: transparent;
|
||||
color: var(--theme-text);
|
||||
}
|
||||
|
||||
.buy-button:hover,
|
||||
.restock-button:hover,
|
||||
.detail-bottom-actions button:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: var(--theme-shadow-soft);
|
||||
}
|
||||
|
||||
.restock-button:hover {
|
||||
border-color: rgba(var(--theme-accent-rgb) / 0.68);
|
||||
}
|
||||
/* Buy / restock / discovery / review CTAs use the global .atmos-btn system
|
||||
(see src/style/buttons.css). The .restock-button class is kept on the
|
||||
element only as a hook for the mobile breakpoint that hides it. */
|
||||
|
||||
.product-story-grid,
|
||||
.product-meta-section {
|
||||
@@ -597,23 +566,54 @@
|
||||
}
|
||||
|
||||
.structure-phase-card {
|
||||
position: relative;
|
||||
isolation: isolate;
|
||||
overflow: hidden;
|
||||
min-height: 280px;
|
||||
padding: clamp(1rem, 2vw, 1.5rem);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
gap: var(--gap-md);
|
||||
border-color: rgba(255, 255, 255, 0.18);
|
||||
background: #262626;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.structure-phase-card::before,
|
||||
.structure-phase-card::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.structure-phase-card::before {
|
||||
background: var(--phase-visual-image, none) center / cover no-repeat;
|
||||
transform: scale(1.02);
|
||||
}
|
||||
|
||||
.structure-phase-card::after {
|
||||
background:
|
||||
linear-gradient(180deg, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.72)),
|
||||
linear-gradient(90deg, rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0.12));
|
||||
}
|
||||
|
||||
.structure-phase-card > * {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.structure-index {
|
||||
color: var(--theme-accent);
|
||||
color: rgba(255, 255, 255, 0.7);
|
||||
font-size: var(--text-sm);
|
||||
letter-spacing: 0.2em;
|
||||
}
|
||||
|
||||
.structure-phase-card h3 {
|
||||
margin: 0;
|
||||
color: var(--theme-text);
|
||||
color: #fff;
|
||||
font-size: var(--text-lg);
|
||||
font-weight: 400;
|
||||
letter-spacing: 0.02em;
|
||||
@@ -628,8 +628,9 @@
|
||||
|
||||
.structure-phase-card div span {
|
||||
padding: 0.55rem 0.75rem;
|
||||
border: 1px solid var(--theme-border);
|
||||
color: var(--theme-text-muted);
|
||||
border: 1px solid rgba(255, 255, 255, 0.22);
|
||||
background: rgba(0, 0, 0, 0.26);
|
||||
color: rgba(255, 255, 255, 0.86);
|
||||
font-size: var(--text-sm);
|
||||
}
|
||||
|
||||
@@ -773,21 +774,7 @@
|
||||
margin-top: var(--gap-sm);
|
||||
}
|
||||
|
||||
.review-toggle {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: var(--gap-sm);
|
||||
padding: 0.9rem 1rem;
|
||||
background: transparent;
|
||||
color: var(--theme-text);
|
||||
}
|
||||
|
||||
.review-toggle:hover {
|
||||
border-color: rgba(var(--theme-accent-rgb) / 0.6);
|
||||
}
|
||||
|
||||
/* .review-toggle is rendered as `.atmos-btn--outline --block --split`. */
|
||||
.review-toggle-icon {
|
||||
font-size: 1.2rem;
|
||||
line-height: 1;
|
||||
@@ -835,12 +822,6 @@
|
||||
background: var(--theme-accent);
|
||||
}
|
||||
|
||||
.review-write-button {
|
||||
background: var(--theme-paper);
|
||||
color: var(--theme-text-muted);
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.detail-bottom-cta {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) auto;
|
||||
@@ -851,13 +832,13 @@
|
||||
overflow: hidden;
|
||||
background:
|
||||
radial-gradient(circle at 86% 12%, rgba(255, 255, 255, 0.24), transparent 18rem),
|
||||
linear-gradient(135deg, var(--theme-accent), #e95700);
|
||||
linear-gradient(135deg, var(--theme-accent-fill), var(--theme-accent-fill-strong));
|
||||
}
|
||||
|
||||
.detail-bottom-cta .eyebrow,
|
||||
.detail-bottom-cta h2,
|
||||
.detail-bottom-cta p {
|
||||
color: #fff;
|
||||
color: var(--theme-accent-contrast);
|
||||
}
|
||||
|
||||
.detail-bottom-cta p {
|
||||
@@ -865,29 +846,9 @@
|
||||
}
|
||||
|
||||
.detail-bottom-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--gap-xs);
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.detail-bottom-actions button {
|
||||
padding: 0 clamp(1rem, 2vw, 1.35rem);
|
||||
border: 0;
|
||||
border-radius: var(--radius-lg);
|
||||
background: #fff;
|
||||
color: var(--theme-accent);
|
||||
box-shadow: 0 18px 42px rgba(0, 0, 0, 0.18);
|
||||
font-size: var(--text-sm);
|
||||
letter-spacing: 0;
|
||||
text-transform: none;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.detail-bottom-actions button:active {
|
||||
transform: translateY(0) scale(0.98);
|
||||
}
|
||||
|
||||
.recommendation-heading {
|
||||
display: block;
|
||||
max-width: 74rem;
|
||||
@@ -931,7 +892,7 @@
|
||||
width: min(86%, 430px);
|
||||
height: auto;
|
||||
object-fit: contain;
|
||||
filter: drop-shadow(0 28px 58px rgba(0, 0, 0, 0.34));
|
||||
filter: var(--shadow-product-card);
|
||||
transition: transform var(--duration-slow) var(--ease-out);
|
||||
}
|
||||
|
||||
@@ -956,6 +917,36 @@
|
||||
line-height: 1.45;
|
||||
}
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
.detail-body-grid {
|
||||
grid-template-columns: 1fr clamp(280px, 24vw, 390px);
|
||||
grid-template-rows: auto 1fr;
|
||||
column-gap: var(--gap-lg);
|
||||
}
|
||||
|
||||
.product-hero {
|
||||
grid-column: 1 / -1;
|
||||
grid-row: 1;
|
||||
}
|
||||
|
||||
.detail-sidebar {
|
||||
grid-column: 2;
|
||||
grid-row: 1 / 3;
|
||||
z-index: 4;
|
||||
padding-top: clamp(10rem, 24svh, 18rem);
|
||||
}
|
||||
|
||||
.detail-sections {
|
||||
grid-column: 1;
|
||||
grid-row: 2;
|
||||
}
|
||||
|
||||
.product-purchase-panel {
|
||||
position: sticky;
|
||||
top: clamp(5rem, 8vw, 6.5rem);
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1180px) {
|
||||
.product-story-grid,
|
||||
.product-meta-section,
|
||||
@@ -963,26 +954,32 @@
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.structure-timeline,
|
||||
.recommendation-grid {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1023px) {
|
||||
.product-hero {
|
||||
grid-template-columns: minmax(0, 1fr) minmax(18rem, 0.72fr);
|
||||
align-items: center;
|
||||
min-height: 100svh;
|
||||
padding-top: clamp(5.6rem, 9vw, 7.4rem);
|
||||
padding-bottom: clamp(1rem, 2vw, 1.6rem);
|
||||
grid-template-columns: 1fr;
|
||||
align-content: start;
|
||||
align-items: start;
|
||||
gap: clamp(1rem, 2.5vw, 1.5rem);
|
||||
min-height: auto;
|
||||
padding-top: clamp(6rem, 10vw, 7.5rem);
|
||||
padding-bottom: clamp(2.5rem, 5vw, 4rem);
|
||||
}
|
||||
|
||||
.product-media-column {
|
||||
grid-column: 1;
|
||||
grid-row: 1;
|
||||
}
|
||||
|
||||
.product-media-column {
|
||||
grid-row: auto;
|
||||
min-height: 0;
|
||||
display: grid;
|
||||
grid-template-columns: 1fr;
|
||||
grid-template-rows: auto minmax(0, 1fr) auto auto;
|
||||
gap: clamp(0.65rem, 1.4vw, 1rem);
|
||||
align-self: stretch;
|
||||
grid-template-rows: auto auto auto auto;
|
||||
gap: clamp(0.8rem, 2vw, 1.25rem);
|
||||
align-self: auto;
|
||||
place-items: stretch;
|
||||
}
|
||||
|
||||
@@ -992,15 +989,20 @@
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.product-hero-copy h1 {
|
||||
max-width: 12ch;
|
||||
font-size: clamp(2.4rem, 6.8vw, 4.8rem);
|
||||
}
|
||||
|
||||
.product-hero-visual {
|
||||
grid-column: auto;
|
||||
grid-row: auto;
|
||||
min-height: 0;
|
||||
height: min(42svh, 420px);
|
||||
height: clamp(18rem, 48svh, 32rem);
|
||||
}
|
||||
|
||||
.product-hero-image {
|
||||
width: min(74%, 430px);
|
||||
width: min(74%, 460px);
|
||||
max-height: 100%;
|
||||
}
|
||||
|
||||
@@ -1008,7 +1010,7 @@
|
||||
.hero-fact-grid {
|
||||
position: static;
|
||||
width: auto;
|
||||
margin-top: var(--gap-sm);
|
||||
margin-top: 0;
|
||||
transform: none;
|
||||
}
|
||||
|
||||
@@ -1017,8 +1019,8 @@
|
||||
}
|
||||
|
||||
.thumb-btn {
|
||||
width: clamp(3.6rem, 6vw, 4.8rem);
|
||||
height: clamp(3.6rem, 6vw, 4.8rem);
|
||||
width: clamp(3.6rem, 8vw, 4.8rem);
|
||||
height: clamp(3.6rem, 8vw, 4.8rem);
|
||||
}
|
||||
|
||||
.hero-fact-grid {
|
||||
@@ -1039,28 +1041,14 @@
|
||||
.hero-fact-grid p {
|
||||
font-size: var(--text-sm);
|
||||
line-height: 1.38;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.product-purchase-panel {
|
||||
grid-column: 2;
|
||||
grid-row: 1;
|
||||
position: relative;
|
||||
justify-self: stretch;
|
||||
align-self: center;
|
||||
width: 100%;
|
||||
max-height: none;
|
||||
overflow: visible;
|
||||
gap: var(--gap-xs);
|
||||
}
|
||||
|
||||
.product-hero-copy h1 {
|
||||
max-width: 12ch;
|
||||
font-size: clamp(2.4rem, 5.5vw, 4.6rem);
|
||||
}
|
||||
|
||||
.structure-timeline,
|
||||
.recommendation-grid {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
width: min(100%, 46rem);
|
||||
max-width: 46rem;
|
||||
margin-inline: auto;
|
||||
gap: var(--gap-sm);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1072,25 +1060,24 @@
|
||||
.product-hero {
|
||||
grid-template-columns: 1fr;
|
||||
align-content: start;
|
||||
gap: clamp(0.5rem, 1.8vw, 0.8rem);
|
||||
min-height: 100svh;
|
||||
padding-top: clamp(6.7rem, 20vw, 7.25rem);
|
||||
padding-bottom: clamp(0.75rem, 2.4vw, 1rem);
|
||||
gap: clamp(0.65rem, 2vw, 1rem);
|
||||
min-height: auto;
|
||||
padding-top: clamp(6.4rem, 18vw, 7.25rem);
|
||||
padding-bottom: clamp(1.5rem, 5vw, 2.5rem);
|
||||
}
|
||||
|
||||
.product-media-column,
|
||||
.product-purchase-panel {
|
||||
.product-media-column {
|
||||
grid-column: 1;
|
||||
grid-row: auto;
|
||||
}
|
||||
|
||||
.product-hero-visual {
|
||||
height: min(29svh, 250px);
|
||||
min-height: 198px;
|
||||
height: clamp(13rem, 32svh, 18rem);
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.product-hero-image {
|
||||
width: min(74%, 292px);
|
||||
width: min(68%, 280px);
|
||||
}
|
||||
|
||||
.character-facts,
|
||||
@@ -1128,10 +1115,11 @@
|
||||
.thumb-btn {
|
||||
width: clamp(2.8rem, 11vw, 3.25rem);
|
||||
height: clamp(2.8rem, 11vw, 3.25rem);
|
||||
min-width: var(--touch-target-min);
|
||||
}
|
||||
|
||||
.product-thumbs {
|
||||
margin-top: -0.6rem;
|
||||
margin-top: 0.2rem;
|
||||
}
|
||||
|
||||
.hero-fact-grid {
|
||||
@@ -1145,12 +1133,12 @@
|
||||
|
||||
.hero-fact-grid span {
|
||||
margin-bottom: 0.25rem;
|
||||
font-size: 0.58rem;
|
||||
font-size: clamp(0.65rem, 2vw, var(--text-xs));
|
||||
letter-spacing: 0.09em;
|
||||
}
|
||||
|
||||
.hero-fact-grid p {
|
||||
font-size: 0.72rem;
|
||||
font-size: clamp(0.78rem, 2.5vw, var(--text-sm));
|
||||
line-height: 1.22;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
@@ -1170,18 +1158,21 @@
|
||||
}
|
||||
|
||||
.size-card {
|
||||
min-height: 62px;
|
||||
padding: 0.55rem 0.6rem;
|
||||
min-width: 0;
|
||||
min-height: 70px;
|
||||
gap: 0.2rem;
|
||||
padding: 0.6rem 0.7rem;
|
||||
}
|
||||
|
||||
.size-title {
|
||||
margin-bottom: 0.25rem;
|
||||
font-size: 0.76rem;
|
||||
font-size: 0.66rem;
|
||||
letter-spacing: 0.14em;
|
||||
}
|
||||
|
||||
.size-card strong {
|
||||
margin-bottom: 0;
|
||||
font-size: 0.95rem;
|
||||
font-size: 0.98rem;
|
||||
white-space: normal;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.size-card small,
|
||||
@@ -1189,9 +1180,9 @@
|
||||
display: none;
|
||||
}
|
||||
|
||||
.buy-button,
|
||||
.purchase-actions .atmos-btn,
|
||||
.restock-button {
|
||||
min-height: 38px;
|
||||
min-height: var(--touch-target-min);
|
||||
font-size: 0.72rem;
|
||||
}
|
||||
|
||||
@@ -1212,11 +1203,6 @@
|
||||
width: min(100%, 24rem);
|
||||
}
|
||||
|
||||
.buy-button,
|
||||
.restock-button {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.review-score-block {
|
||||
justify-items: start;
|
||||
}
|
||||
@@ -1230,6 +1216,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.product-thumbs {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.product-hero-copy h1 {
|
||||
font-size: clamp(1.95rem, 10.2vw, 2.85rem);
|
||||
@@ -1257,6 +1249,66 @@
|
||||
}
|
||||
}
|
||||
|
||||
.mobile-purchase-cta {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@media (max-width: 1023px) {
|
||||
.detail-body-grid {
|
||||
padding-bottom: clamp(4rem, 8vw, 5.5rem);
|
||||
}
|
||||
|
||||
.mobile-purchase-cta {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 500;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: var(--gap-sm);
|
||||
padding: clamp(0.6rem, 1.8vw, 0.85rem) var(--page-x);
|
||||
background: color-mix(in srgb, var(--theme-bg) 88%, transparent);
|
||||
border-top: 1px solid var(--theme-border);
|
||||
backdrop-filter: blur(18px) saturate(1.2);
|
||||
-webkit-backdrop-filter: blur(18px) saturate(1.2);
|
||||
transform: translateY(100%);
|
||||
transition: transform var(--duration-med) var(--ease-out);
|
||||
}
|
||||
|
||||
.mobile-purchase-cta.is-visible {
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
.mobile-purchase-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.15rem;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.mobile-purchase-info span {
|
||||
color: var(--theme-text-muted);
|
||||
font-size: var(--text-xs);
|
||||
letter-spacing: 0.12em;
|
||||
text-transform: uppercase;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.mobile-purchase-info strong {
|
||||
color: var(--theme-text);
|
||||
font-size: var(--text-lg);
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.mobile-purchase-cta .atmos-btn {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.is-transition-arriving .product-hero-image,
|
||||
.is-transition-arriving [data-product-transition-reveal] {
|
||||
|
||||
@@ -1,13 +1,54 @@
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import { useEffect, useMemo, useRef, useState } from "react";
|
||||
import { Link, useParams } from "react-router";
|
||||
import perfumes from "../data/perfumes";
|
||||
import SharedNavbar from "./SharedNavbar";
|
||||
import PageMeta from "./seo/PageMeta";
|
||||
import { useProductTransition } from "../transitions/ProductTransitionContext";
|
||||
import { formatChf } from "../shop/money";
|
||||
import { useShop } from "../shop/useShop";
|
||||
import { formatChf } from "../shop/money";
|
||||
import "./ProductDetailPage.css";
|
||||
|
||||
const STORY_PANEL_IMAGE = "/placeholder-character-panel.jpg";
|
||||
// TODO: replace with the real production origin once available.
|
||||
const SITE_ORIGIN = "https://atmos.example";
|
||||
|
||||
function buildProductJsonLd(perfume) {
|
||||
const priceMatch = String(perfume.prices?.full || "").match(/(\d+)/);
|
||||
const price = priceMatch ? Number(priceMatch[1]) : undefined;
|
||||
const reviews = perfume.reviews;
|
||||
|
||||
const data = {
|
||||
"@context": "https://schema.org",
|
||||
"@type": "Product",
|
||||
name: perfume.name,
|
||||
sku: `${perfume.id}-${perfume.slug}`,
|
||||
description: `${perfume.text} ${perfume.mood}`.trim(),
|
||||
image: `${SITE_ORIGIN}${perfume.image}`,
|
||||
brand: { "@type": "Brand", name: "atmos" },
|
||||
category: "Parfum",
|
||||
};
|
||||
|
||||
if (price !== undefined) {
|
||||
data.offers = {
|
||||
"@type": "Offer",
|
||||
priceCurrency: "CHF",
|
||||
price,
|
||||
availability: "https://schema.org/InStock",
|
||||
url: `${SITE_ORIGIN}/duft/${perfume.slug}`,
|
||||
};
|
||||
}
|
||||
|
||||
if (reviews?.score && reviews?.total) {
|
||||
data.aggregateRating = {
|
||||
"@type": "AggregateRating",
|
||||
ratingValue: reviews.score,
|
||||
reviewCount: reviews.total,
|
||||
bestRating: 5,
|
||||
worstRating: 1,
|
||||
};
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
const priceToCents = (price) => {
|
||||
const match = String(price).match(/(\d+)/);
|
||||
@@ -34,17 +75,17 @@ function ProductPurchasePanel({
|
||||
subscribeToProduct,
|
||||
}) {
|
||||
const selectedProductId = `${perfume.slug}-${selectedSize === "sample" ? "sample" : "full"}`;
|
||||
const selectedProductLabel = selectedSize === "sample" ? "Sample" : "Full Size";
|
||||
const selectedProductLabel = selectedSize === "sample" ? "Probe" : "50 ml Flakon";
|
||||
const sizeOptions = [
|
||||
{
|
||||
key: "full",
|
||||
title: "Full Size 50ml",
|
||||
title: "50 ml Flakon",
|
||||
price: perfume.prices.full,
|
||||
note: "Nachkauf, 500+ Anwendungen",
|
||||
},
|
||||
{
|
||||
key: "sample",
|
||||
title: "Sample 2ml",
|
||||
title: "Probe 2 ml",
|
||||
price: perfume.prices.sample,
|
||||
note: "Zum Testen, ca. 20 Anwendungen",
|
||||
},
|
||||
@@ -78,13 +119,13 @@ function ProductPurchasePanel({
|
||||
|
||||
<div className="purchase-actions">
|
||||
<button
|
||||
className="buy-button"
|
||||
className="atmos-btn atmos-btn--primary atmos-btn--block atmos-btn--uppercase"
|
||||
type="button"
|
||||
onClick={() =>
|
||||
addToCart(
|
||||
selectedProductId,
|
||||
1,
|
||||
`${perfume.name} ${selectedProductLabel} added.`
|
||||
`${perfume.name} ${selectedProductLabel} wurde in den Warenkorb gelegt.`
|
||||
).catch(() => {})
|
||||
}
|
||||
>
|
||||
@@ -92,11 +133,11 @@ function ProductPurchasePanel({
|
||||
</button>
|
||||
|
||||
<button
|
||||
className="restock-button"
|
||||
className="atmos-btn atmos-btn--outline atmos-btn--block atmos-btn--uppercase atmos-btn--sm restock-button"
|
||||
type="button"
|
||||
onClick={() => subscribeToProduct(selectedProductId, "restock").catch(() => {})}
|
||||
>
|
||||
Restock Update abonnieren
|
||||
Verfügbarkeits-Update abonnieren
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -104,7 +145,7 @@ function ProductPurchasePanel({
|
||||
<div>
|
||||
<strong>Discovery Set wird angerechnet</strong>
|
||||
<p>
|
||||
Sample- und Set-Guthaben werden beim Full-Size-Kauf automatisch
|
||||
Proben- und Set-Guthaben werden beim 50-ml-Kauf automatisch
|
||||
abgezogen.
|
||||
</p>
|
||||
{discountPreviewCents > 0 && (
|
||||
@@ -114,23 +155,18 @@ function ProductPurchasePanel({
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
<Link to="/discovery-set">Zum Set</Link>
|
||||
<Link
|
||||
to="/discovery-set"
|
||||
className="atmos-btn atmos-btn--outline atmos-btn--sm"
|
||||
>
|
||||
Zum Set
|
||||
</Link>
|
||||
</div>
|
||||
</aside>
|
||||
);
|
||||
}
|
||||
|
||||
function ProductHero({
|
||||
perfume,
|
||||
selectedImage,
|
||||
setSelectedImage,
|
||||
selectedSize,
|
||||
setSelectedSize,
|
||||
selectedPriceCents,
|
||||
discountPreviewCents,
|
||||
addToCart,
|
||||
subscribeToProduct,
|
||||
}) {
|
||||
function ProductHero({ perfume, selectedImage, setSelectedImage }) {
|
||||
const galleryImages = [...new Set([perfume.image, ...(perfume.gallery || [])])].slice(0, 3);
|
||||
|
||||
return (
|
||||
@@ -144,10 +180,12 @@ function ProductHero({
|
||||
<div className="product-hero-visual">
|
||||
<img
|
||||
src={selectedImage}
|
||||
alt={perfume.name}
|
||||
alt={`${perfume.name} Parfumflakon`}
|
||||
className="product-hero-image"
|
||||
data-product-transition-target={perfume.slug}
|
||||
decoding="async"
|
||||
loading="eager"
|
||||
fetchPriority="high"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -181,15 +219,6 @@ function ProductHero({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ProductPurchasePanel
|
||||
perfume={perfume}
|
||||
selectedSize={selectedSize}
|
||||
setSelectedSize={setSelectedSize}
|
||||
selectedPriceCents={selectedPriceCents}
|
||||
discountPreviewCents={discountPreviewCents}
|
||||
addToCart={addToCart}
|
||||
subscribeToProduct={subscribeToProduct}
|
||||
/>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -217,8 +246,8 @@ function ProductStorySection({ perfume }) {
|
||||
<div className="story-visual-panel" data-reveal="fade">
|
||||
<img
|
||||
className="story-visual-image"
|
||||
src={STORY_PANEL_IMAGE}
|
||||
alt=""
|
||||
src={perfume.storyVisualImage || perfume.image}
|
||||
alt={`Material- und Stimmungsstudie zu ${perfume.name}`}
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
/>
|
||||
@@ -236,10 +265,23 @@ function ProductStorySection({ perfume }) {
|
||||
}
|
||||
|
||||
function ProductStructureSection({ perfume }) {
|
||||
const phaseVisualImages = perfume.phaseVisualImages || [];
|
||||
const phaseGroups = [
|
||||
{ label: "Top Notes / 0-1 h", notes: perfume.phases.top },
|
||||
{ label: "Heart Notes / 1-4 h", notes: perfume.phases.heart },
|
||||
{ label: "Base Notes / 4 h+", notes: perfume.phases.base },
|
||||
{
|
||||
label: "Top Notes / 0-1 h",
|
||||
notes: perfume.phases.top,
|
||||
visualImage: phaseVisualImages[0],
|
||||
},
|
||||
{
|
||||
label: "Heart Notes / 1-4 h",
|
||||
notes: perfume.phases.heart,
|
||||
visualImage: phaseVisualImages[1],
|
||||
},
|
||||
{
|
||||
label: "Base Notes / 4 h+",
|
||||
notes: perfume.phases.base,
|
||||
visualImage: phaseVisualImages[2],
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
@@ -251,7 +293,16 @@ function ProductStructureSection({ perfume }) {
|
||||
|
||||
<div className="structure-timeline">
|
||||
{phaseGroups.map((phase, index) => (
|
||||
<article className="structure-phase-card" key={phase.label} data-reveal="fade">
|
||||
<article
|
||||
className="structure-phase-card"
|
||||
key={phase.label}
|
||||
data-reveal="fade"
|
||||
style={
|
||||
phase.visualImage
|
||||
? { "--phase-visual-image": `url(${phase.visualImage})` }
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
<span className="structure-index">0{index + 1}</span>
|
||||
<h3>{phase.label}</h3>
|
||||
<div>
|
||||
@@ -364,7 +415,7 @@ function ProductReviews({
|
||||
<div className={`review-panel ${showReviewDetails ? "is-open" : ""}`} data-reveal="fade">
|
||||
<button
|
||||
type="button"
|
||||
className="review-toggle"
|
||||
className="atmos-btn atmos-btn--outline atmos-btn--block atmos-btn--split atmos-btn--uppercase review-toggle"
|
||||
onClick={() => setShowReviewDetails((prev) => !prev)}
|
||||
aria-expanded={showReviewDetails}
|
||||
>
|
||||
@@ -389,7 +440,11 @@ function ProductReviews({
|
||||
</div>
|
||||
))}
|
||||
|
||||
<button type="button" className="review-write-button" disabled>
|
||||
<button
|
||||
type="button"
|
||||
className="atmos-btn atmos-btn--outline atmos-btn--block atmos-btn--uppercase"
|
||||
disabled
|
||||
>
|
||||
Bewertung schreiben
|
||||
</button>
|
||||
</div>
|
||||
@@ -401,33 +456,35 @@ function ProductReviews({
|
||||
|
||||
function ProductTestingCTA({ perfume, addToCart }) {
|
||||
return (
|
||||
<section className="detail-bottom-cta" data-reveal-group>
|
||||
<section className="detail-bottom-cta" data-reveal-group data-on-accent>
|
||||
<div>
|
||||
<span className="eyebrow" data-reveal="fade">Lieber erst testen?</span>
|
||||
<h2 data-reveal="lines">Sample oder Discovery Set.</h2>
|
||||
<h2 data-reveal="lines">Probe oder Discovery Set.</h2>
|
||||
<p data-reveal="fade">
|
||||
Bestelle ein 2ml Sample für CHF 12 oder das komplette Discovery Set mit
|
||||
allen 6 Düften für CHF 48. Beide werden beim späteren Full-Size-Kauf
|
||||
Bestelle eine 2-ml-Probe für CHF 12 oder das komplette Discovery Set mit
|
||||
allen 6 Düften für CHF 48. Beide werden beim späteren 50-ml-Kauf
|
||||
vollständig angerechnet.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="detail-bottom-actions" data-reveal="fade">
|
||||
<div className="detail-bottom-actions atmos-btn-row atmos-btn-row--responsive" data-reveal="fade">
|
||||
<button
|
||||
type="button"
|
||||
className="atmos-btn atmos-btn--primary"
|
||||
onClick={() =>
|
||||
addToCart(`${perfume.slug}-sample`, 1, `${perfume.name} Sample added.`).catch(
|
||||
addToCart(`${perfume.slug}-sample`, 1, `${perfume.name} Probe wurde in den Warenkorb gelegt.`).catch(
|
||||
() => {}
|
||||
)
|
||||
}
|
||||
>
|
||||
Sample bestellen - {perfume.prices.sample}
|
||||
Probe bestellen — {perfume.prices.sample}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => addToCart("discovery-set", 1, "Discovery Set added.").catch(() => {})}
|
||||
className="atmos-btn atmos-btn--secondary"
|
||||
onClick={() => addToCart("discovery-set", 1, "Discovery Set wurde in den Warenkorb gelegt.").catch(() => {})}
|
||||
>
|
||||
Discovery Set - CHF 48
|
||||
Discovery Set — CHF 48
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
@@ -474,6 +531,33 @@ function ProductRecommendations({ currentSlug, startProductTransition }) {
|
||||
);
|
||||
}
|
||||
|
||||
function MobilePurchaseCTA({ perfume, selectedSize, addToCart, visible }) {
|
||||
const selectedProductId = `${perfume.slug}-${selectedSize === "sample" ? "sample" : "full"}`;
|
||||
const selectedProductLabel = selectedSize === "sample" ? "Probe" : "50 ml Flakon";
|
||||
|
||||
return (
|
||||
<div className={`mobile-purchase-cta ${visible ? "is-visible" : ""}`}>
|
||||
<div className="mobile-purchase-info">
|
||||
<span>{perfume.name}</span>
|
||||
<strong>{perfume.prices[selectedSize]}</strong>
|
||||
</div>
|
||||
<button
|
||||
className="atmos-btn atmos-btn--primary atmos-btn--uppercase"
|
||||
type="button"
|
||||
onClick={() =>
|
||||
addToCart(
|
||||
selectedProductId,
|
||||
1,
|
||||
`${perfume.name} ${selectedProductLabel} wurde in den Warenkorb gelegt.`
|
||||
).catch(() => {})
|
||||
}
|
||||
>
|
||||
Kaufen
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function ProductDetailContent({ perfumeSlug }) {
|
||||
const { addToCart, subscribeToProduct, user } = useShop();
|
||||
const { activeSlug, phase, startProductTransition } = useProductTransition();
|
||||
@@ -489,6 +573,8 @@ function ProductDetailContent({ perfumeSlug }) {
|
||||
const [selectedSize, setSelectedSize] = useState("full");
|
||||
const [showReviewDetails, setShowReviewDetails] = useState(false);
|
||||
const [commentPage, setCommentPage] = useState(0);
|
||||
const sidebarRef = useRef(null);
|
||||
const [isPanelVisible, setIsPanelVisible] = useState(true);
|
||||
const selectedPriceCents = priceToCents(perfume.prices[selectedSize]);
|
||||
const sampleCredit = user?.sampleCredits?.find(
|
||||
(credit) => credit.slug === perfume.slug && credit.status === "available"
|
||||
@@ -545,40 +631,80 @@ function ProductDetailContent({ perfumeSlug }) {
|
||||
return () => window.clearInterval(interval);
|
||||
}, [safeCommentPages.length]);
|
||||
|
||||
useEffect(() => {
|
||||
const el = sidebarRef.current;
|
||||
if (!el) return;
|
||||
const observer = new IntersectionObserver(
|
||||
([entry]) => setIsPanelVisible(entry.isIntersecting),
|
||||
{ threshold: 0 }
|
||||
);
|
||||
observer.observe(el);
|
||||
return () => observer.disconnect();
|
||||
}, []);
|
||||
|
||||
const productJsonLd = useMemo(() => buildProductJsonLd(perfume), [perfume]);
|
||||
|
||||
return (
|
||||
<div className={`detail-page ${isTransitionArriving ? "is-transition-arriving" : ""}`}>
|
||||
<PageMeta
|
||||
title={`${perfume.name} · Edition ${perfume.id}`}
|
||||
description={`${perfume.text} ${perfume.mood} ${perfume.concentration}.`}
|
||||
path={`/duft/${perfume.slug}`}
|
||||
image={perfume.image}
|
||||
/>
|
||||
<script
|
||||
type="application/ld+json"
|
||||
dangerouslySetInnerHTML={{ __html: JSON.stringify(productJsonLd) }}
|
||||
/>
|
||||
<SharedNavbar variant="hero" brandMode="back" />
|
||||
|
||||
<main className="shell">
|
||||
<ProductHero
|
||||
perfume={perfume}
|
||||
selectedImage={selectedImage}
|
||||
setSelectedImage={setSelectedImage}
|
||||
selectedSize={selectedSize}
|
||||
setSelectedSize={handleSizeSelection}
|
||||
selectedPriceCents={selectedPriceCents}
|
||||
discountPreviewCents={discountPreviewCents}
|
||||
addToCart={addToCart}
|
||||
subscribeToProduct={subscribeToProduct}
|
||||
/>
|
||||
<main id="main-content" className="shell">
|
||||
<div className="detail-body-grid">
|
||||
<ProductHero
|
||||
perfume={perfume}
|
||||
selectedImage={selectedImage}
|
||||
setSelectedImage={setSelectedImage}
|
||||
/>
|
||||
|
||||
<ProductStorySection perfume={perfume} />
|
||||
<ProductStructureSection perfume={perfume} />
|
||||
<ProductMetaSection perfume={perfume} />
|
||||
<ProductReviews
|
||||
reviewSummary={reviewSummary}
|
||||
safeCommentPages={safeCommentPages}
|
||||
commentPage={commentPage}
|
||||
setCommentPage={setCommentPage}
|
||||
showReviewDetails={showReviewDetails}
|
||||
setShowReviewDetails={setShowReviewDetails}
|
||||
/>
|
||||
<ProductTestingCTA perfume={perfume} addToCart={addToCart} />
|
||||
<ProductRecommendations
|
||||
currentSlug={perfume.slug}
|
||||
startProductTransition={startProductTransition}
|
||||
/>
|
||||
<div className="detail-sidebar" ref={sidebarRef}>
|
||||
<ProductPurchasePanel
|
||||
perfume={perfume}
|
||||
selectedSize={selectedSize}
|
||||
setSelectedSize={handleSizeSelection}
|
||||
selectedPriceCents={selectedPriceCents}
|
||||
discountPreviewCents={discountPreviewCents}
|
||||
addToCart={addToCart}
|
||||
subscribeToProduct={subscribeToProduct}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="detail-sections">
|
||||
<ProductStorySection perfume={perfume} />
|
||||
<ProductStructureSection perfume={perfume} />
|
||||
<ProductMetaSection perfume={perfume} />
|
||||
<ProductReviews
|
||||
reviewSummary={reviewSummary}
|
||||
safeCommentPages={safeCommentPages}
|
||||
commentPage={commentPage}
|
||||
setCommentPage={setCommentPage}
|
||||
showReviewDetails={showReviewDetails}
|
||||
setShowReviewDetails={setShowReviewDetails}
|
||||
/>
|
||||
<ProductTestingCTA perfume={perfume} addToCart={addToCart} />
|
||||
<ProductRecommendations
|
||||
currentSlug={perfume.slug}
|
||||
startProductTransition={startProductTransition}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<MobilePurchaseCTA
|
||||
perfume={perfume}
|
||||
selectedSize={selectedSize}
|
||||
addToCart={addToCart}
|
||||
visible={!isPanelVisible}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
object-fit: contain;
|
||||
transform-origin: 0 0;
|
||||
will-change: transform, opacity;
|
||||
filter: drop-shadow(0 34px 82px rgba(0, 0, 0, 0.42));
|
||||
filter: var(--shadow-product);
|
||||
}
|
||||
|
||||
body.product-transition-active {
|
||||
|
||||
@@ -4,58 +4,84 @@ import { useTheme } from "../theme/useTheme";
|
||||
import "../style/navbar.css";
|
||||
|
||||
function SharedNavbar({ variant = "hero", active = "", brandMode = "logo" }) {
|
||||
const { cart, openCart, openProfile, user } = useShop();
|
||||
const { cart, openCart, openProfile, panelOpen, panelType, user } = useShop();
|
||||
const { isLight, toggleTheme } = useTheme();
|
||||
const cartLabel =
|
||||
cart.total_quantity > 0 ? `Cart ${cart.total_quantity}` : "Cart";
|
||||
const cartCount = cart.total_quantity || 0;
|
||||
const cartLabel = cartCount > 0 ? `Warenkorb ${cartCount}` : "Warenkorb";
|
||||
const cartCompactLabel = cartCount > 0 ? `Korb ${cartCount}` : "Korb";
|
||||
const cartAriaLabel =
|
||||
cartCount > 0
|
||||
? `Warenkorb mit ${cartCount} ${cartCount === 1 ? "Artikel" : "Artikeln"} öffnen`
|
||||
: "Warenkorb öffnen";
|
||||
const logoSrc =
|
||||
variant === "hero" ? "/atmos-logo-light.svg" : "/atmos-logo-dark.svg";
|
||||
const brandIsBack = brandMode === "back";
|
||||
|
||||
return (
|
||||
<nav className={`navbar navbar--${variant}`} aria-label="Hauptnavigation">
|
||||
<div className="nav-pill">
|
||||
<Link
|
||||
to="/"
|
||||
className={`nav-link nav-link--brand ${brandIsBack ? "nav-link--back" : ""} ${
|
||||
active === "atmos" ? "active" : ""
|
||||
}`}
|
||||
aria-label={brandIsBack ? "Zur Startseite" : "Atmos Startseite"}
|
||||
>
|
||||
{brandIsBack ? (
|
||||
<>
|
||||
<span className="nav-back-icon" aria-hidden="true" />
|
||||
<span>Zurück</span>
|
||||
</>
|
||||
) : (
|
||||
<img src={logoSrc} alt="" className="nav-brand-logo" />
|
||||
)}
|
||||
</Link>
|
||||
<Link
|
||||
to="/discovery-set"
|
||||
className={`nav-link ${active === "testen" ? "active" : ""}`}
|
||||
>
|
||||
Testen
|
||||
</Link>
|
||||
<button type="button" className="nav-link nav-button" onClick={openCart}>
|
||||
{cartLabel}
|
||||
</button>
|
||||
<button type="button" className="nav-link nav-button" onClick={openProfile}>
|
||||
{user ? "Profile" : "Profile"}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className={`nav-link nav-button nav-theme-switch ${isLight ? "is-light" : ""}`}
|
||||
onClick={toggleTheme}
|
||||
aria-label={isLight ? "Switch to dark mode" : "Switch to light mode"}
|
||||
aria-pressed={isLight}
|
||||
>
|
||||
<span className="nav-theme-switch__track" aria-hidden="true">
|
||||
<span className="nav-theme-switch__thumb" />
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
</nav>
|
||||
<header className={`site-header site-header--${variant}`}>
|
||||
<nav className={`navbar navbar--${variant}`} aria-label="Hauptnavigation">
|
||||
<div className="nav-pill">
|
||||
<Link
|
||||
to="/"
|
||||
className={`nav-link nav-link--brand ${brandIsBack ? "nav-link--back" : ""} ${
|
||||
active === "atmos" ? "active" : ""
|
||||
}`}
|
||||
aria-label={brandIsBack ? "Zur Startseite" : "Atmos Startseite"}
|
||||
>
|
||||
{brandIsBack ? (
|
||||
<>
|
||||
<span className="nav-back-icon" aria-hidden="true" />
|
||||
<span>Zurück</span>
|
||||
</>
|
||||
) : (
|
||||
<img src={logoSrc} alt="" className="nav-brand-logo" />
|
||||
)}
|
||||
</Link>
|
||||
<Link
|
||||
to="/discovery-set"
|
||||
className={`nav-link ${active === "testen" ? "active" : ""}`}
|
||||
>
|
||||
Testen
|
||||
</Link>
|
||||
<button
|
||||
type="button"
|
||||
className="nav-link nav-button nav-link--cart"
|
||||
onClick={openCart}
|
||||
aria-haspopup="dialog"
|
||||
aria-controls="shop-drawer"
|
||||
aria-expanded={panelOpen && panelType === "cart"}
|
||||
aria-label={cartAriaLabel}
|
||||
>
|
||||
<span className="nav-label nav-label--full">{cartLabel}</span>
|
||||
<span className="nav-label nav-label--compact">
|
||||
{cartCompactLabel}
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="nav-link nav-button"
|
||||
onClick={openProfile}
|
||||
aria-haspopup="dialog"
|
||||
aria-controls="shop-drawer"
|
||||
aria-expanded={panelOpen && panelType === "profile"}
|
||||
aria-label={user ? "Profil öffnen" : "Anmelden oder Profil öffnen"}
|
||||
>
|
||||
Profil
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className={`nav-link nav-button nav-theme-switch ${isLight ? "is-light" : ""}`}
|
||||
onClick={toggleTheme}
|
||||
aria-label="Light Mode"
|
||||
aria-pressed={isLight}
|
||||
>
|
||||
<span className="nav-theme-switch__track" aria-hidden="true">
|
||||
<span className="nav-theme-switch__thumb" />
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,40 +1,109 @@
|
||||
import { useState } from "react";
|
||||
import { useEffect, useId, useRef, useState } from "react";
|
||||
import { Link } from "react-router";
|
||||
import { formatChf } from "../shop/money";
|
||||
import { useShop } from "../shop/useShop";
|
||||
import "./ShopDrawer.css";
|
||||
|
||||
const paymentMethods = [
|
||||
{ key: "Bill", badge: "BILL", label: "Bill" },
|
||||
{ key: "Card", badge: "CARD", label: "Card" },
|
||||
{ key: "Bill", badge: "RE", label: "Rechnung" },
|
||||
{ key: "Card", badge: "KA", label: "Karte" },
|
||||
{ key: "Twint", badge: "TW", label: "Twint" },
|
||||
{ key: "PayPal", badge: "PP", label: "PayPal" },
|
||||
];
|
||||
|
||||
const notificationLabels = [
|
||||
["drops_enabled", "New Drops"],
|
||||
["restocks_enabled", "Restocks"],
|
||||
["small_batch_enabled", "Small Batch Releases"],
|
||||
["discovery_enabled", "Discovery Set Updates"],
|
||||
["drops_enabled", "Neue Drops"],
|
||||
["restocks_enabled", "Verfügbarkeits-Updates"],
|
||||
["small_batch_enabled", "Small-Batch-Veröffentlichungen"],
|
||||
["discovery_enabled", "Discovery-Set-Updates"],
|
||||
];
|
||||
|
||||
function Field({ label, value, onChange, type = "text", readOnly = false }) {
|
||||
const discoveryStatusLabels = {
|
||||
"No Discount atm": "Noch kein Rabatt",
|
||||
"Discount already used": "Rabatt bereits genutzt",
|
||||
"Discount available": "Rabatt verfügbar",
|
||||
};
|
||||
|
||||
const creditStatusLabels = {
|
||||
available: "verfügbar",
|
||||
used: "genutzt",
|
||||
};
|
||||
|
||||
const formatDiscoveryStatus = (status) => discoveryStatusLabels[status] || status;
|
||||
const formatCreditStatus = (status) => creditStatusLabels[status] || status;
|
||||
|
||||
const focusableSelector = [
|
||||
"a[href]",
|
||||
"button:not([disabled])",
|
||||
"input:not([disabled]):not([type='hidden'])",
|
||||
"select:not([disabled])",
|
||||
"textarea:not([disabled])",
|
||||
"[tabindex]:not([tabindex='-1'])",
|
||||
].join(",");
|
||||
|
||||
const getFocusableElements = (container) =>
|
||||
Array.from(container.querySelectorAll(focusableSelector)).filter(
|
||||
(element) =>
|
||||
element instanceof HTMLElement &&
|
||||
element.tabIndex >= 0 &&
|
||||
!element.closest("[inert]") &&
|
||||
element.getClientRects().length > 0
|
||||
);
|
||||
|
||||
function Field({
|
||||
label,
|
||||
value,
|
||||
onChange,
|
||||
type = "text",
|
||||
readOnly = false,
|
||||
id,
|
||||
name,
|
||||
autoComplete,
|
||||
inputMode,
|
||||
describedBy,
|
||||
invalid = false,
|
||||
}) {
|
||||
const generatedId = useId();
|
||||
const fallbackName = label
|
||||
.toLowerCase()
|
||||
.replace(/[^a-z0-9]+/g, "_")
|
||||
.replace(/^_|_$/g, "");
|
||||
const fieldName = name || fallbackName;
|
||||
const fieldId = id || `shop-field-${fieldName}-${generatedId}`;
|
||||
|
||||
return (
|
||||
<label className="shop-field">
|
||||
<label className="drawer-field" htmlFor={fieldId}>
|
||||
<span>{label}</span>
|
||||
<input
|
||||
id={fieldId}
|
||||
name={fieldName}
|
||||
type={type}
|
||||
value={value}
|
||||
readOnly={readOnly}
|
||||
autoComplete={autoComplete}
|
||||
inputMode={inputMode}
|
||||
aria-describedby={describedBy}
|
||||
aria-invalid={invalid || undefined}
|
||||
onChange={(event) => onChange?.(event.target.value)}
|
||||
/>
|
||||
</label>
|
||||
);
|
||||
}
|
||||
|
||||
function DrawerError({ id, children }) {
|
||||
if (!children) return null;
|
||||
|
||||
return (
|
||||
<p className="drawer-error" id={id} role="alert">
|
||||
{children}
|
||||
</p>
|
||||
);
|
||||
}
|
||||
|
||||
function AuthPanel() {
|
||||
const { busy, error, login, register } = useShop();
|
||||
const [mode, setMode] = useState("login");
|
||||
const errorId = "auth-error";
|
||||
const [form, setForm] = useState({
|
||||
first_name: "",
|
||||
surname: "",
|
||||
@@ -54,38 +123,80 @@ function AuthPanel() {
|
||||
};
|
||||
|
||||
return (
|
||||
<form className="drawer-section auth-panel" onSubmit={submit}>
|
||||
<span className="drawer-kicker">{mode === "login" ? "LOGIN" : "REGISTER"}</span>
|
||||
<h2>{mode === "login" ? "Welcome back." : "Create your atmos account."}</h2>
|
||||
<form className="drawer-stack" onSubmit={submit}>
|
||||
<section className="drawer-section">
|
||||
<span className="drawer-eyebrow">{mode === "login" ? "Anmelden" : "Registrieren"}</span>
|
||||
<h2 className="drawer-heading">
|
||||
{mode === "login" ? "Willkommen zurück." : "Konto erstellen."}
|
||||
</h2>
|
||||
|
||||
{mode === "register" && (
|
||||
<div className="drawer-grid drawer-grid--two">
|
||||
<Field label="Name" value={form.first_name} onChange={(value) => update("first_name", value)} />
|
||||
<Field label="Surname" value={form.surname} onChange={(value) => update("surname", value)} />
|
||||
<div className="drawer-form">
|
||||
{mode === "register" && (
|
||||
<div className="drawer-grid drawer-grid--two">
|
||||
<Field
|
||||
label="Name"
|
||||
name="first_name"
|
||||
value={form.first_name}
|
||||
autoComplete="given-name"
|
||||
describedBy={error ? errorId : undefined}
|
||||
invalid={!!error}
|
||||
onChange={(value) => update("first_name", value)}
|
||||
/>
|
||||
<Field
|
||||
label="Nachname"
|
||||
name="surname"
|
||||
value={form.surname}
|
||||
autoComplete="family-name"
|
||||
describedBy={error ? errorId : undefined}
|
||||
invalid={!!error}
|
||||
onChange={(value) => update("surname", value)}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<Field
|
||||
id="auth-email"
|
||||
label="E-Mail"
|
||||
name="email"
|
||||
type="email"
|
||||
value={form.email}
|
||||
autoComplete="email"
|
||||
inputMode="email"
|
||||
describedBy={error ? errorId : undefined}
|
||||
invalid={!!error}
|
||||
onChange={(value) => update("email", value)}
|
||||
/>
|
||||
<Field
|
||||
id="auth-password"
|
||||
label="Passwort"
|
||||
name="password"
|
||||
type="password"
|
||||
value={form.password}
|
||||
autoComplete={mode === "login" ? "current-password" : "new-password"}
|
||||
describedBy={error ? errorId : undefined}
|
||||
invalid={!!error}
|
||||
onChange={(value) => update("password", value)}
|
||||
/>
|
||||
|
||||
<DrawerError id={errorId}>{error}</DrawerError>
|
||||
|
||||
<button
|
||||
className="atmos-btn atmos-btn--primary atmos-btn--block"
|
||||
type="submit"
|
||||
disabled={busy}
|
||||
>
|
||||
{mode === "login" ? "Anmelden" : "Registrieren"}
|
||||
</button>
|
||||
|
||||
<button
|
||||
className="atmos-btn atmos-btn--ghost atmos-btn--block atmos-btn--sm"
|
||||
type="button"
|
||||
onClick={() => setMode((current) => (current === "login" ? "register" : "login"))}
|
||||
>
|
||||
{mode === "login" ? "Konto erstellen" : "Bestehendes Konto nutzen"}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<Field label="Email address" value={form.email} onChange={(value) => update("email", value)} />
|
||||
<Field
|
||||
label="Password"
|
||||
type="password"
|
||||
value={form.password}
|
||||
onChange={(value) => update("password", value)}
|
||||
/>
|
||||
|
||||
{error && <p className="drawer-error">{error}</p>}
|
||||
|
||||
<button className="drawer-primary" type="submit" disabled={busy}>
|
||||
{mode === "login" ? "Login" : "Register"}
|
||||
</button>
|
||||
|
||||
<button
|
||||
className="drawer-secondary"
|
||||
type="button"
|
||||
onClick={() => setMode((current) => (current === "login" ? "register" : "login"))}
|
||||
>
|
||||
{mode === "login" ? "Create account" : "Use existing account"}
|
||||
</button>
|
||||
</section>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
@@ -107,6 +218,7 @@ function CartPanel() {
|
||||
city: user?.city || "",
|
||||
}));
|
||||
const [paymentMethod, setPaymentMethod] = useState("Bill");
|
||||
const errorId = "cart-error";
|
||||
|
||||
const updateAddress = (key, value) =>
|
||||
setAddress((current) => ({ ...current, [key]: value }));
|
||||
@@ -119,109 +231,166 @@ function CartPanel() {
|
||||
return (
|
||||
<form className="drawer-stack" onSubmit={submit}>
|
||||
<section className="drawer-section">
|
||||
<span className="drawer-kicker">CART</span>
|
||||
<span className="drawer-eyebrow">Warenkorb</span>
|
||||
{cart.items.length === 0 ? (
|
||||
<p className="drawer-muted">Your cart is empty.</p>
|
||||
<p className="drawer-muted">Dein Warenkorb ist leer.</p>
|
||||
) : (
|
||||
<div className="cart-items">
|
||||
{cart.items.map((item) => (
|
||||
<article className="cart-item" key={item.product_id}>
|
||||
<div>
|
||||
<h3>{item.product.name}</h3>
|
||||
<p>
|
||||
{item.product.size_label} · {formatChf(item.product.price_cents)}
|
||||
</p>
|
||||
</div>
|
||||
{cart.items.map((item) => {
|
||||
const productName = item.product.name;
|
||||
|
||||
<div className="cart-controls">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => updateCartQuantity(item.product_id, item.quantity - 1)}
|
||||
>
|
||||
-
|
||||
</button>
|
||||
<span>{item.quantity}</span>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => updateCartQuantity(item.product_id, item.quantity + 1)}
|
||||
>
|
||||
+
|
||||
</button>
|
||||
</div>
|
||||
return (
|
||||
<article className="cart-item" key={item.product_id}>
|
||||
<div className="cart-item-info">
|
||||
<h3>{productName}</h3>
|
||||
<p>
|
||||
{item.product.size_label} · {formatChf(item.product.price_cents)}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<button
|
||||
className="cart-remove"
|
||||
type="button"
|
||||
onClick={() => removeCartItem(item.product_id)}
|
||||
>
|
||||
Remove
|
||||
</button>
|
||||
</article>
|
||||
))}
|
||||
<div
|
||||
className="cart-controls"
|
||||
role="group"
|
||||
aria-label={`${productName} Menge: ${item.quantity}`}
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
aria-label={`${productName} Menge verringern`}
|
||||
onClick={() => updateCartQuantity(item.product_id, item.quantity - 1)}
|
||||
>
|
||||
−
|
||||
</button>
|
||||
<span aria-live="polite">{item.quantity}</span>
|
||||
<button
|
||||
type="button"
|
||||
aria-label={`${productName} Menge erhoehen`}
|
||||
onClick={() => updateCartQuantity(item.product_id, item.quantity + 1)}
|
||||
>
|
||||
+
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<button
|
||||
className="atmos-btn atmos-btn--ghost atmos-btn--sm"
|
||||
type="button"
|
||||
aria-label={`${productName} aus dem Warenkorb entfernen`}
|
||||
onClick={() => removeCartItem(item.product_id)}
|
||||
>
|
||||
Entfernen
|
||||
</button>
|
||||
</article>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
|
||||
<section className="drawer-section">
|
||||
<span className="drawer-kicker">SHIPPING</span>
|
||||
<span className="drawer-eyebrow">Versand</span>
|
||||
<div className="drawer-grid drawer-grid--two">
|
||||
<Field label="Street Name" value={address.street_name} onChange={(value) => updateAddress("street_name", value)} />
|
||||
<Field label="House Number" value={address.house_number} onChange={(value) => updateAddress("house_number", value)} />
|
||||
<Field label="ZIP Code" value={address.zip_code} onChange={(value) => updateAddress("zip_code", value)} />
|
||||
<Field label="City" value={address.city} onChange={(value) => updateAddress("city", value)} />
|
||||
<Field
|
||||
label="Strasse"
|
||||
value={address.street_name}
|
||||
describedBy={error ? errorId : undefined}
|
||||
invalid={!!error}
|
||||
onChange={(value) => updateAddress("street_name", value)}
|
||||
/>
|
||||
<Field
|
||||
label="Nr."
|
||||
value={address.house_number}
|
||||
describedBy={error ? errorId : undefined}
|
||||
invalid={!!error}
|
||||
onChange={(value) => updateAddress("house_number", value)}
|
||||
/>
|
||||
<Field
|
||||
label="PLZ"
|
||||
value={address.zip_code}
|
||||
describedBy={error ? errorId : undefined}
|
||||
invalid={!!error}
|
||||
onChange={(value) => updateAddress("zip_code", value)}
|
||||
/>
|
||||
<Field
|
||||
label="Ort"
|
||||
value={address.city}
|
||||
describedBy={error ? errorId : undefined}
|
||||
invalid={!!error}
|
||||
onChange={(value) => updateAddress("city", value)}
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="drawer-section">
|
||||
<span className="drawer-kicker">PAYMENT</span>
|
||||
<div className="payment-grid">
|
||||
{paymentMethods.map((method) => (
|
||||
<button
|
||||
type="button"
|
||||
className={`payment-card ${paymentMethod === method.key ? "active" : ""}`}
|
||||
key={method.key}
|
||||
onClick={() => setPaymentMethod(method.key)}
|
||||
>
|
||||
<span>{method.badge}</span>
|
||||
<strong>{method.label}</strong>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<span className="drawer-eyebrow">Zahlung</span>
|
||||
<fieldset
|
||||
className="payment-fieldset"
|
||||
aria-describedby={error ? errorId : undefined}
|
||||
>
|
||||
<legend className="visually-hidden">Zahlungsmethode</legend>
|
||||
<div className="payment-grid">
|
||||
{paymentMethods.map((method) => {
|
||||
const active = paymentMethod === method.key;
|
||||
return (
|
||||
<label
|
||||
className={`payment-card ${active ? "is-active" : ""}`}
|
||||
key={method.key}
|
||||
>
|
||||
<input
|
||||
className="payment-card__input"
|
||||
type="radio"
|
||||
name="payment_method"
|
||||
value={method.key}
|
||||
checked={active}
|
||||
aria-invalid={!!error || undefined}
|
||||
onChange={() => setPaymentMethod(method.key)}
|
||||
/>
|
||||
<span className="payment-card__badge" aria-hidden="true">
|
||||
{method.badge}
|
||||
</span>
|
||||
<strong>{method.label}</strong>
|
||||
</label>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</fieldset>
|
||||
</section>
|
||||
|
||||
<section className="drawer-section totals-box">
|
||||
<div>
|
||||
<span>Subtotal</span>
|
||||
<section className="drawer-section drawer-totals">
|
||||
<div className="drawer-totals__row">
|
||||
<span>Zwischensumme</span>
|
||||
<strong>{formatChf(cart.subtotal_cents)}</strong>
|
||||
</div>
|
||||
<div>
|
||||
<div className="drawer-totals__row">
|
||||
<span>Rabatte</span>
|
||||
<strong>-{formatChf(cart.discount_cents)}</strong>
|
||||
<strong>−{formatChf(cart.discount_cents)}</strong>
|
||||
</div>
|
||||
{cart.discounts?.length > 0 && (
|
||||
<div className="discount-explainer">
|
||||
<span>Applied automatically</span>
|
||||
<div className="drawer-totals__explainer">
|
||||
<span className="drawer-eyebrow">Automatisch angewendet</span>
|
||||
{cart.discounts.map((discount) => (
|
||||
<p key={`${discount.type}-${discount.creditId}`}>
|
||||
<strong>{formatChf(discount.amount_cents)}</strong>
|
||||
{" - "}
|
||||
{" — "}
|
||||
{discount.type === "discovery"
|
||||
? "Discovery Set credit for a full-size bottle"
|
||||
: `Sample credit for ${discount.slug}`}
|
||||
? "Discovery-Set-Gutschrift für einen 50-ml-Flakon"
|
||||
: `Proben-Gutschrift für ${discount.slug}`}
|
||||
</p>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
<div className="total-row">
|
||||
<span>Total</span>
|
||||
<div className="drawer-totals__row drawer-totals__row--total">
|
||||
<span>Gesamt</span>
|
||||
<strong>{formatChf(cart.total_cents)}</strong>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{error && <p className="drawer-error">{error}</p>}
|
||||
<DrawerError id={errorId}>{error}</DrawerError>
|
||||
|
||||
<button className="drawer-primary" type="submit" disabled={busy || cart.items.length === 0}>
|
||||
Checkout
|
||||
<button
|
||||
className="atmos-btn atmos-btn--primary atmos-btn--block atmos-btn--lg"
|
||||
type="submit"
|
||||
disabled={busy || cart.items.length === 0}
|
||||
>
|
||||
Jetzt bezahlen
|
||||
</button>
|
||||
</form>
|
||||
);
|
||||
@@ -229,9 +398,9 @@ function CartPanel() {
|
||||
|
||||
function RequirementRow({ label, met, children }) {
|
||||
return (
|
||||
<div className="requirement-row">
|
||||
<div className={`drawer-requirement ${met ? "is-met" : ""}`}>
|
||||
<span>{label}</span>
|
||||
<strong className={met ? "met" : ""}>{children || (met ? "met" : "open")}</strong>
|
||||
<strong>{children || (met ? "Erfüllt" : "Offen")}</strong>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -250,6 +419,7 @@ function ProfilePanel() {
|
||||
} = useShop();
|
||||
const [editing, setEditing] = useState(false);
|
||||
const [form, setForm] = useState(user || {});
|
||||
const errorId = "profile-error";
|
||||
|
||||
const update = (key, value) => setForm((current) => ({ ...current, [key]: value }));
|
||||
const notifications = user?.notifications || {};
|
||||
@@ -284,72 +454,130 @@ function ProfilePanel() {
|
||||
|
||||
return (
|
||||
<div className="drawer-stack">
|
||||
<section className="drawer-section profile-head">
|
||||
<span className="drawer-kicker">PROFILE</span>
|
||||
<h2>Hi, {user.first_name}</h2>
|
||||
<button className="drawer-secondary" type="button" onClick={logout}>
|
||||
Logout
|
||||
<section className="drawer-section drawer-profile-head">
|
||||
<div>
|
||||
<span className="drawer-eyebrow">Profil</span>
|
||||
<h2 className="drawer-heading">Hallo, {user.first_name}.</h2>
|
||||
</div>
|
||||
<button
|
||||
className="atmos-btn atmos-btn--outline atmos-btn--sm"
|
||||
type="button"
|
||||
onClick={logout}
|
||||
>
|
||||
Abmelden
|
||||
</button>
|
||||
</section>
|
||||
|
||||
<section className="drawer-section">
|
||||
<div className="profile-section-header">
|
||||
<span className="drawer-kicker">PROFILE INFORMATION</span>
|
||||
<header className="drawer-section-head">
|
||||
<span className="drawer-eyebrow">Profil-Informationen</span>
|
||||
{!editing && (
|
||||
<button className="drawer-secondary" type="button" onClick={() => setEditing(true)}>
|
||||
Profil bearbeiten
|
||||
<button
|
||||
className="atmos-btn atmos-btn--ghost atmos-btn--sm"
|
||||
type="button"
|
||||
onClick={() => setEditing(true)}
|
||||
>
|
||||
Bearbeiten
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</header>
|
||||
|
||||
{editing ? (
|
||||
<>
|
||||
<div className="drawer-grid drawer-grid--two">
|
||||
<Field label="Name" value={form.first_name || ""} onChange={(value) => update("first_name", value)} />
|
||||
<Field label="Surname" value={form.surname || ""} onChange={(value) => update("surname", value)} />
|
||||
<Field label="Street Name" value={form.street_name || ""} onChange={(value) => update("street_name", value)} />
|
||||
<Field label="House Number" value={form.house_number || ""} onChange={(value) => update("house_number", value)} />
|
||||
<Field label="ZIP Code" value={form.zip_code || ""} onChange={(value) => update("zip_code", value)} />
|
||||
<Field label="City" value={form.city || ""} onChange={(value) => update("city", value)} />
|
||||
<Field label="Birthdate" type="date" value={form.birthdate || ""} onChange={(value) => update("birthdate", value)} />
|
||||
<Field
|
||||
label="Name"
|
||||
value={form.first_name || ""}
|
||||
describedBy={error ? errorId : undefined}
|
||||
invalid={!!error}
|
||||
onChange={(value) => update("first_name", value)}
|
||||
/>
|
||||
<Field
|
||||
label="Nachname"
|
||||
value={form.surname || ""}
|
||||
describedBy={error ? errorId : undefined}
|
||||
invalid={!!error}
|
||||
onChange={(value) => update("surname", value)}
|
||||
/>
|
||||
<Field
|
||||
label="Strasse"
|
||||
value={form.street_name || ""}
|
||||
describedBy={error ? errorId : undefined}
|
||||
invalid={!!error}
|
||||
onChange={(value) => update("street_name", value)}
|
||||
/>
|
||||
<Field
|
||||
label="Nr."
|
||||
value={form.house_number || ""}
|
||||
describedBy={error ? errorId : undefined}
|
||||
invalid={!!error}
|
||||
onChange={(value) => update("house_number", value)}
|
||||
/>
|
||||
<Field
|
||||
label="PLZ"
|
||||
value={form.zip_code || ""}
|
||||
describedBy={error ? errorId : undefined}
|
||||
invalid={!!error}
|
||||
onChange={(value) => update("zip_code", value)}
|
||||
/>
|
||||
<Field
|
||||
label="Ort"
|
||||
value={form.city || ""}
|
||||
describedBy={error ? errorId : undefined}
|
||||
invalid={!!error}
|
||||
onChange={(value) => update("city", value)}
|
||||
/>
|
||||
<Field
|
||||
label="Geburtsdatum"
|
||||
type="date"
|
||||
value={form.birthdate || ""}
|
||||
describedBy={error ? errorId : undefined}
|
||||
invalid={!!error}
|
||||
onChange={(value) => update("birthdate", value)}
|
||||
/>
|
||||
</div>
|
||||
<div className="drawer-actions">
|
||||
<button className="drawer-primary" type="button" disabled={busy} onClick={save}>
|
||||
Save profile
|
||||
<div className="atmos-btn-row">
|
||||
<button
|
||||
className="atmos-btn atmos-btn--primary"
|
||||
type="button"
|
||||
disabled={busy}
|
||||
onClick={save}
|
||||
>
|
||||
Profil speichern
|
||||
</button>
|
||||
<button
|
||||
className="drawer-secondary"
|
||||
className="atmos-btn atmos-btn--outline"
|
||||
type="button"
|
||||
onClick={() => {
|
||||
setForm(user);
|
||||
setEditing(false);
|
||||
}}
|
||||
>
|
||||
Cancel
|
||||
Abbrechen
|
||||
</button>
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
<div className="profile-read-grid">
|
||||
<ReadBlock label="Name" value={user.first_name} />
|
||||
<ReadBlock label="Surname" value={user.surname} />
|
||||
<ReadBlock label="Street Name" value={user.street_name || "-"} />
|
||||
<ReadBlock label="House Number" value={user.house_number || "-"} />
|
||||
<ReadBlock label="ZIP Code" value={user.zip_code || "-"} />
|
||||
<ReadBlock label="City" value={user.city || "-"} />
|
||||
<ReadBlock label="Birthdate" value={user.birthdate || "-"} />
|
||||
<ReadBlock label="Nachname" value={user.surname} />
|
||||
<ReadBlock label="Strasse" value={user.street_name || "—"} />
|
||||
<ReadBlock label="Nr." value={user.house_number || "—"} />
|
||||
<ReadBlock label="PLZ" value={user.zip_code || "—"} />
|
||||
<ReadBlock label="Ort" value={user.city || "—"} />
|
||||
<ReadBlock label="Geburtsdatum" value={user.birthdate || "—"} />
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
|
||||
<section className="drawer-section">
|
||||
<span className="drawer-kicker">DISCOUNT STATUS</span>
|
||||
<div className="status-box">{user.discoveryStatus}</div>
|
||||
<span className="drawer-eyebrow">Rabattstatus</span>
|
||||
<div className="drawer-status-box">{formatDiscoveryStatus(user.discoveryStatus)}</div>
|
||||
{user.sampleCredits?.length > 0 && (
|
||||
<div className="sample-credit-list">
|
||||
<div className="drawer-credit-list">
|
||||
{user.sampleCredits.map((credit) => (
|
||||
<span key={`${credit.slug}-${credit.created_at}`}>
|
||||
{credit.slug}: {credit.status}
|
||||
{credit.slug}: {formatCreditStatus(credit.status)}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
@@ -357,37 +585,42 @@ function ProfilePanel() {
|
||||
</section>
|
||||
|
||||
<section className="drawer-section">
|
||||
<span className="drawer-kicker">DROP / RESTOCK PREFERENCES</span>
|
||||
<div className="toggle-grid">
|
||||
{notificationLabels.map(([key, label]) => (
|
||||
<button
|
||||
key={key}
|
||||
type="button"
|
||||
className={`pref-toggle ${notifications[key] ? "active" : ""}`}
|
||||
onClick={() => togglePreference(key)}
|
||||
>
|
||||
<span>{label}</span>
|
||||
<strong>{notifications[key] ? "Active" : "Inactive"}</strong>
|
||||
</button>
|
||||
))}
|
||||
<span className="drawer-eyebrow">Drop- und Verfügbarkeits-Einstellungen</span>
|
||||
<div className="drawer-toggle-grid">
|
||||
{notificationLabels.map(([key, label]) => {
|
||||
const active = !!notifications[key];
|
||||
return (
|
||||
<button
|
||||
key={key}
|
||||
type="button"
|
||||
aria-pressed={active}
|
||||
className={`drawer-toggle ${active ? "is-active" : ""}`}
|
||||
onClick={() => togglePreference(key)}
|
||||
>
|
||||
<span>{label}</span>
|
||||
<strong>{active ? "Aktiv" : "Inaktiv"}</strong>
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
|
||||
<div className="subscription-list">
|
||||
<span className="subscription-list-title">Subscribed Restocks</span>
|
||||
<div className="drawer-subscription-list">
|
||||
<span className="drawer-eyebrow">Abonnierte Restocks</span>
|
||||
{restockSubscriptions.length === 0 ? (
|
||||
<p className="drawer-muted">No product-specific restock updates yet.</p>
|
||||
<p className="drawer-muted">Noch keine produktbezogenen Restock-Updates.</p>
|
||||
) : (
|
||||
restockSubscriptions.map((subscription) => (
|
||||
<article className="subscription-row" key={subscription.id}>
|
||||
<article className="drawer-subscription-row" key={subscription.id}>
|
||||
<div>
|
||||
<strong>{subscription.name}</strong>
|
||||
<span>{subscription.size_label}</span>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
className="atmos-btn atmos-btn--ghost atmos-btn--sm"
|
||||
onClick={() => removeProductSubscription(subscription.id).catch(() => {})}
|
||||
>
|
||||
Delete
|
||||
Entfernen
|
||||
</button>
|
||||
</article>
|
||||
))
|
||||
@@ -396,20 +629,22 @@ function ProfilePanel() {
|
||||
</section>
|
||||
|
||||
<section className="drawer-section">
|
||||
<span className="drawer-kicker">SMALL BATCH ACCESS</span>
|
||||
<div className="status-box">{loyalty.unlocked ? "Unlocked" : "Locked"}</div>
|
||||
<div className="requirements">
|
||||
<span className="drawer-eyebrow">Small-Batch-Zugang</span>
|
||||
<div className="drawer-status-box">
|
||||
{loyalty.unlocked ? "Freigeschaltet" : "Noch gesperrt"}
|
||||
</div>
|
||||
<div className="drawer-requirements">
|
||||
<RequirementRow label="Discovery Set" met={loyalty.hasDiscoverySet} />
|
||||
<RequirementRow label="Full Size" met={loyalty.hasFullSize} />
|
||||
<RequirementRow label="Purchases" met={loyalty.purchases >= 3}>
|
||||
{loyalty.purchases}/3 Purchases
|
||||
<RequirementRow label="50 ml Flakon" met={loyalty.hasFullSize} />
|
||||
<RequirementRow label="Bestellungen" met={loyalty.purchases >= 3}>
|
||||
{loyalty.purchases}/3
|
||||
</RequirementRow>
|
||||
<RequirementRow label="Spend" met={loyalty.spent_cents > 50000}>
|
||||
<RequirementRow label="Umsatz" met={loyalty.spent_cents > 50000}>
|
||||
{formatChf(loyalty.spent_cents)} / CHF 500+
|
||||
</RequirementRow>
|
||||
</div>
|
||||
<Link
|
||||
className="drawer-primary drawer-link-primary"
|
||||
className="atmos-btn atmos-btn--secondary atmos-btn--block"
|
||||
to="/small-batch"
|
||||
onClick={closePanel}
|
||||
>
|
||||
@@ -418,33 +653,33 @@ function ProfilePanel() {
|
||||
</section>
|
||||
|
||||
<section className="drawer-section">
|
||||
<span className="drawer-kicker">PURCHASES</span>
|
||||
<span className="drawer-eyebrow">Bestellungen</span>
|
||||
{orders.length === 0 ? (
|
||||
<p className="drawer-muted">No orders yet.</p>
|
||||
<p className="drawer-muted">Noch keine Bestellungen.</p>
|
||||
) : (
|
||||
<div className="order-list">
|
||||
<div className="drawer-order-list">
|
||||
{orders.map((order) => (
|
||||
<article className="order-card" key={order.id}>
|
||||
<div>
|
||||
<strong>Order #{order.id}</strong>
|
||||
<article className="drawer-order-card" key={order.id}>
|
||||
<header>
|
||||
<strong>Bestellung #{order.id}</strong>
|
||||
<span>{new Date(order.created_at).toLocaleDateString("de-CH")}</span>
|
||||
</div>
|
||||
<p>{order.items.map((item) => `${item.quantity} x ${item.product.name}`).join(", ")}</p>
|
||||
<strong>{formatChf(order.total_cents)}</strong>
|
||||
</header>
|
||||
<p>{order.items.map((item) => `${item.quantity} × ${item.product.name}`).join(", ")}</p>
|
||||
<strong className="drawer-order-card__total">{formatChf(order.total_cents)}</strong>
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
|
||||
{error && <p className="drawer-error">{error}</p>}
|
||||
<DrawerError id={errorId}>{error}</DrawerError>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function ReadBlock({ label, value }) {
|
||||
return (
|
||||
<div className="read-block">
|
||||
<div className="drawer-read-block">
|
||||
<span>{label}</span>
|
||||
<strong>{value}</strong>
|
||||
</div>
|
||||
@@ -453,24 +688,133 @@ function ReadBlock({ label, value }) {
|
||||
|
||||
function ShopDrawer() {
|
||||
const { closePanel, panelOpen, panelType, user } = useShop();
|
||||
const drawerRef = useRef(null);
|
||||
const restoreFocusRef = useRef(null);
|
||||
const wasOpenRef = useRef(false);
|
||||
const drawerTitleId = useId();
|
||||
|
||||
const drawerLabel = !user ? "Konto" : panelType === "cart" ? "Warenkorb" : "Profil";
|
||||
|
||||
useEffect(() => {
|
||||
if (typeof document === "undefined") return undefined;
|
||||
|
||||
if (!panelOpen) {
|
||||
if (wasOpenRef.current) {
|
||||
const restoreTarget = restoreFocusRef.current;
|
||||
if (restoreTarget && document.contains(restoreTarget)) {
|
||||
window.requestAnimationFrame(() => {
|
||||
restoreTarget.focus({ preventScroll: true });
|
||||
});
|
||||
}
|
||||
}
|
||||
wasOpenRef.current = false;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
wasOpenRef.current = true;
|
||||
const activeElement = document.activeElement;
|
||||
if (
|
||||
activeElement instanceof HTMLElement &&
|
||||
!drawerRef.current?.contains(activeElement)
|
||||
) {
|
||||
restoreFocusRef.current = activeElement;
|
||||
}
|
||||
|
||||
const previousOverflow = document.body.style.overflow;
|
||||
document.body.style.overflow = "hidden";
|
||||
|
||||
const frameId = window.requestAnimationFrame(() => {
|
||||
const drawer = drawerRef.current;
|
||||
if (!drawer) return;
|
||||
const [firstFocusable] = getFocusableElements(drawer);
|
||||
(firstFocusable || drawer).focus({ preventScroll: true });
|
||||
});
|
||||
|
||||
return () => {
|
||||
window.cancelAnimationFrame(frameId);
|
||||
document.body.style.overflow = previousOverflow;
|
||||
};
|
||||
}, [panelOpen]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!panelOpen || typeof document === "undefined") return undefined;
|
||||
|
||||
const drawer = drawerRef.current;
|
||||
if (!drawer) return undefined;
|
||||
|
||||
const handleKeyDown = (event) => {
|
||||
if (event.key === "Escape") {
|
||||
event.preventDefault();
|
||||
closePanel();
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.key !== "Tab") return;
|
||||
|
||||
const focusableElements = getFocusableElements(drawer);
|
||||
if (focusableElements.length === 0) {
|
||||
event.preventDefault();
|
||||
drawer.focus({ preventScroll: true });
|
||||
return;
|
||||
}
|
||||
|
||||
const firstFocusable = focusableElements[0];
|
||||
const lastFocusable = focusableElements[focusableElements.length - 1];
|
||||
|
||||
if (!drawer.contains(document.activeElement)) {
|
||||
event.preventDefault();
|
||||
firstFocusable.focus({ preventScroll: true });
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.shiftKey && document.activeElement === firstFocusable) {
|
||||
event.preventDefault();
|
||||
lastFocusable.focus({ preventScroll: true });
|
||||
return;
|
||||
}
|
||||
|
||||
if (!event.shiftKey && document.activeElement === lastFocusable) {
|
||||
event.preventDefault();
|
||||
firstFocusable.focus({ preventScroll: true });
|
||||
}
|
||||
};
|
||||
|
||||
document.addEventListener("keydown", handleKeyDown);
|
||||
return () => document.removeEventListener("keydown", handleKeyDown);
|
||||
}, [closePanel, panelOpen]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div
|
||||
className={`drawer-backdrop ${panelOpen ? "open" : ""}`}
|
||||
className={`drawer-backdrop ${panelOpen ? "is-open" : ""}`}
|
||||
aria-hidden="true"
|
||||
onClick={closePanel}
|
||||
/>
|
||||
<aside
|
||||
className={`shop-drawer ${panelOpen ? "open" : ""}`}
|
||||
id="shop-drawer"
|
||||
ref={drawerRef}
|
||||
role="dialog"
|
||||
className={`shop-drawer ${panelOpen ? "is-open" : ""}`}
|
||||
aria-labelledby={drawerTitleId}
|
||||
aria-modal="true"
|
||||
aria-hidden={!panelOpen}
|
||||
inert={!panelOpen ? "" : undefined}
|
||||
tabIndex={-1}
|
||||
data-lenis-prevent
|
||||
>
|
||||
<div className="drawer-top">
|
||||
<span>{!user ? "ACCOUNT" : panelType === "cart" ? "CART" : "PROFILE"}</span>
|
||||
<button type="button" onClick={closePanel} aria-label="Close panel">
|
||||
x
|
||||
<header className="drawer-top">
|
||||
<span className="drawer-eyebrow" id={drawerTitleId}>
|
||||
{drawerLabel}
|
||||
</span>
|
||||
<button
|
||||
type="button"
|
||||
className="atmos-btn atmos-btn--outline atmos-btn--icon atmos-btn--sm"
|
||||
onClick={closePanel}
|
||||
aria-label="Panel schliessen"
|
||||
>
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
</header>
|
||||
{!user ? <AuthPanel /> : panelType === "cart" ? <CartPanel /> : <ProfilePanel />}
|
||||
</aside>
|
||||
</>
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
z-index: 1200;
|
||||
border: none;
|
||||
border-radius: 999px;
|
||||
background: #ff6a00;
|
||||
color: #fff;
|
||||
background: var(--theme-accent-fill);
|
||||
color: var(--theme-accent-contrast);
|
||||
padding: 14px 20px;
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
@@ -107,8 +107,8 @@
|
||||
|
||||
.chatbot-message--user {
|
||||
align-self: flex-end;
|
||||
background: #ff6a00;
|
||||
color: #fff;
|
||||
background: var(--theme-accent-fill);
|
||||
color: var(--theme-accent-contrast);
|
||||
}
|
||||
|
||||
.chatbot-message--typing {
|
||||
@@ -153,15 +153,16 @@
|
||||
|
||||
.chatbot-input {
|
||||
width: 100%;
|
||||
border: 1px solid var(--theme-border);
|
||||
background: var(--theme-paper);
|
||||
border: 1px solid var(--theme-control-border);
|
||||
background: var(--theme-control-bg);
|
||||
padding: 12px 14px;
|
||||
font-size: 14px;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.chatbot-input:focus {
|
||||
border-color: #ff6a00;
|
||||
border-color: var(--theme-control-border-focus);
|
||||
outline: 2px solid var(--theme-focus-ring);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.chatbot-send {
|
||||
@@ -183,7 +184,7 @@
|
||||
.chatbot-link {
|
||||
text-decoration: none;
|
||||
font-size: 13px;
|
||||
color: #ff6a00;
|
||||
color: var(--theme-accent);
|
||||
background: transparent;
|
||||
border: none;
|
||||
padding: 0;
|
||||
@@ -238,9 +239,9 @@
|
||||
}
|
||||
|
||||
.chatbot-feedback-btn--primary {
|
||||
background: #ff6a00;
|
||||
border-color: #ff6a00;
|
||||
color: #fff;
|
||||
background: var(--theme-accent-fill);
|
||||
border-color: var(--theme-accent-fill);
|
||||
color: var(--theme-accent-contrast);
|
||||
}
|
||||
|
||||
.chatbot-secondary-actions {
|
||||
@@ -250,7 +251,7 @@
|
||||
.chatbot-text-button {
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: #ff6a00;
|
||||
color: var(--theme-accent);
|
||||
padding: 0;
|
||||
font-size: 13px;
|
||||
cursor: pointer;
|
||||
|
||||
@@ -24,7 +24,7 @@ const SUPPORT_TOPICS = {
|
||||
title: "Fragen zum Discovery Set",
|
||||
keywords: ["discovery", "set", "sample", "testen", "proben"],
|
||||
reply:
|
||||
"Das Discovery Set ist dafür gedacht, mehrere Düfte in Ruhe auf der Haut zu testen, bevor du dich für eine Full Size entscheidest. So bekommst du ein genaueres Gefühl für Verlauf, Atmosphäre und Tragbarkeit der einzelnen Kompositionen.",
|
||||
"Das Discovery Set ist dafür gedacht, mehrere Düfte in Ruhe auf der Haut zu testen, bevor du dich für einen 50-ml-Flakon entscheidest. So bekommst du ein genaueres Gefühl für Verlauf, Atmosphäre und Tragbarkeit der einzelnen Kompositionen.",
|
||||
},
|
||||
duftwahl: {
|
||||
id: "duftwahl",
|
||||
@@ -319,7 +319,11 @@ function SupportChatbot() {
|
||||
|
||||
<div className="chatbot-footer">
|
||||
<form className="chatbot-form" onSubmit={handleSubmit}>
|
||||
<label htmlFor="chatbot-input" className="visually-hidden">
|
||||
Deine Frage an den Support
|
||||
</label>
|
||||
<input
|
||||
id="chatbot-input"
|
||||
type="text"
|
||||
className="chatbot-input"
|
||||
placeholder="Deine Frage eingeben..."
|
||||
|
||||
@@ -1,11 +1,18 @@
|
||||
import { Link } from "react-router";
|
||||
import IntroOverlay from "./IntroOverlay";
|
||||
import {
|
||||
HERO_PRODUCT_IMAGE_SIZES,
|
||||
buildPublicImageSrcSet,
|
||||
} from "../../utils/responsiveImages";
|
||||
|
||||
const HERO_PRODUCT_IMAGE = "/blasse-seide-hero-product.webp";
|
||||
|
||||
function HeroSection({
|
||||
heroImageWrapRef,
|
||||
heroImageRef,
|
||||
setHeadlinePrimaryRef,
|
||||
setHeadlineSecondaryRef,
|
||||
setHeadlineTertiaryRef,
|
||||
setWordmarkRef,
|
||||
setDescriptionRef,
|
||||
setActionsRef,
|
||||
@@ -33,7 +40,13 @@ function HeroSection({
|
||||
<figure className="hero-product">
|
||||
<div className="hero-product__inner" ref={setDescriptionRef}>
|
||||
<img
|
||||
src="/blasse-seide-hero-product.webp"
|
||||
src={HERO_PRODUCT_IMAGE}
|
||||
srcSet={buildPublicImageSrcSet(HERO_PRODUCT_IMAGE, {
|
||||
folder: "/images/hero",
|
||||
widths: [480, 768, 960],
|
||||
originalWidth: 1078,
|
||||
})}
|
||||
sizes={HERO_PRODUCT_IMAGE_SIZES}
|
||||
alt="Blasse Seide Parfumflakon auf einer dunklen Produktkarte"
|
||||
className="hero-product__image"
|
||||
loading="eager"
|
||||
@@ -56,15 +69,17 @@ function HeroSection({
|
||||
</span>
|
||||
</span>
|
||||
<span className="hero-copy-line">
|
||||
<span className="reveal-line">Raum und Charakter.</span>
|
||||
<span className="reveal-line" ref={setHeadlineTertiaryRef}>
|
||||
Raum und Charakter.
|
||||
</span>
|
||||
</span>
|
||||
</h1>
|
||||
|
||||
<div className="hero-actions" ref={setActionsRef}>
|
||||
<a href="#dufte" className="btn btn-primary">
|
||||
<a href="#dufte" className="atmos-btn atmos-btn--primary">
|
||||
{"Aktuelle D\u00FCfte"}
|
||||
</a>
|
||||
<Link to="/discovery-set" className="btn btn-secondary">
|
||||
<Link to="/discovery-set" className="atmos-btn atmos-btn--secondary">
|
||||
Discovery Set
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* Container — horizontally constrained content wrapper.
|
||||
*
|
||||
* Sizes map to design tokens in src/style/tokens.css:
|
||||
* default → --container (max 1440px)
|
||||
* narrow → --container-narrow (max 920px, for prose)
|
||||
* wide → --container-wide (max 1680px, for hero/grid pages)
|
||||
*/
|
||||
function Container({
|
||||
as = "div",
|
||||
size = "default",
|
||||
className = "",
|
||||
children,
|
||||
...rest
|
||||
}) {
|
||||
const Tag = as;
|
||||
const sizeClass =
|
||||
size === "narrow"
|
||||
? "container-narrow"
|
||||
: size === "wide"
|
||||
? "container-wide"
|
||||
: "container";
|
||||
|
||||
return (
|
||||
<Tag className={`${sizeClass}${className ? ` ${className}` : ""}`} {...rest}>
|
||||
{children}
|
||||
</Tag>
|
||||
);
|
||||
}
|
||||
|
||||
export default Container;
|
||||