优化首页图标,用 lucide-react 代替了蓝牙模块的图标
This commit is contained in:
+36
-12
@@ -14,11 +14,12 @@ import { useDevice } from "@/contexts/DeviceContext";
|
||||
import {
|
||||
ChevronLeft,
|
||||
ChevronDown,
|
||||
Minus,
|
||||
Plus,
|
||||
Edit3,
|
||||
Headphones,
|
||||
Trash2,
|
||||
Copy,
|
||||
Share2,
|
||||
FilePenLine,
|
||||
} from "lucide-react";
|
||||
import { useLocation } from "wouter";
|
||||
import { useState, useMemo, useEffect, useRef, useCallback } from "react";
|
||||
@@ -179,6 +180,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,
|
||||
@@ -549,22 +554,24 @@ 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);
|
||||
forgetPeqPresetCache(target.name);
|
||||
applyPeqStateToUI({
|
||||
peq: nextItems,
|
||||
peqSelect: Math.max(0, headphoneIdx - 1),
|
||||
peqSelect: Math.max(0, target.idx - 1),
|
||||
});
|
||||
toast.success(eqUi.toastDeleted);
|
||||
return;
|
||||
@@ -1641,7 +1648,7 @@ export default function EQPage() {
|
||||
}}
|
||||
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"
|
||||
@@ -1651,7 +1658,7 @@ export default function EQPage() {
|
||||
}}
|
||||
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"
|
||||
@@ -1663,7 +1670,7 @@ export default function EQPage() {
|
||||
openAddPresetDialog();
|
||||
}}
|
||||
>
|
||||
<Plus size={15} />
|
||||
<Copy size={18} />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2179,6 +2186,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