优化 peq 流程
This commit is contained in:
@@ -6,6 +6,7 @@ export function BatchEditDialog({
|
||||
text,
|
||||
onChangeText,
|
||||
onSave,
|
||||
saving = false,
|
||||
onClose,
|
||||
eqUi,
|
||||
}: {
|
||||
@@ -13,6 +14,7 @@ export function BatchEditDialog({
|
||||
text: string;
|
||||
onChangeText: (v: string) => void;
|
||||
onSave: () => void;
|
||||
saving?: boolean;
|
||||
onClose: () => void;
|
||||
eqUi: PeqEqUi;
|
||||
}) {
|
||||
@@ -34,6 +36,7 @@ export function BatchEditDialog({
|
||||
type="button"
|
||||
className="text-white/45 hover:text-white/75 transition-colors"
|
||||
onClick={onClose}
|
||||
disabled={saving}
|
||||
>
|
||||
<X size={20} />
|
||||
</button>
|
||||
@@ -43,6 +46,7 @@ export function BatchEditDialog({
|
||||
</p>
|
||||
<textarea
|
||||
value={text}
|
||||
disabled={saving}
|
||||
onChange={(e) => onChangeText(e.target.value)}
|
||||
spellCheck={false}
|
||||
className="h-[360px] w-full resize-none overflow-auto rounded-[10px] border border-white/12 bg-[#15171b] p-3 font-mono text-[13px] leading-6 text-white/90 outline-none focus:border-[#00FFF6]/55"
|
||||
@@ -52,6 +56,7 @@ export function BatchEditDialog({
|
||||
type="button"
|
||||
className="px-5 py-2 rounded-full text-[24px] text-white/80 bg-[#3f4349] hover:bg-[#4a4f56] transition-colors"
|
||||
onClick={onClose}
|
||||
disabled={saving}
|
||||
>
|
||||
{eqUi.cancel}
|
||||
</button>
|
||||
@@ -59,6 +64,8 @@ export function BatchEditDialog({
|
||||
type="button"
|
||||
className="px-5 py-2 rounded-full text-[24px] text-black bg-[#00FFF6] hover:brightness-95 transition-all"
|
||||
onClick={onSave}
|
||||
disabled={saving}
|
||||
aria-busy={saving}
|
||||
>
|
||||
{eqUi.save}
|
||||
</button>
|
||||
|
||||
@@ -16,6 +16,7 @@ export type PeqUndoSnapshot = {
|
||||
bandsByMode: { A: PeqUndoBand[]; B: PeqUndoBand[] };
|
||||
preamp: number;
|
||||
autoPre: number;
|
||||
metaByMode?: Record<"A" | "B", { preamp: number; autoPre: number }>;
|
||||
};
|
||||
|
||||
function cloneSnapshot(snapshot: PeqUndoSnapshot): PeqUndoSnapshot {
|
||||
@@ -27,6 +28,7 @@ function cloneSnapshot(snapshot: PeqUndoSnapshot): PeqUndoSnapshot {
|
||||
},
|
||||
preamp: snapshot.preamp,
|
||||
autoPre: snapshot.autoPre,
|
||||
...(snapshot.metaByMode ? { metaByMode: { A: { ...snapshot.metaByMode.A }, B: { ...snapshot.metaByMode.B } } } : {}),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -36,6 +38,7 @@ export function peqUndoSnapshotsEqual(
|
||||
): boolean {
|
||||
if (a.abMode !== b.abMode) return false;
|
||||
if (a.preamp !== b.preamp || a.autoPre !== b.autoPre) return false;
|
||||
if (JSON.stringify(a.metaByMode) !== JSON.stringify(b.metaByMode)) return false;
|
||||
return (
|
||||
JSON.stringify(a.bandsByMode.A) === JSON.stringify(b.bandsByMode.A) &&
|
||||
JSON.stringify(a.bandsByMode.B) === JSON.stringify(b.bandsByMode.B)
|
||||
|
||||
Reference in New Issue
Block a user