From 7c49fcd788692a898e985cb156dd9fd910c05790 Mon Sep 17 00:00:00 2001 From: sowgro Date: Fri, 4 Apr 2025 23:14:14 -0400 Subject: Add new authentication to dashboard, cleanup --- .../components/dashboard/dashboard.component.css | 10 ++++--- .../components/dashboard/dashboard.component.html | 31 ++++++++++++---------- .../components/dashboard/dashboard.component.ts | 2 ++ 3 files changed, 26 insertions(+), 17 deletions(-) (limited to 'ufund-ui/src/app/components/dashboard') diff --git a/ufund-ui/src/app/components/dashboard/dashboard.component.css b/ufund-ui/src/app/components/dashboard/dashboard.component.css index 185fdc2..742a151 100644 --- a/ufund-ui/src/app/components/dashboard/dashboard.component.css +++ b/ufund-ui/src/app/components/dashboard/dashboard.component.css @@ -1,7 +1,11 @@ :host { display: flex; - flex-direction: column; + justify-content: center; +} + +#box { + display: flex; width: 800px; - align-self: center; - gap: 20px + flex-direction: column; + gap: 10px; } diff --git a/ufund-ui/src/app/components/dashboard/dashboard.component.html b/ufund-ui/src/app/components/dashboard/dashboard.component.html index 2af467c..074ca76 100644 --- a/ufund-ui/src/app/components/dashboard/dashboard.component.html +++ b/ufund-ui/src/app/components/dashboard/dashboard.component.html @@ -1,14 +1,17 @@ - -

Admin Dashboard

- - - -_ Registered users - {{count | async}} -_ Fulfilled needs - -_ Most fulfilled needs - -_ Total monetary contributions -${{totalDonations | async}} -_ +
+ @if ((authService.getCurrentUserSubject() | async)?.type === userType.MANAGER) { +

Admin Dashboard

+ _ Registered users + {{count | async}} + _ Fulfilled needs + + _ Most fulfilled needs + + _ Total monetary contributions + ${{totalDonations | async}} + _ + } @else { +

Unauthorized

+ This page requires you to be logged in as an admin! Log In + } +
diff --git a/ufund-ui/src/app/components/dashboard/dashboard.component.ts b/ufund-ui/src/app/components/dashboard/dashboard.component.ts index 9bf7627..1181608 100644 --- a/ufund-ui/src/app/components/dashboard/dashboard.component.ts +++ b/ufund-ui/src/app/components/dashboard/dashboard.component.ts @@ -5,6 +5,7 @@ import {CupboardService} from '../../services/cupboard.service'; import {UsersService} from '../../services/users.service'; import {BehaviorSubject} from 'rxjs'; import {GoalType, Need} from '../../models/Need'; +import {userType} from '../../models/User'; @Component({ selector: 'app-dashboard', @@ -55,4 +56,5 @@ export class DashboardComponent implements OnInit{ } + protected readonly userType = userType; } -- cgit v1.2.3