This commit is contained in:
Nicolas Constant 2019-03-05 23:37:58 -05:00
parent 84988b1fcd
commit 933bfa9acd
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
3 changed files with 32 additions and 3 deletions

View File

@ -1,4 +1,8 @@
<form (ngSubmit)="onSubmit()">
<form class="status-form" (ngSubmit)="onSubmit()">
<div class="status-form__sending" *ngIf="isSending">
<app-waiting-animation class="waiting-icon status-form__sending--waiting"></app-waiting-animation>
</div>
<input [(ngModel)]="title" type="text" class="form-control form-control-sm" name="title" autocomplete="off" placeholder="Title, Content Warning (optional)" />
<textarea #reply [(ngModel)]="status" name="status" class="form-control form-control-sm" rows="5" required

View File

@ -1,4 +1,5 @@
@import "variables";
@import "commons";
@import "panel";
@import "buttons";
$btn-send-status-width: 60px;
@ -9,11 +10,9 @@ $btn-send-status-width: 60px;
border-color: $status-secondary-color;
color: #fff;
font-size: $default-font-size;
&:focus {
box-shadow: none;
}
&--privacy {
display: inline-block;
width: calc(100% - 15px - #{$btn-send-status-width});
@ -33,4 +32,21 @@ $btn-send-status-width: 60px;
// &:focus {
// border-color: darkblue;
// }
}
.status-form {
position: relative;
&__sending {
position: absolute;
top: 0px;
left: 4px;
right: 4px;
bottom: 4px;
background-color: rgba($column-color, .75);
z-index: 2;
&--waiting{
margin-top: calc(25%);
}
}
}

View File

@ -17,6 +17,8 @@ export class CreateStatusComponent implements OnInit {
title: string;
status: string = '';
isSending: boolean;
@Input() statusReplyingToWrapper: StatusWrapper;
@Output() onClose = new EventEmitter();
@ViewChild('reply') replyElement: ElementRef;
@ -73,6 +75,10 @@ export class CreateStatusComponent implements OnInit {
}
onSubmit(): boolean {
if(this.isSending) return false;
this.isSending = true;
let visibility: VisibilityEnum = VisibilityEnum.Unknown;
switch (this.selectedPrivacy) { //FIXME: in case of responding, set the visibility to original
case 'Public':
@ -118,6 +124,9 @@ export class CreateStatusComponent implements OnInit {
})
.catch((err: HttpErrorResponse) => {
this.notificationService.notifyHttpError(err);
})
.then(() => {
this.isSending = false;
});
return false;