Buckets:
| import { Icon, type IconProps } from "@opencode-ai/ui/icon" | |
| import { Toast, showToast as showLegacyToast, type ToastOptions, type ToastVariant } from "@opencode-ai/ui/toast" | |
| import { ToastV2, showToastV2 } from "@opencode-ai/ui/v2/toast-v2" | |
| let v2 = false | |
| export function setV2Toast(value: boolean) { | |
| v2 = value | |
| } | |
| export function ToastRegion(props: { v2: boolean }) { | |
| if (props.v2) return <ToastV2.Region /> | |
| return <Toast.Region /> | |
| } | |
| export function showToast(options: ToastOptions | string) { | |
| if (!v2) return showLegacyToast(options) | |
| if (typeof options === "string") return showToastV2(options) | |
| return showToastV2({ | |
| ...options, | |
| icon: resolveIcon(options.icon, options.variant), | |
| actions: options.actions?.map((action) => ({ | |
| ...action, | |
| variant: action.onClick === "dismiss" ? "secondary" : "primary", | |
| })), | |
| }) | |
| } | |
| function resolveIcon(icon: IconProps["name"] | undefined, variant: ToastVariant | undefined) { | |
| const name = icon ?? (variant === "success" ? "check" : undefined) | |
| if (!name) return | |
| return <Icon name={name} /> | |
| } | |
Xet Storage Details
- Size:
- 1.07 kB
- Xet hash:
- 4e67bdd9fee0ef0a2d9f0868a98d4f025febe8cd89838778c087837ed3851584
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.