33import { Component , inject , type OnInit , signal } from "@angular/core" ;
44import { CommonModule } from "@angular/common" ;
55import { Router , RouterLink , RouterOutlet } from "@angular/router" ;
6- import { IconComponent , SidebarComponent } from "@uilib" ;
6+ import { IconComponent , ProfileControlPanelComponent , SidebarComponent } from "@uilib" ;
77import { SidebarProfileComponent } from "./shared/sidebar-profile/sidebar-profile.component" ;
8- import { ProfileService } from "./profile/services/profile.service" ;
98import type { UserData } from "../models/profile.model" ;
109import { AuthService } from "@auth/services" ;
10+ import { SnackbarComponent } from "@ui/components/snackbar/snackbar.component" ;
1111
1212/**
1313 * Корневой компонент приложения, который служит основным контейнером макета
@@ -32,13 +32,14 @@ import { AuthService } from "@auth/services";
3232 SidebarComponent ,
3333 SidebarProfileComponent ,
3434 IconComponent ,
35+ ProfileControlPanelComponent ,
36+ SnackbarComponent ,
3537 ] ,
3638 templateUrl : "./app.component.html" ,
3739 styleUrl : "./app.component.scss" ,
3840} )
3941export class AppComponent implements OnInit {
4042 // Внедренные сервисы для управления профилем и аутентификацией
41- profileService = inject ( ProfileService ) ;
4243 authService = inject ( AuthService ) ;
4344 router = inject ( Router ) ;
4445
@@ -54,12 +55,9 @@ export class AppComponent implements OnInit {
5455 * Каждый элемент представляет основной раздел приложения
5556 */
5657 navItems = [
57- // { name: "Навыки", icon: "lib", link: "skills" }, // Временно отключено
58- { name : "Детский Форсайт" , icon : "trackcar" , link : "trackCar" } ,
59- // { name: "Траектории", icon: "receipt", link: "subscription" },
60- // { name: "Рейтинг", icon: "growth", link: "rating" },
61- // { name: "Траектория бизнеса", icon: "trackbuss", link: "trackBuss" }, // Временно отключено
62- // { name: "Вебинары", icon: "webinars", link: "webinars" }, // Временно отключено
58+ { name : "Мой профиль" , icon : "person" , link : "profile" } ,
59+ { name : "Рейтинг" , icon : "growth" , link : "rating" } ,
60+ // { name: "Траектории", icon: "receipt", link: "trackCar" },
6361 ] ;
6462
6563 // Реактивное состояние с использованием Angular signals
@@ -71,23 +69,11 @@ export class AppComponent implements OnInit {
7169 * Получает данные пользователя и синхронизирует профиль при запуске
7270 * Перенаправляет на страницу входа при ошибке аутентификации
7371 */
74- ngOnInit ( ) : void {
75- // Получение текущих данных пользователя
76- this . profileService . getUserData ( ) . subscribe ( {
77- next : data => this . userData . set ( data as UserData ) ,
78- error : ( ) => {
79- // Перенаправление на основное приложение для входа при ошибке получения данных пользователя
80- location . href = "https://app.procollab.ru/auth/login" ;
81- } ,
82- } ) ;
72+ ngOnInit ( ) : void { }
8373
84- // Синхронизация данных профиля с бэкендом
85- this . profileService . syncProfile ( ) . subscribe ( {
74+ onLogout ( ) {
75+ this . authService . logout ( ) . subscribe ( {
8676 next : ( ) => {
87- // Синхронизация профиля успешна - никаких действий не требуется
88- } ,
89- error : ( ) => {
90- // Перенаправление на основное приложение для входа при ошибке синхронизации профиля
9177 location . href = "https://app.procollab.ru/auth/login" ;
9278 } ,
9379 } ) ;
0 commit comments