Hide register and login button on about when user is logged in

master
Max 5 years ago
parent 52767b0dc2
commit 3a39e0e3b3

@ -66,9 +66,11 @@
<div id="text2" style="text-align: center;"> <div id="text2" style="text-align: center;">
<p class="mat-display-1">We believe, that together we can do amazing things to protect our environment and keep it <p class="mat-display-1">We believe, that together we can do amazing things to protect our environment and keep it
clean and green.</p> clean and green.</p>
<div *ngIf="!loggedIn">
<p class="mat-display-1">You aren't part of greenvironment yet? - join us now!</p> <p class="mat-display-1">You aren't part of greenvironment yet? - join us now!</p>
<a mat-stroked-button color="primary" class="link-button" routerLink="/register">Register</a> <a mat-stroked-button color="primary" class="link-button" routerLink="/register">Register</a>
<br> <br>
<a mat-stroked-button color="primary" class="link-button" routerLink="/login">Login</a> <a mat-stroked-button color="primary" class="link-button" routerLink="/login">Login</a>
</div> </div>
</div> </div>
</div>

@ -4,6 +4,7 @@ import {LevelList} from 'src/app/models/levellist';
import { MatSort } from '@angular/material/sort'; import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table'; import { MatTableDataSource } from '@angular/material/table';
import { ActivityService } from 'src/app/services/activity/activity.service'; import { ActivityService } from 'src/app/services/activity/activity.service';
import { DatasharingService } from '../../services/datasharing.service';
@Component({ @Component({
selector: 'app-about', selector: 'app-about',
@ -11,6 +12,7 @@ import {ActivityService} from 'src/app/services/activity/activity.service';
styleUrls: ['./about.component.sass'] styleUrls: ['./about.component.sass']
}) })
export class AboutComponent implements OnInit { export class AboutComponent implements OnInit {
loggedIn = false;
actionlist: Activitylist = new Activitylist(); actionlist: Activitylist = new Activitylist();
levellist: LevelList = new LevelList(); levellist: LevelList = new LevelList();
@ -19,12 +21,15 @@ export class AboutComponent implements OnInit {
displayedLevelColumns = ['level', 'name']; displayedLevelColumns = ['level', 'name'];
levelSource = new MatTableDataSource(this.levellist.levels); levelSource = new MatTableDataSource(this.levellist.levels);
constructor(private activityService: ActivityService) { constructor(private activityService: ActivityService, private data: DatasharingService) {
} }
@ViewChild(MatSort, { static: true }) sort: MatSort; @ViewChild(MatSort, { static: true }) sort: MatSort;
ngOnInit() { ngOnInit() {
this.data.currentUser.subscribe(user => {
this.loggedIn = user.loggedIn;
});
this.activityService.getActivities(); this.activityService.getActivities();
this.activityService.activitylist.subscribe(response => { this.activityService.activitylist.subscribe(response => {
this.actionlist = response; this.actionlist = response;

Loading…
Cancel
Save