Refactor AIPage and EQPage components to use lazy loading with PageSuspense for improved performance; update vite.config.ts to adjust chunking strategy and increase chunk size warning limit for better handling of large libraries.
This commit is contained in:
+19
-18
@@ -378,6 +378,25 @@ export default function Home() {
|
||||
};
|
||||
}, []);
|
||||
|
||||
const volumePassthroughActive =
|
||||
(deviceState?.dacVolumeDirect ?? 0) === 1 || (deviceState?.dacVolumeDirect ?? 0) === 2;
|
||||
const volumeControlsLocked =
|
||||
volumePassthroughActive &&
|
||||
(deviceState?.output ?? 0) !== HEADPHONE_OUTPUT_INDEX;
|
||||
|
||||
const volumePassthroughHint =
|
||||
homeText.volumePassthroughLockedHint ??
|
||||
homeText.volumePassthroughLockedToast ??
|
||||
"当前为音量直通模式,无法调节音量";
|
||||
|
||||
const guardVolumeChange = useCallback(
|
||||
(action: () => void) => {
|
||||
if (volumeControlsLocked) return;
|
||||
action();
|
||||
},
|
||||
[volumeControlsLocked],
|
||||
);
|
||||
|
||||
if (!isConnected) return <ConnectionPlaceholder />;
|
||||
|
||||
const ds = deviceState!;
|
||||
@@ -393,24 +412,6 @@ export default function Home() {
|
||||
// 换算为 volume 单位:0.5/1/2/3 dB -> 1/2/4/6
|
||||
const fineVolumeStep = [1, 2, 4, 6][ds.soundStep ?? 1] ?? 1;
|
||||
|
||||
const volumePassthroughActive =
|
||||
(ds.dacVolumeDirect ?? 0) === 1 || (ds.dacVolumeDirect ?? 0) === 2;
|
||||
const volumeControlsLocked =
|
||||
volumePassthroughActive && ds.output !== HEADPHONE_OUTPUT_INDEX;
|
||||
|
||||
const volumePassthroughHint =
|
||||
homeText.volumePassthroughLockedHint ??
|
||||
homeText.volumePassthroughLockedToast ??
|
||||
"当前为音量直通模式,无法调节音量";
|
||||
|
||||
const guardVolumeChange = useCallback(
|
||||
(action: () => void) => {
|
||||
if (volumeControlsLocked) return;
|
||||
action();
|
||||
},
|
||||
[volumeControlsLocked],
|
||||
);
|
||||
|
||||
// Slider fill % (0-200 → 0-100%)
|
||||
const fillPct = (localVol / 200) * 100;
|
||||
// Knob angle (map 0..200 -> -135..+135 degrees)
|
||||
|
||||
Reference in New Issue
Block a user