Добавлены кнопки навигации "Главная" и "Экономика" в боковую панель. Реализованы обработчики кликов для перехода на соответствующие страницы. Обновлены стили кнопок для улучшения пользовательского интерфейса в зависимости от состояния навигации.

This commit is contained in:
Veronika Smirnova
2025-08-02 13:13:22 +03:00
parent 3f759e7454
commit a33adda9d7
21 changed files with 3225 additions and 0 deletions

View File

@ -25,6 +25,8 @@ import {
ChevronLeft,
ChevronRight,
BarChart3,
Home,
DollarSign,
} from "lucide-react";
// Компонент для отображения уведомлений о непринятых поставках
@ -173,6 +175,16 @@ export function Sidebar() {
router.push("/partners");
};
const handleHomeClick = () => {
router.push("/home");
};
const handleEconomicsClick = () => {
router.push("/economics");
};
const isHomeActive = pathname === "/home";
const isEconomicsActive = pathname === "/economics";
const isSettingsActive = pathname === "/settings";
const isMarketActive = pathname.startsWith("/market");
const isMessengerActive = pathname.startsWith("/messenger");
@ -304,6 +316,27 @@ export function Sidebar() {
{/* Навигация */}
<div className="space-y-1 mb-3 flex-1">
{/* Кнопка Главная - первая для всех типов кабинетов */}
<Button
variant={isHomeActive ? "secondary" : "ghost"}
className={`w-full ${
isCollapsed ? "justify-center px-2 h-9" : "justify-start h-10"
} text-left transition-all duration-200 text-xs ${
isHomeActive
? "bg-white/20 text-white hover:bg-white/30"
: "text-white/80 hover:bg-white/10 hover:text-white"
} cursor-pointer`}
onClick={handleHomeClick}
title={isCollapsed ? "Главная" : ""}
>
<Home
className={`${
isCollapsed ? "h-4 w-4" : "h-4 w-4"
} flex-shrink-0`}
/>
{!isCollapsed && <span className="ml-3">Главная</span>}
</Button>
<Button
variant={isMarketActive ? "secondary" : "ghost"}
className={`w-full ${
@ -607,6 +640,27 @@ export function Sidebar() {
</Button>
)}
{/* Кнопка Экономика - для всех типов кабинетов, перед настройками */}
<Button
variant={isEconomicsActive ? "secondary" : "ghost"}
className={`w-full ${
isCollapsed ? "justify-center px-2 h-9" : "justify-start h-10"
} text-left transition-all duration-200 text-xs ${
isEconomicsActive
? "bg-white/20 text-white hover:bg-white/30"
: "text-white/80 hover:bg-white/10 hover:text-white"
} cursor-pointer`}
onClick={handleEconomicsClick}
title={isCollapsed ? "Экономика" : ""}
>
<DollarSign
className={`${
isCollapsed ? "h-4 w-4" : "h-4 w-4"
} flex-shrink-0`}
/>
{!isCollapsed && <span className="ml-3">Экономика</span>}
</Button>
<Button
variant={isSettingsActive ? "secondary" : "ghost"}
className={`w-full ${

View File

@ -0,0 +1,40 @@
"use client";
import { useAuth } from "@/hooks/useAuth";
import { SellerEconomicsPage } from "./seller-economics-page";
import { FulfillmentEconomicsPage } from "./fulfillment-economics-page";
import { WholesaleEconomicsPage } from "./wholesale-economics-page";
import { LogistEconomicsPage } from "./logist-economics-page";
export function EconomicsPageWrapper() {
const { user } = useAuth();
// Проверка доступа - только авторизованные пользователи с организацией
if (!user?.organization?.type) {
return (
<div className="min-h-screen bg-gradient-smooth flex items-center justify-center">
<div className="text-white">Ошибка: тип организации не определен</div>
</div>
);
}
// Роутинг по типу организации
switch (user.organization.type) {
case "SELLER":
return <SellerEconomicsPage />;
case "FULFILLMENT":
return <FulfillmentEconomicsPage />;
case "WHOLESALE":
return <WholesaleEconomicsPage />;
case "LOGIST":
return <LogistEconomicsPage />;
default:
return (
<div className="min-h-screen bg-gradient-smooth flex items-center justify-center">
<div className="text-white">
Неподдерживаемый тип кабинета: {user.organization.type}
</div>
</div>
);
}
}

View File

@ -0,0 +1,59 @@
"use client";
import { useAuth } from "@/hooks/useAuth";
import { Sidebar } from "@/components/dashboard/sidebar";
import { useSidebar } from "@/hooks/useSidebar";
import { Card } from "@/components/ui/card";
import { TrendingUp } from "lucide-react";
export function FulfillmentEconomicsPage() {
const { user } = useAuth();
const { getSidebarMargin } = useSidebar();
const getOrganizationName = () => {
if (user?.organization?.name) {
return user.organization.name;
}
if (user?.organization?.fullName) {
return user.organization.fullName;
}
return "Вашей организации";
};
return (
<div className="h-screen flex overflow-hidden">
<Sidebar />
<main
className={`flex-1 ${getSidebarMargin()} px-6 py-4 overflow-hidden transition-all duration-300`}
>
<div className="p-8">
{/* Заголовок страницы */}
<div className="mb-8">
<h1 className="text-3xl font-bold text-white mb-2">
Экономика фулфилмента
</h1>
<p className="text-white/60">
Финансовые показатели {getOrganizationName()}
</p>
</div>
{/* Карточка-заглушка */}
<Card className="bg-white/10 backdrop-blur border-white/20 p-6">
<div className="flex items-center space-x-3 mb-4">
<TrendingUp className="h-8 w-8 text-purple-400" />
<h3 className="text-xl font-semibold text-white">
Экономические показатели
</h3>
</div>
<div className="space-y-2">
<p className="text-white font-medium">
Раздел находится в разработке
</p>
<p className="text-white/60 text-sm">Будет добавлен позже</p>
</div>
</Card>
</div>
</main>
</div>
);
}

View File

@ -0,0 +1,59 @@
"use client";
import { useAuth } from "@/hooks/useAuth";
import { Sidebar } from "@/components/dashboard/sidebar";
import { useSidebar } from "@/hooks/useSidebar";
import { Card } from "@/components/ui/card";
import { Calculator } from "lucide-react";
export function LogistEconomicsPage() {
const { user } = useAuth();
const { getSidebarMargin } = useSidebar();
const getOrganizationName = () => {
if (user?.organization?.name) {
return user.organization.name;
}
if (user?.organization?.fullName) {
return user.organization.fullName;
}
return "Вашей организации";
};
return (
<div className="h-screen flex overflow-hidden">
<Sidebar />
<main
className={`flex-1 ${getSidebarMargin()} px-6 py-4 overflow-hidden transition-all duration-300`}
>
<div className="p-8">
{/* Заголовок страницы */}
<div className="mb-8">
<h1 className="text-3xl font-bold text-white mb-2">
Экономика логистики
</h1>
<p className="text-white/60">
Финансовые показатели {getOrganizationName()}
</p>
</div>
{/* Карточка-заглушка */}
<Card className="bg-white/10 backdrop-blur border-white/20 p-6">
<div className="flex items-center space-x-3 mb-4">
<Calculator className="h-8 w-8 text-orange-400" />
<h3 className="text-xl font-semibold text-white">
Экономические показатели
</h3>
</div>
<div className="space-y-2">
<p className="text-white font-medium">
Раздел находится в разработке
</p>
<p className="text-white/60 text-sm">Будет добавлен позже</p>
</div>
</Card>
</div>
</main>
</div>
);
}

View File

@ -0,0 +1,59 @@
"use client";
import { useAuth } from "@/hooks/useAuth";
import { Sidebar } from "@/components/dashboard/sidebar";
import { useSidebar } from "@/hooks/useSidebar";
import { Card } from "@/components/ui/card";
import { DollarSign } from "lucide-react";
export function SellerEconomicsPage() {
const { user } = useAuth();
const { getSidebarMargin } = useSidebar();
const getOrganizationName = () => {
if (user?.organization?.name) {
return user.organization.name;
}
if (user?.organization?.fullName) {
return user.organization.fullName;
}
return "Вашей организации";
};
return (
<div className="h-screen flex overflow-hidden">
<Sidebar />
<main
className={`flex-1 ${getSidebarMargin()} px-6 py-4 overflow-hidden transition-all duration-300`}
>
<div className="p-8">
{/* Заголовок страницы */}
<div className="mb-8">
<h1 className="text-3xl font-bold text-white mb-2">
Экономика селлера
</h1>
<p className="text-white/60">
Финансовые показатели {getOrganizationName()}
</p>
</div>
{/* Карточка-заглушка */}
<Card className="bg-white/10 backdrop-blur border-white/20 p-6">
<div className="flex items-center space-x-3 mb-4">
<DollarSign className="h-8 w-8 text-green-400" />
<h3 className="text-xl font-semibold text-white">
Экономические показатели
</h3>
</div>
<div className="space-y-2">
<p className="text-white font-medium">
Раздел находится в разработке
</p>
<p className="text-white/60 text-sm">Будет добавлен позже</p>
</div>
</Card>
</div>
</main>
</div>
);
}

View File

@ -0,0 +1,59 @@
"use client";
import { useAuth } from "@/hooks/useAuth";
import { Sidebar } from "@/components/dashboard/sidebar";
import { useSidebar } from "@/hooks/useSidebar";
import { Card } from "@/components/ui/card";
import { BarChart3 } from "lucide-react";
export function WholesaleEconomicsPage() {
const { user } = useAuth();
const { getSidebarMargin } = useSidebar();
const getOrganizationName = () => {
if (user?.organization?.name) {
return user.organization.name;
}
if (user?.organization?.fullName) {
return user.organization.fullName;
}
return "Вашей организации";
};
return (
<div className="h-screen flex overflow-hidden">
<Sidebar />
<main
className={`flex-1 ${getSidebarMargin()} px-6 py-4 overflow-hidden transition-all duration-300`}
>
<div className="p-8">
{/* Заголовок страницы */}
<div className="mb-8">
<h1 className="text-3xl font-bold text-white mb-2">
Экономика поставщика
</h1>
<p className="text-white/60">
Финансовые показатели {getOrganizationName()}
</p>
</div>
{/* Карточка-заглушка */}
<Card className="bg-white/10 backdrop-blur border-white/20 p-6">
<div className="flex items-center space-x-3 mb-4">
<BarChart3 className="h-8 w-8 text-blue-400" />
<h3 className="text-xl font-semibold text-white">
Экономические показатели
</h3>
</div>
<div className="space-y-2">
<p className="text-white font-medium">
Раздел находится в разработке
</p>
<p className="text-white/60 text-sm">Будет добавлен позже</p>
</div>
</Card>
</div>
</main>
</div>
);
}

View File

@ -0,0 +1,62 @@
"use client";
import { useAuth } from "@/hooks/useAuth";
import { Sidebar } from "@/components/dashboard/sidebar";
import { useSidebar } from "@/hooks/useSidebar";
import { Card } from "@/components/ui/card";
import { Factory } from "lucide-react";
export function FulfillmentHomePage() {
const { user } = useAuth();
const { getSidebarMargin } = useSidebar();
const getOrganizationName = () => {
if (user?.organization?.name) {
return user.organization.name;
}
if (user?.organization?.fullName) {
return user.organization.fullName;
}
return "Вашей организации";
};
return (
<div className="h-screen flex overflow-hidden">
<Sidebar />
<main
className={`flex-1 ${getSidebarMargin()} px-6 py-4 overflow-hidden transition-all duration-300`}
>
<div className="p-8">
{/* Заголовок страницы */}
<div className="mb-8">
<h1 className="text-3xl font-bold text-white mb-2">
Главная страница фулфилмента
</h1>
<p className="text-white/60">
Добро пожаловать в кабинет фулфилмент-центра{" "}
{getOrganizationName()}
</p>
</div>
{/* Карточка-заглушка */}
<Card className="bg-white/10 backdrop-blur border-white/20 p-6">
<div className="flex items-center space-x-3 mb-4">
<Factory className="h-8 w-8 text-purple-400" />
<h3 className="text-xl font-semibold text-white">
Кабинет фулфилмента
</h3>
</div>
<div className="space-y-2">
<p className="text-white font-medium">
Страница находится в разработке
</p>
<p className="text-white/60 text-sm">
Содержание будет добавлено позже
</p>
</div>
</Card>
</div>
</main>
</div>
);
}

View File

@ -0,0 +1,40 @@
"use client";
import { useAuth } from "@/hooks/useAuth";
import { SellerHomePage } from "./seller-home-page";
import { FulfillmentHomePage } from "./fulfillment-home-page";
import { WholesaleHomePage } from "./wholesale-home-page";
import { LogistHomePage } from "./logist-home-page";
export function HomePageWrapper() {
const { user } = useAuth();
// Проверка доступа - только авторизованные пользователи с организацией
if (!user?.organization?.type) {
return (
<div className="min-h-screen bg-gradient-smooth flex items-center justify-center">
<div className="text-white">Ошибка: тип организации не определен</div>
</div>
);
}
// Роутинг по типу организации
switch (user.organization.type) {
case "SELLER":
return <SellerHomePage />;
case "FULFILLMENT":
return <FulfillmentHomePage />;
case "WHOLESALE":
return <WholesaleHomePage />;
case "LOGIST":
return <LogistHomePage />;
default:
return (
<div className="min-h-screen bg-gradient-smooth flex items-center justify-center">
<div className="text-white">
Неподдерживаемый тип кабинета: {user.organization.type}
</div>
</div>
);
}
}

View File

@ -0,0 +1,62 @@
"use client";
import { useAuth } from "@/hooks/useAuth";
import { Sidebar } from "@/components/dashboard/sidebar";
import { useSidebar } from "@/hooks/useSidebar";
import { Card } from "@/components/ui/card";
import { Truck } from "lucide-react";
export function LogistHomePage() {
const { user } = useAuth();
const { getSidebarMargin } = useSidebar();
const getOrganizationName = () => {
if (user?.organization?.name) {
return user.organization.name;
}
if (user?.organization?.fullName) {
return user.organization.fullName;
}
return "Вашей организации";
};
return (
<div className="h-screen flex overflow-hidden">
<Sidebar />
<main
className={`flex-1 ${getSidebarMargin()} px-6 py-4 overflow-hidden transition-all duration-300`}
>
<div className="p-8">
{/* Заголовок страницы */}
<div className="mb-8">
<h1 className="text-3xl font-bold text-white mb-2">
Главная страница логистики
</h1>
<p className="text-white/60">
Добро пожаловать в кабинет логистической компании{" "}
{getOrganizationName()}
</p>
</div>
{/* Карточка-заглушка */}
<Card className="bg-white/10 backdrop-blur border-white/20 p-6">
<div className="flex items-center space-x-3 mb-4">
<Truck className="h-8 w-8 text-orange-400" />
<h3 className="text-xl font-semibold text-white">
Кабинет логистики
</h3>
</div>
<div className="space-y-2">
<p className="text-white font-medium">
Страница находится в разработке
</p>
<p className="text-white/60 text-sm">
Содержание будет добавлено позже
</p>
</div>
</Card>
</div>
</main>
</div>
);
}

View File

@ -0,0 +1,61 @@
"use client";
import { useAuth } from "@/hooks/useAuth";
import { Sidebar } from "@/components/dashboard/sidebar";
import { useSidebar } from "@/hooks/useSidebar";
import { Card } from "@/components/ui/card";
import { Building2 } from "lucide-react";
export function SellerHomePage() {
const { user } = useAuth();
const { getSidebarMargin } = useSidebar();
const getOrganizationName = () => {
if (user?.organization?.name) {
return user.organization.name;
}
if (user?.organization?.fullName) {
return user.organization.fullName;
}
return "Вашей организации";
};
return (
<div className="h-screen flex overflow-hidden">
<Sidebar />
<main
className={`flex-1 ${getSidebarMargin()} px-6 py-4 overflow-hidden transition-all duration-300`}
>
<div className="p-8">
{/* Заголовок страницы */}
<div className="mb-8">
<h1 className="text-3xl font-bold text-white mb-2">
Главная страница селлера
</h1>
<p className="text-white/60">
Добро пожаловать в кабинет селлера {getOrganizationName()}
</p>
</div>
{/* Карточка-заглушка */}
<Card className="bg-white/10 backdrop-blur border-white/20 p-6">
<div className="flex items-center space-x-3 mb-4">
<Building2 className="h-8 w-8 text-blue-400" />
<h3 className="text-xl font-semibold text-white">
Кабинет селлера
</h3>
</div>
<div className="space-y-2">
<p className="text-white font-medium">
Страница находится в разработке
</p>
<p className="text-white/60 text-sm">
Содержание будет добавлено позже
</p>
</div>
</Card>
</div>
</main>
</div>
);
}

View File

@ -0,0 +1,61 @@
"use client";
import { useAuth } from "@/hooks/useAuth";
import { Sidebar } from "@/components/dashboard/sidebar";
import { useSidebar } from "@/hooks/useSidebar";
import { Card } from "@/components/ui/card";
import { Package } from "lucide-react";
export function WholesaleHomePage() {
const { user } = useAuth();
const { getSidebarMargin } = useSidebar();
const getOrganizationName = () => {
if (user?.organization?.name) {
return user.organization.name;
}
if (user?.organization?.fullName) {
return user.organization.fullName;
}
return "Вашей организации";
};
return (
<div className="h-screen flex overflow-hidden">
<Sidebar />
<main
className={`flex-1 ${getSidebarMargin()} px-6 py-4 overflow-hidden transition-all duration-300`}
>
<div className="p-8">
{/* Заголовок страницы */}
<div className="mb-8">
<h1 className="text-3xl font-bold text-white mb-2">
Главная страница поставщика
</h1>
<p className="text-white/60">
Добро пожаловать в кабинет поставщика {getOrganizationName()}
</p>
</div>
{/* Карточка-заглушка */}
<Card className="bg-white/10 backdrop-blur border-white/20 p-6">
<div className="flex items-center space-x-3 mb-4">
<Package className="h-8 w-8 text-green-400" />
<h3 className="text-xl font-semibold text-white">
Кабинет поставщика
</h3>
</div>
<div className="space-y-2">
<p className="text-white font-medium">
Страница находится в разработке
</p>
<p className="text-white/60 text-sm">
Содержание будет добавлено позже
</p>
</div>
</Card>
</div>
</main>
</div>
);
}