Skip to content

Commit

Permalink
fix: fixed the expired NR tooltip (#39)
Browse files Browse the repository at this point in the history
* fix: fixed the expired NR tooltip

* fix: fixed wording

* fix: fixed in response to Sev's comments

* fix: fixed small comments

---------

Co-authored-by: Karim El Jazzar <[email protected]>
  • Loading branch information
JazzarKarim and KarimJazzar authored Dec 23, 2024
1 parent bb3c54b commit 04877e1
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,24 @@ const entityAlertMessages: Record<string, Message> = {
message: t(`entityAlertTypes.${EntityAlertTypes.DISSOLUTION}`),
colour: 'text-red-600',
priority: 1
},
[EntityAlertTypes.EXPIRED]: {
message: t(`entityAlertTypes.${EntityAlertTypes.EXPIRED}`),
colour: 'text-red-600',
priority: 5
}
}
const generateMessage = (status: string): Message | null => {
return entityAlertMessages[status] || null
const generateMessage = (status: string | { type: string, data: any }): Message | null => {
if (typeof status === 'string') {
return entityAlertMessages[status] || null
}
// Handle EXPIRED case with dynamic type
if (status.type === EntityAlertTypes.EXPIRED) {
return {
message: t(`entityAlertTypes.${EntityAlertTypes.EXPIRED}`, status.data),
colour: 'text-red-600',
priority: 5
}
}
return null
}
const makeMessages = () => {
Expand Down
10 changes: 8 additions & 2 deletions business-registry-dashboard/app/locales/en-CA.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,19 @@ export default {
description: 'The link appears to be entered incorrectly. Please go back and click the full link.'
}
},
entityTypes: {
registration: 'registration',
incorporationApplication: 'incorporation application',
amalgamationApplication: 'amalgamation application',
continuationApplication: 'continuation application'
},
entityAlertTypes: {
FROZEN: 'This business is frozen',
BAD_STANDING: 'This business is not in good standing',
LIQUIDATION: 'This business is in liquidation',
DISSOLUTION: 'This business is in the process of being dissolved',
PROCESSING: 'This name request is still processing, it may take up to 10 minutes.',
EXPIRED: 'This incorporation application is no longer valid; the name request is expired.'
PROCESSING: 'This name request is still processing. It may take up to 10 minutes.',
EXPIRED: 'This {type} is no longer valid; the name request is expired.'
},
form: {
manageNR: {
Expand Down
8 changes: 7 additions & 1 deletion business-registry-dashboard/app/locales/fr-CA.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,19 @@ export default {
description: 'Le lien semble avoir été mal saisi. Veuillez revenir en arrière et cliquer sur le lien complet.'
}
},
entityTypes: {
registration: 'inscription',
incorporationApplication: 'demande de constitution',
amalgamationApplication: 'demande de fusion',
continuationApplication: 'demande de continuation'
},
entityAlertTypes: {
FROZEN: 'Cette entreprise est gelée',
BAD_STANDING: "Cette entreprise n'est pas en règle",
LIQUIDATION: 'Cette entreprise est en liquidation',
DISSOLUTION: 'Cette entreprise est en cours de dissolution',
PROCESSING: "Cette demande de dénomination est encore en cours de traitement, cela peut prendre jusqu'à 10 minutes.",
EXPIRED: "Cette demande d'incorporation n'est plus valide; la demande de dénomination est expirée."
EXPIRED: "Cette {type} n'est plus valide; la demande de nom est expirée."
},
form: {
manageNR: {
Expand Down
6 changes: 3 additions & 3 deletions business-registry-dashboard/app/pages/incorporateNow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,11 @@ onMounted(async () => {
await affNav.goToDashboard(identifier)
}
} catch (error) {
// All errors are handled with a generic error modal
// All errors are handled with the incorporate now error modal
console.error('Error in incorporate flow:', error)
brdModal.openMagicLinkModal(
t('error.magicLinkGenericError.title'),
t('error.magicLinkGenericError.description')
t('error.magicLinkIncorporateNowError.title'),
t('error.magicLinkIncorporateNowError.description')
)
} finally {
isLoading.value = false
Expand Down
10 changes: 9 additions & 1 deletion business-registry-dashboard/app/utils/affiliations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,17 @@ export const isDissolution = (item: Business) => {
}

export const getDetails = (item: Business): EntityAlertTypes[] => {
const { t } = useNuxtApp().$i18n
const details = []
if (isExpired(item)) {
details.push(EntityAlertTypes.EXPIRED)
const typeMap = {
[CorpTypes.REGISTRATION]: t('entityTypes.registration'),
[CorpTypes.INCORPORATION_APPLICATION]: t('entityTypes.incorporationApplication'),
[CorpTypes.AMALGAMATION_APPLICATION]: t('entityTypes.amalgamationApplication'),
[CorpTypes.CONTINUATION_IN]: t('entityTypes.continuationApplication')
}
const type = typeMap[item.corpType?.code] || t('entityTypes.incorporationApplication')
details.push({ type: EntityAlertTypes.EXPIRED, data: { type } })
}
if (isFrozed(item)) {
details.push(EntityAlertTypes.FROZEN)
Expand Down
2 changes: 1 addition & 1 deletion business-registry-dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "business-registry-dashboard",
"private": true,
"type": "module",
"version": "0.0.9",
"version": "0.0.10",
"scripts": {
"build-check": "nuxt build",
"build": "nuxt generate",
Expand Down

0 comments on commit 04877e1

Please sign in to comment.