PeerTube/client/src/app/videos/+video-watch/comment/video-comments.component.html

98 lines
4.1 KiB
HTML

<div>
<div class="title-block">
<div 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>
</div>
<my-feed [syndicationItems]="syndicationItems"></my-feed>
<div ngbDropdown class="d-inline-block ml-4">
<button class="btn btn-sm btn-outline-secondary" id="dropdownSortComments" ngbDropdownToggle i18n>
Sort by
</button>
<div ngbDropdownMenu aria-labelledby="dropdownSortComments">
<button (click)="handleSortChange('-createdAt')" ngbDropdownItem i18n>Most recent first (default)</button>
<button (click)="handleSortChange('-totalReplies')" ngbDropdownItem i18n>Most replies first</button>
</div>
</div>
</div>
<ng-template [ngIf]="video.commentsEnabled === true">
<my-video-comment-add
[video]="video"
[user]="user"
(commentCreated)="onCommentThreadCreated($event)"
></my-video-comment-add>
<div *ngIf="componentPagination.totalItems === 0 && comments.length === 0" i18n>No comments.</div>
<div
class="comment-threads"
myInfiniteScroller
[autoInit]="true"
(nearOfBottom)="onNearOfBottom()"
[dataObservable]="onDataSubject.asObservable()"
>
<div #commentHighlightBlock id="highlighted-comment">
<my-video-comment
*ngIf="highlightedThread"
[comment]="highlightedThread"
[video]="video"
[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; 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()"
(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>
<my-small-loader class="comment-thread-loading ml-1" [loading]="threadLoading[comment.id]"></my-small-loader>
</div>
</my-video-comment>
</div>
</div>
</ng-template>
<div *ngIf="video.commentsEnabled === false" i18n>
Comments are disabled.
</div>
</div>