ActivityPub-federated video streaming platform using P2P directly in your web browser
<div>
@if (commentsEnabled) {
<div class="title-block">
<h2 i18n>
{totalNotDeletedComments, plural, =0 {Comments} =1 {1 Comment} other {{{ totalNotDeletedComments | myNumberFormatter }} Comments}}
</h2>
<my-feed class="me-1" [syndicationItems]="syndicationItems"></my-feed>
<div ngbDropdown class="d-inline-block ms-auto dropdown-root">
<button class="peertube-button tertiary-button" 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>
</div>
<my-video-comment-add
[video]="video()"
[videoPassword]="videoPassword()"
[user]="user()"
(commentCreated)="onCommentThreadCreated($event)"
[textValue]="commentThreadRedraftValue"
hasCancel="false"
></my-video-comment-add>
@if (totalNotDeletedComments === 0 && comments.length === 0) {
<div i18n>No comments.</div>
}
<div class="comment-threads" myInfiniteScroller (nearOfBottom)="onNearOfBottom()" [dataObservable]="onDataSubject.asObservable()">
<div>
<div class="anchor" #commentHighlightBlock id="highlighted-comment"></div>
@if (highlightedThread) {
<my-video-comment
[comment]="highlightedThread"
[video]="video()"
[videoPassword]="videoPassword()"
[inReplyToCommentId]="inReplyToCommentId"
[commentTree]="threadComments[highlightedThread.id]"
[highlightedComment]="true"
[firstInThread]="true"
(wantedToReply)="onWantedToReply($event)"
(wantedToDelete)="onWantedToDelete($event)"
(wantedToRedraft)="onWantedToRedraft($event)"
(wantedToApprove)="onWantToApprove($event)"
(wantedToViewRepliesInModal)="onWantedToViewRepliesInModal($event)"
(threadCreated)="onThreadCreated($event)"
(resetReply)="onResetReply()"
(timestampClicked)="handleTimestampClicked($event)"
[redraftValue]="commentReplyRedraftValue"
></my-video-comment>
}
</div>
@for (comment of comments; track comment; let i = $index) {
<div>
@if (!highlightedThread || comment.id !== highlightedThread.id) {
<my-video-comment
[comment]="comment"
[video]="video()"
[videoPassword]="videoPassword()"
[inReplyToCommentId]="inReplyToCommentId"
[commentTree]="threadComments[comment.id]"
[firstInThread]="i + 1 !== comments.length"
(wantedToReply)="onWantedToReply($event)"
(wantedToDelete)="onWantedToDelete($event)"
(wantedToRedraft)="onWantedToRedraft($event)"
(wantedToApprove)="onWantToApprove($event)"
(wantedToViewRepliesInModal)="onWantedToViewRepliesInModal($event)"
(threadCreated)="onThreadCreated($event)"
(resetReply)="onResetReply()"
(timestampClicked)="handleTimestampClicked($event)"
[redraftValue]="commentReplyRedraftValue"
>
@if (comment.totalReplies !== 0 && !threadComments[comment.id]) {
<button (click)="viewReplies(comment.id)" class="view-replies mb-2 button-unstyle">
<span class="chevron-down"></span>
@if (comment.totalRepliesFromVideoAuthor > 0) {
@if (comment.totalReplies !== comment.totalRepliesFromVideoAuthor) {
<ng-container i18n>
View {comment.totalReplies, plural, =1 {1 reply} other {{{ comment.totalReplies }} replies}} from {{
video()?.account?.displayName || 'the author'
}} and others
</ng-container>
} @else {
<ng-container i18n>
View {comment.totalReplies, plural, =1 {1 reply} other {{{ comment.totalReplies }} replies}} from {{
video()?.account?.displayName || 'the author'
}}
</ng-container>
}
} @else {
<ng-container i18n>View {comment.totalReplies, plural, =1 {1 reply} other {{{ comment.totalReplies }} replies}}</ng-container>
}
<my-loader size="sm" class="ms-1" [loading]="threadLoading[comment.id]"></my-loader>
</button>
}
</my-video-comment>
}
</div>
}
</div>
} @else {
<div class="title-block">
<h2>Comments</h2>
</div>
<div i18n>Comments are disabled.</div>
}
</div>
<ng-template #repliesModal>
<div class="modal-header">
@if (repliesModalStack.length > 1) {
<button class="border-0 p-0 me-2" title="Go back to the previous comment" i18n-title (click)="onRepliesModalBack()">
<my-global-icon iconName="chevron-left" ariaHidden="true"></my-global-icon>
</button>
}
<h4 class="modal-title" i18n>Replies to {{ getRepliesModalRoot()?.comment?.account?.displayName || 'Unknown' }}</h4>
<button class="border-0 p-0" title="Close this modal" i18n-title (click)="closeRepliesModal()">
<my-global-icon iconName="cross" ariaHidden="true"></my-global-icon>
</button>
</div>
<div class="modal-body replies-modal-body">
<!-- The stack is emptied when the modal is closed, but the template can still be rendered while it fades out -->
@if (getRepliesModalRoot(); as repliesModalRoot) {
<my-video-comment
[comment]="repliesModalRoot.comment"
[video]="video()"
[videoPassword]="videoPassword()"
[inReplyToCommentId]="inReplyToCommentId"
[commentTree]="repliesModalTree"
[parentComments]="repliesModalRoot.parentComments"
[autoLoadReplies]="true"
(wantedToReply)="onWantedToReply($event)"
(wantedToDelete)="onWantedToDelete($event)"
(wantedToRedraft)="onWantedToRedraft($event)"
(wantedToApprove)="onWantToApprove($event)"
(wantedToViewRepliesInModal)="onWantedToViewRepliesInModal($event)"
(resetReply)="onResetReply()"
(timestampClicked)="handleTimestampClicked($event)"
[redraftValue]="commentReplyRedraftValue"
></my-video-comment>
}
</div>
</ng-template>