portal pages update for details view
This commit is contained in:
parent
b0856c986f
commit
78a7ff2060
5 changed files with 193 additions and 47 deletions
|
|
@ -59,21 +59,21 @@ function legacyMap(pathname: string): MapResult | null {
|
|||
if (pathname.startsWith("/portal")) return null;
|
||||
|
||||
// 1) DETAIL PAGES: map legacy detail URLs straight into the portal with ?id=
|
||||
// NOTE: We intentionally DO NOT remap `/lasers/:id` and `/projects/:id`
|
||||
// so the portal iframes can load those canonical pages without recursion.
|
||||
const detailRules: Array<[RegExp, (m: RegExpExecArray) => MapResult]> = [
|
||||
// Laser settings
|
||||
[/^\/fiber-settings\/([^/]+)\/?$/i, (m) => ({ pathname: "/portal/laser-settings", query: { t: "fiber", id: m[1] } })],
|
||||
[/^\/uv-settings\/([^/]+)\/?$/i, (m) => ({ pathname: "/portal/laser-settings", query: { t: "uv", id: m[1] } })],
|
||||
[/^\/co2-galvo-settings\/([^/]+)\/?$/i, (m) => ({ pathname: "/portal/laser-settings", query: { t: "co2-galvo", id: m[1] } })],
|
||||
[/^\/co2-gantry-settings\/([^/]+)\/?$/i, (m) => ({ pathname: "/portal/laser-settings", query: { t: "co2-gantry", id: m[1] } })],
|
||||
[/^\/co2gantry-settings\/([^/]+)\/?$/i, (m) => ({ pathname: "/portal/laser-settings", query: { t: "co2-gantry", id: m[1] } })], // old alias
|
||||
[/^\/co2gantry-settings\/([^/]+)\/?$/i, (m) => ({ pathname: "/portal/laser-settings", query: { t: "co2-gantry", id: m[1] } })],
|
||||
|
||||
// Materials
|
||||
[/^\/materials\/([^/]+)\/?$/i, (m) => ({ pathname: "/portal/materials", query: { t: "materials", id: m[1] } })],
|
||||
[/^\/materials-coatings\/([^/]+)\/?$/i, (m) => ({ pathname: "/portal/materials", query: { t: "materials-coatings", id: m[1] } })],
|
||||
|
||||
// Lasers / Projects detail
|
||||
[/^\/lasers\/([^/]+)\/?$/i, (m) => ({ pathname: "/portal/laser-sources", query: { id: m[1] } })],
|
||||
[/^\/projects\/([^/]+)\/?$/i, (m) => ({ pathname: "/portal/projects", query: { id: m[1] } })],
|
||||
// (no lasers/projects detail remap here on purpose)
|
||||
];
|
||||
for (const [re, to] of detailRules) {
|
||||
const m = re.exec(pathname);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue