Reviewed-on: #19 Reviewed-by: Микаэл Оганесян <15lu.akari@unprism.ru> Co-authored-by: fisenko <kkzemeow@gmail.com> Co-committed-by: fisenko <kkzemeow@gmail.com>
130 lines
2.5 KiB
TypeScript
130 lines
2.5 KiB
TypeScript
import { authStore } from "@shared";
|
|
import {
|
|
Power,
|
|
LucideIcon,
|
|
Building2,
|
|
Map,
|
|
Users,
|
|
Earth,
|
|
Landmark,
|
|
GitBranch,
|
|
Table,
|
|
Split,
|
|
PersonStanding,
|
|
Cpu,
|
|
} from "lucide-react";
|
|
|
|
import carrierIcon from "./carrier.svg";
|
|
|
|
export const DRAWER_WIDTH = 300;
|
|
|
|
interface NavigationItem {
|
|
id: string;
|
|
label: string;
|
|
icon?: LucideIcon | React.ReactNode;
|
|
path?: string;
|
|
for_admin?: boolean;
|
|
onClick?: () => void;
|
|
nestedItems?: NavigationItem[];
|
|
isActive?: boolean;
|
|
}
|
|
|
|
export const NAVIGATION_ITEMS: {
|
|
primary: NavigationItem[];
|
|
secondary: NavigationItem[];
|
|
} = {
|
|
primary: [
|
|
{
|
|
id: "snapshots",
|
|
label: "Снапшоты",
|
|
icon: GitBranch,
|
|
path: "/snapshot",
|
|
for_admin: true,
|
|
},
|
|
{
|
|
id: "map",
|
|
label: "Карта",
|
|
icon: Map,
|
|
path: "/map",
|
|
},
|
|
{
|
|
id: "devices",
|
|
label: "Устройства",
|
|
icon: Cpu,
|
|
path: "/devices",
|
|
for_admin: true,
|
|
},
|
|
{
|
|
id: "users",
|
|
label: "Пользователи",
|
|
icon: Users,
|
|
path: "/user",
|
|
for_admin: true,
|
|
},
|
|
{
|
|
id: "all",
|
|
label: "Справочник",
|
|
icon: Table,
|
|
nestedItems: [
|
|
{
|
|
id: "attractions",
|
|
label: "Достопримечательности",
|
|
icon: Landmark,
|
|
path: "/sight",
|
|
},
|
|
{
|
|
id: "stations",
|
|
label: "Остановки",
|
|
icon: PersonStanding,
|
|
path: "/station",
|
|
},
|
|
{
|
|
id: "routes",
|
|
label: "Маршруты",
|
|
icon: Split,
|
|
path: "/route",
|
|
},
|
|
|
|
{
|
|
id: "countries",
|
|
label: "Страны",
|
|
icon: Earth,
|
|
path: "/country",
|
|
for_admin: true,
|
|
},
|
|
{
|
|
id: "cities",
|
|
label: "Города",
|
|
icon: Building2,
|
|
path: "/city",
|
|
for_admin: true,
|
|
},
|
|
{
|
|
id: "carriers",
|
|
label: "Перевозчики",
|
|
// @ts-ignore
|
|
icon: () => <img src={carrierIcon} alt="Перевозчики" />,
|
|
path: "/carrier",
|
|
for_admin: true,
|
|
},
|
|
],
|
|
},
|
|
],
|
|
secondary: [
|
|
{
|
|
id: "logout",
|
|
label: "Выйти",
|
|
icon: Power,
|
|
onClick: () => {
|
|
authStore.logout();
|
|
window.location.href = "/login";
|
|
},
|
|
},
|
|
],
|
|
};
|
|
|
|
export const VEHICLE_TYPES = [
|
|
{ label: "Трамвай", value: 1 },
|
|
{ label: "Троллейбус", value: 2 },
|
|
];
|