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

View File

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

View File

@ -90,9 +90,11 @@ export function AddToCart({
return (
<form action={actionWithVariant}>
<SubmitButton availableForSale={availableForSale} selectedVariantId={selectedVariantId} />
<p aria-live="polite" className="sr-only" role="status">
{message}
</p>
<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}
</p>
</div>
</form>
);
}

View File

@ -26,7 +26,7 @@ export function ProductDescription({ product }: { product: Product }) {
{product.descriptionHtml ? (
<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}
/>
) : null}

View File

@ -21,7 +21,7 @@
"dependencies": {
"@headlessui/react": "^1.7.17",
"@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",
"next": "13.5.4",
"react": "18.2.0",

512
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff