aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+videos
diff options
context:
space:
mode:
authorkontrollanten <6680299+kontrollanten@users.noreply.github.com>2021-04-15 10:01:27 +0200
committerGitHub <noreply@github.com>2021-04-15 10:01:27 +0200
commitfbdcd4ec9f549b730f8311512bcc0c0b7bc2db0a (patch)
treee4c4d3a9abdc52afb2443234a57d74f0819b7d08 /client/src/app/+videos
parent266947e5efc7ff30b0020beb5a74e4d4fc696fa5 (diff)
downloadPeerTube-fbdcd4ec9f549b730f8311512bcc0c0b7bc2db0a.tar.gz
PeerTube-fbdcd4ec9f549b730f8311512bcc0c0b7bc2db0a.tar.zst
PeerTube-fbdcd4ec9f549b730f8311512bcc0c0b7bc2db0a.zip
Add AccountAvatarComponent (#3965)
* refactor(client): create account-avatar component * continue implement account-avatar * fix review comments
Diffstat (limited to 'client/src/app/+videos')
-rw-r--r--client/src/app/+videos/+video-watch/comment/video-comment-add.component.html2
-rw-r--r--client/src/app/+videos/+video-watch/comment/video-comment-add.component.scss4
-rw-r--r--client/src/app/+videos/+video-watch/comment/video-comment-add.component.ts5
-rw-r--r--client/src/app/+videos/+video-watch/comment/video-comment.component.html10
-rw-r--r--client/src/app/+videos/+video-watch/comment/video-comment.component.scss4
-rw-r--r--client/src/app/+videos/+video-watch/comment/video-comment.component.ts4
-rw-r--r--client/src/app/+videos/+video-watch/video-avatar-channel.component.html14
-rw-r--r--client/src/app/+videos/+video-watch/video-watch.module.ts7
8 files changed, 12 insertions, 38 deletions
diff --git a/client/src/app/+videos/+video-watch/comment/video-comment-add.component.html b/client/src/app/+videos/+video-watch/comment/video-comment-add.component.html
index fdefed09a..930464024 100644
--- a/client/src/app/+videos/+video-watch/comment/video-comment-add.component.html
+++ b/client/src/app/+videos/+video-watch/comment/video-comment-add.component.html
@@ -1,6 +1,6 @@
1<form novalidate [formGroup]="form" (ngSubmit)="formValidated()"> 1<form novalidate [formGroup]="form" (ngSubmit)="formValidated()">
2 <div class="avatar-and-textarea"> 2 <div class="avatar-and-textarea">
3 <img [src]="getAvatarUrl()" alt="Avatar" /> 3 <my-account-avatar [account]="user?.account" size="25"></my-account-avatar>
4 4
5 <div class="form-group"> 5 <div class="form-group">
6 <textarea i18n-placeholder placeholder="Add comment..." myAutoResize 6 <textarea i18n-placeholder placeholder="Add comment..." myAutoResize
diff --git a/client/src/app/+videos/+video-watch/comment/video-comment-add.component.scss b/client/src/app/+videos/+video-watch/comment/video-comment-add.component.scss
index d938e2e28..e11b9be5a 100644
--- a/client/src/app/+videos/+video-watch/comment/video-comment-add.component.scss
+++ b/client/src/app/+videos/+video-watch/comment/video-comment-add.component.scss
@@ -9,9 +9,7 @@ form {
9 display: flex; 9 display: flex;
10 margin-bottom: 10px; 10 margin-bottom: 10px;
11 11
12 img { 12 my-account-avatar {
13 @include avatar(25px);
14
15 vertical-align: top; 13 vertical-align: top;
16 margin-right: 10px; 14 margin-right: 10px;
17 } 15 }
diff --git a/client/src/app/+videos/+video-watch/comment/video-comment-add.component.ts b/client/src/app/+videos/+video-watch/comment/video-comment-add.component.ts
index f1f0dfeba..fce7e5edc 100644
--- a/client/src/app/+videos/+video-watch/comment/video-comment-add.component.ts
+++ b/client/src/app/+videos/+video-watch/comment/video-comment-add.component.ts
@@ -143,11 +143,6 @@ export class VideoCommentAddComponent extends FormReactive implements OnChanges,
143 return window.location.href 143 return window.location.href
144 } 144 }
145 145
146 getAvatarUrl () {
147 if (this.user) return this.user.accountAvatarUrl
148 return Account.GET_DEFAULT_AVATAR_URL()
149 }
150
151 gotoLogin () { 146 gotoLogin () {
152 this.hideModals() 147 this.hideModals()
153 this.router.navigate([ '/login' ]) 148 this.router.navigate([ '/login' ])
diff --git a/client/src/app/+videos/+video-watch/comment/video-comment.component.html b/client/src/app/+videos/+video-watch/comment/video-comment.component.html
index ba41b6f48..f13b12b25 100644
--- a/client/src/app/+videos/+video-watch/comment/video-comment.component.html
+++ b/client/src/app/+videos/+video-watch/comment/video-comment.component.html
@@ -1,14 +1,6 @@
1<div *ngIf="isCommentDisplayed()" class="root-comment"> 1<div *ngIf="isCommentDisplayed()" class="root-comment">
2 <div class="left"> 2 <div class="left">
3 <a *ngIf="!comment.isDeleted" [href]="comment.account.url" target="_blank" rel="noopener noreferrer"> 3 <my-account-avatar *ngIf="!comment.isDeleted" [account]="comment.account"></my-account-avatar>
4 <img
5 class="comment-avatar"
6 [src]="comment.accountAvatarUrl"
7 (error)="switchToDefaultAvatar($event)"
8 alt="Avatar"
9 />
10 </a>
11
12 <div class="vertical-border"></div> 4 <div class="vertical-border"></div>
13 </div> 5 </div>
14 6
diff --git a/client/src/app/+videos/+video-watch/comment/video-comment.component.scss b/client/src/app/+videos/+video-watch/comment/video-comment.component.scss
index f6ff376b9..866293eea 100644
--- a/client/src/app/+videos/+video-watch/comment/video-comment.component.scss
+++ b/client/src/app/+videos/+video-watch/comment/video-comment.component.scss
@@ -23,10 +23,6 @@
23 width: 100%; 23 width: 100%;
24 } 24 }
25 25
26 .comment-avatar {
27 @include avatar(36px);
28 }
29
30 .comment { 26 .comment {
31 flex-grow: 1; 27 flex-grow: 1;
32 // Fix word-wrap with flex 28 // Fix word-wrap with flex
diff --git a/client/src/app/+videos/+video-watch/comment/video-comment.component.ts b/client/src/app/+videos/+video-watch/comment/video-comment.component.ts
index 5c5d72b22..dd3db0c65 100644
--- a/client/src/app/+videos/+video-watch/comment/video-comment.component.ts
+++ b/client/src/app/+videos/+video-watch/comment/video-comment.component.ts
@@ -131,10 +131,6 @@ export class VideoCommentComponent implements OnInit, OnChanges {
131 ) 131 )
132 } 132 }
133 133
134 switchToDefaultAvatar ($event: Event) {
135 ($event.target as HTMLImageElement).src = Account.GET_DEFAULT_AVATAR_URL()
136 }
137
138 isCommentDisplayed () { 134 isCommentDisplayed () {
139 // Not deleted 135 // Not deleted
140 return !this.comment.isDeleted || 136 return !this.comment.isDeleted ||
diff --git a/client/src/app/+videos/+video-watch/video-avatar-channel.component.html b/client/src/app/+videos/+video-watch/video-avatar-channel.component.html
index 5058f05dd..545ecb1d5 100644
--- a/client/src/app/+videos/+video-watch/video-avatar-channel.component.html
+++ b/client/src/app/+videos/+video-watch/video-avatar-channel.component.html
@@ -4,15 +4,11 @@
4 <img [src]="video.videoChannelAvatarUrl" i18n-alt alt="Channel avatar" class="channel-avatar" /> 4 <img [src]="video.videoChannelAvatarUrl" i18n-alt alt="Channel avatar" class="channel-avatar" />
5 </a> 5 </a>
6 6
7 <a [routerLink]="[ '/accounts', video.byAccount ]" [title]="accountLinkTitle"> 7 <my-account-avatar [account]="video.account"></my-account-avatar>
8 <img [src]="video.accountAvatarUrl" i18n-alt alt="Account avatar" /> 8</ng-container>
9 </a>
10 </ng-container>
11 9
12 <ng-container *ngIf="!isChannelAvatarNull() && genericChannel"> 10 <ng-container *ngIf="!isChannelAvatarNull() && genericChannel">
13 <a [routerLink]="[ '/accounts', video.byAccount ]" [title]="accountLinkTitle"> 11 <my-account-avatar [account]="video.account"></my-account-avatar>
14 <img [src]="video.accountAvatarUrl" i18n-alt alt="Account avatar" />
15 </a>
16 12
17 <a [routerLink]="[ '/video-channels', video.byVideoChannel ]" [title]="channelLinkTitle"> 13 <a [routerLink]="[ '/video-channels', video.byVideoChannel ]" [title]="channelLinkTitle">
18 <img [src]="video.videoChannelAvatarUrl" i18n-alt alt="Channel avatar" class="channel-avatar" /> 14 <img [src]="video.videoChannelAvatarUrl" i18n-alt alt="Channel avatar" class="channel-avatar" />
@@ -20,8 +16,6 @@
20 </ng-container> 16 </ng-container>
21 17
22 <ng-container *ngIf="isChannelAvatarNull()"> 18 <ng-container *ngIf="isChannelAvatarNull()">
23 <a [routerLink]="[ '/accounts', video.byAccount ]" [title]="accountLinkTitle"> 19 <my-account-avatar [account]="video.account"></my-account-avatar>
24 <img [src]="video.accountAvatarUrl" i18n-alt alt="Account avatar" />
25 </a>
26 </ng-container> 20 </ng-container>
27</div> 21</div>
diff --git a/client/src/app/+videos/+video-watch/video-watch.module.ts b/client/src/app/+videos/+video-watch/video-watch.module.ts
index 29ad92f00..cf6afd852 100644
--- a/client/src/app/+videos/+video-watch/video-watch.module.ts
+++ b/client/src/app/+videos/+video-watch/video-watch.module.ts
@@ -17,10 +17,11 @@ import { VideoCommentsComponent } from './comment/video-comments.component'
17import { PlayerStylesComponent } from './player-styles.component' 17import { PlayerStylesComponent } from './player-styles.component'
18import { RecommendationsModule } from './recommendations/recommendations.module' 18import { RecommendationsModule } from './recommendations/recommendations.module'
19import { TimestampRouteTransformerDirective } from './timestamp-route-transformer.directive' 19import { TimestampRouteTransformerDirective } from './timestamp-route-transformer.directive'
20import { VideoAvatarChannelComponent } from './video-avatar-channel.component'
21import { VideoWatchPlaylistComponent } from './video-watch-playlist.component' 20import { VideoWatchPlaylistComponent } from './video-watch-playlist.component'
22import { VideoWatchRoutingModule } from './video-watch-routing.module' 21import { VideoWatchRoutingModule } from './video-watch-routing.module'
23import { VideoWatchComponent } from './video-watch.component' 22import { VideoWatchComponent } from './video-watch.component'
23import { SharedAccountAvatarModule } from '../../shared/shared-account-avatar/shared-account-avatar.module'
24import { VideoAvatarChannelComponent } from './video-avatar-channel.component'
24 25
25@NgModule({ 26@NgModule({
26 imports: [ 27 imports: [
@@ -37,7 +38,8 @@ import { VideoWatchComponent } from './video-watch.component'
37 SharedVideoCommentModule, 38 SharedVideoCommentModule,
38 SharedShareModal, 39 SharedShareModal,
39 SharedVideoModule, 40 SharedVideoModule,
40 SharedSupportModal 41 SharedSupportModal,
42 SharedAccountAvatarModule
41 ], 43 ],
42 44
43 declarations: [ 45 declarations: [
@@ -47,6 +49,7 @@ import { VideoWatchComponent } from './video-watch.component'
47 VideoCommentsComponent, 49 VideoCommentsComponent,
48 VideoCommentAddComponent, 50 VideoCommentAddComponent,
49 VideoCommentComponent, 51 VideoCommentComponent,
52 VideoAvatarChannelComponent,
50 53
51 VideoAvatarChannelComponent, 54 VideoAvatarChannelComponent,
52 55