diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index cdbd71b0..b898bc6d 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -13,7 +13,6 @@ import { ResetPasswordComponent } from './pages/reset-password/reset-password.co import { AuthGuard } from './guard/auth.guard'; import { EditUserComponent } from './pages/edit-user/edit-user.component'; import { UpdateRoleComponent } from './pages/update-role/update-role.component'; -import { AdminGuard } from './services/admin.guard'; import { SuggestAgendaComponent } from './pages/suggest-agenda/suggest-agenda.component'; import { ParticipateComponent } from './pages/participate/participate.component'; import { GridDaysComponent } from './pages/grid-days/grid-days.component'; @@ -101,25 +100,26 @@ const routes: Routes = [ }, { path: 'privacy', component: PrivacyPolicyComponent }, - { path: 'homeAdmin', + { + path: 'homeAdmin', component: HomeAdminComponent, canActivate: [TokenAdminGuard], }, { path: 'adminActivate', - component: AdminActivateComponent + component: AdminActivateComponent, }, { path: 'superAdminActivate', component: SuperAdminActivateComponent, }, - { + { path: 'category-views', component: CategoryTableComponent, canActivate: [TokenAdminGuard], }, - { - path: 'video-views', + { + path: 'video-views', component: VideoViewsComponent, canActivate: [TokenAdminGuard], }, @@ -129,14 +129,14 @@ const routes: Routes = [ canActivate: [TokenAdminGuard], }, { - path: 'record', - component: RecordComponent, - canActivate: [AuthGuard] + path: 'record', + component: RecordComponent, + canActivate: [AuthGuard], }, { - path: 'notifications', - component: NotificationsComponent, - canActivate: [AuthGuard] + path: 'notifications', + component: NotificationsComponent, + canActivate: [AuthGuard], }, { path: 'recommendation', @@ -169,4 +169,4 @@ const routes: Routes = [ imports: [RouterModule.forRoot(routes)], exports: [RouterModule], }) -export class AppRoutingModule { } +export class AppRoutingModule {} diff --git a/src/app/components/background/background.component.ts b/src/app/components/background/background.component.ts index 3cbedd8c..d1ccc648 100644 --- a/src/app/components/background/background.component.ts +++ b/src/app/components/background/background.component.ts @@ -12,7 +12,7 @@ import { Subscription, interval } from 'rxjs'; export class BackgroundComponent implements OnInit, OnDestroy { items: MenuItem[] = []; mobileDevide: boolean = true; - hasNotifications: boolean = false; // Indica se há notificações + hasNotifications: boolean = false; // Indica se há notificações private intervalSubscription: Subscription | null = null; constructor( @@ -22,7 +22,7 @@ export class BackgroundComponent implements OnInit, OnDestroy { ngOnInit(): void { console.log('BackgroundComponent initialized'); - + this.items = [ { label: 'Perfil', @@ -32,12 +32,12 @@ export class BackgroundComponent implements OnInit, OnDestroy { label: `Notificações`, routerLink: '/notifications', escape: false, - } + }, ]; // Atualiza as notificações imediatamente com base no serviço - this.notificationService.recommendedVideosCount$.subscribe(count => { - this.hasNotifications = count > 0; // Verifica se há notificações + this.notificationService.recommendedVideosCount$.subscribe((count) => { + this.hasNotifications = count > 0; // Verifica se há notificações this.updateNotificationLabel(); }); @@ -46,8 +46,9 @@ export class BackgroundComponent implements OnInit, OnDestroy { const token = localStorage.getItem('token') as string; this.notificationService.setUserIdFromToken(token); const userId = this.notificationService.userId; - this.notificationService.fetchRecommendedVideosCount(userId) - .subscribe(response => { + this.notificationService + .fetchRecommendedVideosCount(userId) + .subscribe((response) => { console.log('Response from fetchRecommendedVideosCount:', response); this.updateNotificationCount(response); }); @@ -60,16 +61,17 @@ export class BackgroundComponent implements OnInit, OnDestroy { const token = localStorage.getItem('token') as string; this.notificationService.setUserIdFromToken(token); const userId = this.notificationService.userId; - this.notificationService.fetchRecommendedVideosCount(userId) - .subscribe(response => { + this.notificationService + .fetchRecommendedVideosCount(userId) + .subscribe((response) => { console.log('Response from interval fetch:', response); this.updateNotificationCount(response); }); } - this.notificationService.recommendedVideosCount$.subscribe(count => { + this.notificationService.recommendedVideosCount$.subscribe((count) => { console.log('New notifications count (from BehaviorSubject):', count); - this.hasNotifications = count > 0; // Verifica se há notificações + this.hasNotifications = count > 0; // Verifica se há notificações this.updateNotificationLabel(); }); }); @@ -84,7 +86,7 @@ export class BackgroundComponent implements OnInit, OnDestroy { } updateNotificationCount(response: any): void { - if (response && response.recommend_videos) { + if (response?.recommend_videos) { const count = response.recommend_videos.length; console.log('Updating notification count with:', count); this.hasNotifications = count > 0; @@ -99,7 +101,8 @@ export class BackgroundComponent implements OnInit, OnDestroy { identifiesUserDevice(): void { const userAgent = navigator.userAgent; - this.mobileDevide = /Android|iPhone|iPad|iPod|BlackBerry|Windows Phone/i.test(userAgent); + this.mobileDevide = + /Android|iPhone|iPad|iPod|BlackBerry|Windows Phone/i.test(userAgent); } getActualRoute(): string { @@ -108,9 +111,13 @@ export class BackgroundComponent implements OnInit, OnDestroy { updateNotificationLabel(): void { console.log('Updating notification label'); - this.items = this.items.map(item => { + this.items = this.items.map((item) => { if (item.routerLink === '/notifications') { - item.label = `Notificações ${this.hasNotifications ? '' : ''}`; + item.label = `Notificações ${ + this.hasNotifications + ? '' + : '' + }`; } return item; }); diff --git a/src/app/pages/controle-super-admin/controle-super-admin.component.css b/src/app/pages/controle-super-admin/controle-super-admin.component.css index 672b5dbe..41b7343d 100644 --- a/src/app/pages/controle-super-admin/controle-super-admin.component.css +++ b/src/app/pages/controle-super-admin/controle-super-admin.component.css @@ -122,7 +122,7 @@ button:hover { background-color: #979ea0; } -.btn_and_select_container{ +.btn_and_select_container { display: flex; } @@ -157,7 +157,6 @@ select { align-items: center; /* Centraliza o texto verticalmente */ justify-content: center; /* Centraliza o texto horizontalmente */ width: auto; /* Define o tamanho automático para alinhar com o conteúdo */ - min-width: 10rem; /* Define uma largura mínima para o texto readonly */ text-align: center; /* Centraliza o texto dentro do elemento */ cursor: not-allowed; /* Cursor de proibição padrão */ transition: background-color 0.3s ease, box-shadow 0.3s ease; /* Transição suave para hover */ @@ -194,4 +193,4 @@ select:focus { select option { color: #000; /* Cor do texto das opções */ -} \ No newline at end of file +} diff --git a/src/app/pages/controle-super-admin/controle-super-admin.component.html b/src/app/pages/controle-super-admin/controle-super-admin.component.html index e3684203..965d864d 100644 --- a/src/app/pages/controle-super-admin/controle-super-admin.component.html +++ b/src/app/pages/controle-super-admin/controle-super-admin.component.html @@ -42,7 +42,7 @@

Lista de usuários cadastrados:

{{ user.name }} {{ user.connection }} {{ user.email }} - {{ user.role }} + {{ user.role }}