From 6786b8a95c1c153918fb74ff3274fb74284ec093 Mon Sep 17 00:00:00 2001
From: yun-zhi-ztl <15071461069@163.com>
Date: Sun, 15 Mar 2026 13:44:07 +0800
Subject: [PATCH] fix(toast): center feedback and remove native token tooltip
---
web/src/features/token/token-list.tsx | 2 +-
web/src/shared/components/toaster.tsx | 60 ++++++++++-----------------
web/src/shared/lib/toast.ts | 17 +++++---
3 files changed, 35 insertions(+), 44 deletions(-)
diff --git a/web/src/features/token/token-list.tsx b/web/src/features/token/token-list.tsx
index 7625cd58..db2ee3c3 100644
--- a/web/src/features/token/token-list.tsx
+++ b/web/src/features/token/token-list.tsx
@@ -240,7 +240,7 @@ export function TokenList() {
variant="outline"
size="sm"
onClick={() => handleCopyToken(token.id)}
- title={createdTokens[token.id] ? t('token.copy') : t('token.copyUnavailableTitle')}
+ aria-label={createdTokens[token.id] ? t('token.copy') : t('token.copyUnavailableTitle')}
>
{t('token.copy')}
diff --git a/web/src/shared/components/toaster.tsx b/web/src/shared/components/toaster.tsx
index bd6d3543..b405dae2 100644
--- a/web/src/shared/components/toaster.tsx
+++ b/web/src/shared/components/toaster.tsx
@@ -3,43 +3,27 @@ import { CENTER_TOASTER_ID } from '@/shared/lib/toast'
export function Toaster() {
return (
- <>
-
-
- >
+
)
}
diff --git a/web/src/shared/lib/toast.ts b/web/src/shared/lib/toast.ts
index ce2a09e0..8a9254f3 100644
--- a/web/src/shared/lib/toast.ts
+++ b/web/src/shared/lib/toast.ts
@@ -14,18 +14,25 @@ export function centeredToastOptions(options?: ExternalToast): ExternalToast {
}
}
+function withDefaultToaster(options?: ExternalToast): ExternalToast {
+ return {
+ toasterId: CENTER_TOASTER_ID,
+ ...options,
+ }
+}
+
export const toast = {
success: (message: string, description?: string, options?: ExternalToast) => {
- sonnerToast.success(message, { description, ...options })
+ sonnerToast.success(message, { description, ...withDefaultToaster(options) })
},
error: (message: string, description?: string, options?: ExternalToast) => {
- sonnerToast.error(message, { description, ...options })
+ sonnerToast.error(message, { description, ...withDefaultToaster(options) })
},
warning: (message: string, description?: string, options?: ExternalToast) => {
- sonnerToast.warning(message, { description, ...options })
+ sonnerToast.warning(message, { description, ...withDefaultToaster(options) })
},
info: (message: string, description?: string, options?: ExternalToast) => {
- sonnerToast.info(message, { description, ...options })
+ sonnerToast.info(message, { description, ...withDefaultToaster(options) })
},
promise: (
promise: Promise,
@@ -35,6 +42,6 @@ export const toast = {
error: string | ((error: Error) => string)
}
) => {
- return sonnerToast.promise(promise, options)
+ return sonnerToast.promise(promise, { ...options, toasterId: CENTER_TOASTER_ID })
},
}