]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/+videos/+video-watch/shared/comment/video-comments.component.html
Reorganize watch components
[github/Chocobozzz/PeerTube.git] / client / src / app / +videos / +video-watch / shared / comment / video-comments.component.html
1 <div>
2 <div class="title-block">
3 <h2 class="title-page title-page-single">
4 {totalNotDeletedComments, plural, =0 {Comments} =1 {1 Comment} other {{{totalNotDeletedComments}} Comments}}
5 </h2>
6
7 <my-feed [syndicationItems]="syndicationItems"></my-feed>
8
9 <div ngbDropdown class="d-inline-block ml-4 dropdown-root">
10 <button class="btn btn-sm btn-outline-secondary" id="dropdown-sort-comments" ngbDropdownToggle i18n>
11 SORT BY
12 </button>
13 <div ngbDropdownMenu aria-labelledby="dropdown-sort-comments">
14 <button (click)="handleSortChange('-createdAt')" ngbDropdownItem i18n>Most recent first (default)</button>
15 <button (click)="handleSortChange('-totalReplies')" ngbDropdownItem i18n>Most replies first</button>
16 </div>
17 </div>
18 </div>
19
20 <ng-template [ngIf]="video.commentsEnabled === true">
21 <my-video-comment-add
22 [video]="video"
23 [user]="user"
24 (commentCreated)="onCommentThreadCreated($event)"
25 [textValue]="commentThreadRedraftValue"
26 ></my-video-comment-add>
27
28 <div *ngIf="totalNotDeletedComments === 0 && comments.length === 0" i18n>No comments.</div>
29
30 <div
31 class="comment-threads"
32 myInfiniteScroller
33 [autoInit]="true"
34 (nearOfBottom)="onNearOfBottom()"
35 [dataObservable]="onDataSubject.asObservable()"
36 >
37 <div>
38 <div class="anchor" #commentHighlightBlock id="highlighted-comment"></div>
39 <my-video-comment
40 *ngIf="highlightedThread"
41 [comment]="highlightedThread"
42 [video]="video"
43 [inReplyToCommentId]="inReplyToCommentId"
44 [commentTree]="threadComments[highlightedThread.id]"
45 [highlightedComment]="true"
46 [firstInThread]="true"
47 (wantedToReply)="onWantedToReply($event)"
48 (wantedToDelete)="onWantedToDelete($event)"
49 (wantedToRedraft)="onWantedToRedraft($event)"
50 (threadCreated)="onThreadCreated($event)"
51 (resetReply)="onResetReply()"
52 (timestampClicked)="handleTimestampClicked($event)"
53 [redraftValue]="commentReplyRedraftValue"
54 ></my-video-comment>
55 </div>
56
57 <div *ngFor="let comment of comments; index as i">
58 <my-video-comment
59 *ngIf="!highlightedThread || comment.id !== highlightedThread.id"
60 [comment]="comment"
61 [video]="video"
62 [inReplyToCommentId]="inReplyToCommentId"
63 [commentTree]="threadComments[comment.id]"
64 [firstInThread]="i + 1 !== comments.length"
65 (wantedToReply)="onWantedToReply($event)"
66 (wantedToDelete)="onWantedToDelete($event)"
67 (wantedToRedraft)="onWantedToRedraft($event)"
68 (threadCreated)="onThreadCreated($event)"
69 (resetReply)="onResetReply()"
70 (timestampClicked)="handleTimestampClicked($event)"
71 [redraftValue]="commentReplyRedraftValue"
72 >
73 <div *ngIf="comment.totalReplies !== 0 && !threadComments[comment.id]" (click)="viewReplies(comment.id)" class="view-replies mb-2">
74 <span class="glyphicon glyphicon-menu-down"></span>
75
76 <ng-container *ngIf="comment.totalRepliesFromVideoAuthor > 0; then hasAuthorComments; else noAuthorComments"></ng-container>
77
78 <ng-template #hasAuthorComments>
79 <ng-container *ngIf="comment.totalReplies !== comment.totalRepliesFromVideoAuthor; else onlyAuthorComments" i18n>
80 View {comment.totalReplies, plural, =1 {1 reply} other {{{ comment.totalReplies }} replies}} from {{ video?.account?.displayName || 'the author' }} and others
81 </ng-container>
82 <ng-template i18n #onlyAuthorComments>
83 View {comment.totalReplies, plural, =1 {1 reply} other {{{ comment.totalReplies }} replies}} from {{ video?.account?.displayName || 'the author' }}
84 </ng-template>
85 </ng-template>
86
87 <ng-template i18n #noAuthorComments>View {comment.totalReplies, plural, =1 {1 reply} other {{{ comment.totalReplies }} replies}}</ng-template>
88
89 <my-small-loader class="comment-thread-loading ml-1" [loading]="threadLoading[comment.id]"></my-small-loader>
90 </div>
91 </my-video-comment>
92
93 </div>
94 </div>
95 </ng-template>
96
97 <div *ngIf="video.commentsEnabled === false" i18n>
98 Comments are disabled.
99 </div>
100 </div>