rescheduling functionnal
This commit is contained in:
parent
f81c76c80c
commit
c5d3f6c97b
|
@ -23,7 +23,7 @@
|
|||
|
||||
<app-poll-editor *ngIf="pollIsActive"></app-poll-editor>
|
||||
|
||||
<app-status-scheduler *ngIf="scheduleIsActive"></app-status-scheduler>
|
||||
<app-status-scheduler class="scheduler" *ngIf="scheduleIsActive"></app-status-scheduler>
|
||||
|
||||
<div class="status-editor__footer" #footer>
|
||||
<button type="submit" title="reply" class="status-editor__footer--send-button" *ngIf="statusReplyingToWrapper">
|
||||
|
|
|
@ -190,11 +190,12 @@ $counter-width: 90px;
|
|||
}
|
||||
|
||||
.emojipicker {
|
||||
|
||||
font-size: $default-font-size !important;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.scheduler {
|
||||
display: block;
|
||||
margin: 0 5px;
|
||||
}
|
||||
|
||||
@import '~@angular/cdk/overlay-prebuilt.css';
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
.scheduler {
|
||||
background-color: $scheduler-background;
|
||||
margin: 0 5px;
|
||||
//margin: 0 5px;
|
||||
border-bottom: 1px solid whitesmoke;
|
||||
|
||||
&__input {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import { Component, OnInit, Input } from '@angular/core';
|
||||
import { faCalendarAlt } from "@fortawesome/free-regular-svg-icons";
|
||||
|
||||
@Component({
|
||||
|
@ -9,7 +9,9 @@ import { faCalendarAlt } from "@fortawesome/free-regular-svg-icons";
|
|||
export class StatusSchedulerComponent implements OnInit {
|
||||
faCalendarAlt = faCalendarAlt;
|
||||
min = new Date();
|
||||
scheduledDate: string;
|
||||
// scheduledDate: string;
|
||||
|
||||
@Input() scheduledDate: string;
|
||||
|
||||
constructor() { }
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
</div>
|
||||
|
||||
<div class="scheduled-status__edition">
|
||||
<div *ngIf="!deleting">
|
||||
<div *ngIf="!deleting && !rescheduling">
|
||||
<button class="scheduled-status__edition--button" (click)="delete()" title="delete status">Delete</button>
|
||||
<button class="scheduled-status__edition--button" (click)="reschedule()"
|
||||
title="reschedule status">Reschedule</button>
|
||||
|
@ -34,5 +34,14 @@
|
|||
Delete the status?
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngIf="rescheduling">
|
||||
<app-status-scheduler [scheduledDate]="status.scheduled_at" class="scheduled-status__edition--scheduler" #statusScheduler></app-status-scheduler>
|
||||
|
||||
<button class="scheduled-status__edition--button" (click)="cancelReschedule()" title="cancel">CANCEL</button>
|
||||
<button class="scheduled-status__edition--button"
|
||||
(click)="confirmReschedule()" title="confirm rescheduling">REPLAN</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -61,5 +61,9 @@ $avatar-size: 40px;
|
|||
float: right;
|
||||
padding: 9px 5px 0 5px;
|
||||
}
|
||||
|
||||
&--scheduler {
|
||||
margin: 5px 0;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
import { Component, OnInit, Input } from '@angular/core';
|
||||
import { Component, OnInit, Input, ViewChild } from '@angular/core';
|
||||
|
||||
import { AccountInfo } from '../../../../states/accounts.state';
|
||||
import { ScheduledStatus } from '../../../../services/models/mastodon.interfaces';
|
||||
|
@ -6,6 +6,7 @@ import { ToolsService } from '../../../../services/tools.service';
|
|||
import { MastodonService } from '../../../../services/mastodon.service';
|
||||
import { NotificationService } from '../../../../services/notification.service';
|
||||
import { ScheduledStatusService } from '../../../../services/scheduled-status.service';
|
||||
import { StatusSchedulerComponent } from '../../../../components/create-status/status-scheduler/status-scheduler.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-scheduled-status',
|
||||
|
@ -16,6 +17,8 @@ export class ScheduledStatusComponent implements OnInit {
|
|||
deleting: boolean = false;
|
||||
rescheduling: boolean = false;
|
||||
|
||||
@ViewChild(StatusSchedulerComponent) statusScheduler: StatusSchedulerComponent;
|
||||
|
||||
avatar: string;
|
||||
@Input() account: AccountInfo;
|
||||
@Input() status: ScheduledStatus;
|
||||
|
@ -58,4 +61,22 @@ export class ScheduledStatusComponent implements OnInit {
|
|||
this.rescheduling = !this.rescheduling;
|
||||
return false;
|
||||
}
|
||||
|
||||
cancelReschedule(): boolean {
|
||||
this.rescheduling = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
confirmReschedule(): boolean {
|
||||
let scheduledTime = this.statusScheduler.getScheduledDate();
|
||||
this.mastodonService.changeScheduledStatus(this.account, this.status.id, scheduledTime)
|
||||
.then(() => {
|
||||
this.status.scheduled_at = scheduledTime;
|
||||
this.rescheduling = false;
|
||||
})
|
||||
.catch(err => {
|
||||
this.notificationService.notifyHttpError(err);
|
||||
});
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue