chore: show out of stock message

This commit is contained in:
Björn Meyer 2023-10-27 15:42:13 +02:00
parent 267ed5d103
commit d67e8f57c1
6 changed files with 272 additions and 258 deletions

View File

@ -20,7 +20,7 @@ export async function generateMetadata({
}): Promise<Metadata> { }): Promise<Metadata> {
// see https://github.com/facebook/react/issues/25994 // see https://github.com/facebook/react/issues/25994
const collectionName = decodeURIComponent(transformHandle(params?.collection ?? '')); const collectionName = decodeURIComponent(transformHandle(params?.collection ?? ''));
if (collectionName === 'react_devtools_backend_compact.js.map') { if (collectionName.includes('.js.map')) {
return {}; return {};
} }
@ -47,7 +47,7 @@ export default async function CategoryPage({
// see https://github.com/facebook/react/issues/25994 // see https://github.com/facebook/react/issues/25994
const collectionName = decodeURIComponent(transformHandle(params?.collection ?? '')); const collectionName = decodeURIComponent(transformHandle(params?.collection ?? ''));
if (collectionName === 'react_devtools_backend_compact.js.map') { if (collectionName.includes('.js.map')) {
return null; return null;
} }

View File

@ -57,12 +57,12 @@ export async function addItem(prevState: any, selectedVariantId: string | undefi
} }
] ]
}); });
revalidateTag(TAGS.cart);
const errorMessage = alertErrorMessages(response); const errorMessage = alertErrorMessages(response);
if (errorMessage !== '') { if (errorMessage !== '') {
return errorMessage; return errorMessage;
} }
revalidateTag(TAGS.cart);
} catch (error) { } catch (error) {
if (error instanceof ApiClientError) { if (error instanceof ApiClientError) {
console.error(error); console.error(error);

View File

@ -90,9 +90,11 @@ export function AddToCart({
return ( return (
<form action={actionWithVariant}> <form action={actionWithVariant}>
<SubmitButton availableForSale={availableForSale} selectedVariantId={selectedVariantId} /> <SubmitButton availableForSale={availableForSale} selectedVariantId={selectedVariantId} />
<p aria-live="polite" className="sr-only" role="status"> <div className="flex items-center px-4 py-3 text-sm font-bold text-black">
<p aria-live="polite" className="h-6" role="status">
{message} {message}
</p> </p>
</div>
</form> </form>
); );
} }

View File

@ -26,7 +26,7 @@ export function ProductDescription({ product }: { product: Product }) {
{product.descriptionHtml ? ( {product.descriptionHtml ? (
<Prose <Prose
className="m-6 max-h-96 overflow-y-auto text-sm leading-tight dark:text-white/[60%]" className="m-6 mt-3 max-h-96 overflow-y-auto text-sm leading-tight dark:text-white/[60%]"
html={product.descriptionHtml} html={product.descriptionHtml}
/> />
) : null} ) : null}

View File

@ -21,7 +21,7 @@
"dependencies": { "dependencies": {
"@headlessui/react": "^1.7.17", "@headlessui/react": "^1.7.17",
"@heroicons/react": "^2.0.18", "@heroicons/react": "^2.0.18",
"@shopware/api-client": "0.0.0-canary-20230904132316", "@shopware/api-client": "0.0.0-canary-20231024141318",
"clsx": "^2.0.0", "clsx": "^2.0.0",
"next": "13.5.4", "next": "13.5.4",
"react": "18.2.0", "react": "18.2.0",

512
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff