diff --git a/app/home/(user)/_components/order-analyses-cards.tsx b/app/home/(user)/_components/order-analyses-cards.tsx index ea58399..f7575bc 100644 --- a/app/home/(user)/_components/order-analyses-cards.tsx +++ b/app/home/(user)/_components/order-analyses-cards.tsx @@ -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,47 +50,59 @@ export default function OrderAnalysesCards({ variants, description, subtitle, - }) => ( - - - - - - - handleSelect(variants![0]!)} + status, + metadata, + }) => { + const isAvailable = status === 'published' && !!metadata?.analysisIdOriginal; + return ( + + + - {isAddingToCart ? : } - - - - - - {title} - {description && ( - <> - {' '} - - > + + + {isAvailable && ( + + handleSelect(variants![0]!)} + > + {isAddingToCart ? : } + + )} - - {subtitle && ( - - {subtitle} - - )} - - - ))} + + + + {title} + {description && ( + <> + {' '} + + > + )} + + {isAvailable && subtitle && ( + + {subtitle} + + )} + {!isAvailable && ( + + + + )} + + + ); + })} ); } diff --git a/public/locales/en/order-analysis.json b/public/locales/en/order-analysis.json index 3cc4ea9..6ab9af8 100644 --- a/public/locales/en/order-analysis.json +++ b/public/locales/en/order-analysis.json @@ -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" } \ No newline at end of file diff --git a/public/locales/et/order-analysis.json b/public/locales/et/order-analysis.json index f04be5e..42f790e 100644 --- a/public/locales/et/order-analysis.json +++ b/public/locales/et/order-analysis.json @@ -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" } \ No newline at end of file