diff options
| author | sowgro <tpoke.ferrari@gmail.com> | 2025-04-04 23:14:14 -0400 | 
|---|---|---|
| committer | sowgro <tpoke.ferrari@gmail.com> | 2025-04-04 23:14:14 -0400 | 
| commit | 7c49fcd788692a898e985cb156dd9fd910c05790 (patch) | |
| tree | fad3944da55014731cf0455ea416df72c16ebb4c /ufund-ui/src | |
| parent | f70e86470f7083cda1949ff97556d9e39578ce1d (diff) | |
| download | JellySolutions-7c49fcd788692a898e985cb156dd9fd910c05790.tar.gz JellySolutions-7c49fcd788692a898e985cb156dd9fd910c05790.tar.bz2 JellySolutions-7c49fcd788692a898e985cb156dd9fd910c05790.zip  | |
Add new authentication to dashboard, cleanup
Diffstat (limited to '')
8 files changed, 35 insertions, 22 deletions
diff --git a/ufund-ui/src/app/components/cupboard/cupboard.component.ts b/ufund-ui/src/app/components/cupboard/cupboard.component.ts index 289618f..b03b77e 100644 --- a/ufund-ui/src/app/components/cupboard/cupboard.component.ts +++ b/ufund-ui/src/app/components/cupboard/cupboard.component.ts @@ -23,13 +23,11 @@ export class CupboardComponent implements OnInit {      @ViewChild("needList") needList?: NeedListComponent      private searchDelay: any; -    // selectedNeed: Need | null = null;      needs: Need[] = [];      searchResults: Need[] = [];      sortMode: 'Ascending' | 'Descending' = 'Ascending'      itemsPerPage = 5;      currentSortAlgo = 'sortByPriority'; -    // activeEdit?: Need;      constructor(          private cupboardService: CupboardService, 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 @@ - -<h1>Admin Dashboard</h1> -<!--<app-mini-need-list [needList]="topNeeds" jtitle="Top needs" url="/cupboard"/>--> -<!--<app-mini-need-list [needList]="almostThere" jtitle="Almost there" url="/cupboard"/>--> -<!--<app-mini-need-list [needList]="inBasket" jtitle="In your basket" url="/basket"/>--> -<span>_ Registered users</span> -<span *ngIf="count"> {{count | async}} </span> -<span>_ Fulfilled needs</span> -<app-mini-need-list [needList]="fulfilledNeeds.getValue()" jtitle="Fulfilled needs"> </app-mini-need-list> -<span>_ Most fulfilled needs</span> -<app-mini-need-list [needList]="mostFulfilledNeeds.getValue()" jtitle="Most fulfilled"> </app-mini-need-list> -<span>_ Total monetary contributions</span> -<span *ngIf="totalDonations">${{totalDonations | async}} </span> -<span>_ </span> +<div id="box"> +    @if ((authService.getCurrentUserSubject() | async)?.type === userType.MANAGER) { +        <h1>Admin Dashboard</h1> +        <span>_ Registered users</span> +        <span *ngIf="count"> {{count | async}} </span> +        <span>_ Fulfilled needs</span> +        <app-mini-need-list [needList]="fulfilledNeeds.getValue()" label="Fulfilled needs"> </app-mini-need-list> +        <span>_ Most fulfilled needs</span> +        <app-mini-need-list [needList]="mostFulfilledNeeds.getValue()" label="Most fulfilled"> </app-mini-need-list> +        <span>_ Total monetary contributions</span> +        <span *ngIf="totalDonations">${{totalDonations | async}} </span> +        <span>_ </span> +    } @else { +        <h1>Unauthorized</h1> +        <span>This page requires you to be logged in as an admin! <a routerLink="/login">Log In</a></span> +    } +</div> 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;  } diff --git a/ufund-ui/src/app/components/mini-need-list/mini-need-list.component.css b/ufund-ui/src/app/components/mini-need-list/mini-need-list.component.css index 090bea9..d01ac54 100644 --- a/ufund-ui/src/app/components/mini-need-list/mini-need-list.component.css +++ b/ufund-ui/src/app/components/mini-need-list/mini-need-list.component.css @@ -45,6 +45,10 @@      cursor: pointer;  } +.needEntry:hover { +    background-color: #444444; +} +  .needName {      font-weight: bold;  } diff --git a/ufund-ui/src/app/components/mini-need-list/mini-need-list.component.html b/ufund-ui/src/app/components/mini-need-list/mini-need-list.component.html index 9febfa5..91f51cf 100644 --- a/ufund-ui/src/app/components/mini-need-list/mini-need-list.component.html +++ b/ufund-ui/src/app/components/mini-need-list/mini-need-list.component.html @@ -1,5 +1,5 @@  <div id="header"> -    <span>{{jtitle}}</span> +    <span>{{label}}</span>      <a *ngIf="url" [routerLink]="url">Show All<span class="icon">arrow_forward_ios</span></a>  </div> diff --git a/ufund-ui/src/app/components/mini-need-list/mini-need-list.component.ts b/ufund-ui/src/app/components/mini-need-list/mini-need-list.component.ts index c909ae6..18b176b 100644 --- a/ufund-ui/src/app/components/mini-need-list/mini-need-list.component.ts +++ b/ufund-ui/src/app/components/mini-need-list/mini-need-list.component.ts @@ -10,7 +10,7 @@ import {Need} from '../../models/Need';  export class MiniNeedListComponent {      @Input() needList?: Need[] -    @Input() jtitle?: string +    @Input() label?: string      @Input() url?: string      constructor( diff --git a/ufund-ui/src/app/components/need-page/need-page.component.ts b/ufund-ui/src/app/components/need-page/need-page.component.ts index 45d6db5..0967266 100644 --- a/ufund-ui/src/app/components/need-page/need-page.component.ts +++ b/ufund-ui/src/app/components/need-page/need-page.component.ts @@ -1,5 +1,5 @@  import {Component, Input, OnInit} from '@angular/core'; -import {Need} from '../../models/Need'; +import {GoalType, Need} from '../../models/Need';  import {ActivatedRoute, Router} from "@angular/router";  import {CupboardService} from "../../services/cupboard.service";  import {AuthService} from '../../services/auth.service'; @@ -69,4 +69,6 @@ export class NeedPageComponent implements OnInit {              })          // this.refresh();      } + +    readonly GoalType = GoalType  }  | 
