feat: 重写为 Tauri + React + TypeScript (v4.0)

完全移除旧 C+IUP 代码,改用 Tauri 2.x + React 19 + TypeScript + Rust 技术栈重写。
功能与 v3.1 完全等价:

- React 前端:Tailwind CSS 4、Zustand 状态管理、i18next 国际化
- Rust 后端:winreg 注册表读写、Win32 API FFI 调用
- 核心逻辑:StringList、UndoRedoManager、PathManager、Import/Export
- 深色模式、中英文切换、键盘快捷键、合并预览
- 66 个 Vitest 单元测试

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-25 18:32:54 +08:00
parent cdcfd8e0a7
commit 48129a8908
2545 changed files with 12608 additions and 142894 deletions
@@ -0,0 +1,42 @@
import { useTranslation } from 'react-i18next';
import { useAppStore } from '@/store/app-store';
export function UndoRedoButtons() {
const { t } = useTranslation();
const isAdmin = useAppStore((s) => s.isAdmin);
const undoRedo = useAppStore((s) => s.undoRedo);
const undo = useAppStore((s) => s.undo);
const redo = useAppStore((s) => s.redo);
const btnClass =
'px-3 py-1 text-sm rounded border transition-colors disabled:opacity-40 disabled:cursor-not-allowed';
const btnStyle = {
backgroundColor: 'var(--app-bg)',
color: 'var(--app-fg)',
borderColor: 'var(--app-border)',
};
// 订阅状态更新(canUndo/canRedo 不会触发 re-render,用 setTimeout 简单轮询不优雅,但 Zustand 的 subscribe 可以)
// 这里简化为每次渲染时检查(因为 undo/redo 会修改列表触发重渲染)
return (
<div className="flex gap-1">
<button
className={btnClass}
style={btnStyle}
disabled={!isAdmin || !undoRedo.canUndo()}
onClick={undo}
>
{t('button.undo')}
</button>
<button
className={btnClass}
style={btnStyle}
disabled={!isAdmin || !undoRedo.canRedo()}
onClick={redo}
>
{t('button.redo')}
</button>
</div>
);
}