diff options
| author | Gunther6070 <haydenhartman10@yahoo.com> | 2025-04-02 13:33:47 -0400 | 
|---|---|---|
| committer | Gunther6070 <haydenhartman10@yahoo.com> | 2025-04-02 13:33:47 -0400 | 
| commit | f14d070155a6927d544a908545c648c402948fea (patch) | |
| tree | f6f56af728b5d0d23f1f222962a9215bc852a080 /ufund-ui/src | |
| parent | 22df0d963e09520339dfa9c681caeaaec790df8e (diff) | |
| parent | 2eb67f9481d858474e77af545e71f68b2cea7041 (diff) | |
| download | JellySolutions-f14d070155a6927d544a908545c648c402948fea.tar.gz JellySolutions-f14d070155a6927d544a908545c648c402948fea.tar.bz2 JellySolutions-f14d070155a6927d544a908545c648c402948fea.zip  | |
Merge remote-tracking branch 'origin/css' into css
Diffstat (limited to 'ufund-ui/src')
11 files changed, 49 insertions, 38 deletions
diff --git a/ufund-ui/src/app/app.component.html b/ufund-ui/src/app/app.component.html index 959eada..f697695 100644 --- a/ufund-ui/src/app/app.component.html +++ b/ufund-ui/src/app/app.component.html @@ -5,9 +5,9 @@          </a>      </div>      <div> -        <a routerLink="/dashboard">Dashboard</a> +        <a *ngIf="(currentUser | async)?.type === userType.MANAGER" routerLink="/dashboard">Dashboard</a>          <a routerLink="/cupboard">Cupboard</a> -        <a routerLink="/basket">Basket</a> +        <a *ngIf="(currentUser | async)?.type === userType.HELPER" routerLink="/basket">Basket</a>  <!--        <span>{{currentUser$ | async}}</span>-->          <button *ngIf="currentUser | async" (click)="logout()"> Log Out</button>          <button *ngIf="!(currentUser | async)" (click)="login()"> Log In</button> diff --git a/ufund-ui/src/app/app.component.ts b/ufund-ui/src/app/app.component.ts index 2f98334..bc0e71a 100644 --- a/ufund-ui/src/app/app.component.ts +++ b/ufund-ui/src/app/app.component.ts @@ -3,7 +3,7 @@ import {BehaviorSubject} from 'rxjs';  import { DOCUMENT } from '@angular/common';  import {AuthService} from './services/auth.service';  import {ToastsService} from './services/toasts.service'; -import {User} from './models/User'; +import {User, userType} from './models/User';  import {ActivatedRoute, Router} from '@angular/router';  @Component({ @@ -48,4 +48,6 @@ export class AppComponent implements OnInit {          localStorage.removeItem("credential")          location.reload()      } + +    protected readonly userType = userType;  } diff --git a/ufund-ui/src/app/components/dashboard/dashboard.component.css b/ufund-ui/src/app/components/dashboard/dashboard.component.css index 78a69ba..185fdc2 100644 --- a/ufund-ui/src/app/components/dashboard/dashboard.component.css +++ b/ufund-ui/src/app/components/dashboard/dashboard.component.css @@ -1,7 +1,7 @@  :host {      display: flex;      flex-direction: column; -    width: 1000px; +    width: 800px;      align-self: center;      gap: 20px  } diff --git a/ufund-ui/src/app/components/dashboard/dashboard.component.html b/ufund-ui/src/app/components/dashboard/dashboard.component.html index 6a95ecd..2d7b4c3 100644 --- a/ufund-ui/src/app/components/dashboard/dashboard.component.html +++ b/ufund-ui/src/app/components/dashboard/dashboard.component.html @@ -1,5 +1,10 @@ -<h1>Your 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"/> +<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>_ Needs with overflow</span> +<span>_ Needs in peoples baskets</span> +<span>_ Total monetary contributions</span> +<span>_ </span> diff --git a/ufund-ui/src/app/components/need-list/need-list.component.css b/ufund-ui/src/app/components/need-list/need-list.component.css index 5f2e5e1..e17609b 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.css +++ b/ufund-ui/src/app/components/need-list/need-list.component.css @@ -89,6 +89,10 @@ select {      background-color: #3a3a3a;      border-radius: 5px;      cursor: pointer; +    height: 130px; +    display: flex; +    flex-direction: column; +    justify-content: space-between;  }  .clickable:hover { diff --git a/ufund-ui/src/app/components/need-list/need-list.component.html b/ufund-ui/src/app/components/need-list/need-list.component.html index c0501ba..88317dd 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.html +++ b/ufund-ui/src/app/components/need-list/need-list.component.html @@ -40,8 +40,6 @@                  </div>              </div> -            <br> -              <div class="prog">                  <span id="hover-status-label-{{need.id}}"> </span>                  <span>{{need.current}}/{{need.maxGoal}} ({{((need.current / need.maxGoal) * 100).toFixed(0)}}%)</span> @@ -65,7 +63,9 @@  </div>  <div id="page-selector"> -    <button *ngIf="currentPage > 0" (click)="decrementPage()"><span class="icon">arrow_back_ios</span></button> +    <button [disabled]="!(currentPage !== 0)" (click)="firstPage()"><span class="icon">first_page</span></button> +    <button [disabled]="!(currentPage > 0)" (click)="decrementPage()"><span class="icon">arrow_back_ios_new</span></button>      <span>Page {{currentPage + 1}} of {{totalPages}}</span> -    <button *ngIf="currentPage < totalPages - 1" (click)="incrementPage()"><span class="icon">arrow_forward_ios</span></button> +    <button [disabled]="!(currentPage < totalPages - 1)" (click)="incrementPage()"><span class="icon">arrow_forward_ios</span></button> +    <button [disabled]="!(currentPage !== totalPages - 1)" (click)="lastPage()"><span class="icon">last_page</span></button>  </div> diff --git a/ufund-ui/src/app/components/need-list/need-list.component.ts b/ufund-ui/src/app/components/need-list/need-list.component.ts index cd3d9bd..06a612e 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.ts +++ b/ufund-ui/src/app/components/need-list/need-list.component.ts @@ -74,12 +74,22 @@ export class NeedListComponent {    decrementPage() {      this.currentPage--; -    this.updateVisibleNeeds();     +    this.updateVisibleNeeds();    }    incrementPage() {      this.currentPage++; -    this.updateVisibleNeeds();     +    this.updateVisibleNeeds(); +  } + +  lastPage() { +      this.currentPage = this.totalPages - 1 +      this.updateVisibleNeeds() +  } + +  firstPage() { +      this.currentPage = 0 +      this.updateVisibleNeeds()    }    editNeedsPerPage(amount: number) { @@ -135,7 +145,7 @@ export class NeedListComponent {    ngOnInit(): void {      this.refresh() -    +    }    changeSortMode(form : any) { @@ -269,7 +279,4 @@ export class NeedListComponent {        }    }  } -function not(location: string) { -  throw new Error('Function not implemented.'); -} diff --git a/ufund-ui/src/app/components/need-page/need-page.component.html b/ufund-ui/src/app/components/need-page/need-page.component.html index 958dfa6..522b710 100644 --- a/ufund-ui/src/app/components/need-page/need-page.component.html +++ b/ufund-ui/src/app/components/need-page/need-page.component.html @@ -1,14 +1,14 @@  <div id="box"> -    <h1>{{need?.name}}</h1> -    <span class="needType">{{need?.type}} GOAL</span> +    <h1>{{need.name}}</h1> +    <span class="needType">{{need.type}} GOAL</span> -    <img *ngIf="need.image" alt="Need image" [src]="need?.image"/> +    <img *ngIf="need.image" alt="Need image" [src]="need.image"/> -    <p>{{need?.description}}</p> +    <p>{{need.description}}</p>      <div class="prog">  <!--        <span>{{need?.current}} / {{need?.maxGoal}}</span>--> -        <progress [value]="need?.current" [max]="need?.maxGoal"></progress> -        <span>This goal is <strong>{{(((need?.current ?? 0)*100) / (need?.maxGoal ?? 0)).toFixed(0)}}%</strong> complete!</span> +        <progress [value]="need.current" [max]="need.maxGoal"></progress> +        <span>This goal is <strong>{{(((need.current)*100) / (need.maxGoal)).toFixed(0)}}%</strong> complete!</span>      </div>      <span><strong>Target Goal:</strong> {{need.maxGoal}}</span> diff --git a/ufund-ui/src/app/components/signup/signup.component.html b/ufund-ui/src/app/components/signup/signup.component.html index bc3aaf0..84f15e4 100644 --- a/ufund-ui/src/app/components/signup/signup.component.html +++ b/ufund-ui/src/app/components/signup/signup.component.html @@ -8,7 +8,7 @@      <div>          <div>              <input placeholder="Password" type="password" (input)="validate(username.value, confirmPass.value, password.value)" #password> -            <progress [ngClass]="'color' + strength.getValue()" id="bar" [value]="strength | async" max="6">  </progress> +            <progress [ngClass]="'color' + strength.getValue()" id="bar" [value]="strength | async" max="5">  </progress>              <span *ngIf="passwordStatusText">{{passwordStatusText | async}}</span>          </div> @@ -24,8 +24,6 @@      <div>          <button [disabled]="!(ableToCreateAccount | async)" (click)="signup(username.value, password.value)">Create Account</button> -        <span *ngIf="showSuccessMessage | async">Account created <a routerLink="/login">Proceed to login</a></span> -        <span *ngIf="statusText | async">{{statusText | async}}</span>      </div>      <span>Already have an account? <a routerLink="/login">Log in</a></span>  </div> diff --git a/ufund-ui/src/app/components/signup/signup.component.ts b/ufund-ui/src/app/components/signup/signup.component.ts index a20d828..b040d1a 100644 --- a/ufund-ui/src/app/components/signup/signup.component.ts +++ b/ufund-ui/src/app/components/signup/signup.component.ts @@ -6,7 +6,6 @@ import {ToastsService, ToastType} from '../../services/toasts.service';  class PasswordRequirements {      sixLong:    {title: string, value: boolean} = {title: 'Is 6 characters or longer' , value: false} -    twelveLong: {title: string, value: boolean} = {title: 'Is 12 characters or longer', value: false}      lowercase:  {title: string, value: boolean} = {title: 'Includes lowercase letter' , value: false}      uppercase:  {title: string, value: boolean} = {title: 'Includes uppercase letter' , value: false}      number:     {title: string, value: boolean} = {title: 'Includes number'           , value: false} @@ -25,12 +24,10 @@ export class SignupComponent {      protected passwordStatusText = new BehaviorSubject("")      protected passwordsMatch = new BehaviorSubject(false)      protected usernameStatusText = new BehaviorSubject("") -    protected showSuccessMessage = new BehaviorSubject(false)      protected passwordStrongEnough = new BehaviorSubject(false)      protected ableToCreateAccount = new BehaviorSubject(false)      protected passwordRequirements: PasswordRequirements = new PasswordRequirements()      protected strength = new BehaviorSubject(0) -    protected statusText = new BehaviorSubject("");      constructor(          protected usersService: UsersService, @@ -45,7 +42,9 @@ export class SignupComponent {          }          this.usersService.createUser(username, password).then(() => { -            this.showSuccessMessage.next(true); +            // let action = {label: 'Proceed to login', onAction: () => this.router.navigate(["/login"])} +            this.toastService.sendToast(ToastType.INFO, "Account successfully created") +            this.router.navigate(["/login"])          }).catch(ex => {              this.toastService.sendToast(ToastType.ERROR, "Unable to create account: " + friendlyHttpStatus[ex.status])              console.log(ex) @@ -74,16 +73,12 @@ export class SignupComponent {          if (password.match(/[^!-~]/g)) {              this.passwordStatusText.next("Invalid characters") -              return          }          if (password.length > 6) {              this.passwordRequirements.sixLong.value = true          } -        if (password.length > 12) { -            this.passwordRequirements.twelveLong.value = true -        }          if (password.match(/[a-z]/g)) {              this.passwordRequirements.lowercase.value = true          } @@ -108,7 +103,7 @@ export class SignupComponent {          } else if (strength == 0) {              this.passwordStatusText.next("")          } else { -            this.passwordStatusText.next("5/6 checks required") +            this.passwordStatusText.next("Password must meet requirements")          }          this.strength.next(strength) diff --git a/ufund-ui/src/app/models/User.ts b/ufund-ui/src/app/models/User.ts index e6848fa..d7d67b5 100644 --- a/ufund-ui/src/app/models/User.ts +++ b/ufund-ui/src/app/models/User.ts @@ -1,6 +1,6 @@  export enum userType { -    HELPER, -    MANAGER +    HELPER = "HELPER", +    MANAGER = "MANAGER"  }  export interface User {  | 
