2026-03-31 18:52:37 +08:00
|
|
|
/* ============================================================
|
|
|
|
|
VU PAGE — VU Meter Gallery
|
|
|
|
|
Design: Reference luxsin_x8_VU表.png
|
2026-05-11 17:42:18 +08:00
|
|
|
- 3-column grid of VU style cards
|
2026-03-31 18:52:37 +08:00
|
|
|
- Active = cyan check circle below card
|
|
|
|
|
- Inactive = empty circle
|
|
|
|
|
============================================================ */
|
|
|
|
|
import { useDevice } from "@/contexts/DeviceContext";
|
|
|
|
|
import { cn } from "@/lib/utils";
|
2026-04-22 14:34:23 +08:00
|
|
|
import BottomNav from "@/components/BottomNav";
|
2026-03-31 18:52:37 +08:00
|
|
|
import { Check, ChevronLeft } from "lucide-react";
|
|
|
|
|
import { useLocation } from "wouter";
|
2026-05-11 17:42:18 +08:00
|
|
|
import { useMemo } from "react";
|
|
|
|
|
import localeZh from "@/locales/data-zh.json";
|
|
|
|
|
import localeEn from "@/locales/data-en.json";
|
2026-07-01 11:23:06 +08:00
|
|
|
import { resolveLocalePack } from "@/locales/resolveLocale";
|
|
|
|
|
import { usePageTitleWithConnection } from "@/hooks/usePageTitleWithConnection";
|
2026-05-11 17:42:18 +08:00
|
|
|
|
|
|
|
|
type VUPageLocale = NonNullable<(typeof localeZh)["vuPage"]>;
|
2026-03-31 18:52:37 +08:00
|
|
|
|
|
|
|
|
interface VUStyle {
|
|
|
|
|
index: number;
|
|
|
|
|
name: string;
|
2026-04-01 16:29:52 +08:00
|
|
|
preview: string;
|
2026-03-31 18:52:37 +08:00
|
|
|
}
|
|
|
|
|
|
2026-04-09 17:00:44 +08:00
|
|
|
const VU_STYLES: VUStyle[] = Array.from({ length: 16 }, (_, i) => ({
|
|
|
|
|
index: i,
|
|
|
|
|
name: `VU ${i + 1}`,
|
2026-06-18 16:12:51 +08:00
|
|
|
preview: `${import.meta.env.BASE_URL}images/vu/vu${i + 1}.png`,
|
2026-04-09 17:00:44 +08:00
|
|
|
}));
|
2026-03-31 18:52:37 +08:00
|
|
|
|
|
|
|
|
export default function VUPage() {
|
|
|
|
|
const [, setLocation] = useLocation();
|
|
|
|
|
const { deviceState, updateSetting } = useDevice();
|
|
|
|
|
const currentVU = deviceState?.vu ?? 0;
|
|
|
|
|
|
2026-05-11 17:42:18 +08:00
|
|
|
const vuPageText = useMemo((): VUPageLocale => {
|
2026-07-01 11:23:06 +08:00
|
|
|
const loc = resolveLocalePack(deviceState?.language);
|
|
|
|
|
return (loc.vuPage ?? localeEn.vuPage ?? {}) as VUPageLocale;
|
2026-05-11 17:42:18 +08:00
|
|
|
}, [deviceState?.language]);
|
|
|
|
|
|
2026-07-01 11:23:06 +08:00
|
|
|
const pageTitle = usePageTitleWithConnection(vuPageText.title ?? "VU");
|
|
|
|
|
|
2026-03-31 18:52:37 +08:00
|
|
|
return (
|
|
|
|
|
<div className="min-h-screen bg-black">
|
|
|
|
|
<div className="page-header">
|
|
|
|
|
<button onClick={() => setLocation("/")} className="mr-4 text-white/60 active:text-white transition-colors">
|
|
|
|
|
<ChevronLeft size={24} />
|
|
|
|
|
</button>
|
2026-05-11 17:42:18 +08:00
|
|
|
<h1 className="flex-1 text-center text-[17px] font-semibold text-white">
|
2026-07-01 11:23:06 +08:00
|
|
|
{pageTitle}
|
2026-05-11 17:42:18 +08:00
|
|
|
</h1>
|
2026-03-31 18:52:37 +08:00
|
|
|
<div className="w-8" />
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-05-11 17:42:18 +08:00
|
|
|
<div className="px-4 pb-32 pt-4">
|
|
|
|
|
<div className="grid grid-cols-3 gap-x-2 gap-y-4">
|
|
|
|
|
{VU_STYLES.map((style) => {
|
|
|
|
|
const isActive = currentVU === style.index;
|
|
|
|
|
return (
|
|
|
|
|
<div key={style.index} className="flex flex-col items-center gap-1.5 min-w-0">
|
|
|
|
|
<div
|
|
|
|
|
className={cn(
|
|
|
|
|
"ios-list-group p-1.5 cursor-pointer transition-all duration-200 w-full",
|
|
|
|
|
isActive && "border-[#00FFF6]/30"
|
|
|
|
|
)}
|
|
|
|
|
style={isActive ? { borderColor: "rgba(0,255,246,0.3)", boxShadow: "0 0 16px rgba(0,255,246,0.08)" } : {}}
|
|
|
|
|
onClick={() => updateSetting({ vu: style.index })}
|
|
|
|
|
>
|
|
|
|
|
<img
|
|
|
|
|
src={style.preview}
|
|
|
|
|
alt={style.name}
|
|
|
|
|
className="w-full h-[4.5rem] sm:h-24 object-contain rounded-lg bg-black/20"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2026-03-31 18:52:37 +08:00
|
|
|
|
|
|
|
|
<button
|
2026-05-11 17:42:18 +08:00
|
|
|
type="button"
|
2026-03-31 18:52:37 +08:00
|
|
|
onClick={() => updateSetting({ vu: style.index })}
|
|
|
|
|
className={cn(
|
2026-05-11 17:42:18 +08:00
|
|
|
"w-6 h-6 rounded-full flex items-center justify-center transition-all duration-200 shrink-0",
|
2026-03-31 18:52:37 +08:00
|
|
|
isActive
|
2026-05-11 17:42:18 +08:00
|
|
|
? "bg-[#00FFF6] text-black shadow-[0_0_10px_rgba(0,255,246,0.45)]"
|
2026-03-31 18:52:37 +08:00
|
|
|
: "border-2 border-white/20 text-transparent"
|
|
|
|
|
)}
|
2026-05-11 17:42:18 +08:00
|
|
|
aria-label={isActive ? `${style.name}(已选)` : `选择${style.name}`}
|
2026-03-31 18:52:37 +08:00
|
|
|
>
|
2026-05-11 17:42:18 +08:00
|
|
|
{isActive && <Check size={12} strokeWidth={3} />}
|
2026-03-31 18:52:37 +08:00
|
|
|
</button>
|
|
|
|
|
|
2026-05-11 17:42:18 +08:00
|
|
|
<p
|
|
|
|
|
className={cn(
|
|
|
|
|
"text-center text-[11px] sm:text-xs font-medium truncate w-full px-0.5",
|
|
|
|
|
isActive ? "text-[#00FFF6]" : "text-white/60"
|
|
|
|
|
)}
|
|
|
|
|
>
|
2026-03-31 18:52:37 +08:00
|
|
|
{style.name}
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
2026-05-11 17:42:18 +08:00
|
|
|
);
|
|
|
|
|
})}
|
|
|
|
|
</div>
|
2026-03-31 18:52:37 +08:00
|
|
|
</div>
|
2026-04-22 14:34:23 +08:00
|
|
|
<BottomNav />
|
2026-03-31 18:52:37 +08:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|