新增 undo 功能

This commit is contained in:
eafonyang
2026-08-14 16:40:45 +08:00
parent 546c8eb970
commit 907c474e28
4 changed files with 28 additions and 27 deletions
+6 -8
View File
@@ -1,11 +1,9 @@
# 更新说明
# What's New
> 本文档记录 Luxsin B9 控制器的功能更新与问题修复,每次发布新版本后在此追加记录。
> This document records feature updates and bug fixes for the Luxsin X9 controller. A new entry is appended here after each release.
## v1.0.0
## v2026.08.06
### 新功能
- 首页新增「更新说明」入口,支持在线查看版本更新记录
### 修复
-
### New Features
- Added a "What's New" entry on the home page, allowing you to view release notes online.
- Added Undo support on the EQ page: tap the Undo button to revert your most recent change. It covers band parameter edits (frequency / gain / Q / filter type), slider drag adjustments, preamp and auto-preamp changes, A/B mode copy & switch, and batch edits. Each undo shows a toast describing exactly what was reverted (e.g. "A Band 3 GAIN +2.0 → 0.0").
+2 -6
View File
@@ -87,7 +87,6 @@ import { ShareDialog } from "./eq/components/ShareDialog";
import { BrandDrawer } from "./eq/components/BrandDrawer";
import { PeqOverwriteConfirmDialog } from "./eq/components/PeqOverwriteConfirmDialog";
import { PeqPresetManageDialog } from "./eq/components/PeqPresetManageDialog";
import { PeqUndoButton } from "./eq/components/PeqUndoButton";
import { useRawCurve } from "./eq/hooks/useRawCurve";
import {
usePeqUndoHistory,
@@ -1795,11 +1794,6 @@ export default function EQPage() {
)}
</div>
<div className="flex shrink-0 items-center gap-2">
<PeqUndoButton
disabled={!canUndo}
label={eqUi.undo ?? "Undo"}
onClick={handleUndo}
/>
<button
className="w-9 h-9 rounded-full flex items-center justify-center text-white/60 active:text-white transition-colors"
style={{
@@ -1844,6 +1838,8 @@ export default function EQPage() {
abMode={abMode}
onAbToggle={handleAbToggle}
onCopyAndSwitchTo={handleCopyAndSwitchTo}
canUndo={canUndo}
onUndo={handleUndo}
onApplyB={() => void handleApplyB()}
onSaveB={openSaveBDialog}
onBandDrag={(idx, patch) =>
@@ -7,6 +7,7 @@ import {
} from "@/lib/peqAudio";
import type { PeqEqUi } from "../constants";
import { eqInterp } from "../utils";
import { PeqUndoButton } from "./PeqUndoButton";
/* ── Legend indicator ── */
function LegendCurveIndicator({
@@ -37,6 +38,8 @@ export function FreqChart({
abMode,
onAbToggle,
onCopyAndSwitchTo,
canUndo,
onUndo,
onApplyB,
onSaveB,
onBandDrag,
@@ -52,6 +55,8 @@ export function FreqChart({
abMode: "A" | "B";
onAbToggle: (m: "A" | "B") => void;
onCopyAndSwitchTo: (to: "A" | "B") => void;
canUndo: boolean;
onUndo: () => void;
onApplyB: () => void;
onSaveB: () => void;
onBandDrag: (idx: number, patch: Partial<{ freq: number; gain: number }>) => void;
@@ -295,6 +300,11 @@ export function FreqChart({
}}>
{copyButtonText}
</button>
<PeqUndoButton
disabled={!canUndo}
label={eqUi.undo ?? "Undo"}
onClick={onUndo}
/>
</div>
<div className="ml-auto flex shrink-0 items-center gap-2">
<button
@@ -1,4 +1,3 @@
import { Undo2 } from "lucide-react";
import { cn } from "@/lib/utils";
type PeqUndoButtonProps = {
@@ -8,6 +7,11 @@ type PeqUndoButtonProps = {
className?: string;
};
const pillStyle = {
background: "rgba(44,44,46,0.7)",
border: "1px solid rgba(255,255,255,0.08)",
} as const;
/**
* EQ page undo control — disabled when the undo stack is empty.
*/
@@ -25,22 +29,15 @@ export function PeqUndoButton({
title={label}
onClick={onClick}
className={cn(
"w-9 h-9 rounded-full flex items-center justify-center transition-colors active:scale-95",
"px-3 py-1 rounded-[8px] text-[11px] transition-colors",
disabled
? "text-white/25 cursor-not-allowed"
: "text-white/70 active:text-white",
? "text-white/25 cursor-not-allowed opacity-50"
: "text-white/50 active:text-white",
className,
)}
style={{
background: disabled
? "rgba(44,44,46,0.45)"
: "rgba(44,44,46,0.8)",
border: disabled
? "1px solid rgba(255,255,255,0.06)"
: "1px solid rgba(255,255,255,0.1)",
}}
style={pillStyle}
>
<Undo2 size={18} />
{label}
</button>
);
}