From 98277924a39ec2231bc819212c2d309e7b45588e Mon Sep 17 00:00:00 2001 From: estifanos Date: Tue, 18 Aug 2026 11:46:52 +0000 Subject: [PATCH] UI improvements --- .../vessel-registration/inFlightColumns.tsx | 76 +++++++++++++++++++ .../pages/VesselRegistrationPage.tsx | 66 +++++----------- apps/portal/src/app/i18n/locales/am.ts | 1 + apps/portal/src/app/i18n/locales/en.ts | 1 + 4 files changed, 98 insertions(+), 46 deletions(-) create mode 100644 apps/portal/src/app/features/vessel-registration/inFlightColumns.tsx diff --git a/apps/portal/src/app/features/vessel-registration/inFlightColumns.tsx b/apps/portal/src/app/features/vessel-registration/inFlightColumns.tsx new file mode 100644 index 000000000..43dc3e382 --- /dev/null +++ b/apps/portal/src/app/features/vessel-registration/inFlightColumns.tsx @@ -0,0 +1,76 @@ +import { Badge, Button, Group, Progress, Text } from '@mantine/core'; +import { IconArrowRight } from '@tabler/icons-react'; +import type { TFunction } from 'i18next'; +import type { AdvancedColumn } from '@ema-platform/ui'; +import { + STATUS_COLORS, + STATUS_LABELS, + STATUS_PROGRESS, + type LicenseApplication, +} from '@ema-platform/api'; + +/** Columns for the applicant's in-flight vessel registration applications. */ +export function inFlightColumns( + t: TFunction, + deps: { onOpen: (app: LicenseApplication) => void }, +): AdvancedColumn[] { + return [ + { + header: t('applications.table.applicationNumber'), + cell: ({ row }) => ( + + {row.original.applicationNumber} + {row.original.kind === 'RENEWAL' && ( + + {t('vesselRegistration.inFlight.renewalBadge')} + + )} + + ), + }, + { + header: t('common.status'), + cell: ({ row }) => ( + + {STATUS_LABELS[row.original.status]} + + ), + }, + { + header: t('applications.table.progress'), + size: 140, + cell: ({ row }) => ( + + ), + }, + { + header: '', + label: t('common.actions'), + align: 'right', + cell: ({ row }) => { + const app = row.original; + const needsAction = app.status === 'RESUBMIT_REQUIRED'; + return ( + + ); + }, + }, + ]; +} diff --git a/apps/portal/src/app/features/vessel-registration/pages/VesselRegistrationPage.tsx b/apps/portal/src/app/features/vessel-registration/pages/VesselRegistrationPage.tsx index 3b752cc68..145193801 100644 --- a/apps/portal/src/app/features/vessel-registration/pages/VesselRegistrationPage.tsx +++ b/apps/portal/src/app/features/vessel-registration/pages/VesselRegistrationPage.tsx @@ -9,7 +9,6 @@ import { Divider, Group, Paper, - Progress, SimpleGrid, Stack, Text, @@ -27,12 +26,10 @@ import { IconInfoCircle, IconClockHour4, IconTransferIn, - IconArrowRight, } from '@tabler/icons-react'; +import { AdvancedTable } from '@ema-platform/ui'; +import { inFlightColumns } from '../inFlightColumns'; import { - STATUS_COLORS, - STATUS_LABELS, - STATUS_PROGRESS, TERMINAL_STATUSES, useApiMutation, useGetMyApplicationsQuery, @@ -45,6 +42,8 @@ import { authStorage } from '@ema-platform/auth'; /** Registration applications run through the config-driven licensing wizard. */ const REGISTRATION_TYPE_KEY = 'VESSEL_REGISTRATION'; +const PAGE_SIZE = 5; + type VesselRegStatus = 'Pending' | 'Under Review' | 'Approved' | 'Rejected' | 'Correction Required'; type VesselCategory = 'Inland Waterway Vessel' | 'Sea-going Vessel (International)'; type RenewalStatus = 'Valid' | 'Due Soon' | 'Overdue' | 'Not Applicable'; @@ -133,6 +132,7 @@ export function VesselRegistrationPage() { const navigate = useNavigate(); const { t } = useTranslation(); const { data: applications } = useGetMyApplicationsQuery(); + const [page, setPage] = useState(0); const [registration, setRegistration] = useState(null); const [fetchTrigger] = useApiMutation(); const fetched = useRef(false); @@ -155,6 +155,11 @@ export function VesselRegistrationPage() { !TERMINAL_STATUSES.includes(app.status), ); + const columns = inFlightColumns(t, { + onOpen: (app) => + navigate(`/licensing/${REGISTRATION_TYPE_KEY}/applications/${app.id}`), + }); + const certs = registration?.category === 'Sea-going Vessel (International)' ? SEAGOING_CERTIFICATES : INLAND_CERTIFICATES; @@ -175,47 +180,16 @@ export function VesselRegistrationPage() { {inFlight.length > 0 && ( {t('vesselRegistration.inFlight.title')} - {inFlight.map((app) => { - const isDraft = app.status === 'DRAFT'; - const needsAction = app.status === 'RESUBMIT_REQUIRED'; - return ( - - -
- - {app.applicationNumber} - {app.kind === 'RENEWAL' && ( - - {t('vesselRegistration.inFlight.renewalBadge')} - - )} - - -
- - - {STATUS_LABELS[app.status]} - - - -
-
- ); - })} +
)} diff --git a/apps/portal/src/app/i18n/locales/am.ts b/apps/portal/src/app/i18n/locales/am.ts index 948de1c30..e80d54123 100644 --- a/apps/portal/src/app/i18n/locales/am.ts +++ b/apps/portal/src/app/i18n/locales/am.ts @@ -208,6 +208,7 @@ export const am: Translations = { licence: 'ፍቃድ', applicant: 'አመልካች', progress: 'ደረጃ', + applicationNumber: 'የማመልከቻ ቁጥር', }, actions: { continue: 'ቀጥል', diff --git a/apps/portal/src/app/i18n/locales/en.ts b/apps/portal/src/app/i18n/locales/en.ts index 621209e49..738d7e5a6 100644 --- a/apps/portal/src/app/i18n/locales/en.ts +++ b/apps/portal/src/app/i18n/locales/en.ts @@ -207,6 +207,7 @@ export const en = { licence: 'Licence', applicant: 'Applicant', progress: 'Progress', + applicationNumber: 'Application №', }, actions: { continue: 'Continue',