<div>
<div class="title-block">
- <div i18n class="title-page title-page-single">
- Comments
+ <h2 class="title-page title-page-single">
+ <ng-container *ngIf="componentPagination.totalItems > 0; then hasComments; else noComments"></ng-container>
+ <ng-template #hasComments>
+ <ng-container i18n *ngIf="componentPagination.totalItems === 1; else manyComments">1 Comment</ng-container>
+ <ng-template i18n #manyComments>{{ componentPagination.totalItems }} Comments</ng-template>
+ </ng-template>
+ <ng-template i18n #noComments>Comments</ng-template>
+ </h2>
+
+ <my-feed [syndicationItems]="syndicationItems"></my-feed>
+
+ <div ngbDropdown class="d-inline-block ml-4">
+ <button class="btn btn-sm btn-outline-secondary" id="dropdown-sort-comments" ngbDropdownToggle i18n>
+ SORT BY
+ </button>
+ <div ngbDropdownMenu aria-labelledby="dropdown-sort-comments">
+ <button (click)="handleSortChange('-createdAt')" ngbDropdownItem i18n>Most recent first (default)</button>
+ <button (click)="handleSortChange('-totalReplies')" ngbDropdownItem i18n>Most replies first</button>
+ </div>
</div>
- <my-help
- *ngIf="video.commentsEnabled === true" helpType="custom" i18n-customHtml
- customHtml="You can either comment on the page of your instance where this video is federated with your PeerTube account, or via any ActivityPub-capable fediverse instance. For instance with Mastodon or Pleroma you can type in the search box <strong>@{{video.account.name}}@{{video.account.host}}</strong> and find back the video. Direct commenting capabilities are being worked on in <a href='https://github.com/Chocobozzz/PeerTube/issues/224'>#224</a>."></my-help>
</div>
<ng-template [ngIf]="video.commentsEnabled === true">
myInfiniteScroller
[autoInit]="true"
(nearOfBottom)="onNearOfBottom()"
+ [dataObservable]="onDataSubject.asObservable()"
>
- <div #commentHighlightBlock id="highlighted-comment">
+ <div>
+ <div class="anchor" #commentHighlightBlock id="highlighted-comment"></div>
<my-video-comment
*ngIf="highlightedThread"
[comment]="highlightedThread"
[inReplyToCommentId]="inReplyToCommentId"
[commentTree]="threadComments[highlightedThread.id]"
[highlightedComment]="true"
+ [firstInThread]="true"
(wantedToReply)="onWantedToReply($event)"
(wantedToDelete)="onWantedToDelete($event)"
(threadCreated)="onThreadCreated($event)"
(resetReply)="onResetReply()"
+ (timestampClicked)="handleTimestampClicked($event)"
></my-video-comment>
</div>
- <div *ngFor="let comment of comments">
+ <div *ngFor="let comment of comments; index as i">
<my-video-comment
*ngIf="!highlightedThread || comment.id !== highlightedThread.id"
[comment]="comment"
[video]="video"
[inReplyToCommentId]="inReplyToCommentId"
[commentTree]="threadComments[comment.id]"
+ [firstInThread]="i + 1 !== comments.length"
(wantedToReply)="onWantedToReply($event)"
(wantedToDelete)="onWantedToDelete($event)"
(threadCreated)="onThreadCreated($event)"
(resetReply)="onResetReply()"
- ></my-video-comment>
+ (timestampClicked)="handleTimestampClicked($event)"
+ >
+ <div *ngIf="comment.totalReplies !== 0 && !threadComments[comment.id]" (click)="viewReplies(comment.id)" class="view-replies mb-2">
+ <span class="glyphicon glyphicon-menu-down"></span>
+
+ <ng-container *ngIf="comment.totalRepliesFromVideoAuthor > 0; then hasAuthorComments; else noAuthorComments"></ng-container>
+ <ng-template #hasAuthorComments>
+ <ng-container *ngIf="comment.totalReplies !== comment.totalRepliesFromVideoAuthor; else onlyAuthorComments" i18n>
+ View {{ comment.totalReplies }} replies from {{ video?.account?.displayName || 'the author' }} and others
+ </ng-container>
+ <ng-template i18n #onlyAuthorComments>
+ View {{ comment.totalReplies }} replies from {{ video?.account?.displayName || 'the author' }}
+ </ng-template>
+ </ng-template>
+ <ng-template i18n #noAuthorComments>View {{ comment.totalReplies }} replies</ng-template>
- <div *ngIf="comment.totalReplies !== 0 && !threadComments[comment.id]" (click)="viewReplies(comment.id)" class="view-replies">
- <ng-container i18n>View all {{ comment.totalReplies }} replies</ng-container>
+ <my-small-loader class="comment-thread-loading ml-1" [loading]="threadLoading[comment.id]"></my-small-loader>
+ </div>
+ </my-video-comment>
- <span *ngIf="!threadLoading[comment.id]" class="glyphicon glyphicon-menu-down"></span>
- <my-loader class="comment-thread-loading" [loading]="threadLoading[comment.id]"></my-loader>
- </div>
</div>
</div>
</ng-template>