feat(админка): оболочка v2 с пятью разделами
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
export const BASE = "/admin/v2";
|
||||
export const SECTIONS = [
|
||||
["today", "Мой день", BASE],
|
||||
["customers", "Клиенты", `${BASE}/customers`],
|
||||
["money", "Деньги", `${BASE}/money`],
|
||||
["work", "Работа", `${BASE}/work`],
|
||||
["system", "Система", `${BASE}/system`],
|
||||
];
|
||||
|
||||
export function sectionFromPath(pathname) {
|
||||
const clean = (pathname || "").replace(/\/+$/, "");
|
||||
if (clean === BASE || clean === `${BASE}/today`) return "today";
|
||||
const found = SECTIONS.find(([, , href]) => clean === href);
|
||||
return found ? found[0] : "today";
|
||||
}
|
||||
|
||||
export function hrefFor(section) {
|
||||
const found = SECTIONS.find(([key]) => key === section);
|
||||
return found ? found[2] : BASE;
|
||||
}
|
||||
Reference in New Issue
Block a user