Improve comment tree UI
This commit is contained in:
parent
cd3d847d63
commit
fc641dedd6
|
@ -10,10 +10,10 @@ form {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
|
|
||||||
img {
|
img {
|
||||||
@include avatar(36px);
|
@include avatar(25px);
|
||||||
|
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
margin-right: 20px;
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-group {
|
.form-group {
|
||||||
|
@ -40,10 +40,14 @@ form {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (max-width: 450px) {
|
@media screen and (max-width: 600px) {
|
||||||
textarea, .submit-comment button {
|
textarea, .submit-comment button {
|
||||||
font-size: 14px !important;
|
font-size: 14px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
textarea {
|
||||||
|
padding: 5px !important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-body {
|
.modal-body {
|
||||||
|
@ -56,4 +60,4 @@ form {
|
||||||
float: left;
|
float: left;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,65 +1,70 @@
|
||||||
<div class="root-comment">
|
<div class="root-comment">
|
||||||
<img
|
<div class="left">
|
||||||
*ngIf="!comment.isDeleted"
|
<img
|
||||||
class="comment-avatar"
|
*ngIf="!comment.isDeleted"
|
||||||
[src]="comment.accountAvatarUrl"
|
class="comment-avatar"
|
||||||
alt="Avatar"
|
[src]="comment.accountAvatarUrl"
|
||||||
/>
|
alt="Avatar"
|
||||||
|
/>
|
||||||
|
|
||||||
<span
|
<div class="vertical-border"></div>
|
||||||
*ngIf="comment.isDeleted"
|
</div>
|
||||||
class="comment-avatar"
|
|
||||||
></span>
|
|
||||||
|
|
||||||
<div class="comment">
|
<div class="right">
|
||||||
<ng-container *ngIf="!comment.isDeleted">
|
<span *ngIf="comment.isDeleted" class="comment-avatar"></span>
|
||||||
<div *ngIf="highlightedComment === true" class="highlighted-comment" i18n>Highlighted comment</div>
|
|
||||||
|
|
||||||
<div class="comment-account-date">
|
<div class="comment">
|
||||||
<a [href]="comment.account.url" target="_blank" rel="noopener noreferrer" class="comment-account">{{ comment.by }}</a>
|
<ng-container *ngIf="!comment.isDeleted">
|
||||||
<a [routerLink]="['/videos/watch', video.uuid, { 'threadId': comment.threadId }]" class="comment-date">{{ comment.createdAt | myFromNow }}</a>
|
<div *ngIf="highlightedComment === true" class="highlighted-comment" i18n>Highlighted comment</div>
|
||||||
</div>
|
|
||||||
<div class="comment-html" [innerHTML]="sanitizedCommentHTML"></div>
|
|
||||||
|
|
||||||
<div class="comment-actions">
|
<div class="comment-account-date">
|
||||||
<div *ngIf="isUserLoggedIn()" (click)="onWantToReply()" class="comment-action-reply" i18n>Reply</div>
|
<a [href]="comment.account.url" target="_blank" rel="noopener noreferrer" class="comment-account">{{ comment.by }}</a>
|
||||||
<div *ngIf="isRemovableByUser()" (click)="onWantToDelete()" class="comment-action-delete" i18n>Delete</div>
|
<a [routerLink]="['/videos/watch', video.uuid, { 'threadId': comment.threadId }]"
|
||||||
</div>
|
class="comment-date">{{ comment.createdAt | myFromNow }}</a>
|
||||||
</ng-container>
|
</div>
|
||||||
|
<div class="comment-html" [innerHTML]="sanitizedCommentHTML"></div>
|
||||||
|
|
||||||
<ng-container *ngIf="comment.isDeleted">
|
<div class="comment-actions">
|
||||||
<div class="comment-account-date">
|
<div *ngIf="isUserLoggedIn()" (click)="onWantToReply()" class="comment-action-reply" i18n>Reply</div>
|
||||||
<span class="comment-account" i18n>Deleted</span>
|
<div *ngIf="isRemovableByUser()" (click)="onWantToDelete()" class="comment-action-delete" i18n>Delete</div>
|
||||||
<a [routerLink]="['/videos/watch', video.uuid, { 'threadId': comment.threadId }]" class="comment-date">{{ comment.createdAt | myFromNow }}</a>
|
</div>
|
||||||
</div>
|
</ng-container>
|
||||||
|
|
||||||
<div *ngIf="comment.isDeleted" class="comment-html comment-html-deleted">
|
<ng-container *ngIf="comment.isDeleted">
|
||||||
<i i18n>This comment has been deleted</i>
|
<div class="comment-account-date">
|
||||||
</div>
|
<span class="comment-account" i18n>Deleted</span>
|
||||||
</ng-container>
|
<a [routerLink]="['/videos/watch', video.uuid, { 'threadId': comment.threadId }]"
|
||||||
|
class="comment-date">{{ comment.createdAt | myFromNow }}</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
<my-video-comment-add
|
<div *ngIf="comment.isDeleted" class="comment-html comment-html-deleted">
|
||||||
*ngIf="!comment.isDeleted && isUserLoggedIn() && inReplyToCommentId === comment.id"
|
<i i18n>This comment has been deleted</i>
|
||||||
[user]="user"
|
</div>
|
||||||
[video]="video"
|
</ng-container>
|
||||||
[parentComment]="comment"
|
|
||||||
[parentComments]="newParentComments"
|
|
||||||
[focusOnInit]="true"
|
|
||||||
(commentCreated)="onCommentReplyCreated($event)"
|
|
||||||
></my-video-comment-add>
|
|
||||||
|
|
||||||
<div *ngIf="commentTree" class="children">
|
<my-video-comment-add
|
||||||
<div *ngFor="let commentChild of commentTree.children">
|
*ngIf="!comment.isDeleted && isUserLoggedIn() && inReplyToCommentId === comment.id"
|
||||||
<my-video-comment
|
[user]="user"
|
||||||
[comment]="commentChild.comment"
|
[video]="video"
|
||||||
[video]="video"
|
[parentComment]="comment"
|
||||||
[inReplyToCommentId]="inReplyToCommentId"
|
[parentComments]="newParentComments"
|
||||||
[commentTree]="commentChild"
|
[focusOnInit]="true"
|
||||||
[parentComments]="newParentComments"
|
(commentCreated)="onCommentReplyCreated($event)"
|
||||||
(wantedToReply)="onWantToReply($event)"
|
></my-video-comment-add>
|
||||||
(wantedToDelete)="onWantToDelete($event)"
|
|
||||||
(resetReply)="onResetReply()"
|
<div *ngIf="commentTree" class="children">
|
||||||
></my-video-comment>
|
<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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -5,11 +5,24 @@
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
display: flex;
|
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 {
|
.comment-avatar {
|
||||||
@include avatar(36px);
|
@include avatar(36px);
|
||||||
|
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
margin-right: 20px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.comment {
|
.comment {
|
||||||
|
@ -84,33 +97,47 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Decrease the space of child comments on small screens
|
|
||||||
@media screen and (max-width: 1600px) {
|
|
||||||
.children {
|
.children {
|
||||||
margin-left: -20px;
|
// Reduce avatars size for replies
|
||||||
|
.comment-avatar {
|
||||||
|
@include avatar(25px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.left {
|
||||||
|
margin-right: 6px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (max-width: 1200px) {
|
@media screen and (max-width: 1200px) {
|
||||||
.children {
|
.children {
|
||||||
margin-left: -30px;
|
margin-left: -10px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (max-width: 600px) {
|
@media screen and (max-width: 600px) {
|
||||||
.children {
|
|
||||||
margin-left: -35px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.root-comment {
|
.root-comment {
|
||||||
.comment-avatar { margin-right: 10px; }
|
.children {
|
||||||
}
|
margin-left: -20px;
|
||||||
}
|
|
||||||
|
.left {
|
||||||
@media screen and (max-width: 450px) {
|
align-items: flex-start;
|
||||||
.root-comment {
|
|
||||||
font-size: 14px;
|
.vertical-border {
|
||||||
|
margin-left: 2px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.comment {
|
||||||
|
.comment-account-date {
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
.comment-date {
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
font-weight: $font-semibold;
|
font-weight: $font-semibold;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
margin-left: 56px;
|
margin-left: 46px;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@mixin peertube-word-wrap {
|
@mixin peertube-word-wrap {
|
||||||
word-break: normal;
|
word-break: break-word;
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
overflow-wrap: break-word;
|
overflow-wrap: break-word;
|
||||||
-webkit-hyphens: auto;
|
-webkit-hyphens: auto;
|
||||||
|
@ -397,6 +397,7 @@
|
||||||
width: $size;
|
width: $size;
|
||||||
height: $size;
|
height: $size;
|
||||||
min-width: $size;
|
min-width: $size;
|
||||||
|
min-height: $size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@mixin chevron ($size, $border-width) {
|
@mixin chevron ($size, $border-width) {
|
||||||
|
|
Loading…
Reference in New Issue