Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

improve comment form: cancel button and full width

Rigel Kent88adad2d0f42
diff --git a/client/src/app/videos/+video-watch/comment/video-comment-add.component.html b/client/src/app/videos/+video-watch/comment/video-comment-add.component.html
index cce8455e02..3a9977df61 100644
--- a/client/src/app/videos/+video-watch/comment/video-comment-add.component.html
+++ b/client/src/app/videos/+video-watch/comment/video-comment-add.component.html
@@ -16,9 +16,12 @@
</div>
</div>
- <div class="submit-comment">
+ <div class="comment-buttons">
+ <button *ngIf="isAddButtonDisplayed()" class="cancel-button" (click)="cancelCommentReply()" i18n>
+ Cancel
+ </button>
<button *ngIf="isAddButtonDisplayed()" [ngClass]="{ disabled: !form.valid || addingComment }" i18n>
- Post comment
+ Reply
</button>
</div>
</form>
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.scss
index 5087f71b6d..c04727ba04 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
@@ -30,18 +30,29 @@ form {
}
}
-.submit-comment {
+.cancel-button {
+ font-weight: $font-semibold;
+ display: inline-block;
+ padding: 0 10px 0 10px;
+ white-space: nowrap;
+ background: transparent;
+}
+
+.comment-buttons {
display: flex;
justify-content: flex-end;
button {
@include peertube-button;
- @include orange-button;
+
+ &:last-child {
+ @include orange-button;
+ }
}
}
@media screen and (max-width: 600px) {
- textarea, .submit-comment button {
+ textarea, .comment-buttons button {
font-size: 14px !important;
}
diff --git a/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts b/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts
index 8cdd37680b..083509b832 100644
--- a/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts
+++ b/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts
@@ -26,6 +26,7 @@ export class VideoCommentAddComponent extends FormReactive implements OnInit {
@Input() focusOnInit = false
@Output() commentCreated = new EventEmitter<VideoCommentCreate>()
+ @Output() cancel = new EventEmitter()
@ViewChild('visitorModal', { static: true }) visitorModal: NgbModal
@ViewChild('textarea', { static: true }) textareaElement: ElementRef
@@ -145,4 +146,8 @@ export class VideoCommentAddComponent extends FormReactive implements OnInit {
return this.videoCommentService
.addCommentThread(this.video.id, commentCreate)
}
+
+ private cancelCommentReply () {
+ this.cancel.emit(null)
+ }
}
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.html
index 207be3c7cc..80e8cae1d4 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
@@ -50,6 +50,7 @@
[parentComments]="newParentComments"
[focusOnInit]="true"
(commentCreated)="onCommentReplyCreated($event)"
+ (cancel)="onResetReply()"
></my-video-comment-add>
<div *ngIf="commentTree" class="children">
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.scss
index 4cc2fddee6..8d5348af4a 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
@@ -19,6 +19,10 @@
}
}
+ .right {
+ width: 100%;
+ }
+
.comment-avatar {
@include avatar(36px);