2026-03-19 03:36:46 +01:00
|
|
|
import { A, useParams } from '@solidjs/router';
|
2026-03-23 21:13:42 +01:00
|
|
|
import { createMemo, onMount } from 'solid-js';
|
|
|
|
|
import { useNavigate } from '@solidjs/router';
|
2026-03-19 03:36:46 +01:00
|
|
|
import AdminShell from '~/components/AdminShell';
|
|
|
|
|
|
|
|
|
|
function toTitle(value: string): string {
|
|
|
|
|
return value
|
|
|
|
|
.split(/[-_/]/g)
|
|
|
|
|
.filter(Boolean)
|
|
|
|
|
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
|
|
|
|
|
.join(' ');
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-23 21:13:42 +01:00
|
|
|
const LEGACY_ADMIN_ORIGIN = import.meta.env.VITE_LEGACY_ADMIN_ORIGIN || 'http://localhost:3001';
|
2026-03-19 03:36:46 +01:00
|
|
|
|
|
|
|
|
function resolveLegacyPath(modulePath: string): string {
|
|
|
|
|
switch (modulePath) {
|
|
|
|
|
case 'roles':
|
|
|
|
|
return '/roles?scope=internal';
|
2026-03-23 21:13:42 +01:00
|
|
|
case 'approval-management':
|
|
|
|
|
case 'approvals':
|
|
|
|
|
return '/approval';
|
2026-03-19 03:36:46 +01:00
|
|
|
case 'onboarding-management':
|
|
|
|
|
return '/onboarding-management';
|
|
|
|
|
case 'internal-dashboard-management':
|
|
|
|
|
return '/internal-dashboard-management';
|
|
|
|
|
case 'external-dashboard-management':
|
|
|
|
|
return '/external-dashboard-management';
|
|
|
|
|
case 'support':
|
|
|
|
|
return '/help';
|
|
|
|
|
default:
|
|
|
|
|
return `/${modulePath}`;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default function LegacyModuleShellPage() {
|
|
|
|
|
const params = useParams();
|
2026-03-23 21:13:42 +01:00
|
|
|
const navigate = useNavigate();
|
2026-03-19 03:36:46 +01:00
|
|
|
const modulePath = String((params as any).module || '').trim();
|
|
|
|
|
const moduleName = createMemo(() => toTitle(modulePath || 'Management'));
|
|
|
|
|
const legacyPath = createMemo(() => resolveLegacyPath(modulePath));
|
|
|
|
|
const legacyUrl = createMemo(() => `${LEGACY_ADMIN_ORIGIN}${legacyPath()}`);
|
|
|
|
|
|
2026-03-23 21:13:42 +01:00
|
|
|
onMount(() => {
|
|
|
|
|
if (modulePath === 'approval') navigate('/admin/approval', { replace: true });
|
|
|
|
|
});
|
|
|
|
|
|
2026-03-19 03:36:46 +01:00
|
|
|
return (
|
|
|
|
|
<AdminShell>
|
|
|
|
|
<h1 class="page-title">{moduleName()}</h1>
|
|
|
|
|
<p class="page-subtitle">
|
|
|
|
|
Live legacy module embedded for exact design and functionality parity during migration.
|
|
|
|
|
</p>
|
|
|
|
|
<section class="card">
|
|
|
|
|
<div class="actions">
|
|
|
|
|
<A class="btn" href={legacyUrl()} target="_blank">Open Module In New Tab</A>
|
|
|
|
|
</div>
|
|
|
|
|
<iframe
|
|
|
|
|
src={legacyUrl()}
|
|
|
|
|
title={`${moduleName()} (Legacy)`}
|
|
|
|
|
style={{ width: '100%', height: '72vh', border: '1px solid #e2e8f0', 'border-radius': '10px', 'margin-top': '10px' }}
|
|
|
|
|
/>
|
|
|
|
|
</section>
|
|
|
|
|
</AdminShell>
|
|
|
|
|
);
|
|
|
|
|
}
|