feat: enhance UI consistency and improve spacing across components

- Added styles for player-side toast notifications to improve user feedback.
- Adjusted padding and spacing in various components for a more cohesive layout.
- Updated card and dialog components to streamline visual hierarchy and enhance readability.
- Refactored player panel and navigation elements for better alignment and user experience.
This commit is contained in:
2026-05-21 17:28:06 +08:00
parent 496ed10981
commit 0cd85ae287
33 changed files with 253 additions and 190 deletions

11
src/lib/player-spacing.ts Normal file
View File

@@ -0,0 +1,11 @@
/** 玩家端统一紧凑间距(页面壳、区块堆叠、区块间距) */
export const playerPageInset = "px-3 pb-6 pt-2";
/** 顶栏:左右等宽列 + 居中标题,避免返回键与标题高低不齐 */
export const playerPageHeader =
"mb-2 grid min-h-9 grid-cols-[1fr_auto_1fr] items-center gap-x-2";
/** 顶栏左右控件统一高度 */
export const playerHeaderControl =
"inline-flex h-8 shrink-0 items-center justify-center";
export const playerStack = "space-y-3";
export const playerStackGap = "gap-3";
export const playerSectionMb = "mb-3";

View File

@@ -4,3 +4,15 @@ import { twMerge } from "tailwind-merge"
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}
/** 幂等键:优先 Web CryptoHTTP/旧环境回退为类 UUID 字符串 */
export function randomIdempotentKey(): string {
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
return crypto.randomUUID()
}
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
const r = (Math.random() * 16) | 0
const v = c === "x" ? r : (r & 0x3) | 0x8
return v.toString(16)
})
}