Files
windmill/frontend/src/lib/toast.ts
HugoCasa 1f9455a3d3 feat: improve drafts and diffs (#2534)
* feat: improve drafts and diffs

* feat: add scripts diff button

* fix: remove diff drawer in scripts/add

* fix: nits

* feat: diffs for flows and apps w/ deep comparison

* fix: flow preview buttons height

* fix: use ordered json stringify

* fix: code view

* fix: temp flow diffs

* fix: flow diffs merge conflict
2023-11-04 08:45:03 +01:00

36 lines
620 B
TypeScript

import Toast from '$lib/components/Toast.svelte'
import { toast } from '@zerodevx/svelte-toast'
export type ToastAction = {
label: string
callback: () => void
}
export function sendUserToast(
message: string,
error: boolean = false,
actions: ToastAction[] = [],
errorMessage: string | undefined = undefined,
duration: number = 5000
): void {
toast.push({
component: {
src: Toast,
props: {
message,
error,
actions,
errorMessage,
duration
},
sendIdTo: 'toastId'
},
dismissable: false,
initial: 0,
theme: {
'--toastPadding': '0',
'--toastMsgPadding': '0'
}
})
}