diff --git a/src/app/providers/helper/protected.route.tsx b/src/app/providers/helper/protected.route.tsx index f803ad1..b702b45 100644 --- a/src/app/providers/helper/protected.route.tsx +++ b/src/app/providers/helper/protected.route.tsx @@ -8,7 +8,7 @@ interface ProtectedRouteProps { export const ProtectedRoute: React.FC = ({ children, - fallbackPath = "/", + fallbackPath = "/auth", }) => { const isAuthenticated = authService.isAuthenticated(); diff --git a/src/app/providers/routing.tsx b/src/app/providers/routing.tsx index 0203765..132830c 100644 --- a/src/app/providers/routing.tsx +++ b/src/app/providers/routing.tsx @@ -17,16 +17,13 @@ export const Routing = () => { } > - } /> + } /> + } /> } - /> - - + } /> diff --git a/src/modules/auth/hooks/useAuth.ts b/src/modules/auth/hooks/useAuth.ts index a8c5df4..913f55a 100644 --- a/src/modules/auth/hooks/useAuth.ts +++ b/src/modules/auth/hooks/useAuth.ts @@ -6,7 +6,6 @@ import type { LoginCredentials, RegisterData, OrganizationCreateData, - OrganizationMember, } from "../types/auth.types"; export const useAuth = () => { @@ -24,7 +23,7 @@ export const useAuth = () => { const orgs = await request(() => authService.getOrganizations()); if (orgs && orgs.length > 0) { authService.saveOrganization(orgs[0]); - navigate("/home"); + navigate("/"); } else { navigate("/create-organization"); } @@ -58,7 +57,7 @@ export const useAuth = () => { if (result) { authService.saveOrganization(result); - navigate("/home"); + navigate("/"); } else if (error) { setAuthError(error); } diff --git a/src/pages/AuthPage.tsx b/src/pages/AuthPage.tsx index 418b2b3..ca2cd28 100644 --- a/src/pages/AuthPage.tsx +++ b/src/pages/AuthPage.tsx @@ -1,17 +1,30 @@ -import { useState } from "react"; +import React, { useState } from "react"; +import { useNavigate } from "react-router-dom"; import { ThemeToggle } from "@/modules/theme-changer/ui/Theme.toggle"; import { LoginForm } from "@/modules/auth/components/LoginForm"; import { RegisterForm } from "@/modules/auth/components/RegisterForm"; export const AuthPage = () => { const [isLogin, setIsLogin] = useState(true); + const navigate = useNavigate(); return (
-
+
+
diff --git a/src/pages/home.page.tsx b/src/pages/home.page.tsx index 1d253de..334f209 100644 --- a/src/pages/home.page.tsx +++ b/src/pages/home.page.tsx @@ -6,7 +6,6 @@ import { Shield, Users, Bot, - Settings, Activity, LogOut, ChevronRight, @@ -20,11 +19,14 @@ import { AlertCircle, CheckCircle, Clock, + LogIn, + UserPlus, } from "lucide-react"; export const HomePage = () => { const navigate = useNavigate(); const { logout } = useAuth(); + const isAuthenticated = authService.isAuthenticated(); const organization = authService.getCurrentOrganization(); const authStorage = localStorage.getItem("auth-storage"); const user = authStorage ? JSON.parse(authStorage).state?.user : null; @@ -72,37 +74,66 @@ export const HomePage = () => { }, ]; - const quickActions = [ + const features = [ { - name: "IPS Агенты", + title: "Централизованное управление", + description: "Управляйте всеми IPS агентами из единого интерфейса", icon: Server, - path: "/agents", - description: "Управление агентами", color: "#6366f1", }, { - name: "Правила", - icon: Shield, - path: "/rules", - description: "Правила фильтрации", - color: "#22c55e", - }, - { - name: "AI Аналитика", + title: "AI Аналитика", + description: "Искусственный интеллект помогает находить сложные атаки", icon: Bot, - path: "/ai-analytics", - description: "Анализ логов", color: "#8b5cf6", }, { - name: "Команда", - icon: Users, - path: "/organization", - description: "Управление доступом", + title: "Мгновенная блокировка", + description: "Автоматическая блокировка IP при обнаружении угроз", + icon: Zap, color: "#f59e0b", }, + { + title: "Безопасность данных", + description: "LLM не получает доступ к чувствительным логам", + icon: Lock, + color: "#22c55e", + }, ]; + const quickActions = isAuthenticated + ? [ + { + name: "IPS Агенты", + icon: Server, + path: "/agents", + description: "Управление агентами", + color: "#6366f1", + }, + { + name: "Правила", + icon: Shield, + path: "/rules", + description: "Правила фильтрации", + color: "#22c55e", + }, + { + name: "AI Аналитика", + icon: Bot, + path: "/ai-analytics", + description: "Анализ логов", + color: "#8b5cf6", + }, + { + name: "Команда", + icon: Users, + path: "/organization", + description: "Управление доступом", + color: "#f59e0b", + }, + ] + : []; + const getSeverityStyles = (severity: string) => { switch (severity) { case "high": @@ -169,54 +200,88 @@ export const HomePage = () => { {/* Right section */}
- - -
-
- {user?.first_name?.[0]} - {user?.last_name?.[0]} -
-
-

+

-
- + + + + +
+
+ {user?.first_name?.[0]} + {user?.last_name?.[0]} +
+
+

+ {user?.first_name} {user?.last_name} +

+

+ Администратор +

+
+
+ + + ) : ( + <> + + + + + )}
- {/* Welcome Section */} + {/* Hero Section */}
{

- Добро пожаловать, {user?.first_name || "Администратор"}! + {isAuthenticated + ? `Добро пожаловать, ${user?.first_name || "Администратор"}!` + : "Добро пожаловать в IPS Manager"}

- Система IPS мониторинга и защиты + {isAuthenticated + ? "Система IPS мониторинга и защиты" + : "Современная платформа для централизованного управления IPS агентами"}

-
- - - Все системы работают стабильно - -
+ {!isAuthenticated && ( +
+ + +
+ )} + {isAuthenticated && ( +
+ + + Все системы работают стабильно + +
+ )}
@@ -246,292 +330,393 @@ export const HomePage = () => {
- {/* Stats Grid */} -
- {stats.map((stat, index) => { - const Icon = stat.icon; - return ( + {/* Stats Grid - только для авторизованных */} + {isAuthenticated && ( +
+ {stats.map((stat, index) => { + const Icon = stat.icon; + return ( +
+
+
+ +
+ + {stat.change} + +
+

+ {stat.value} +

+

+ {stat.label} +

+
+ ); + })} +
+ )} + + {/* Features Section - для всех */} +
+
+

+ Ключевые возможности +

+

+ Всё необходимое для защиты вашей инфраструктуры +

+
+
+ {features.map((feature, index) => { + const Icon = feature.icon; + return ( +
+
+ +
+

+ {feature.title} +

+

+ {feature.description} +

+
+ ); + })} +
+
+ + {isAuthenticated ? ( + <> +
+ {/* Quick Actions */} +
+
+

+ Быстрый доступ +

+
+ {quickActions.map((action, index) => { + const Icon = action.icon; + return ( + + ); + })} +
+
+
+ + {/* Recent Activity */}
-
-
+

- -

- - {stat.change} - + Последние события + +
-

+ {recentActivities.map((activity) => { + const severityStyles = getSeverityStyles(activity.severity); + const Icon = severityStyles.icon; + return ( +
+
+
+ +
+
+

+ {activity.message} +

+
+ +

+ {activity.time} +

+
+
+
+
+ ); + })} +

+
- ); - })} -
+
-
- {/* Quick Actions */} -
+ {/* AI Insights */}
-

- Быстрый доступ -

-
- {quickActions.map((action, index) => { - const Icon = action.icon; - return ( - - ); - })} + AI Аналитика + +

+ Новые предложения на основе анализа логов +

+
+
+ +
+
+
+

+ 🔍 Обнаружена аномалия +

+

+ Повышенная активность с IP-адресов из диапазона + 185.xxx.xx.xx +

+
+
+

+ 💡 Предложено правил +

+

+ AI предлагает 3 новых правила для блокировки бот-сканеров +

+
+
+

+ ⚡ Оптимизация +

+

+ Рекомендуется обновить 5 существующих правил для повышения + эффективности +

+
- - - {/* Recent Activity */} + + ) : ( + /* CTA Section для неавторизованных */
-
-

- Последние события -

- -
-
- {recentActivities.map((activity) => { - const severityStyles = getSeverityStyles(activity.severity); - const Icon = severityStyles.icon; - return ( -
-
-
- -
-
-

- {activity.message} -

-
- -

- {activity.time} -

-
-
-
-
- ); - })} -
- -
- - - {/* AI Insights */} -
-
-
-
- -
-
-

- AI Аналитика -

-

- Новые предложения на основе анализа логов -

-
-
+ Готовы начать? + +

+ Присоединяйтесь к IPS Manager и получите полный контроль над + безопасностью +

-
-
-

- 🔍 Обнаружена аномалия -

-

- Повышенная активность с IP-адресов из диапазона 185.xxx.xx.xx -

-
-
-

- 💡 Предложено правил -

-

- AI предлагает 3 новых правила для блокировки бот-сканеров -

-
-
-

- ⚡ Оптимизация -

-

- Рекомендуется обновить 5 существующих правил для повышения - эффективности -

-
-
-
+ )}
);