Fix dialogs
parent
ccdaa571d8
commit
d9a7282929
|
@ -8,7 +8,7 @@ import { showToast } from "../speech";
|
||||||
export class MergeDialog extends Dialog<boolean> {
|
export class MergeDialog extends Dialog<boolean> {
|
||||||
private channelList: Dropdown;
|
private channelList: Dropdown;
|
||||||
private mergeButton: Button;
|
private mergeButton: Button;
|
||||||
private cancelButton: Button;
|
protected cancelButton: Button;
|
||||||
|
|
||||||
public constructor() {
|
public constructor() {
|
||||||
super("Merge channels", false);
|
super("Merge channels", false);
|
||||||
|
|
|
@ -8,14 +8,14 @@ import { showToast } from "../speech";
|
||||||
export class RemoveDialog extends Dialog<boolean> {
|
export class RemoveDialog extends Dialog<boolean> {
|
||||||
private content: Text;
|
private content: Text;
|
||||||
private confirmButton: Button;
|
private confirmButton: Button;
|
||||||
private cancelButton: Button;
|
protected cancelButton: Button;
|
||||||
|
|
||||||
public constructor(channelId: string) {
|
public constructor(channelId: string) {
|
||||||
super("Remove channel", false);
|
super("Remove channel", false);
|
||||||
this.content = new Text("Are you sure you want to remove this channel?");
|
this.content = new Text("Are you sure you want to remove this channel?");
|
||||||
this.confirmButton = new Button("Remove");
|
this.confirmButton = new Button("Remove");
|
||||||
this.confirmButton.setPosition(30, 30, 40, 30);
|
this.confirmButton.setPosition(30, 30, 40, 30);
|
||||||
this.confirmButton.onClick(() => this.remove());
|
this.confirmButton.onClick(() => this.doRemove());
|
||||||
this.cancelButton = new Button("Cancel");
|
this.cancelButton = new Button("Cancel");
|
||||||
this.cancelButton.setPosition(30, 70, 40, 30);
|
this.cancelButton.setPosition(30, 70, 40, 30);
|
||||||
this.cancelButton.onClick(() => this.cancel());
|
this.cancelButton.onClick(() => this.cancel());
|
||||||
|
@ -24,7 +24,7 @@ export class RemoveDialog extends Dialog<boolean> {
|
||||||
this.add(this.cancelButton);
|
this.add(this.cancelButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async remove() {
|
private async doRemove() {
|
||||||
try {
|
try {
|
||||||
const res = await API.deleteChannel(state.currentChannel!.id.toString());
|
const res = await API.deleteChannel(state.currentChannel!.id.toString());
|
||||||
state.removeChannel(state.currentChannel!);
|
state.removeChannel(state.currentChannel!);
|
||||||
|
|
|
@ -6,8 +6,8 @@ export class Dialog<T> extends UIWindow {
|
||||||
private rejectPromise!: (reason?: any) => void;
|
private rejectPromise!: (reason?: any) => void;
|
||||||
private promise: Promise<T>;
|
private promise: Promise<T>;
|
||||||
private dialogElement!: HTMLDialogElement;
|
private dialogElement!: HTMLDialogElement;
|
||||||
private okButton?: Button;
|
protected okButton?: Button;
|
||||||
private cancelButton?: Button;
|
protected cancelButton?: Button;
|
||||||
|
|
||||||
private previouslyFocusedElement!: HTMLElement;
|
private previouslyFocusedElement!: HTMLElement;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue