diff options
Diffstat (limited to 'ufund-ui/src/app')
3 files changed, 39 insertions, 49 deletions
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 ae6bc99..ca92eeb 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 @@ -68,34 +68,41 @@ export class NeedListComponent {    searchResults: Need[] = [];    visibleNeeds: Need[] = [];    sortMode: 'Ascending' | 'Descending' = 'Ascending' -  currentPage: number = 0; -  itemsPerPage: number = 5; +  currentPage: number = localStorage.getItem('currentPage') ? parseInt(localStorage.getItem('currentPage')!) : 0; +  itemsPerPage: number = localStorage.getItem('itemsPerPage') ? parseInt(localStorage.getItem('itemsPerPage')!) : 5;    totalPages: number = Math.ceil(this.needs.length / this.itemsPerPage);    getPrefix(need: Need) {        return (need.type === GoalType.MONETARY) ? "$" : "";    } +  //increment/decrement    decrementPage() {      this.currentPage--; +    localStorage.setItem('currentPage', this.currentPage.toString());      this.updateVisibleNeeds();    }    incrementPage() {      this.currentPage++; +    localStorage.setItem('currentPage', this.currentPage.toString());      this.updateVisibleNeeds();    } +  //skipping pages    lastPage() {        this.currentPage = this.totalPages - 1 +      localStorage.setItem('currentPage', this.currentPage.toString());        this.updateVisibleNeeds()    }    firstPage() {        this.currentPage = 0 +      localStorage.setItem('currentPage', this.currentPage.toString());        this.updateVisibleNeeds()    } +  //user editing needs per page    editNeedsPerPage() {      if (this.itemsPerPage > this.searchResults.length) {        this.itemsPerPage = this.searchResults.length; @@ -103,16 +110,20 @@ export class NeedListComponent {      if (this.itemsPerPage < 1) {        this.itemsPerPage = 1;      } +    localStorage.setItem('itemsPerPage', this.itemsPerPage.toString());      this.resetVisibleNeeds();    } +  //refresing visible needs    updateVisibleNeeds() {      this.totalPages = Math.ceil(this.searchResults.length / this.itemsPerPage);      this.visibleNeeds = this.searchResults.slice(this.currentPage * this.itemsPerPage, (this.currentPage + 1) * this.itemsPerPage);    } +  //reset back to first page and refresh needs    resetVisibleNeeds() {      this.currentPage = 0; +    localStorage.setItem('currentPage', this.currentPage.toString());      this.updateVisibleNeeds();    } 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 44db4b4..8263737 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 @@ -4,6 +4,7 @@  }  #box { +    padding-top: 7.5%;      display: flex;      flex-direction: column;      width: 800px; @@ -22,32 +23,16 @@      /*margin-bottom: 20px;*/  } -.split { -    display: flex; -    flex-direction: row; -    justify-content: space-between; - - -    .left { -        display: flex; -        flex-direction: column; -        width : 50%; -    } - -    .right { -        display: flex; -        flex-direction: column; -        align-items: end; -    } -}  .need-image { -    width: 400px; -    height: auto; +    width: 55%; +    height: 40%; +    position: absolute; +    left: 22.5%;      aspect-ratio: 16/9;      object-fit: cover; +    mask-image: linear-gradient(to bottom, rgba(255,255,255,1) 0%, rgba(255,255,255,.2) 50%, rgba(255,255,255,.1) 90%, transparent 100%);      border-radius: 10px; -    box-shadow: rgb(0, 40, 70) 0 0 50px;  }  .urgent { 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 6921eac..a4937ed 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,4 +1,6 @@ -<div id="box"> +<img *ngIf="need.image" alt="Need image" class="need-image" [src]="need.image"/> + +<div id="box">          <h1>{{need.name}}</h1>      <span class="needType">{{need.type}} GOAL</span>      <p>{{need.description}}</p> @@ -8,35 +10,27 @@          <span>This goal is <strong>{{(((need.current)*100) / (need.maxGoal)).toFixed(0)}}%</strong> complete!</span>      </div> +  +    <span><strong>Target Goal:</strong> {{(need.type === GoalType.MONETARY) ? "$" : ""}}{{need.maxGoal}}</span> -    <div class="split"> -      <div class="left"> -        <span><strong>Target Goal:</strong> {{(need.type === GoalType.MONETARY) ? "$" : ""}}{{need.maxGoal}}</span> - -        <span><strong>Amount Currently Collected:</strong> {{need.type.toString() == 'MONETARY' ? '$' : ''}}{{need.current}}</span> +    <span><strong>Amount Currently Collected:</strong> {{need.type.toString() == 'MONETARY' ? '$' : ''}}{{need.current}}</span> -        <span><strong>Location:</strong> {{need.location}}</span> +    <span><strong>Location:</strong> {{need.location}}</span> -            <span><strong>Urgency: </strong> -                <span *ngIf="!need.urgent">Not urgent</span> -                <span *ngIf="need.urgent" class="urgent">URGENT</span> -            </span> -         -            <div *ngIf="need.filterAttributes.length > 0"> -                <strong>Tags:</strong> -                <ul style="display: flex; column-gap: 24px;"> -                    <li *ngFor="let tag of need?.filterAttributes"> -                        <p>{{tag}}</p> -                    </li> -                </ul> -            </div> -        </div> -        <div class="right"> -          <img *ngIf="need.image" alt="Need image" class="need-image" [src]="need.image"/> -        </div> -    </div> +    <span><strong>Urgency: </strong> +        <span *ngIf="!need.urgent">Not urgent</span> +        <span *ngIf="need.urgent" class="urgent">URGENT</span> +    </span> - +    <div *ngIf="need.filterAttributes.length > 0"> +        <strong>Tags:</strong> +        <ul style="display: flex; column-gap: 24px;"> +            <li *ngFor="let tag of need?.filterAttributes"> +                <p>{{tag}}</p> +            </li> +        </ul> +    </div> +            <div class="actionArea">          <button *ngIf="isHelper()" (click)="add(need!)">              <span class="icon">add</span>Add To Basket  | 
