web/dialogs: add picker dialog & clean up small dialog

This commit is contained in:
wukko
2024-07-22 14:33:43 +06:00
parent 24b783e5fb
commit 66bac03e30
11 changed files with 584 additions and 199 deletions

9
web/src/lib/download.ts Normal file
View File

@@ -0,0 +1,9 @@
import { device } from "$lib/device";
export const downloadFile = (url: string) => {
if (device.is.iOS) {
return navigator?.share({ url }).catch(() => {});
} else {
return window.open(url, "_blank");
}
};

View File

@@ -9,13 +9,20 @@ export type DialogButton = {
export type SmallDialogIcons = "warn-red";
export type DialogPickerItem = {
type?: 'photo' | 'video',
url: string,
thumb?: string,
}
export type DialogInfo = {
id: string,
type: "small",
type: "small" | "picker",
meowbalt?: MeowbaltEmotions,
icon?: SmallDialogIcons,
title?: string,
bodyText?: string,
bodySubText?: string,
buttons: DialogButton[],
buttons?: DialogButton[],
items?: DialogPickerItem[],
}