150 lines
2.9 KiB
TypeScript
150 lines
2.9 KiB
TypeScript
import { authStore } from "@shared";
|
|
import {
|
|
Power,
|
|
LucideIcon,
|
|
Building2,
|
|
Map,
|
|
Users,
|
|
Earth,
|
|
Landmark,
|
|
GitBranch,
|
|
// Car,
|
|
Table,
|
|
Split,
|
|
// Newspaper,
|
|
PersonStanding,
|
|
Cpu,
|
|
// BookImage,
|
|
} from "lucide-react";
|
|
import { CarrierSvg } from "./CarrierSvg";
|
|
|
|
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: "vehicles",
|
|
// label: "Транспорт",
|
|
// icon: Car,
|
|
// path: "/vehicle",
|
|
// },
|
|
{
|
|
id: "users",
|
|
label: "Пользователи",
|
|
icon: Users,
|
|
path: "/user",
|
|
for_admin: true,
|
|
},
|
|
{
|
|
id: "all",
|
|
label: "Справочник",
|
|
icon: Table,
|
|
nestedItems: [
|
|
// {
|
|
// id: "media",
|
|
// label: "Медиа",
|
|
// icon: BookImage,
|
|
// path: "/media",
|
|
// },
|
|
// {
|
|
// id: "articles",
|
|
// label: "Статьи",
|
|
// icon: Newspaper,
|
|
// path: "/article",
|
|
// },
|
|
{
|
|
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: CarrierSvg,
|
|
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 },
|
|
];
|