Skip to content

Commit 19a35e6

Browse files
author
Your Name
committed
WIP: Display image icon and comment count on video miniature component
1 parent c880427 commit 19a35e6

File tree

4 files changed

+24
-2
lines changed

4 files changed

+24
-2
lines changed

client/src/app/shared/shared-main/video/video.model.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ export class Video implements VideoServerModel {
116116

117117
automaticTags?: string[]
118118

119+
commentCount: number
120+
119121
static buildWatchUrl (video: Partial<Pick<Video, 'uuid' | 'shortUUID'>>) {
120122
return buildVideoWatchPath({ shortUUID: video.shortUUID || video.uuid })
121123
}
@@ -209,6 +211,8 @@ export class Video implements VideoServerModel {
209211
this.aspectRatio = hash.aspectRatio
210212

211213
this.automaticTags = hash.automaticTags
214+
215+
this.commentCount = hash.commentCount
212216
}
213217

214218
isVideoNSFWForUser (user: User, serverConfig: HTMLServerConfig) {

client/src/app/shared/shared-video-miniature/video-miniature.component.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@
4141

4242
<my-video-views-counter *ngIf="displayOptions.views" [video]="video"></my-video-views-counter>
4343
</span>
44+
45+
<span class="comment-count" *ngIf="displayOptions.commentCount">
46+
<my-global-icon iconName="message-circle"></my-global-icon>
47+
<span>{{ video.commentCount }}</span>
48+
</span>
4449
</span>
4550

4651
<a *ngIf="displayOptions.by" class="video-miniature-account" [routerLink]="[ '/c', video.byVideoChannel ]">

client/src/app/shared/shared-video-miniature/video-miniature.component.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,15 @@ my-actor-avatar {
109109

110110
.video-miniature-created-at-views {
111111
display: block;
112+
113+
.comment-count {
114+
float: right;
115+
text-align: right;
116+
117+
span {
118+
margin-left: 5px;
119+
}
120+
}
112121
}
113122

114123
.video-actions {

client/src/app/shared/shared-video-miniature/video-miniature.component.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { NgClass, NgIf, NgFor } from '@angular/common'
2525
import { Video } from '../shared-main/video/video.model'
2626
import { VideoService } from '../shared-main/video/video.service'
2727
import { VideoPlaylistService } from '../shared-video-playlist/video-playlist.service'
28+
import { GlobalIconComponent } from '../shared-icons/global-icon.component'
2829

2930
export type MiniatureDisplayOptions = {
3031
date?: boolean
@@ -37,7 +38,8 @@ export type MiniatureDisplayOptions = {
3738
nsfw?: boolean
3839

3940
by?: boolean
40-
forceChannelInBy?: boolean
41+
forceChannelInBy?: boolean,
42+
commentCount?: boolean
4143
}
4244
@Component({
4345
selector: 'my-video-miniature',
@@ -55,7 +57,8 @@ export type MiniatureDisplayOptions = {
5557
VideoViewsCounterComponent,
5658
RouterLink,
5759
NgFor,
58-
VideoActionsDropdownComponent
60+
VideoActionsDropdownComponent,
61+
GlobalIconComponent
5962
]
6063
})
6164
export class VideoMiniatureComponent implements OnInit {
@@ -67,6 +70,7 @@ export class VideoMiniatureComponent implements OnInit {
6770
date: true,
6871
views: true,
6972
by: true,
73+
commentCount: true,
7074
avatar: false,
7175
privacyLabel: false,
7276
privacyText: false,

0 commit comments

Comments
 (0)