web/dialog: refactor types and logic
This commit is contained in:
parent
4e4f7af437
commit
7c5b703e37
3 changed files with 18 additions and 11 deletions
|
@ -19,9 +19,7 @@
|
||||||
bodySubText={dialog.bodySubText}
|
bodySubText={dialog.bodySubText}
|
||||||
buttons={dialog.buttons}
|
buttons={dialog.buttons}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{:else if dialog.type === "picker"}
|
||||||
|
|
||||||
{#if dialog.type === "picker"}
|
|
||||||
<PickerDialog
|
<PickerDialog
|
||||||
id={dialog.id}
|
id={dialog.id}
|
||||||
items={dialog.items}
|
items={dialog.items}
|
||||||
|
|
|
@ -69,7 +69,7 @@
|
||||||
restoreDownloadButton();
|
restoreDownloadButton();
|
||||||
|
|
||||||
return createDialog({
|
return createDialog({
|
||||||
...(defaultErrorPopup as DialogInfo),
|
...defaultErrorPopup,
|
||||||
bodyText: "couldn't access the api",
|
bodyText: "couldn't access the api",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@
|
||||||
restoreDownloadButton();
|
restoreDownloadButton();
|
||||||
|
|
||||||
return createDialog({
|
return createDialog({
|
||||||
...(defaultErrorPopup as DialogInfo),
|
...defaultErrorPopup,
|
||||||
bodyText: response.text,
|
bodyText: response.text,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@
|
||||||
restoreDownloadButton();
|
restoreDownloadButton();
|
||||||
|
|
||||||
return createDialog({
|
return createDialog({
|
||||||
...(defaultErrorPopup as DialogInfo),
|
...defaultErrorPopup,
|
||||||
bodyText: "couldn't probe the stream",
|
bodyText: "couldn't probe the stream",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -146,7 +146,7 @@
|
||||||
restoreDownloadButton();
|
restoreDownloadButton();
|
||||||
|
|
||||||
return createDialog({
|
return createDialog({
|
||||||
...(defaultErrorPopup as DialogInfo),
|
...defaultErrorPopup,
|
||||||
bodyText: "unknown/unsupported status",
|
bodyText: "unknown/unsupported status",
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -15,14 +15,23 @@ export type DialogPickerItem = {
|
||||||
thumb?: string,
|
thumb?: string,
|
||||||
}
|
}
|
||||||
|
|
||||||
export type DialogInfo = {
|
type Dialog = {
|
||||||
id: string,
|
id: string,
|
||||||
type: "small" | "picker",
|
buttons?: DialogButton[],
|
||||||
|
};
|
||||||
|
|
||||||
|
export type SmallDialog = Dialog & {
|
||||||
|
type: "small",
|
||||||
meowbalt?: MeowbaltEmotions,
|
meowbalt?: MeowbaltEmotions,
|
||||||
icon?: SmallDialogIcons,
|
icon?: SmallDialogIcons,
|
||||||
title?: string,
|
title?: string,
|
||||||
bodyText?: string,
|
bodyText?: string,
|
||||||
bodySubText?: string,
|
bodySubText?: string,
|
||||||
buttons?: DialogButton[],
|
};
|
||||||
|
|
||||||
|
export type PickerDialog = Dialog & {
|
||||||
|
type: "picker",
|
||||||
items?: DialogPickerItem[],
|
items?: DialogPickerItem[],
|
||||||
}
|
};
|
||||||
|
|
||||||
|
export type DialogInfo = SmallDialog | PickerDialog;
|
Loading…
Reference in a new issue