diff --git a/apps/portal/src/app/features/licensing/components/LicenseCatalogue.tsx b/apps/portal/src/app/features/licensing/components/LicenseCatalogue.tsx index b4dedc212..f0042b260 100644 --- a/apps/portal/src/app/features/licensing/components/LicenseCatalogue.tsx +++ b/apps/portal/src/app/features/licensing/components/LicenseCatalogue.tsx @@ -20,6 +20,7 @@ import { IconBuildingWarehouse, IconChevronRight, IconFileText, + IconLock, IconShieldOff, IconShip, IconTrendingUp, @@ -277,8 +278,14 @@ function LicenseTypeCard({ withBorder radius="md" padding="md" - style={{ cursor: 'pointer', height: '100%' }} - onClick={() => onSelect(type)} + style={{ + cursor: canApply ? 'pointer' : 'default', + height: '100%', + // Dimmed rather than hidden: browse-all exists so an applicant can see + // what else the authority issues. It just must not look actionable. + opacity: canApply ? 1 : 0.6, + }} + onClick={canApply ? () => onSelect(type) : undefined} > @@ -286,11 +293,19 @@ function LicenseTypeCard({ {localized(type.name)} - + {canApply ? ( + + ) : ( + + )} {type.description && ( @@ -329,13 +344,33 @@ function LicenseTypeCard({ mt="sm" size="xs" variant="light" - color={canApply ? undefined : 'gray'} + disabled={!canApply} rightSection={} > - {canApply - ? t('licensing.catalogue.startApplication') - : t('licensing.catalogue.addToOperations')} + {t('licensing.catalogue.startApplication')} + {/* A disabled button on its own only says "no". This says why, and + where to go about it — the licence is offered against a declared + mode of operation, and the server refuses a create for one the + applicant has not declared. */} + {!canApply && ( + + {t('licensing.catalogue.lockedHint')}{' '} + { + // The card is inert while locked, but the anchor inside it + // must not re-trigger anything if that ever changes. + event.stopPropagation(); + onSelect(type); + }} + > + {t('licensing.catalogue.addToOperations')} + + + )} diff --git a/apps/portal/src/app/i18n/locales/am.ts b/apps/portal/src/app/i18n/locales/am.ts index ab5013291..2a56acf6c 100644 --- a/apps/portal/src/app/i18n/locales/am.ts +++ b/apps/portal/src/app/i18n/locales/am.ts @@ -831,6 +831,8 @@ export const am: Translations = { evaluationOnly: 'ግምገማ ብቻ', startApplication: 'ማመልከቻ ጀምር', addToOperations: 'ወደ ስራ ዘርፎቼ ጨምር', + lockedHint: + 'ከተመዘገቡ የስራ ዘርፎችዎ ውስጥ ስላልሆነ እስካሁን ማመልከት አይችሉም።', }, }, diff --git a/apps/portal/src/app/i18n/locales/en.ts b/apps/portal/src/app/i18n/locales/en.ts index f0a99d212..a181d2ead 100644 --- a/apps/portal/src/app/i18n/locales/en.ts +++ b/apps/portal/src/app/i18n/locales/en.ts @@ -831,6 +831,8 @@ export const en = { evaluationOnly: 'Evaluation only', startApplication: 'Start application', addToOperations: 'Add to my operations', + lockedHint: + 'Not one of your declared operations, so it cannot be applied for yet.', }, },