MED-197: improve analysis compare page
This commit is contained in:
@@ -7,6 +7,8 @@ import { sdk } from '@lib/config';
|
||||
import medusaError from '@lib/util/medusa-error';
|
||||
import { HttpTypes, StoreCart } from '@medusajs/types';
|
||||
|
||||
import { getLogger } from '@kit/shared/logger';
|
||||
|
||||
import {
|
||||
getAuthHeaders,
|
||||
getCacheOptions,
|
||||
@@ -135,13 +137,21 @@ export async function addToCart({
|
||||
quantity: number;
|
||||
countryCode: string;
|
||||
}) {
|
||||
const logger = await getLogger();
|
||||
const ctx = {
|
||||
variantId,
|
||||
quantity,
|
||||
countryCode,
|
||||
};
|
||||
if (!variantId) {
|
||||
logger.error(ctx, 'Missing variant ID when adding to cart');
|
||||
throw new Error('Missing variant ID when adding to cart');
|
||||
}
|
||||
|
||||
const cart = await getOrSetCart(countryCode);
|
||||
|
||||
if (!cart) {
|
||||
logger.error(ctx, 'Error retrieving or creating cart');
|
||||
throw new Error('Error retrieving or creating cart');
|
||||
}
|
||||
|
||||
|
||||
@@ -18,14 +18,16 @@ export const PackageHeader = ({
|
||||
return (
|
||||
<div className="space-y-1 text-center">
|
||||
<p className="text-sm sm:text-lg sm:font-medium">{title}</p>
|
||||
<h2 className="text-xl sm:text-4xl">
|
||||
<h2 className="xs:text-xl text-lg sm:text-4xl">
|
||||
{formatCurrency({
|
||||
currencyCode: 'eur',
|
||||
locale: language,
|
||||
value: price,
|
||||
})}
|
||||
</h2>
|
||||
<Badge className={cn('text-xs', tagColor)}>{analysesNr}</Badge>
|
||||
<Badge className={cn('xs:text-xs text-[10px]', tagColor)}>
|
||||
{analysesNr}
|
||||
</Badge>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -117,6 +117,7 @@ export default function SelectAnalysisPackage({
|
||||
<Button
|
||||
className="w-full text-[10px] sm:text-sm"
|
||||
onClick={handleSelect}
|
||||
disabled={isAddingToCart}
|
||||
>
|
||||
{isAddingToCart ? (
|
||||
<Spinner />
|
||||
|
||||
Reference in New Issue
Block a user