mirror of https://github.com/Chocobozzz/PeerTube
Improve comment tree UI
parent
cd3d847d63
commit
fc641dedd6
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
||||
<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="comment.isDeleted" class="comment-html comment-html-deleted">
|
||||
<i i18n>This comment has been deleted</i>
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
<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>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -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; }
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 450px) {
|
||||
.root-comment {
|
||||
font-size: 14px;
|
||||
.children {
|
||||
margin-left: -20px;
|
||||
|
||||
.left {
|
||||
align-items: flex-start;
|
||||
|
||||
.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-size: 15px;
|
||||
cursor: pointer;
|
||||
margin-left: 56px;
|
||||
margin-left: 46px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue