mirror of
https://github.com/Tria-plc/emaui.git
synced 2026-09-09 07:08:20 +00:00
Revert "feat: implement custom 404 error page and internationalized navigation suggestions for backoffice and portal apps"
This reverts commit 2d92d00e0b.
This commit is contained in:
@@ -15,19 +15,6 @@ export const am: Translations = {
|
||||
skipToContent: "ወደ ዋናው ይዘት ዝለል",
|
||||
},
|
||||
|
||||
notFound: {
|
||||
kicker: 'ስህተት 404 — ገጹ አልተገኘም',
|
||||
title: 'ከካርታው ውጭ ወጥተዋል',
|
||||
description:
|
||||
'ይህ ገጽ የለም፣ ተዛውሯል፣ ወይም ለመለያዎ አይገኝም። አገናኙም ጊዜው ያለፈበት ሊሆን ይችላል።',
|
||||
home: 'ወደ ዳሽቦርድ ተመለስ',
|
||||
back: 'ተመለስ',
|
||||
suggestions: 'ወይም ወደ ሌላ ጠቃሚ ቦታ ይሂዱ',
|
||||
dashboardDesc: 'ወረፋዎችዎ እና የዛሬው ሥራዎ',
|
||||
analyticsDesc: 'መጠኖች፣ የማጠናቀቂያ ጊዜ እና አዝማሚያዎች',
|
||||
profileDesc: 'መለያዎ እና ምርጫዎችዎ',
|
||||
},
|
||||
|
||||
msg: {
|
||||
genericError: "የሆነ ስህተት ተፈጥሯል። እባክዎ እንደገና ይሞክሩ።",
|
||||
serverError: "የሰርቨር ስህተት። እባክዎ ቆየት ብለው እንደገና ይሞክሩ።",
|
||||
|
||||
@@ -15,21 +15,6 @@ export const en = {
|
||||
skipToContent: 'Skip to main content',
|
||||
},
|
||||
|
||||
// The page a wrong URL lands on. Labels for its suggested destinations come
|
||||
// from `nav`, so they cannot drift from the sidebar.
|
||||
notFound: {
|
||||
kicker: 'Error 404 — page not found',
|
||||
title: "You've drifted off the chart",
|
||||
description:
|
||||
'This page does not exist, has moved, or is not available to your account. The link may be out of date.',
|
||||
home: 'Back to dashboard',
|
||||
back: 'Go back',
|
||||
suggestions: 'Or head somewhere useful',
|
||||
dashboardDesc: "Your queues and today's workload",
|
||||
analyticsDesc: 'Volumes, turnaround and trends',
|
||||
profileDesc: 'Your account and preferences',
|
||||
},
|
||||
|
||||
msg: {
|
||||
genericError: 'Something went wrong. Please try again.',
|
||||
serverError: 'Server error. Please try again later.',
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import type { ReactNode } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import {
|
||||
createBrowserRouter,
|
||||
RouterProvider,
|
||||
@@ -13,12 +12,7 @@ import {
|
||||
RequirePermission,
|
||||
LICENSE_PERMISSIONS as P,
|
||||
} from '@ema-platform/auth';
|
||||
import { NotFoundPage, ThemeGallery } from '@ema-platform/ui';
|
||||
import {
|
||||
IconChartBar,
|
||||
IconLayoutDashboard,
|
||||
IconUserCircle,
|
||||
} from '@tabler/icons-react';
|
||||
import { ThemeGallery } from '@ema-platform/ui';
|
||||
import { AuthLayout } from '../layouts/AuthLayout';
|
||||
import { BackofficeLayout } from '../layouts/BackofficeLayout';
|
||||
import { ProtectedRoute } from './ProtectedRoute';
|
||||
@@ -73,41 +67,6 @@ const guard = (anyOf: string[], element: ReactNode) => (
|
||||
<RequirePermission anyOf={anyOf}>{element}</RequirePermission>
|
||||
);
|
||||
|
||||
/**
|
||||
* Only the destinations every signed-in officer can reach — suggesting a
|
||||
* permission-gated queue would swap one dead end for another. Labels come from
|
||||
* `nav`, the same keys the sidebar uses, so the two cannot drift apart.
|
||||
*/
|
||||
function NotFound() {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<NotFoundPage
|
||||
homePath="/dashboard"
|
||||
links={[
|
||||
{
|
||||
label: t('nav.dashboard'),
|
||||
description: t('notFound.dashboardDesc'),
|
||||
to: '/dashboard',
|
||||
icon: IconLayoutDashboard,
|
||||
},
|
||||
{
|
||||
label: t('nav.analytics'),
|
||||
description: t('notFound.analyticsDesc'),
|
||||
to: '/analytics',
|
||||
icon: IconChartBar,
|
||||
},
|
||||
{
|
||||
label: t('nav.profile'),
|
||||
description: t('notFound.profileDesc'),
|
||||
to: '/profile',
|
||||
icon: IconUserCircle,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
const router = createBrowserRouter([
|
||||
{
|
||||
element: <AuthLayout />,
|
||||
@@ -204,10 +163,8 @@ const router = createBrowserRouter([
|
||||
},
|
||||
],
|
||||
},
|
||||
// Standalone by design — a wrong URL should read as a wrong URL, not bounce
|
||||
// an officer through the layout of a page they never asked for.
|
||||
{ path: '/404', element: <NotFound /> },
|
||||
{ path: '*', element: <NotFound /> },
|
||||
{ path: '/404', element: <div>Page not found</div> },
|
||||
{ path: '*', element: <Navigate to="/404" replace /> },
|
||||
]);
|
||||
|
||||
export function AppRouter() {
|
||||
|
||||
@@ -14,20 +14,6 @@ export const am: Translations = {
|
||||
skipToContent: 'ወደ ዋናው ይዘት ዝለል',
|
||||
},
|
||||
|
||||
notFound: {
|
||||
kicker: 'ስህተት 404 — ገጹ አልተገኘም',
|
||||
title: 'ከካርታው ውጭ ወጥተዋል',
|
||||
description:
|
||||
'ይህ ገጽ የለም፣ ተዛውሯል፣ ወይም ለመለያዎ አይገኝም። አገናኙም ጊዜው ያለፈበት ሊሆን ይችላል።',
|
||||
home: 'ወደ ዳሽቦርድ ተመለስ',
|
||||
back: 'ተመለስ',
|
||||
suggestions: 'ወይም ወደ ሌላ ጠቃሚ ቦታ ይሂዱ',
|
||||
dashboardDesc: 'ማመልከቻዎችዎ፣ ፈቃዶችዎ እና ቀጣይ እርምጃዎች',
|
||||
documentsDesc: 'የጫኗቸው ሁሉም ሰነዶች',
|
||||
notificationsDesc: 'ስላቀረቧቸው ጉዳዮች ማሻሻያዎች',
|
||||
supportDesc: 'ለእገዛ ባለሥልጣኑን ያግኙ',
|
||||
},
|
||||
|
||||
msg: {
|
||||
genericError: 'የሆነ ስህተት ተፈጥሯል። እባክዎ እንደገና ይሞክሩ።',
|
||||
serverError: 'የሰርቨር ስህተት። እባክዎ ቆየት ብለው እንደገና ይሞክሩ።',
|
||||
|
||||
@@ -14,22 +14,6 @@ export const en = {
|
||||
skipToContent: 'Skip to main content',
|
||||
},
|
||||
|
||||
// The page a wrong URL lands on. Labels for its suggested destinations come
|
||||
// from `nav`, so they cannot drift from the sidebar.
|
||||
notFound: {
|
||||
kicker: 'Error 404 — page not found',
|
||||
title: "You've drifted off the chart",
|
||||
description:
|
||||
'This page does not exist, has moved, or is not available to your account. The link may be out of date.',
|
||||
home: 'Back to dashboard',
|
||||
back: 'Go back',
|
||||
suggestions: 'Or head somewhere useful',
|
||||
dashboardDesc: 'Your applications, licences and next steps',
|
||||
documentsDesc: 'Everything you have uploaded',
|
||||
notificationsDesc: 'Updates on what you have filed',
|
||||
supportDesc: 'Reach the authority for help',
|
||||
},
|
||||
|
||||
msg: {
|
||||
genericError: 'Something went wrong. Please try again.',
|
||||
serverError: 'Server error. Please try again later.',
|
||||
|
||||
@@ -1,12 +1,5 @@
|
||||
import { createBrowserRouter, Navigate } from "react-router-dom";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { NotFoundPage, ThemeGallery } from "@ema-platform/ui";
|
||||
import {
|
||||
IconBell,
|
||||
IconFolder,
|
||||
IconLayoutDashboard,
|
||||
IconLifebuoy,
|
||||
} from "@tabler/icons-react";
|
||||
import { ThemeGallery } from "@ema-platform/ui";
|
||||
import { PortalLayout } from "./layouts/PortalLayout";
|
||||
import { ProtectedRoute } from "./components/ProtectedRoute";
|
||||
import { LandingRoute } from "./components/LandingRoute";
|
||||
@@ -64,47 +57,6 @@ import { WaiverPage } from "./features/waiver/pages/WaiverPage";
|
||||
|
||||
import { VesselRegistrationStatusPage } from "./features/vessel-registration/pages/VesselRegistrationStatusPage";
|
||||
|
||||
/**
|
||||
* Only routes with no permission gate, so a suggestion can never land the
|
||||
* applicant on a second refusal. Labels come from `nav`, the same keys the
|
||||
* sidebar uses, so the two cannot drift apart.
|
||||
*/
|
||||
function NotFound() {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<NotFoundPage
|
||||
homePath="/dashboard"
|
||||
links={[
|
||||
{
|
||||
label: t("nav.dashboard"),
|
||||
description: t("notFound.dashboardDesc"),
|
||||
to: "/dashboard",
|
||||
icon: IconLayoutDashboard,
|
||||
},
|
||||
{
|
||||
label: t("nav.documents"),
|
||||
description: t("notFound.documentsDesc"),
|
||||
to: "/documents",
|
||||
icon: IconFolder,
|
||||
},
|
||||
{
|
||||
label: t("nav.notifications"),
|
||||
description: t("notFound.notificationsDesc"),
|
||||
to: "/notifications",
|
||||
icon: IconBell,
|
||||
},
|
||||
{
|
||||
label: t("nav.support"),
|
||||
description: t("notFound.supportDesc"),
|
||||
to: "/support",
|
||||
icon: IconLifebuoy,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export const router = createBrowserRouter([
|
||||
// Public landing page — institutional overview + role-based entry points.
|
||||
{ path: "/", element: <LandingRoute /> },
|
||||
@@ -531,11 +483,7 @@ export const router = createBrowserRouter([
|
||||
element: <Navigate to="/vessel-ownership-transfer" replace />,
|
||||
},
|
||||
|
||||
// A typo'd URL used to be redirected silently to the dashboard, which read as
|
||||
// the app ignoring the link rather than as a missing page. Say so instead,
|
||||
// and offer the way back — the primary action is /dashboard, so a signed-in
|
||||
// user is one click from where the redirect used to dump them, and
|
||||
// ProtectedRoute still sends anonymous visitors on to / (landing).
|
||||
{ path: "/404", element: <NotFound /> },
|
||||
{ path: "*", element: <NotFound /> },
|
||||
// A typo'd URL should not maroon a signed-in user on the marketing page —
|
||||
// ProtectedRoute sends anonymous visitors on to / (landing) instead.
|
||||
{ path: "*", element: <Navigate to="/dashboard" replace /> },
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user