feat: add admin + deploy
ci-front / build (push) Successful in 2m28s

This commit is contained in:
2026-04-04 05:39:00 +03:00
parent 43e16b1360
commit 11cef95929
7 changed files with 1335 additions and 273 deletions
@@ -1,5 +1,12 @@
import { useNavigate, useLocation } from "react-router-dom";
import { FaHome, FaServer, FaPalette, FaUser } from "react-icons/fa";
import {
FaHome,
FaServer,
FaPalette,
FaUser,
FaUsers,
FaRocket,
} from "react-icons/fa";
import { useAuthStore } from "@/modules/auth/store/useAuthStore";
export const Navigation = () => {
@@ -9,7 +16,8 @@ export const Navigation = () => {
const navItems = [
{ path: "/", label: "Главная", icon: FaHome },
{ path: "/add-agents", label: "Агенты", icon: FaServer },
{ path: "/add-agents", label: "Деплой", icon: FaRocket },
{ path: "/admin", label: "Админка", icon: FaUsers, adminOnly: true },
{ path: "/themes", label: "Темы", icon: FaPalette },
];
@@ -40,36 +48,44 @@ export const Navigation = () => {
{/* Навигация */}
<div className="flex items-center gap-1">
{navItems.map((item) => {
const Icon = item.icon;
const active = isActive(item.path);
return (
<button
key={item.path}
onClick={() => navigate(item.path)}
className="flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium transition-all"
style={{
backgroundColor: active ? "var(--accent)" : "transparent",
color: active ? "var(--accent-text)" : "var(--text-secondary)",
}}
onMouseEnter={(e) => {
if (!active) {
e.currentTarget.style.backgroundColor = "var(--bg-secondary)";
e.currentTarget.style.color = "var(--text-primary)";
}
}}
onMouseLeave={(e) => {
if (!active) {
e.currentTarget.style.backgroundColor = "transparent";
e.currentTarget.style.color = "var(--text-secondary)";
}
}}
>
<Icon size={12} />
<span>{item.label}</span>
</button>
);
})}
{navItems
.filter((item) => {
if (item.adminOnly && !user?.permission_admin) return false;
return true;
})
.map((item) => {
const Icon = item.icon;
const active = isActive(item.path);
return (
<button
key={item.path}
onClick={() => navigate(item.path)}
className="flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium transition-all"
style={{
backgroundColor: active ? "var(--accent)" : "transparent",
color: active
? "var(--accent-text)"
: "var(--text-secondary)",
}}
onMouseEnter={(e) => {
if (!active) {
e.currentTarget.style.backgroundColor =
"var(--bg-secondary)";
e.currentTarget.style.color = "var(--text-primary)";
}
}}
onMouseLeave={(e) => {
if (!active) {
e.currentTarget.style.backgroundColor = "transparent";
e.currentTarget.style.color = "var(--text-secondary)";
}
}}
>
<Icon size={12} />
<span>{item.label}</span>
</button>
);
})}
</div>
{/* Профиль пользователя */}
@@ -82,7 +98,10 @@ export const Navigation = () => {
>
<FaUser size={12} style={{ color: "var(--accent)" }} />
</div>
<span className="text-xs" style={{ color: "var(--text-secondary)" }}>
<span
className="text-xs"
style={{ color: "var(--text-secondary)" }}
>
{user.name}
</span>
</div>
@@ -9,6 +9,7 @@ import { RegisterPage } from "@/pages/register.page";
import { DefaultLayout } from "@/shared/layouts/DefaultLayout";
import { AddAgentsPage } from "@/pages/add-agents.page";
import { IDEPage } from "@/pages/ide.page";
import { AdminPage } from "@/pages/admin.page";
export const mockGraphData: GraphData = {
nodes: [
@@ -119,6 +120,7 @@ export const Routing = () => {
<Route path="/" element={<HomePage />} />
<Route path="/themes" element={<ThemesPage />} />
<Route path="/add-agents" element={<AddAgentsPage />} />
<Route path="/admin" element={<AdminPage />} />
<Route path="/IDE" element={<IDEPage />} />
</Route>