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 { handleAddToCart } from '~/lib/services/medusaCart.service';
|
||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
import { InfoTooltip } from '~/components/ui/info-tooltip';
|
import { InfoTooltip } from '~/components/ui/info-tooltip';
|
||||||
|
import { Trans } from '@kit/ui/trans';
|
||||||
|
|
||||||
export default function OrderAnalysesCards({
|
export default function OrderAnalysesCards({
|
||||||
analyses,
|
analyses,
|
||||||
@@ -49,10 +50,14 @@ export default function OrderAnalysesCards({
|
|||||||
variants,
|
variants,
|
||||||
description,
|
description,
|
||||||
subtitle,
|
subtitle,
|
||||||
}) => (
|
status,
|
||||||
|
metadata,
|
||||||
|
}) => {
|
||||||
|
const isAvailable = status === 'published' && !!metadata?.analysisIdOriginal;
|
||||||
|
return (
|
||||||
<Card
|
<Card
|
||||||
key={title}
|
key={title}
|
||||||
variant="gradient-success"
|
variant={isAvailable ? "gradient-success" : "gradient-warning"}
|
||||||
className="flex flex-col justify-between"
|
className="flex flex-col justify-between"
|
||||||
>
|
>
|
||||||
<CardHeader className="flex-row">
|
<CardHeader className="flex-row">
|
||||||
@@ -61,6 +66,7 @@ export default function OrderAnalysesCards({
|
|||||||
>
|
>
|
||||||
<HeartPulse className="size-4 fill-green-500" />
|
<HeartPulse className="size-4 fill-green-500" />
|
||||||
</div>
|
</div>
|
||||||
|
{isAvailable && (
|
||||||
<div className='ml-auto flex size-8 items-center-safe justify-center-safe rounded-full text-white bg-warning'>
|
<div className='ml-auto flex size-8 items-center-safe justify-center-safe rounded-full text-white bg-warning'>
|
||||||
<Button
|
<Button
|
||||||
size="icon"
|
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" />}
|
{isAddingToCart ? <Loader2 className="size-4 stroke-2 animate-spin" /> : <ShoppingCart className="size-4 stroke-2" />}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardFooter className="flex flex-col items-start gap-2">
|
<CardFooter className="flex flex-col items-start gap-2">
|
||||||
<h5>
|
<h5>
|
||||||
@@ -82,14 +89,20 @@ export default function OrderAnalysesCards({
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</h5>
|
</h5>
|
||||||
{subtitle && (
|
{isAvailable && subtitle && (
|
||||||
<CardDescription>
|
<CardDescription>
|
||||||
{subtitle}
|
{subtitle}
|
||||||
</CardDescription>
|
</CardDescription>
|
||||||
)}
|
)}
|
||||||
|
{!isAvailable && (
|
||||||
|
<CardDescription>
|
||||||
|
<Trans i18nKey={'order-analysis:analysisNotAvailable'} />
|
||||||
|
</CardDescription>
|
||||||
|
)}
|
||||||
</CardFooter>
|
</CardFooter>
|
||||||
</Card>
|
</Card>
|
||||||
))}
|
);
|
||||||
|
})}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
"title": "Select analysis",
|
"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",
|
"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