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:
estifanos
2026-09-08 12:42:55 +00:00
parent 2d92d00e0b
commit 723dc5cb70
9 changed files with 7 additions and 741 deletions

View File

@@ -15,19 +15,6 @@ export const am: Translations = {
skipToContent: "ወደ ዋናው ይዘት ዝለል",
},
notFound: {
kicker: 'ስህተት 404 — ገጹ አልተገኘም',
title: 'ከካርታው ውጭ ወጥተዋል',
description:
'ይህ ገጽ የለም፣ ተዛውሯል፣ ወይም ለመለያዎ አይገኝም። አገናኙም ጊዜው ያለፈበት ሊሆን ይችላል።',
home: 'ወደ ዳሽቦርድ ተመለስ',
back: 'ተመለስ',
suggestions: 'ወይም ወደ ሌላ ጠቃሚ ቦታ ይሂዱ',
dashboardDesc: 'ወረፋዎችዎ እና የዛሬው ሥራዎ',
analyticsDesc: 'መጠኖች፣ የማጠናቀቂያ ጊዜ እና አዝማሚያዎች',
profileDesc: 'መለያዎ እና ምርጫዎችዎ',
},
msg: {
genericError: "የሆነ ስህተት ተፈጥሯል። እባክዎ እንደገና ይሞክሩ።",
serverError: "የሰርቨር ስህተት። እባክዎ ቆየት ብለው እንደገና ይሞክሩ።",

View File

@@ -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.',

View File

@@ -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() {