From 0b49430e3b0a5cc14521db58af19dafa5384c3c4 Mon Sep 17 00:00:00 2001 From: sowgro Date: Tue, 1 Apr 2025 16:58:12 -0400 Subject: Fix warnings and misaligned prev page button --- .../src/app/components/need-list/need-list.component.html | 2 +- .../src/app/components/need-page/need-page.component.html | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'ufund-ui/src') 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..8d01291 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 @@ -65,7 +65,7 @@
- + Page {{currentPage + 1}} of {{totalPages}}
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 @@
-

{{need?.name}}

- {{need?.type}} GOAL +

{{need.name}}

+ {{need.type}} GOAL - Need image + Need image -

{{need?.description}}

+

{{need.description}}

- - This goal is {{(((need?.current ?? 0)*100) / (need?.maxGoal ?? 0)).toFixed(0)}}% complete! + + This goal is {{(((need.current)*100) / (need.maxGoal)).toFixed(0)}}% complete!
Target Goal: {{need.maxGoal}} -- cgit v1.2.3 From 734d3d380cd70e87474adebedec5e230959bcf81 Mon Sep 17 00:00:00 2001 From: sowgro Date: Tue, 1 Apr 2025 19:44:28 -0400 Subject: Make nav bar buttons only show conditionally --- ufund-ui/src/app/app.component.html | 4 ++-- ufund-ui/src/app/models/User.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'ufund-ui/src') 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 @@
- Dashboard + Dashboard Cupboard - Basket + Basket 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 { -- cgit v1.2.3 From 92fbcbfd6ade1c5fe0cc3c37d6a6914ef1d2a2a4 Mon Sep 17 00:00:00 2001 From: sowgro Date: Tue, 1 Apr 2025 20:04:33 -0400 Subject: Add skip to first / last page in pagination --- ufund-ui/src/app/app.component.ts | 4 +++- .../app/components/need-list/need-list.component.css | 4 ++++ .../app/components/need-list/need-list.component.html | 8 ++++---- .../app/components/need-list/need-list.component.ts | 19 +++++++++++++------ 4 files changed, 24 insertions(+), 11 deletions(-) (limited to 'ufund-ui/src') 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/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 8d01291..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 @@
-
-
{{need.current}}/{{need.maxGoal}} ({{((need.current / need.maxGoal) * 100).toFixed(0)}}%) @@ -65,7 +63,9 @@
- + + Page {{currentPage + 1}} of {{totalPages}} - + +
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.'); -} -- cgit v1.2.3 From 77f3cf60bbb9e7b13cc2642fa06b5f40dccdbdb1 Mon Sep 17 00:00:00 2001 From: sowgro Date: Tue, 1 Apr 2025 20:05:06 -0400 Subject: Stub out new admin dashboard --- .../src/app/components/dashboard/dashboard.component.css | 2 +- .../src/app/components/dashboard/dashboard.component.html | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'ufund-ui/src') 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 @@ -

Your Dashboard

- - - +

Admin Dashboard

+ + + +_ Registered users +_ Needs with overflow +_ Needs in peoples baskets +_ Total monetary contributions +_ -- cgit v1.2.3 From 2eb67f9481d858474e77af545e71f68b2cea7041 Mon Sep 17 00:00:00 2001 From: sowgro Date: Tue, 1 Apr 2025 21:17:45 -0400 Subject: Simplify sign up process --- ufund-ui/src/app/components/signup/signup.component.html | 4 +--- ufund-ui/src/app/components/signup/signup.component.ts | 13 ++++--------- 2 files changed, 5 insertions(+), 12 deletions(-) (limited to 'ufund-ui/src') 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 @@
- + {{passwordStatusText | async}}
@@ -24,8 +24,6 @@
- Account created Proceed to login - {{statusText | async}}
Already have an account? Log in
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) -- cgit v1.2.3 From 430bd8d3d13f3716160889d6f18fcb2cd08fcf39 Mon Sep 17 00:00:00 2001 From: sowgro Date: Wed, 2 Apr 2025 13:52:28 -0400 Subject: Make enter on login work --- ufund-ui/src/app/components/login/login.component.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ufund-ui/src') diff --git a/ufund-ui/src/app/components/login/login.component.html b/ufund-ui/src/app/components/login/login.component.html index c67b903..1017d0f 100644 --- a/ufund-ui/src/app/components/login/login.component.html +++ b/ufund-ui/src/app/components/login/login.component.html @@ -1,7 +1,7 @@

Login

