优化首页图标,用 lucide-react 代替了蓝牙模块的图标
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
7. Total gain card: 总增益 value + AUTO toggle + slider
|
||||
============================================================ */
|
||||
import { useDevice } from "@/contexts/DeviceContext";
|
||||
import { ChevronLeft, ChevronDown, Minus, Plus, Edit3, Headphones, Share2 } from "lucide-react";
|
||||
import { ChevronLeft, ChevronDown, Trash2, Copy, Edit3, Headphones, Share2, FilePenLine } from "lucide-react";
|
||||
import { useLocation } from "wouter";
|
||||
import { useState, useMemo, useEffect, useRef, useCallback } from "react";
|
||||
import { cn } from "@/lib/utils";
|
||||
@@ -161,6 +161,10 @@ export default function EQPage() {
|
||||
onConfirm: () => void | Promise<void>;
|
||||
onDismiss: () => void;
|
||||
} | null>(null);
|
||||
const [deleteHeadphoneDialog, setDeleteHeadphoneDialog] = useState<{
|
||||
name: string;
|
||||
idx: number;
|
||||
} | null>(null);
|
||||
const {
|
||||
currentRawCurve,
|
||||
setCurrentRawCurve,
|
||||
@@ -550,18 +554,25 @@ export default function EQPage() {
|
||||
setSelectedBandByMode({ A: 0, B: 0 });
|
||||
};
|
||||
|
||||
const handleDeleteHeadphone = async () => {
|
||||
const handleDeleteHeadphone = () => {
|
||||
const target = peqItems[headphoneIdx];
|
||||
if (!target?.name) return;
|
||||
setDeleteHeadphoneDialog({ name: target.name, idx: headphoneIdx });
|
||||
};
|
||||
|
||||
const confirmed = window.confirm(eqInterp(eqUi.deleteConfirm, { name: target.name }));
|
||||
if (!confirmed) return;
|
||||
const confirmDeleteHeadphone = async () => {
|
||||
const target = deleteHeadphoneDialog;
|
||||
if (!target) return;
|
||||
setDeleteHeadphoneDialog(null);
|
||||
|
||||
try {
|
||||
if (isDemoMode || !api) {
|
||||
const nextItems = peqItems.filter((_, idx) => idx !== headphoneIdx);
|
||||
const nextItems = peqItems.filter((_, idx) => idx !== target.idx);
|
||||
delete peqPresetCacheRef.current[target.name];
|
||||
applyPeqStateToUI({ peq: nextItems, peqSelect: Math.max(0, headphoneIdx - 1) });
|
||||
applyPeqStateToUI({
|
||||
peq: nextItems,
|
||||
peqSelect: Math.max(0, target.idx - 1),
|
||||
});
|
||||
toast.success(eqUi.toastDeleted);
|
||||
return;
|
||||
}
|
||||
@@ -1432,14 +1443,14 @@ export default function EQPage() {
|
||||
style={{ background: "rgba(44,44,46,0.8)", border: "1px solid rgba(255,255,255,0.1)" }}
|
||||
onClick={openPresetManageDialog}
|
||||
>
|
||||
<Edit3 size={15} />
|
||||
<FilePenLine size={18} />
|
||||
</button>
|
||||
<button
|
||||
className="w-9 h-9 rounded-full flex items-center justify-center text-white/60 active:text-white transition-colors"
|
||||
style={{ background: "rgba(44,44,46,0.8)", border: "1px solid rgba(255,255,255,0.1)" }}
|
||||
onClick={handleDeleteHeadphone}
|
||||
>
|
||||
<Minus size={15} />
|
||||
<Trash2 size={18} />
|
||||
</button>
|
||||
<button
|
||||
className="w-9 h-9 rounded-full flex items-center justify-center text-white/60 active:text-white transition-colors"
|
||||
@@ -1448,7 +1459,7 @@ export default function EQPage() {
|
||||
openAddPresetDialog();
|
||||
}}
|
||||
>
|
||||
<Plus size={15} />
|
||||
<Copy size={18} />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1822,6 +1833,23 @@ export default function EQPage() {
|
||||
}}
|
||||
/>
|
||||
|
||||
<PeqOverwriteConfirmDialog
|
||||
open={deleteHeadphoneDialog !== null}
|
||||
title={eqUi.deletePreset}
|
||||
description={
|
||||
deleteHeadphoneDialog
|
||||
? eqInterp(eqUi.deleteConfirm, { name: deleteHeadphoneDialog.name })
|
||||
: ""
|
||||
}
|
||||
cancelLabel={eqUi.cancel}
|
||||
confirmLabel={eqUi.deletePreset}
|
||||
variant="destructive"
|
||||
onConfirm={() => {
|
||||
void confirmDeleteHeadphone();
|
||||
}}
|
||||
onCancel={() => setDeleteHeadphoneDialog(null)}
|
||||
/>
|
||||
|
||||
<PeqOverwriteConfirmDialog
|
||||
open={!!overwritePresetDialog}
|
||||
title={eqUi.overwritePresetTitle ?? "Preset name already exists"}
|
||||
|
||||
Reference in New Issue
Block a user