Skip to content

Commit

Permalink
Hide generic channel avatar on watch view
Browse files Browse the repository at this point in the history
  • Loading branch information
kimsible committed Jul 20, 2020
1 parent 3aa7c43 commit 6000457
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ <h1 class="video-info-name">{{ video.name }}</h1>

<div class="pt-3 border-top video-info-channel d-flex">
<div class="video-info-channel-left d-flex">
<avatar-channel [video]="video"></avatar-channel>
<avatar-channel [video]="video" [genericChannel]="isChannelDisplayNameGeneric()"></avatar-channel>

<div class="video-info-channel-left-links ml-1">
<ng-container *ngIf="!isChannelDisplayNameGeneric()">
Expand Down
30 changes: 24 additions & 6 deletions client/src/app/shared/shared-main/account/avatar.component.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
<div class="wrapper" [ngClass]="'avatar-' + size">
<a [routerLink]="[ '/video-channels', video.byVideoChannel ]" [title]="channelLinkTitle">
<img [src]="video.videoChannelAvatarUrl" i18n-alt alt="Channel avatar" />
</a>
<a [routerLink]="[ '/accounts', video.byAccount ]" [title]="accountLinkTitle">
<img [src]="video.accountAvatarUrl" i18n-alt alt="Account avatar" />
</a>
<ng-container *ngIf="!isChannelAvatarNull() && !genericChannel">
<a [routerLink]="[ '/video-channels', video.byVideoChannel ]" [title]="channelLinkTitle">
<img [src]="video.videoChannelAvatarUrl" i18n-alt alt="Channel avatar" />
</a>
<a [routerLink]="[ '/accounts', video.byAccount ]" [title]="accountLinkTitle">
<img [src]="video.accountAvatarUrl" i18n-alt alt="Account avatar" />
</a>
</ng-container>

<ng-container *ngIf="!isChannelAvatarNull() && genericChannel">
<a [routerLink]="[ '/accounts', video.byAccount ]" [title]="accountLinkTitle">
<img [src]="video.accountAvatarUrl" i18n-alt alt="Account avatar" />
</a>

<a [routerLink]="[ '/video-channels', video.byVideoChannel ]" [title]="channelLinkTitle">
<img [src]="video.videoChannelAvatarUrl" i18n-alt alt="Channel avatar" />
</a>
</ng-container>

<ng-container *ngIf="isChannelAvatarNull()">
<a [routerLink]="[ '/accounts', video.byAccount ]" [title]="accountLinkTitle">
<img [src]="video.accountAvatarUrl" i18n-alt alt="Account avatar" />
</a>
</ng-container>
</div>
5 changes: 5 additions & 0 deletions client/src/app/shared/shared-main/account/avatar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { I18n } from '@ngx-translate/i18n-polyfill'
export class AvatarComponent implements OnInit {
@Input() video: Video
@Input() size: 'md' | 'sm' = 'md'
@Input() genericChannel: boolean

channelLinkTitle = ''
accountLinkTitle = ''
Expand All @@ -28,4 +29,8 @@ export class AvatarComponent implements OnInit {
{ name: this.video.account.name, handle: this.video.byAccount }
)
}

isChannelAvatarNull () {
return this.video.channel.avatar === null
}
}

0 comments on commit 6000457

Please sign in to comment.