Skip to content

Commit

Permalink
When not logged in hide publish button and display help button instead
Browse files Browse the repository at this point in the history
  • Loading branch information
kimsible committed Nov 25, 2020
1 parent 2459192 commit 9bd46a6
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
4 changes: 2 additions & 2 deletions client/src/app/header/header.component.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<my-search-typeahead class="w-100 d-flex justify-content-end"></my-search-typeahead>

<a class="publish-button" routerLink="/videos/upload">
<a *ngIf="isLoggedIn" class="publish-button" routerLink="/videos/upload">
<my-global-icon iconName="upload" aria-hidden="true"></my-global-icon>
<span i18n class="publish-button-label">Publish</span>
</a>

<a *ngIf="!isInMobileView" class="about-button" routerLink="/about" routerLinkActive="active" [ngbTooltip]="aboutText">
<a *ngIf="!isInMobileView && !isLoggedIn" class="about-button" routerLink="/about" routerLinkActive="active" [ngbTooltip]="aboutText">
<my-global-icon iconName="help" aria-hidden="true"></my-global-icon>
</a>
7 changes: 6 additions & 1 deletion client/src/app/header/header.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component } from '@angular/core'
import { ScreenService } from '@app/core'
import { AuthService, ScreenService } from '@app/core'

@Component({
selector: 'my-header',
Expand All @@ -11,10 +11,15 @@ export class HeaderComponent {
aboutText = $localize`About`

constructor (
private authService: AuthService,
private screenService: ScreenService
) { }

get isInMobileView () {
return this.screenService.isInMobileView()
}

get isLoggedIn () {
return this.authService.isLoggedIn()
}
}
2 changes: 1 addition & 1 deletion client/src/app/menu/menu.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
<ng-container i18n>Settings</ng-container>
</a>

<a *ngIf="isInMobileView" routerLink="/about" routerLinkActive="active">
<a *ngIf="isAboutDisplayed" routerLink="/about" routerLinkActive="active">
<my-global-icon iconName="help" aria-hidden="true"></my-global-icon>
<ng-container i18n>About</ng-container>
</a>
Expand Down
8 changes: 8 additions & 0 deletions client/src/app/menu/menu.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@ export class MenuComponent implements OnInit {
return this.serverConfig.instance.name
}

get isAboutDisplayed () {
if (this.isLoggedIn) {
return true
} else {
return this.isInMobileView
}
}

ngOnInit () {
this.serverConfig = this.serverService.getTmpConfig()
this.serverService.getConfig()
Expand Down

0 comments on commit 9bd46a6

Please sign in to comment.