summaryrefslogtreecommitdiffhomepage
path: root/packages/ui/src/components/toast.tsx
diff options
context:
space:
mode:
authorAdam <[email protected]>2025-12-27 05:16:39 -0600
committerAdam <[email protected]>2025-12-27 14:43:42 -0600
commit21eba5f987482b4e2e75ab1c564815bd7b0613f4 (patch)
tree2d8cad03e54baa29d83e1e835a7ef2e64d3897e4 /packages/ui/src/components/toast.tsx
parentc523ca412747d66e0236865a4fa2481f7d50f64e (diff)
downloadopencode-21eba5f987482b4e2e75ab1c564815bd7b0613f4.tar.gz
opencode-21eba5f987482b4e2e75ab1c564815bd7b0613f4.zip
feat(desktop): permissions
Diffstat (limited to 'packages/ui/src/components/toast.tsx')
-rw-r--r--packages/ui/src/components/toast.tsx10
1 files changed, 9 insertions, 1 deletions
diff --git a/packages/ui/src/components/toast.tsx b/packages/ui/src/components/toast.tsx
index c1a29cd04..7e90e9f2f 100644
--- a/packages/ui/src/components/toast.tsx
+++ b/packages/ui/src/components/toast.tsx
@@ -92,6 +92,7 @@ export type ToastVariant = "default" | "success" | "error" | "loading"
export interface ToastAction {
label: string
onClick: "dismiss" | (() => void)
+ dismissAfter?: boolean
}
export interface ToastOptions {
@@ -128,7 +129,14 @@ export function showToast(options: ToastOptions | string) {
{opts.actions!.map((action) => (
<button
data-slot="toast-action"
- onClick={typeof action.onClick === "function" ? action.onClick : () => toaster.dismiss(props.toastId)}
+ onClick={() => {
+ if (typeof action.onClick === "function") {
+ action.onClick()
+ if (action.dismissAfter) toaster.dismiss(props.toastId)
+ } else {
+ toaster.dismiss(props.toastId)
+ }
+ }}
>
{action.label}
</button>