diff options
-rw-r--r-- | ufund-ui/src/app/components/need-page/need-page.component.html | 12 | ||||
-rw-r--r-- | ufund-ui/src/app/components/need-page/need-page.component.ts | 7 |
2 files changed, 16 insertions, 3 deletions
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 8263c04..8588852 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,5 +1,15 @@ -<div id="box"> +<ng-template #warn> + <div *ngIf="!this.warned"> + <h1>Not Logged in!</h1> + <p>To contribute please <a routerLink="/login" (click) = "modalService.hideModal()">log in</a></p> + <p>You can still view needs signed out! </p> + <button (click) = "modalService.hideModal(); warned = true"> Continue</button> + </div> +</ng-template> + +<div id="box" (mouseenter)="!warned && (!usersService.isHelper() && !usersService.isManager()) ? modalService.showModal(warn) : null"> @if (need) { + <img *ngIf="need.image" alt="Need image" class="need-image" [src]="need.image"/> <h1>{{need.name}}</h1> <span class="needType">{{need.type}} GOAL</span> 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 17e330c..8c4a513 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,4 +1,4 @@ -import {Component, Input, OnInit} from '@angular/core'; +import {Component, Input, OnInit, ViewChild, TemplateRef} from '@angular/core'; import {GoalType, Need} from '../../models/Need'; import {ActivatedRoute, Router} from "@angular/router"; import {CupboardService} from "../../services/cupboard.service"; @@ -14,7 +14,9 @@ import {ModalService} from '../../services/modal.service'; templateUrl: './need-page.component.html', styleUrl: './need-page.component.css' }) + export class NeedPageComponent implements OnInit { + constructor( private route: ActivatedRoute, private cupboardService: CupboardService, @@ -26,7 +28,8 @@ export class NeedPageComponent implements OnInit { ) {} @Input() need!: Need; - + warned: boolean = false; + ngOnInit(): void { const id = Number(this.route.snapshot.paramMap.get('id')); this.cupboardService.getNeed(id).subscribe(n => this.need = n); |