feat(MED-123): analysis to order can be not-available
This commit is contained in:
@@ -14,6 +14,7 @@ import { useState } from 'react';
|
||||
import { handleAddToCart } from '~/lib/services/medusaCart.service';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { InfoTooltip } from '~/components/ui/info-tooltip';
|
||||
import { Trans } from '@kit/ui/trans';
|
||||
|
||||
export default function OrderAnalysesCards({
|
||||
analyses,
|
||||
@@ -49,10 +50,14 @@ export default function OrderAnalysesCards({
|
||||
variants,
|
||||
description,
|
||||
subtitle,
|
||||
}) => (
|
||||
status,
|
||||
metadata,
|
||||
}) => {
|
||||
const isAvailable = status === 'published' && !!metadata?.analysisIdOriginal;
|
||||
return (
|
||||
<Card
|
||||
key={title}
|
||||
variant="gradient-success"
|
||||
variant={isAvailable ? "gradient-success" : "gradient-warning"}
|
||||
className="flex flex-col justify-between"
|
||||
>
|
||||
<CardHeader className="flex-row">
|
||||
@@ -61,6 +66,7 @@ export default function OrderAnalysesCards({
|
||||
>
|
||||
<HeartPulse className="size-4 fill-green-500" />
|
||||
</div>
|
||||
{isAvailable && (
|
||||
<div className='ml-auto flex size-8 items-center-safe justify-center-safe rounded-full text-white bg-warning'>
|
||||
<Button
|
||||
size="icon"
|
||||
@@ -71,6 +77,7 @@ export default function OrderAnalysesCards({
|
||||
{isAddingToCart ? <Loader2 className="size-4 stroke-2 animate-spin" /> : <ShoppingCart className="size-4 stroke-2" />}
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</CardHeader>
|
||||
<CardFooter className="flex flex-col items-start gap-2">
|
||||
<h5>
|
||||
@@ -82,14 +89,20 @@ export default function OrderAnalysesCards({
|
||||
</>
|
||||
)}
|
||||
</h5>
|
||||
{subtitle && (
|
||||
{isAvailable && subtitle && (
|
||||
<CardDescription>
|
||||
{subtitle}
|
||||
</CardDescription>
|
||||
)}
|
||||
{!isAvailable && (
|
||||
<CardDescription>
|
||||
<Trans i18nKey={'order-analysis:analysisNotAvailable'} />
|
||||
</CardDescription>
|
||||
)}
|
||||
</CardFooter>
|
||||
</Card>
|
||||
))}
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"title": "Select analysis",
|
||||
"description": "Select the analysis that suits your needs"
|
||||
"description": "Select the analysis that suits your needs",
|
||||
"analysisNotAvailable": "Analysis is not available currently"
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"title": "Vali analüüs",
|
||||
"description": "Vali enda vajadustele sobiv analüüs"
|
||||
"description": "Vali enda vajadustele sobiv analüüs",
|
||||
"analysisNotAvailable": "Analüüsi tellimine ei ole hetkel saadaval"
|
||||
}
|
||||
Reference in New Issue
Block a user