diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 2815d63..1252a4f 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -459,6 +459,17 @@ export const App: React.FC = () => { useEffect(() => () => { disposeActiveThemeAndLocaleFonts() }, []) const tr = (k: I18nKey, v?: Record) => t(locale, k, v) const pushToast = toasts.push + useEffect(() => events.onRuntimeWarning((message) => { + const { summary, code, rawDetail } = parseAppError(message) + pushToast({ + kind: 'warning', + title: summary, + errorCode: code, + rawDetail, + detailsLabel: t(locale, 'errRawDetailsToggle'), + copyDetailsLabel: t(locale, 'errCopyDetails'), + }) + }), [locale, pushToast]) useEffect(() => events.onHostDrop(({ delivered, mode }) => { if (mode !== 'l1_share' || delivered.length === 0) return const title = delivered.length === 1 diff --git a/frontend/src/styles/app.css b/frontend/src/styles/app.css index 58e6dad..aa67101 100644 --- a/frontend/src/styles/app.css +++ b/frontend/src/styles/app.css @@ -1007,6 +1007,7 @@ button.status-issue + .status-metric { margin-left: 6px; } .toast-main-row:has(.toast-desc) { align-items: flex-start; } .toast-main-row:has(.toast-desc) > svg { margin-top: 2px; } .toast.ok .toast-main-row > svg { color: var(--status-running); } +.toast.warning .toast-main-row > svg { color: var(--status-busy); } .toast.error .toast-main-row > svg { color: var(--status-error); } .toast-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; } .toast-title-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; } diff --git a/frontend/src/ui/toast.tsx b/frontend/src/ui/toast.tsx index 56cadc0..2e70e85 100644 --- a/frontend/src/ui/toast.tsx +++ b/frontend/src/ui/toast.tsx @@ -1,12 +1,12 @@ import * as RToast from '@radix-ui/react-toast' -import { Check, CircleCheck, CircleX, X } from 'lucide-react' +import { AlertTriangle, Check, CircleCheck, CircleX, X } from 'lucide-react' import { HostIcon } from './themeVisuals' import { emitThemeEvent } from '../lib/themeEngine' import React, { useCallback, useState } from 'react' import { IconButton } from './controls' export interface ToastInput { - kind: 'ok' | 'error' + kind: 'ok' | 'warning' | 'error' title: string description?: string errorCode?: string @@ -63,7 +63,7 @@ const ToastCard: React.FC = ({ item, onRemove, closeLabel }) => { if (!open) onRemove(item.id) }} @@ -71,6 +71,8 @@ const ToastCard: React.FC = ({ item, onRemove, closeLabel }) =>
{item.kind === 'ok' ? (