feat: themes
ci-front / build (push) Successful in 2m17s

This commit is contained in:
nikita
2026-04-04 13:38:32 +03:00
parent 8175d7b3a5
commit 55cb214458
14 changed files with 197 additions and 99 deletions
@@ -3,19 +3,24 @@ import { FaCode } from "react-icons/fa";
import {
FaHome,
FaServer,
FaPalette,
FaUser,
FaUsers,
FaRocket,
FaKey,
FaFileAlt,
FaSun,
FaMoon,
} from "react-icons/fa";
import { useAuthStore } from "@/modules/auth/store/useAuthStore";
import { useThemeStore } from "@/modules/theme-bw/stores/theme.store";
export const Navigation = () => {
const navigate = useNavigate();
const location = useLocation();
const { user, logout } = useAuthStore();
const { toggleTheme, theme } = useThemeStore();
const isDark = theme === "dark";
const navItems = [
{ path: "/", label: "Главная", icon: FaHome },
@@ -25,7 +30,6 @@ export const Navigation = () => {
{ path: "/registration", label: "Регистрация", icon: FaKey },
{ path: "/logs", label: "Логи", icon: FaFileAlt },
{ path: "/admin", label: "Админка", icon: FaUsers, adminOnly: true },
{ path: "/themes", label: "Темы", icon: FaPalette },
];
const isActive = (path: string) => location.pathname === path;
@@ -101,6 +105,21 @@ export const Navigation = () => {
</span>
</div>
)}
{/* Переключатель темы */}
<button
onClick={toggleTheme}
className="p-1.5 rounded-lg transition-colors"
style={{
backgroundColor: "var(--bg-secondary)",
color: isDark ? "#fbbf24" : "#3b82f6",
border: "1px solid var(--border)",
}}
title={isDark ? "Светлая тема" : "Тёмная тема"}
>
{isDark ? <FaSun size={12} /> : <FaMoon size={12} />}
</button>
<button
onClick={() => {
logout();
@@ -1,7 +1,6 @@
import { Suspense } from "react";
import { Routes as ReactRoutes, Route, Navigate } from "react-router-dom";
import { HomePage } from "@/pages/home.page";
import { ThemesPage } from "@/pages/themes.page";
import { TestPage } from "@/pages/test.page";
import { Graph, type GraphData } from "@/modules/graph";
import { AuthPage } from "@/pages/auth.page";
@@ -122,7 +121,6 @@ export const Routing = () => {
<Route element={<DefaultLayout />}>
<Route path="/" element={<HomePage />} />
<Route path="/themes" element={<ThemesPage />} />
<Route path="/add-agents" element={<AddAgentsPage />} />
<Route path="/registration" element={<RegistrationTokenPage />} />
<Route path="/logs" element={<LogsPage />} />