mirror of
https://github.com/LHY0125/PathEditor.git
synced 2026-07-01 19:55:54 +08:00
bdbb399ddc
- 抽取 buttons.ts 共享按钮样式,消除 3 个组件的重复定义 - store 删除未调用的 canUndo/canRedo 方法 - importFromContent 变量 ext→lower 修正确性 - CSV 导出修复 BOM 重复(exportToCsv 自带 BOM) - Rust error.rs 添加 allow(dead_code) 消除编译警告 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
33 lines
865 B
TypeScript
33 lines
865 B
TypeScript
import { useTranslation } from 'react-i18next';
|
|
import { useAppStore } from '@/store/app-store';
|
|
import { btnClass, btnStyle } from '@/components/ui/buttons';
|
|
|
|
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);
|
|
|
|
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>
|
|
);
|
|
}
|