返回 AiToEarn
README.md
根目录 / project / aitoearn-web / src / utils / ui / README.md
1 # UI 工具
2
3 命令式 UI 工具目录,封装跨页面复用的提示、通知、确认弹窗能力。这里只放低业务语义的 UI 基础能力,不放页面流程或业务组件。
4
5 ## 文件清单
6
7 | 文件 | 导出 | 说明 |
8 | ----------------- | -------------- | ----------------------------------------------------------------------------- |
9 | `confirm.tsx` | `confirm` | 基于 shadcn/ui AlertDialog 的命令式确认弹窗,支持异步 `onOk` 与内部 loading。 |
10 | `toast.ts` | `toast` | 基于 sonner 的轻量 Toast 工具,兼容原 message 风格调用。 |
11 | `notification.ts` | `notification` | 基于全局事件的通知工具,供自定义通知中心消费。 |
12
13 ## 使用规则
14
15 - 确认弹窗统一使用 `confirm`,需要 loading 时把异步逻辑放进 `onOk`。
16 - 普通 toast 使用 `toast`;需要接入全局通知中心时使用 `notification`。
17 - 新增命令式 UI 工具必须说明使用场景,并更新本 README 与 `src/utils/README.md`。
18
18 lines MARKDOWN