Skip to content

Commit 4f1caf1

Browse files
committed
fix showing login button for short when user IS LOGGED IN
1 parent e4e2e49 commit 4f1caf1

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

frontend/src/app/public/bookmarks/homepage.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<ng-template mat-tab-label>
66
<span class="app-tab-label"><i class="fas fa-home"></i> Feed</span>
77
</ng-template>
8-
<div *ngIf="!(userIsLoggedIn$ | async); else showFollowedTags">
8+
<div *ngIf="!userIsLoggedIn && showLoginButton; else showFollowedTags">
99
<div class="alert alert-info mt-2">
1010
<button type="button" class="btn btn-primary btn-sm mr-2" (click)="login('feed')"><i
1111
class="fas fa-unlock"></i> Login / Register

frontend/src/app/public/bookmarks/homepage.component.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, OnDestroy, OnInit } from '@angular/core';
1+
import { AfterViewInit, Component, OnDestroy, OnInit } from '@angular/core';
22
import { Observable, Subscription } from 'rxjs';
33
import { Bookmark } from '../../core/model/bookmark';
44
import { ActivatedRoute, Router } from '@angular/router';
@@ -27,7 +27,7 @@ import { MatTabChangeEvent } from '@angular/material/tabs';
2727
templateUrl: './homepage.component.html',
2828
styleUrls: ['./homepage.component.scss']
2929
})
30-
export class HomepageComponent extends TagFollowingBaseComponent implements OnInit, OnDestroy {
30+
export class HomepageComponent extends TagFollowingBaseComponent implements OnInit, OnDestroy, AfterViewInit {
3131

3232
readonly FIRST_PAGE = 1;
3333

@@ -42,6 +42,7 @@ export class HomepageComponent extends TagFollowingBaseComponent implements OnIn
4242
readLater$: Observable<Bookmark[]>;
4343

4444
userIsLoggedIn = false;
45+
showLoginButton = false;
4546
userId: string;
4647
userIsLoggedIn$: Promise<boolean>;
4748

@@ -252,6 +253,14 @@ export class HomepageComponent extends TagFollowingBaseComponent implements OnIn
252253
queryParams: {q: '[' + tag + ']', sd: SearchDomain.PUBLIC_BOOKMARKS, page: this.FIRST_PAGE}
253254
});
254255
}
256+
257+
ngAfterViewInit(): void {
258+
this.userIsLoggedIn$.then(isLoggedIn => {
259+
if (!isLoggedIn) {
260+
this.showLoginButton = true;
261+
}
262+
});
263+
}
255264
}
256265

257266
export interface TabSwitchQueryParams {

0 commit comments

Comments
 (0)