Spaces:
Running
Running
File size: 3,807 Bytes
3b93905 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
import { Component, inject } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterLink, RouterLinkActive, RouterOutlet } from '@angular/router';
import { AuthService } from '../../services/auth.service';
import { ActivityLogComponent } from '../activity-log/activity-log.component';
@Component({
selector: 'app-main',
standalone: true,
imports: [CommonModule, RouterLink, RouterLinkActive, RouterOutlet, ActivityLogComponent],
template: `
<div class="main-layout">
<header class="header">
<div class="header-content">
<h1>Flare Administration</h1>
<div class="header-actions">
<span class="username">{{ username }}</span>
<button class="notification-btn" (click)="toggleActivityLog()">
π
@if (showActivityLog) {
<app-activity-log (close)="toggleActivityLog()"></app-activity-log>
}
</button>
<button class="btn btn-secondary" (click)="logout()">Logout</button>
</div>
</div>
</header>
<nav class="tabs">
<a
routerLink="/user-info"
routerLinkActive="active"
class="tab"
>
User Info
</a>
<a
routerLink="/environment"
routerLinkActive="active"
class="tab"
>
Environment
</a>
<a
routerLink="/apis"
routerLinkActive="active"
class="tab"
>
APIs
</a>
<a
routerLink="/projects"
routerLinkActive="active"
class="tab"
>
Projects
</a>
<a
routerLink="/test"
routerLinkActive="active"
class="tab"
>
Test
</a>
</nav>
<main class="content">
<router-outlet></router-outlet>
</main>
</div>
`,
styles: [`
.main-layout {
height: 100vh;
display: flex;
flex-direction: column;
}
.header {
background-color: #fff;
border-bottom: 1px solid #dee2e6;
padding: 1rem 0;
.header-content {
max-width: 1200px;
margin: 0 auto;
padding: 0 20px;
display: flex;
justify-content: space-between;
align-items: center;
h1 {
font-size: 1.5rem;
color: #333;
margin: 0;
}
}
.header-actions {
display: flex;
align-items: center;
gap: 1rem;
.username {
font-weight: 500;
color: #495057;
}
.notification-btn {
position: relative;
background: none;
border: none;
font-size: 1.25rem;
cursor: pointer;
padding: 0.25rem;
&:hover {
opacity: 0.7;
}
}
}
}
.tabs {
background-color: #fff;
border-bottom: 2px solid #dee2e6;
max-width: 1200px;
width: 100%;
margin: 0 auto;
padding: 0 20px;
display: flex;
a {
text-decoration: none;
}
}
.content {
flex: 1;
overflow-y: auto;
padding: 2rem 0;
> * {
max-width: 1200px;
margin: 0 auto;
padding: 0 20px;
}
}
`]
})
export class MainComponent {
private authService = inject(AuthService);
username = this.authService.getUsername() || '';
showActivityLog = false;
logout() {
this.authService.logout();
}
toggleActivityLog() {
this.showActivityLog = !this.showActivityLog;
}
} |