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