ActivityPub-federated video streaming platform using P2P directly in your web browser
Improve comment tree UI
Chocobozzzfc641dedd6d9
diff --git a/client/src/app/videos/+video-watch/comment/video-comment-add.component.scss b/client/src/app/videos/+video-watch/comment/video-comment-add.component.scssindex e998cba5e7..5087f71b6d 100644--- a/client/src/app/videos/+video-watch/comment/video-comment-add.component.scss+++ b/client/src/app/videos/+video-watch/comment/video-comment-add.component.scss@@ -10,10 +10,10 @@ form {margin-bottom: 10px;img {- @include avatar(36px);+ @include avatar(25px);vertical-align: top;- margin-right: 20px;+ margin-right: 10px;}.form-group {@@ -40,10 +40,14 @@ form {}}-@media screen and (max-width: 450px) {+@media screen and (max-width: 600px) {textarea, .submit-comment button {font-size: 14px !important;}++ textarea {+ padding: 5px !important;+ }}.modal-body {@@ -56,4 +60,4 @@ form {float: left;margin-bottom: 20px;}-}\ No newline at end of file+}diff --git a/client/src/app/videos/+video-watch/comment/video-comment.component.html b/client/src/app/videos/+video-watch/comment/video-comment.component.htmlindex 6ec35d63b8..207be3c7cc 100644--- a/client/src/app/videos/+video-watch/comment/video-comment.component.html+++ b/client/src/app/videos/+video-watch/comment/video-comment.component.html@@ -1,65 +1,70 @@<div class="root-comment">- <img- *ngIf="!comment.isDeleted"- class="comment-avatar"- [src]="comment.accountAvatarUrl"- alt="Avatar"- />+ <div class="left">+ <img+ *ngIf="!comment.isDeleted"+ class="comment-avatar"+ [src]="comment.accountAvatarUrl"+ alt="Avatar"+ />- <span- *ngIf="comment.isDeleted"- class="comment-avatar"- ></span>+ <div class="vertical-border"></div>+ </div>- <div class="comment">- <ng-container *ngIf="!comment.isDeleted">- <div *ngIf="highlightedComment === true" class="highlighted-comment" i18n>Highlighted comment</div>+ <div class="right">+ <span *ngIf="comment.isDeleted" class="comment-avatar"></span>- <div class="comment-account-date">- <a [href]="comment.account.url" target="_blank" rel="noopener noreferrer" class="comment-account">{{ comment.by }}</a>- <a [routerLink]="['/videos/watch', video.uuid, { 'threadId': comment.threadId }]" class="comment-date">{{ comment.createdAt | myFromNow }}</a>- </div>- <div class="comment-html" [innerHTML]="sanitizedCommentHTML"></div>+ <div class="comment">+ <ng-container *ngIf="!comment.isDeleted">+ <div *ngIf="highlightedComment === true" class="highlighted-comment" i18n>Highlighted comment</div>- <div class="comment-actions">- <div *ngIf="isUserLoggedIn()" (click)="onWantToReply()" class="comment-action-reply" i18n>Reply</div>- <div *ngIf="isRemovableByUser()" (click)="onWantToDelete()" class="comment-action-delete" i18n>Delete</div>- </div>- </ng-container>+ <div class="comment-account-date">+ <a [href]="comment.account.url" target="_blank" rel="noopener noreferrer" class="comment-account">{{ comment.by }}</a>+ <a [routerLink]="['/videos/watch', video.uuid, { 'threadId': comment.threadId }]"+ class="comment-date">{{ comment.createdAt | myFromNow }}</a>+ </div>+ <div class="comment-html" [innerHTML]="sanitizedCommentHTML"></div>- <ng-container *ngIf="comment.isDeleted">- <div class="comment-account-date">- <span class="comment-account" i18n>Deleted</span>- <a [routerLink]="['/videos/watch', video.uuid, { 'threadId': comment.threadId }]" class="comment-date">{{ comment.createdAt | myFromNow }}</a>- </div>+ <div class="comment-actions">+ <div *ngIf="isUserLoggedIn()" (click)="onWantToReply()" class="comment-action-reply" i18n>Reply</div>+ <div *ngIf="isRemovableByUser()" (click)="onWantToDelete()" class="comment-action-delete" i18n>Delete</div>+ </div>+ </ng-container>- <div *ngIf="comment.isDeleted" class="comment-html comment-html-deleted">- <i i18n>This comment has been deleted</i>- </div>- </ng-container>+ <ng-container *ngIf="comment.isDeleted">+ <div class="comment-account-date">+ <span class="comment-account" i18n>Deleted</span>+ <a [routerLink]="['/videos/watch', video.uuid, { 'threadId': comment.threadId }]"+ class="comment-date">{{ comment.createdAt | myFromNow }}</a>+ </div>++ <div *ngIf="comment.isDeleted" class="comment-html comment-html-deleted">+ <i i18n>This comment has been deleted</i>+ </div>+ </ng-container>- <my-video-comment-add- *ngIf="!comment.isDeleted && isUserLoggedIn() && inReplyToCommentId === comment.id"- [user]="user"- [video]="video"- [parentComment]="comment"- [parentComments]="newParentComments"- [focusOnInit]="true"- (commentCreated)="onCommentReplyCreated($event)"- ></my-video-comment-add>+ <my-video-comment-add+ *ngIf="!comment.isDeleted && isUserLoggedIn() && inReplyToCommentId === comment.id"+ [user]="user"+ [video]="video"+ [parentComment]="comment"+ [parentComments]="newParentComments"+ [focusOnInit]="true"+ (commentCreated)="onCommentReplyCreated($event)"+ ></my-video-comment-add>- <div *ngIf="commentTree" class="children">- <div *ngFor="let commentChild of commentTree.children">- <my-video-comment- [comment]="commentChild.comment"- [video]="video"- [inReplyToCommentId]="inReplyToCommentId"- [commentTree]="commentChild"- [parentComments]="newParentComments"- (wantedToReply)="onWantToReply($event)"- (wantedToDelete)="onWantToDelete($event)"- (resetReply)="onResetReply()"- ></my-video-comment>+ <div *ngIf="commentTree" class="children">+ <div *ngFor="let commentChild of commentTree.children">+ <my-video-comment+ [comment]="commentChild.comment"+ [video]="video"+ [inReplyToCommentId]="inReplyToCommentId"+ [commentTree]="commentChild"+ [parentComments]="newParentComments"+ (wantedToReply)="onWantToReply($event)"+ (wantedToDelete)="onWantToDelete($event)"+ (resetReply)="onResetReply()"+ ></my-video-comment>+ </div></div></div></div>diff --git a/client/src/app/videos/+video-watch/comment/video-comment.component.scss b/client/src/app/videos/+video-watch/comment/video-comment.component.scssindex ac633fd64a..4cc2fddee6 100644--- a/client/src/app/videos/+video-watch/comment/video-comment.component.scss+++ b/client/src/app/videos/+video-watch/comment/video-comment.component.scss@@ -5,11 +5,24 @@font-size: 15px;display: flex;+ .left {+ display: flex;+ flex-direction: column;+ align-items: center;+ margin-right: 10px;++ .vertical-border {+ width: 2px;+ height: 100%;+ background-color: rgba(0, 0, 0, 0.05);+ margin: 10px 0;+ }+ }+.comment-avatar {@include avatar(36px);margin-top: 5px;- margin-right: 20px;}.comment {@@ -84,33 +97,47 @@}}}-}-// Decrease the space of child comments on small screens-@media screen and (max-width: 1600px) {.children {- margin-left: -20px;+ // Reduce avatars size for replies+ .comment-avatar {+ @include avatar(25px);+ }++ .left {+ margin-right: 6px;+ }}}@media screen and (max-width: 1200px) {.children {- margin-left: -30px;+ margin-left: -10px;}}@media screen and (max-width: 600px) {- .children {- margin-left: -35px;- }-.root-comment {- .comment-avatar { margin-right: 10px; }- }-}+ .children {+ margin-left: -20px;-@media screen and (max-width: 450px) {- .root-comment {- font-size: 14px;+ .left {+ align-items: flex-start;++ .vertical-border {+ margin-left: 2px;+ }+ }+ }++ .comment {+ .comment-account-date {+ flex-direction: column;++ .comment-date {+ margin-left: 0;+ }+ }+ }}}diff --git a/client/src/app/videos/+video-watch/comment/video-comments.component.scss b/client/src/app/videos/+video-watch/comment/video-comments.component.scssindex 575e331e4c..dde10b068c 100644--- a/client/src/app/videos/+video-watch/comment/video-comments.component.scss+++ b/client/src/app/videos/+video-watch/comment/video-comments.component.scss@@ -9,7 +9,7 @@font-weight: $font-semibold;font-size: 15px;cursor: pointer;- margin-left: 56px;+ margin-left: 46px;margin-bottom: 10px;}diff --git a/client/src/sass/include/_mixins.scss b/client/src/sass/include/_mixins.scssindex d9095e0bdf..dd2255cbbc 100644--- a/client/src/sass/include/_mixins.scss+++ b/client/src/sass/include/_mixins.scss@@ -44,7 +44,7 @@}@mixin peertube-word-wrap {- word-break: normal;+ word-break: break-word;word-wrap: break-word;overflow-wrap: break-word;-webkit-hyphens: auto;@@ -397,6 +397,7 @@width: $size;height: $size;min-width: $size;+ min-height: $size;}@mixin chevron ($size, $border-width) {