- - + +
New? Create an account -- cgit v1.2.3 From 6ce39f0facc6ae38ff42d1e8efe091f528afc5a0 Mon Sep 17 00:00:00 2001 From: Gunther6070 Date: Wed, 2 Apr 2025 13:55:46 -0400 Subject: Signup logs you in and brings you to home page now. Also modified toasts in funding basket --- .../src/app/components/funding-basket/funding-basket.component.ts | 6 +++--- ufund-ui/src/app/components/signup/signup.component.ts | 7 +++++-- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'ufund-ui/src') diff --git a/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts b/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts index dcacca1..847baee 100644 --- a/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts +++ b/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts @@ -70,11 +70,11 @@ export class FundingBasketComponent implements OnInit { this.cupboardService.checkoutNeed(need.id, +contribution.value) .pipe(catchError((ex, _) => { if (ex.status == 500) { - this.toastService.sendToast(ToastType.INFO, 'Fields cannot be blank'); + this.toastService.sendToast(ToastType.ERROR, 'Fields cannot be blank'); } else if (ex.status == 400) { - this.toastService.sendToast(ToastType.INFO, 'Goal must be greater than 0'); + this.toastService.sendToast(ToastType.ERROR, ex.error); } else { - this.toastService.sendToast(ToastType.INFO, 'Error on creating need'); + this.toastService.sendToast(ToastType.ERROR, 'Error on creating need'); } return new Observable(); })) diff --git a/ufund-ui/src/app/components/signup/signup.component.ts b/ufund-ui/src/app/components/signup/signup.component.ts index b040d1a..9c37211 100644 --- a/ufund-ui/src/app/components/signup/signup.component.ts +++ b/ufund-ui/src/app/components/signup/signup.component.ts @@ -3,6 +3,7 @@ import {UsersService} from '../../services/users.service'; import {Router} from '@angular/router'; import {BehaviorSubject} from 'rxjs'; import {ToastsService, ToastType} from '../../services/toasts.service'; +import {AuthService} from '../../services/auth.service'; class PasswordRequirements { sixLong: {title: string, value: boolean} = {title: 'Is 6 characters or longer' , value: false} @@ -32,7 +33,8 @@ export class SignupComponent { constructor( protected usersService: UsersService, protected router: Router, - protected toastService: ToastsService + protected toastService: ToastsService, + protected authService: AuthService ) {} signup(username: string | null, password: string | null) { @@ -44,7 +46,8 @@ export class SignupComponent { this.usersService.createUser(username, password).then(() => { // let action = {label: 'Proceed to login', onAction: () => this.router.navigate(["/login"])} this.toastService.sendToast(ToastType.INFO, "Account successfully created") - this.router.navigate(["/login"]) + this.authService.login(username, password) + this.router.navigate(["/"]) }).catch(ex => { this.toastService.sendToast(ToastType.ERROR, "Unable to create account: " + friendlyHttpStatus[ex.status]) console.log(ex) -- cgit v1.2.3 From 4d382ccf9de889e4b339dd13220c3f761497e419 Mon Sep 17 00:00:00 2001 From: Gunther6070 Date: Wed, 2 Apr 2025 16:08:52 -0400 Subject: Added dollar signs and other small additions to needs --- ufund-ui/src/app/components/cupboard/cupboard.component.ts | 8 ++------ ufund-ui/src/app/components/need-list/need-list.component.ts | 9 ++++++++- ufund-ui/src/app/models/Need.ts | 4 ++-- 3 files changed, 12 insertions(+), 9 deletions(-) (limited to 'ufund-ui/src') diff --git a/ufund-ui/src/app/components/cupboard/cupboard.component.ts b/ufund-ui/src/app/components/cupboard/cupboard.component.ts index 2230cd3..a4706b3 100644 --- a/ufund-ui/src/app/components/cupboard/cupboard.component.ts +++ b/ufund-ui/src/app/components/cupboard/cupboard.component.ts @@ -1,6 +1,6 @@ import {Component, OnInit, ViewChild} from '@angular/core'; import { CupboardService } from '../../services/cupboard.service'; -import { Need, GoalType } from '../../models/Need'; +import { Need } from '../../models/Need'; import { userType } from '../../models/User'; import { catchError, of } from 'rxjs'; import { NeedListComponent } from '../need-list/need-list.component'; @@ -90,7 +90,7 @@ export class CupboardComponent implements OnInit { id: 0, maxGoal: form.maxGoal, type: form.type, - urgent: form.urgent ? true : false, + urgent: !!form.urgent, filterAttributes: [], current: 0, description: form.description @@ -120,8 +120,4 @@ export class CupboardComponent implements OnInit { ); } - - destroy() { - - } } 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 06a612e..2ec850e 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 @@ -1,5 +1,5 @@ import {Component, EventEmitter, Output} from '@angular/core'; -import {Need} from '../../models/Need'; +import {GoalType, Need} from '../../models/Need'; import {CupboardService} from '../../services/cupboard.service'; import {UsersService} from '../../services/users.service'; import {userType} from '../../models/User'; @@ -72,6 +72,10 @@ export class NeedListComponent { itemsPerPage: number = 5; totalPages: number = Math.ceil(this.needs.length / this.itemsPerPage); + getPrefix(need: Need) { + return (need.type === GoalType.MONETARY) ? "$" : ""; + } + decrementPage() { this.currentPage--; this.updateVisibleNeeds(); @@ -229,6 +233,7 @@ export class NeedListComponent { if (currentUser) { if (!currentUser.basket.includes(need.id)) { currentUser.basket.push(need.id); + this.toastService.sendToast(ToastType.INFO, "Need added to your basket!") this.usersService.updateUser(currentUser) .pipe(catchError((err, _) => { console.error(err); @@ -278,5 +283,7 @@ export class NeedListComponent { button.style.visibility = 'hidden'; } } + + protected readonly GoalType = GoalType; } diff --git a/ufund-ui/src/app/models/Need.ts b/ufund-ui/src/app/models/Need.ts index 6cf7e76..588e745 100644 --- a/ufund-ui/src/app/models/Need.ts +++ b/ufund-ui/src/app/models/Need.ts @@ -12,6 +12,6 @@ export interface Need { } export enum GoalType { - MONETARY, - PHYSICAL + MONETARY = 'MONETARY', + PHYSICAL = 'PHYSICAL' } -- cgit v1.2.3 From bc23c624a760b33bb67b3c0df5fd3d8f39f36e77 Mon Sep 17 00:00:00 2001 From: Gunther6070 Date: Wed, 2 Apr 2025 16:09:24 -0400 Subject: Added dollar signs and other small additions to needs --- ufund-ui/src/app/components/need-list/need-list.component.html | 2 +- ufund-ui/src/app/components/need-page/need-page.component.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'ufund-ui/src') 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 88317dd..593aebf 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 @@ -42,7 +42,7 @@
- {{need.current}}/{{need.maxGoal}} ({{((need.current / need.maxGoal) * 100).toFixed(0)}}%) + {{getPrefix(need)}}{{need.current}}/{{need.maxGoal}} ({{((need.current / need.maxGoal) * 100).toFixed(0)}}%)
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 522b710..3d362f5 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 @@ -11,7 +11,7 @@ This goal is {{(((need.current)*100) / (need.maxGoal)).toFixed(0)}}% complete!
- Target Goal: {{need.maxGoal}} + Target Goal: {{(need.type === GoalType.MONETARY) ? "$" : ""}}{{need.maxGoal}} Amount Currently Collected: {{need.current}} -- cgit v1.2.3 From 010d2ed677e1fca33cee0963a897492f5902cb89 Mon Sep 17 00:00:00 2001 From: benal01 Date: Wed, 2 Apr 2025 22:25:30 -0400 Subject: need image support in need page --- .../components/need-page/need-page.component.css | 11 +++++++ .../components/need-page/need-page.component.html | 35 ++++++++++++---------- 2 files changed, 31 insertions(+), 15 deletions(-) (limited to 'ufund-ui/src') diff --git a/ufund-ui/src/app/components/need-page/need-page.component.css b/ufund-ui/src/app/components/need-page/need-page.component.css index 844410f..e634c8f 100644 --- a/ufund-ui/src/app/components/need-page/need-page.component.css +++ b/ufund-ui/src/app/components/need-page/need-page.component.css @@ -31,6 +31,7 @@ .left { display: flex; flex-direction: column; + width : 50%; } .right { @@ -40,6 +41,16 @@ } } +.need-image { + width: 80%; + height: auto; + aspect-ratio: 16/9; + object-fit: cover; + border-radius: 10px; + box-shadow: rgb(0, 40, 70) 0 0 50px; + +} + .urgent { font-size: 11pt; background-color: rgba(255, 165, 0, 0.27); 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 3d362f5..210e444 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,9 +1,6 @@

{{need.name}}

{{need.type}} GOAL - - Need image -

{{need.description}}

@@ -11,25 +8,33 @@ This goal is {{(((need.current)*100) / (need.maxGoal)).toFixed(0)}}% complete!
+
+
Target Goal: {{(need.type === GoalType.MONETARY) ? "$" : ""}}{{need.maxGoal}} Amount Currently Collected: {{need.current}} Location: {{need.location}} - Urgency: - Not urgent - URGENT - - -
- Tags: -
    -
  • -

    {{tag}}

    -
  • -
+ Urgency: + Not urgent + URGENT + + +
+ Tags: +
    +
  • +

    {{tag}}

    +
  • +
+
+
+
+ Need image +
+
- Need image + Need image
-- cgit v1.2.3