LingandRX d4c29a1bf4 Develop (#54)
* fix(ci): fix release workflow artifact upload issue

- Split artifact upload into 3 separate steps (Chrome, Firefox, Source)
- Update download steps to match new artifact names
- Add if-no-files-found: error for better error handling
- Fix Node.js 20 compatibility issue with upload-artifact@v4 glob pattern

* docs: 更新 AGENTS.md,添加测试工具和翻译文件结构说明

* docs: 更新 AGENTS.md,完善 CI 步骤和存储键名格式说明

* fix: remove unnecessary animations from StorageCleaner page

- Remove entrance animations (animate-in, fade-in, zoom-in) from all components
- Remove scale effect (active:scale-[0.99]) from clean button
- Remove transition effects (transition-all, transition-colors) from OptionItem, StorageOptionsGrid, AutoRefreshToggle
- Remove bouncing animation from error icon
- Remove pulsing animation from warning banner
- Keep animate-spin on button loading spinner as functional indicator

* fix: remove unnecessary animations from RightClickRestorer page

* fix: remove all unnecessary animations from all pages

- Remove dead code animations (animate-in, fade-in, slide-in, zoom-in, shake) from tailwindcss-animate plugin (not installed)
- Remove decorative transition effects (transition-all, transition-colors) from all page components
- Remove scale effects (active:scale-95) from buttons
- Remove bounce animations (animate-bounce) from icons
- Keep functional animate-spin on loading spinners as they provide essential loading feedback

Affected pages: Dashboard, Timestamp, Jwt, JsonTools, Base64Converter, HtmlToMarkdown, MarkdownToHtml, QrCode, TextStatistics

* docs: 添加项目文档(copilot-instructions、编码规范、各目录 README)

- 新增 .github/copilot-instructions.md:Copilot 指令文件,涵盖构建命令、CI 流水线、项目架构、关键规范
- 新增 .github/CODING_STANDARDS.md:完整的代码编写规范文档(TypeScript、React、样式、错误处理、命名、测试、Hook、i18n、存储等 12 个章节)
- 新增 11 个目录的 README.md:components、components/ui、config、entrypoints、i18n、lib、pages、providers、public、src、types、utils
- 更新 AGENTS.md:补充页面组件模式说明和 components/ui 目录

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(CopyButton): use shadcn buttonVariants instead of duplicated variant classes

Remove hand-written variantClasses/sizeClasses that duplicated shadcn's
buttonVariants. Now extends ButtonProps and imports buttonVariants from
components/ui/button for consistent styling.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(ErrorBoundary): use shadcn destructive tokens instead of hardcoded red colors

Replace hardcoded red-200/red-50/red-600 with border-destructive,
bg-destructive/5, text-destructive. Use variant='destructive' on
Button. Align error log styling with PageErrorBoundary.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(TextInputArea): replace hardcoded Chinese strings with i18n t() calls

Use existing translation keys for clear success, copy success, and
copy error messages instead of hardcoded Chinese text.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(QrCodePreview): use shadcn Button instead of manual button styles

Replace hand-written button class strings with shadcn Button component
using outline and default variants. Removes ~15 lines of duplicated
Tailwind classes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* docs(GlobalSnackbar): clarify relationship with sonner toast

Add note explaining when to use GlobalSnackbar (provider context,
severity levels, custom positioning) vs sonner toast (simple one-off
messages).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(ImageUploader): wrap handleClearFile with useCallback

Prevents unnecessary re-renders by memoizing the callback, consistent
with handleFileChange which already uses useCallback.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(SwitchButtonGroup): remove redundant containerPadding conditional

Both branches of the ternary returned 'p-1'. Inline the constant
directly into the className string.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(TopBar): add missing openExtensionPage import

The function was called in handleOpenInTab but never imported from
utils/chromeTabs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(TopBar): add selectedIndex boundary protection in keyboard nav

Guard against out-of-bounds access when search results change during
keyboard navigation. Check selectedIndex < totalItems before accessing
arrays.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(RouterContainer): remove unnecessary empty-dep useMemo

getEntryPointType() is a simple config getter. Replace useMemo(() => ..., [])
with a direct call — the empty dep array made the memo pointless.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* feat(i18n): add missing translation keys for error boundaries and copy messages

Add keys for errorBoundary, pageErrorBoundary, router, and
messages.copyEmpty in both zh and en locales.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(CopyButton): replace hardcoded Chinese strings with i18n t() calls

Use useTranslation('common') for tooltip, copy empty/success/error
toast messages.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(ErrorBoundary): replace hardcoded Chinese with i18n via withTranslation HOC

Use react-i18next withTranslation HOC for class component to translate
title, description, and refresh button text.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(PageErrorBoundary): replace hardcoded Chinese with i18n via withTranslation HOC

Use react-i18next withTranslation HOC for class component to translate
title, description, and retry button text.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(RouterContainer): replace hardcoded Chinese with i18n t() calls

Use useTranslation('common') for 404 page title and description with
entryPointType interpolation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(pages): 修复 TypeScript 错误、硬编码字符串,移除死代码

- 修复 LiveClock.tsx CopyButton size 属性类型错误 (small → sm)
- 修复 ToolCard.tsx 紫色 RGB 值拼写错误 (147,51,2 purple → 147,51,232)
- 替换 4 处硬编码中文为 i18n 调用 (StorageCleaner, JsonTools)
- MarkdownToHtml 预览链接色改为 CSS 变量以支持暗黑模式
- 移除 Base64Converter 中已被 Base64ConverterSection 替代的死代码
  (FileMode.tsx, ImageMode.tsx 及其测试文件)
- 更新 README.md 移除对已删除文件的引用

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(CopyButton, LiveClock): 修改按钮大小为 'icon',移除硬编码颜色配置

* refactor(TextInputArea): 复用 CopyButton 组件替换内联复制逻辑

* fix(test): 修复 CopyButton mock 未捕获 clipboard writeText 异常

---------

Co-authored-by: Ubuntu <ubuntu@localhost.localdomain>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-28 00:40:54 +08:00
2026-05-20 19:55:49 +08:00
2026-05-28 00:40:54 +08:00
2026-05-28 00:40:54 +08:00
2026-05-28 00:40:54 +08:00
2026-05-28 00:40:54 +08:00
2026-05-28 00:40:54 +08:00
2026-05-28 00:40:54 +08:00
2026-05-28 00:40:54 +08:00
2026-05-28 00:40:54 +08:00
2026-05-28 00:40:54 +08:00
2026-05-28 00:40:54 +08:00
2026-05-28 00:40:54 +08:00
2026-05-28 00:40:54 +08:00
2026-05-17 18:42:01 +08:00
2026-05-28 00:40:54 +08:00
2026-04-19 15:31:14 +08:00
2026-05-28 00:40:54 +08:00
2026-05-28 00:40:54 +08:00

Testing Tools Browser Extension

这是一个基于 WXT 框架的浏览器扩展项目,为开发者和测试人员提供实用的效率工具.

项目概述

Testing Tools 是一个轻量级、功能丰富的浏览器扩展,采用现代化的技术栈构建. 它旨在简化日常开发和测试任务,如时间戳转换、存储管理、JWT 解析等. 项目利用 WXT (Web Extension Toolkit) 框架,提供了卓越的开发体验和跨浏览器支持.

功能特性

🚀 Dashboard 首页

  • 工具导航: 快速访问所有可用工具.
  • 个性化定制: 支持自定义工具的排序和可见性.
  • 实时预览: 在卡片上直接查看实时数据(如当前时间戳).

时间戳转换工具

  • 实时显示: 毫秒级精度显示当前系统时间.
  • 双向转换: 日期字符串与 Unix 时间戳(秒/毫秒)之间的无缝转换.
  • 多时区支持: 预设常用时区(亚洲/上海、美洲/纽约、欧洲/伦敦),支持快速切换.
  • 快捷操作: 一键复制转换结果,支持多种格式.

🧹 存储清理工具

  • 智能识别: 自动检测并显示当前活动标签页的域名.
  • 全面清理: 支持一键清理 localStorage、sessionStorage、IndexedDB、Cookies、Cache Storage 和 Service Workers.
  • 细粒度控制: 可根据需要选择特定的清理项.
  • 自动刷新: 提供清理后自动刷新页面的选项,确保状态同步.

📝 文本统计工具

  • 实时分析: 键入即统计,无需额外操作.
  • 多维指标: 统计字符数、单词数、行数以及精确的字节大小.
  • 性能优化: 采用高性能分词算法,支持大文本处理.

🔑 JWT 解析工具

  • 快速解码: 自动解析 JSON Web Token 的 Header 和 Payload.
  • 格式化显示: 以着色和格式化的 JSON 视图展示数据,方便阅读.
  • 安全检查: 自动去除 Bearer 前缀,处理异常输入并提供友好提示.
  • 签名查看: 展示 JWT 签名部分,辅助验证令牌完整性.

🖱️ 右键恢复工具

  • 当前页面检测: 自动识别当前活动标签页的域名.
  • 一键恢复: 解除网站对右键菜单的限制,恢复复制、粘贴等基础操作.
  • 状态可视化: 通过 Badge 组件直观展示当前页面的锁定/解锁状态.

🖼️ 二维码工具

  • 生成器: 将当前 URL 或自定义文本快速转换为二维码,支持下载.
  • 解析器: 支持通过上传图片或粘贴图片来解析二维码内容.

🔄 JSON 工具

  • 差异比较: 对比两段 JSON 数据,高亮展示差异.
  • 格式化: 支持 JSON 美化、压缩、转 YAML / TOML.

🧰 Base64 转换器

  • 文本编解码: 支持文本内容的 Base64 编码与解码.
  • 文件转换: 支持文件与 Base64 字符串互转.
  • 图像预览: 支持图片 Base64 编码与实时预览.

📝 Markdown ↔ HTML 转换

  • Markdown 转 HTML: 实时预览 Markdown 渲染结果,支持导出 HTML 源码.
  • HTML 转 Markdown: 将 HTML 内容转换为 Markdown 格式.

技术栈

  • 框架: WXT (Web Extension Toolkit)
  • 前端: React 19 + TypeScript
  • UI 组件: shadcn/ui (基于 Radix UI 的无头组件库)
  • 样式: Tailwind CSS + class-variance-authority + cn() 工具函数
  • 日期处理: dayjs (集成 UTC 和 Timezone 插件)
  • 国际化: i18next + react-i18next
  • 通信: @webext-core/messaging
  • 存储: Chrome Storage API (类型安全封装)
  • 解析引擎: qr-scanner (二维码解析), qrious (二维码生成)
  • 测试: Vitest + Testing Library

项目结构

├── components/           # 可复用 React 组件
├── config/              # 应用配置
│   └── features.tsx     # 功能定义与路由映射
├── entrypoints/         # 扩展程序入口点
│   ├── popup/           # 点击图标弹出的主界面
│   ├── options/         # 扩展程序设置页面
│   ├── sidepanel/       # 浏览器侧边栏集成
│   ├── background.ts    # 后台 Service Worker
│   └── content.ts       # 网页注入脚本
├── pages/               # 各功能模块的页面组件
├── providers/           # 全局状态提供者 (Router, Theme 等)
├── hooks/               # 自定义 React Hooks
├── utils/               # 工具函数与服务抽象
├── types/               # TypeScript 类型声明
├── lib/                 # 通用工具函数 (cn, utils 等)
├── i18n/                # 国际化资源
├── public/              # 静态资源 (图标、manifest 资源等)
├── wxt.config.ts        # WXT 框架核心配置
└── package.json         # 项目元数据与依赖管理

开发与部署

开发环境要求

  • Node.js >= 18.x
  • npm 或 pnpm

常用命令

命令 说明
npm run dev 启动 Chrome 开发模式(支持 HMR)
npm run dev:firefox 启动 Firefox 开发模式
npm run build 构建 Chrome 生产版本
npm run build:firefox 构建 Firefox 生产版本
npm run zip 打包 Chrome 扩展 (.output/*.zip)
npm run zip:firefox 打包 Firefox 扩展
npm run typecheck 执行 TypeScript 类型检查
npm run lint 执行 ESLint 代码规范检查
npm run test 运行单元测试
npm run test:coverage 生成测试覆盖率报告

运行单个测试: npx vitest run path/to/file.test.ts

自动化流程

项目通过 GitHub Actions 实现了完善的 CI/CD 流程:

  • CI: 每次推送或 PR 都会自动执行 Lint、类型检查、测试和构建验证.
  • Release: 推送以 v* 开头的 Tag 会自动打包并创建 GitHub Release.

权限说明

本扩展根据功能需要申请了以下权限:

  • storage & unlimitedStorage: 存储用户设置、工具配置及大量数据.
  • activeTab & tabs: 获取当前页面 URL 及其元数据.
  • scripting: 在网页中执行清理和右键恢复脚本.
  • cookies: 管理和清理网站 Cookie.
  • sidePanel: 支持在浏览器侧边栏中运行.
  • clipboardWrite: 提供一键复制功能.
  • contextMenus: 注册右键菜单,支持快捷操作.
  • alarms: 管理后台定时任务(如清理后自动刷新).

浏览器支持

  • Chrome (及其它 Chromium 内核浏览器)
  • Firefox

许可证

基于 MIT License 开源.

S
Description
No description provided
Readme MIT 4.5 MiB
Languages
TypeScript 98.9%
CSS 0.5%
JavaScript 0.4%
HTML 0.2%