ciyidogan commited on
Commit
97f2998
·
verified ·
1 Parent(s): 8f934bf

Update flare-ui/src/app/components/main/main.component.ts

Browse files
flare-ui/src/app/components/main/main.component.ts CHANGED
@@ -1,65 +1,119 @@
1
  import { Component, inject } from '@angular/core';
2
  import { CommonModule } from '@angular/common';
3
  import { RouterLink, RouterLinkActive, RouterOutlet } from '@angular/router';
 
 
 
 
 
 
 
4
  import { AuthService } from '../../services/auth.service';
5
  import { ActivityLogComponent } from '../activity-log/activity-log.component';
6
 
7
  @Component({
8
  selector: 'app-main',
9
  standalone: true,
10
- imports: [CommonModule, RouterLink, RouterLinkActive, RouterOutlet, ActivityLogComponent],
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  template: `
12
  <div class="main-layout">
13
- <header class="header">
14
- <div class="header-content">
15
- <h1>Flare Administration</h1>
 
 
 
 
 
 
16
  <div class="header-actions">
17
- <span class="username">{{ username }}</span>
18
- <button class="notification-btn" (click)="toggleActivityLog()">
19
- 🔔
20
- @if (showActivityLog) {
 
 
 
 
 
 
 
 
 
21
  <app-activity-log (close)="toggleActivityLog()"></app-activity-log>
22
- }
 
 
 
 
23
  </button>
24
- <button class="btn btn-secondary" (click)="logout()">Logout</button>
 
 
 
 
 
 
 
 
 
 
 
25
  </div>
26
- </div>
27
- </header>
28
-
29
- <nav class="tabs">
30
- <a
31
- routerLink="/user-info"
32
- routerLinkActive="active"
33
- class="tab"
34
- >
35
  User Info
36
  </a>
37
- <a
38
- routerLink="/environment"
39
- routerLinkActive="active"
40
- class="tab"
41
- >
 
42
  Environment
43
  </a>
44
- <a
45
- routerLink="/apis"
46
- routerLinkActive="active"
47
- class="tab"
48
- >
 
49
  APIs
50
  </a>
51
- <a
52
- routerLink="/projects"
53
- routerLinkActive="active"
54
- class="tab"
55
- >
 
56
  Projects
57
  </a>
58
- <a
59
- routerLink="/test"
60
- routerLinkActive="active"
61
- class="tab"
62
- >
 
63
  Test
64
  </a>
65
  </nav>
@@ -69,93 +123,81 @@ import { ActivityLogComponent } from '../activity-log/activity-log.component';
69
  </main>
70
  </div>
71
  `,
72
- styles: [`
73
  .main-layout {
74
  height: 100vh;
75
  display: flex;
76
  flex-direction: column;
 
77
  }
78
 
79
- .header {
80
- background-color: #fff;
81
- border-bottom: 1px solid #dee2e6;
82
- padding: 1rem 0;
83
 
84
- .header-content {
85
- max-width: 1200px;
86
- margin: 0 auto;
87
- padding: 0 20px;
88
  display: flex;
89
- justify-content: space-between;
90
  align-items: center;
 
 
 
91
 
92
- h1 {
93
- font-size: 1.5rem;
94
- color: #333;
95
- margin: 0;
96
  }
97
  }
98
 
 
 
 
 
99
  .header-actions {
100
  display: flex;
101
  align-items: center;
102
- gap: 1rem;
 
103
 
104
  .username {
105
- font-weight: 500;
106
- color: #495057;
 
 
 
 
 
 
 
 
107
  }
108
 
109
- .notification-btn {
110
- position: relative;
111
- background: none;
112
- border: 1px solid #dee2e6;
113
- border-radius: 4px;
114
- font-size: 1.25rem;
115
- cursor: pointer;
116
- padding: 0.5rem;
117
- transition: all 0.2s;
118
-
119
- &:hover {
120
- background-color: #f8f9fa;
121
- border-color: #adb5bd;
122
- }
123
  }
124
  }
125
  }
126
 
127
- .tabs {
128
- background-color: #fff;
129
- border-bottom: 2px solid #dee2e6;
130
- max-width: 1200px;
131
- width: 100%;
132
- margin: 0 auto;
133
- padding: 0 20px;
134
- display: flex;
135
 
136
- a {
137
- text-decoration: none;
138
- }
139
-
140
- .tab {
141
- padding: 0.75rem 1.25rem;
142
- cursor: pointer;
143
- border: none;
144
- background: none;
145
- font-weight: 500;
146
- color: #6c757d;
147
- transition: all 0.3s ease;
148
- border-bottom: 2px solid transparent;
149
- margin-bottom: -2px;
150
-
151
- &.active {
152
- color: #007bff;
153
- border-bottom-color: #007bff;
154
- }
155
 
156
- &:hover:not(.active) {
157
- color: #495057;
158
- background-color: #f8f9fa;
 
 
 
 
159
  }
160
  }
161
  }
@@ -163,13 +205,7 @@ styles: [`
163
  .content {
164
  flex: 1;
165
  overflow-y: auto;
166
- padding: 2rem 0;
167
-
168
- > * {
169
- max-width: 1200px;
170
- margin: 0 auto;
171
- padding: 0 20px;
172
- }
173
  }
174
  `]
175
  })
 
1
  import { Component, inject } from '@angular/core';
2
  import { CommonModule } from '@angular/common';
3
  import { RouterLink, RouterLinkActive, RouterOutlet } from '@angular/router';
4
+ import { MatToolbarModule } from '@angular/material/toolbar';
5
+ import { MatTabsModule } from '@angular/material/tabs';
6
+ import { MatButtonModule } from '@angular/material/button';
7
+ import { MatIconModule } from '@angular/material/icon';
8
+ import { MatMenuModule } from '@angular/material/menu';
9
+ import { MatBadgeModule } from '@angular/material/badge';
10
+ import { MatDividerModule } from '@angular/material/divider';
11
  import { AuthService } from '../../services/auth.service';
12
  import { ActivityLogComponent } from '../activity-log/activity-log.component';
13
 
14
  @Component({
15
  selector: 'app-main',
16
  standalone: true,
17
+ imports: [
18
+ CommonModule,
19
+ RouterLink,
20
+ RouterLinkActive,
21
+ RouterOutlet,
22
+ MatToolbarModule,
23
+ MatTabsModule,
24
+ MatButtonModule,
25
+ MatIconModule,
26
+ MatMenuModule,
27
+ MatBadgeModule,
28
+ MatDividerModule,
29
+ ActivityLogComponent
30
+ ],
31
  template: `
32
  <div class="main-layout">
33
+ <mat-toolbar color="primary" class="header-toolbar">
34
+ <mat-toolbar-row>
35
+ <span class="logo">
36
+ <mat-icon>dashboard</mat-icon>
37
+ Flare Administration
38
+ </span>
39
+
40
+ <span class="spacer"></span>
41
+
42
  <div class="header-actions">
43
+ <span class="username">
44
+ <mat-icon>person</mat-icon>
45
+ {{ username }}
46
+ </span>
47
+
48
+ <button mat-icon-button
49
+ (click)="toggleActivityLog()"
50
+ matTooltip="Activity Log">
51
+ <mat-icon>notifications</mat-icon>
52
+ </button>
53
+
54
+ @if (showActivityLog) {
55
+ <div class="activity-log-wrapper" (click)="$event.stopPropagation()">
56
  <app-activity-log (close)="toggleActivityLog()"></app-activity-log>
57
+ </div>
58
+ }
59
+
60
+ <button mat-icon-button [matMenuTriggerFor]="userMenu" matTooltip="User Menu">
61
+ <mat-icon>account_circle</mat-icon>
62
  </button>
63
+
64
+ <mat-menu #userMenu="matMenu">
65
+ <button mat-menu-item routerLink="/user-info">
66
+ <mat-icon>settings</mat-icon>
67
+ <span>User Settings</span>
68
+ </button>
69
+ <mat-divider></mat-divider>
70
+ <button mat-menu-item (click)="logout()">
71
+ <mat-icon>exit_to_app</mat-icon>
72
+ <span>Logout</span>
73
+ </button>
74
+ </mat-menu>
75
  </div>
76
+ </mat-toolbar-row>
77
+ </mat-toolbar>
78
+
79
+ <nav mat-tab-nav-bar class="nav-tabs">
80
+ <a mat-tab-link
81
+ routerLink="/user-info"
82
+ routerLinkActive #rla1="routerLinkActive"
83
+ [active]="rla1.isActive">
84
+ <mat-icon>person</mat-icon>
85
  User Info
86
  </a>
87
+
88
+ <a mat-tab-link
89
+ routerLink="/environment"
90
+ routerLinkActive #rla2="routerLinkActive"
91
+ [active]="rla2.isActive">
92
+ <mat-icon>settings</mat-icon>
93
  Environment
94
  </a>
95
+
96
+ <a mat-tab-link
97
+ routerLink="/apis"
98
+ routerLinkActive #rla3="routerLinkActive"
99
+ [active]="rla3.isActive">
100
+ <mat-icon>api</mat-icon>
101
  APIs
102
  </a>
103
+
104
+ <a mat-tab-link
105
+ routerLink="/projects"
106
+ routerLinkActive #rla4="routerLinkActive"
107
+ [active]="rla4.isActive">
108
+ <mat-icon>folder_special</mat-icon>
109
  Projects
110
  </a>
111
+
112
+ <a mat-tab-link
113
+ routerLink="/test"
114
+ routerLinkActive #rla5="routerLinkActive"
115
+ [active]="rla5.isActive">
116
+ <mat-icon>bug_report</mat-icon>
117
  Test
118
  </a>
119
  </nav>
 
123
  </main>
124
  </div>
125
  `,
126
+ styles: [`
127
  .main-layout {
128
  height: 100vh;
129
  display: flex;
130
  flex-direction: column;
131
+ background-color: #fafafa;
132
  }
133
 
134
+ .header-toolbar {
135
+ box-shadow: 0 2px 4px rgba(0,0,0,0.1);
136
+ z-index: 100;
137
+ position: relative;
138
 
139
+ .logo {
 
 
 
140
  display: flex;
 
141
  align-items: center;
142
+ gap: 8px;
143
+ font-size: 20px;
144
+ font-weight: 500;
145
 
146
+ mat-icon {
147
+ font-size: 28px;
148
+ width: 28px;
149
+ height: 28px;
150
  }
151
  }
152
 
153
+ .spacer {
154
+ flex: 1 1 auto;
155
+ }
156
+
157
  .header-actions {
158
  display: flex;
159
  align-items: center;
160
+ gap: 8px;
161
+ position: relative;
162
 
163
  .username {
164
+ display: flex;
165
+ align-items: center;
166
+ gap: 4px;
167
+ margin-right: 16px;
168
+
169
+ mat-icon {
170
+ font-size: 20px;
171
+ width: 20px;
172
+ height: 20px;
173
+ }
174
  }
175
 
176
+ .activity-log-wrapper {
177
+ position: absolute;
178
+ top: 56px;
179
+ right: 0;
180
+ z-index: 1000;
 
 
 
 
 
 
 
 
 
181
  }
182
  }
183
  }
184
 
185
+ .nav-tabs {
186
+ background-color: white;
187
+ box-shadow: 0 2px 4px rgba(0,0,0,0.08);
 
 
 
 
 
188
 
189
+ ::ng-deep {
190
+ .mat-mdc-tab-link {
191
+ min-width: 120px;
192
+ opacity: 0.8;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
193
 
194
+ mat-icon {
195
+ margin-right: 8px;
196
+ }
197
+
198
+ &.mdc-tab--active {
199
+ opacity: 1;
200
+ }
201
  }
202
  }
203
  }
 
205
  .content {
206
  flex: 1;
207
  overflow-y: auto;
208
+ padding: 24px;
 
 
 
 
 
 
209
  }
210
  `]
211
  })