]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Improve comment tree UI
authorChocobozzz <me@florianbigard.com>
Tue, 10 Dec 2019 09:40:25 +0000 (10:40 +0100)
committerChocobozzz <me@florianbigard.com>
Tue, 10 Dec 2019 10:02:58 +0000 (11:02 +0100)
client/src/app/videos/+video-watch/comment/video-comment-add.component.scss
client/src/app/videos/+video-watch/comment/video-comment.component.html
client/src/app/videos/+video-watch/comment/video-comment.component.scss
client/src/app/videos/+video-watch/comment/video-comments.component.scss
client/src/sass/include/_mixins.scss

index e998cba5e7fe9100b72b3c9962942153f197213d..5087f71b6da7cb0320a60d6a5a7acd726f57abcf 100644 (file)
@@ -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
+}
index 6ec35d63b89f931dc228f4e94a7a26c275a78573..207be3c7cc53a6dd678b1a3e312bf0385218a6af 100644 (file)
@@ -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>
index ac633fd64a20ae0797ea06ab747f6fd03714cd5e..4cc2fddee6f67a600fa48f71ff81fffdcd8e0801 100644 (file)
@@ -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 {
       }
     }
   }
-}
 
-// 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;
+        }
+      }
+    }
   }
 }
index 575e331e4c152be0bdaaabfad51c4f71155b20b8..dde10b068c110f319191c5eb7503b16f395a0a6b 100644 (file)
@@ -9,7 +9,7 @@
   font-weight: $font-semibold;
   font-size: 15px;
   cursor: pointer;
-  margin-left: 56px;
+  margin-left: 46px;
   margin-bottom: 10px;
 }
 
index d9095e0bdf7706ce1ee025389fbe0e6b8d58119b..dd2255cbbcc479fa94d5a93616133196d78749dd 100644 (file)
@@ -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;
   width: $size;
   height: $size;
   min-width: $size;
+  min-height: $size;
 }
 
 @mixin chevron ($size, $border-width) {