From 3c411b3df0845ef0cccc552aaaf061b910a51e6f Mon Sep 17 00:00:00 2001 From: eafonyang Date: Tue, 9 Jun 2026 14:24:28 +0800 Subject: [PATCH] refactor(eq): Enhance EQPage and luxsinApi for improved loading states and debugging - Introduced a loading indicator for raw curve data in the EQPage to enhance user experience during data fetching. - Added console logging for debugging purposes in luxsinApi when syncing PEQ and posting changes. - Updated related functions to manage loading states effectively, ensuring smoother interactions. --- client/src/lib/luxsinApi.ts | 11 +++++- client/src/pages/EQPage.tsx | 71 +++++++++++++++++++++++++++++-------- 2 files changed, 66 insertions(+), 16 deletions(-) diff --git a/client/src/lib/luxsinApi.ts b/client/src/lib/luxsinApi.ts index 73126da..621694f 100644 --- a/client/src/lib/luxsinApi.ts +++ b/client/src/lib/luxsinApi.ts @@ -262,7 +262,11 @@ export class LuxsinAPI { const response = await fetch(`${this.baseUrl}/dev/info.cgi?action=syncPeq`); const text = await response.text(); const decoded = decodeCustomBase64(text.trim()); - return JSON.parse(decoded) as PeqState; + const parsed = JSON.parse(decoded) as PeqState; + if (import.meta.env.DEV) { + console.log("[syncPeq] decoded", parsed); + } + return parsed; } async setPeqFilters(filters: PeqFilter[]): Promise { @@ -281,6 +285,11 @@ export class LuxsinAPI { /** POST `json=` — matches legacy axios `upgradePeq`. */ private async postPeqJson(body: PeqChangePayload | PeqApplyPayload): Promise { + if (import.meta.env.DEV) { + const action = + "peqChange" in body ? "peqChange" : "peqApply" in body ? "peqApply" : "peq"; + console.log(`[dev/info.cgi] POST ${action}`, body); + } const encoded = encodeCustomBase64(JSON.stringify(body)); const form = new URLSearchParams(); form.set("json", encoded); diff --git a/client/src/pages/EQPage.tsx b/client/src/pages/EQPage.tsx index 69c7af3..3a68f58 100644 --- a/client/src/pages/EQPage.tsx +++ b/client/src/pages/EQPage.tsx @@ -84,10 +84,30 @@ import { CyanSlider } from "./eq/components/CyanSlider"; +function LegendCurveIndicator({ + loading, + color, +}: { + loading: boolean; + color: string; +}) { + if (loading) { + return ( +