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:
@@ -20,7 +20,7 @@ export function PlayerAppShell({ children }: PlayerAppShellProps): ReactNode {
|
||||
return (
|
||||
<div className="min-h-dvh bg-white text-foreground">
|
||||
<NetworkStatusBanner />
|
||||
<main className="mx-auto flex w-full max-w-lg flex-col pb-[calc(4rem+env(safe-area-inset-bottom,0px)+1.5rem)]">
|
||||
<main className="mx-auto flex w-full max-w-lg flex-col pb-[calc(3.5rem+env(safe-area-inset-bottom,0px)+0.75rem)]">
|
||||
{children}
|
||||
</main>
|
||||
<PlayerBottomNav />
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import Link from "next/link";
|
||||
import { usePathname } from "next/navigation";
|
||||
|
||||
import { BarChart3, BookOpen, ClipboardList, Home, Wallet } from "lucide-react";
|
||||
import { BarChart3, ClipboardList, Home, Wallet } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import { cn } from "@/lib/utils";
|
||||
@@ -30,13 +30,6 @@ const tabs = [
|
||||
icon: ClipboardList,
|
||||
match: (p: string) => p === "/orders" || p.startsWith("/orders/"),
|
||||
},
|
||||
{
|
||||
href: "/rules",
|
||||
labelKey: "nav.rules",
|
||||
labelDefault: "规则",
|
||||
icon: BookOpen,
|
||||
match: (p: string) => p === "/rules",
|
||||
},
|
||||
{
|
||||
href: "/wallet",
|
||||
labelKey: "nav.wallet",
|
||||
@@ -58,7 +51,7 @@ export function PlayerBottomNav() {
|
||||
className="fixed bottom-0 left-0 right-0 z-50 border-t border-[#e4ebf5] bg-white/96 pb-[env(safe-area-inset-bottom,0px)] shadow-[0_-10px_30px_rgba(15,23,42,0.08)] backdrop-blur-md"
|
||||
aria-label={t("nav.aria")}
|
||||
>
|
||||
<div className="mx-auto grid h-16 w-full max-w-lg grid-rows-1 [grid-template-columns:repeat(5,minmax(0,1fr))]">
|
||||
<div className="mx-auto grid h-14 w-full max-w-lg grid-rows-1 grid-cols-4">
|
||||
{tabs.map(({ href, labelKey, labelDefault, icon: Icon, match }) => {
|
||||
const active = match(pathname);
|
||||
const label = t(labelKey, { defaultValue: labelDefault });
|
||||
|
||||
@@ -7,12 +7,15 @@ import { Bell, ChevronLeft } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import { LanguageSwitcher } from "@/components/language-switcher";
|
||||
import {
|
||||
playerHeaderControl,
|
||||
playerPageHeader,
|
||||
playerPageInset,
|
||||
} from "@/lib/player-spacing";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
type PlayerPanelProps = {
|
||||
title: string;
|
||||
subtitle?: string;
|
||||
eyebrow?: string;
|
||||
children: ReactNode;
|
||||
backHref?: string;
|
||||
backLabel?: string;
|
||||
@@ -22,7 +25,6 @@ type PlayerPanelProps = {
|
||||
|
||||
export function PlayerPanel({
|
||||
title,
|
||||
subtitle,
|
||||
children,
|
||||
backHref = "/hall",
|
||||
backLabel,
|
||||
@@ -37,42 +39,53 @@ export function PlayerPanel({
|
||||
<div className={cn("mx-auto w-full max-w-[480px]", containerClassName)}>
|
||||
<section
|
||||
className={cn(
|
||||
"overflow-hidden bg-white px-4 pb-8 pt-4 text-slate-900",
|
||||
"overflow-hidden bg-white text-slate-900",
|
||||
playerPageInset,
|
||||
className,
|
||||
)}
|
||||
>
|
||||
<div className="mb-3 flex items-center gap-2 px-1 pt-3">
|
||||
<Link
|
||||
href={backHref}
|
||||
className="flex h-9 shrink-0 items-center gap-1 rounded-full border border-[#e4eaf4] bg-[#f8fafc] px-2.5 text-xs font-bold text-[#0b3f96] hover:bg-[#f1f6ff]"
|
||||
>
|
||||
<ChevronLeft className="size-4" aria-hidden />
|
||||
{resolvedBackLabel}
|
||||
</Link>
|
||||
<div className="min-w-0 flex-1 text-center">
|
||||
<h1 className="truncate text-lg font-black tracking-normal text-[#0b3f96]">
|
||||
<header className={playerPageHeader}>
|
||||
<div className="flex min-w-0 justify-start">
|
||||
<Link
|
||||
href={backHref}
|
||||
className={cn(
|
||||
playerHeaderControl,
|
||||
"gap-0.5 rounded-full border border-[#e4eaf4] bg-[#f8fafc] px-2 text-xs font-bold text-[#0b3f96] hover:bg-[#f1f6ff]",
|
||||
)}
|
||||
>
|
||||
<ChevronLeft className="size-4 shrink-0" aria-hidden />
|
||||
<span className="max-w-[4.5rem] truncate">{resolvedBackLabel}</span>
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
<div className="min-w-0 max-w-[min(52vw,12rem)] justify-self-center text-center">
|
||||
<h1 className="truncate text-base font-black leading-tight text-[#0b3f96]">
|
||||
{title}
|
||||
</h1>
|
||||
{subtitle ? (
|
||||
<p className="truncate text-[11px] font-medium text-slate-500">
|
||||
{subtitle}
|
||||
</p>
|
||||
) : null}
|
||||
</div>
|
||||
<LanguageSwitcher
|
||||
variant="minimal"
|
||||
showFlag={false}
|
||||
className="shrink-0 rounded-full border border-[#e4eaf4] bg-[#f8fafc]"
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
className="relative flex size-9 shrink-0 items-center justify-center rounded-full text-[#1d57b7] hover:bg-[#f4f7fb]"
|
||||
aria-label={t("navigation.notifications")}
|
||||
>
|
||||
<Bell className="size-5" aria-hidden />
|
||||
<span className="absolute right-2 top-2 size-2 rounded-full bg-[#ff143d]" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div className="flex min-w-0 items-center justify-end gap-1">
|
||||
<LanguageSwitcher
|
||||
variant="minimal"
|
||||
showFlag={false}
|
||||
className={cn(
|
||||
playerHeaderControl,
|
||||
"rounded-full border border-[#e4eaf4] bg-[#f8fafc] [&_button]:h-8 [&_button]:gap-1 [&_button]:px-2 [&_button]:py-0 [&_button]:text-xs",
|
||||
)}
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
className={cn(
|
||||
playerHeaderControl,
|
||||
"relative size-8 rounded-full text-[#1d57b7] hover:bg-[#f4f7fb]",
|
||||
)}
|
||||
aria-label={t("navigation.notifications")}
|
||||
>
|
||||
<Bell className="size-4" aria-hidden />
|
||||
<span className="absolute right-1.5 top-1.5 size-1.5 rounded-full bg-[#ff143d]" />
|
||||
</button>
|
||||
</div>
|
||||
</header>
|
||||
{children}
|
||||
</section>
|
||||
</div>
|
||||
|
||||
@@ -12,7 +12,7 @@ function Card({
|
||||
data-slot="card"
|
||||
data-size={size}
|
||||
className={cn(
|
||||
"group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-card py-4 text-sm text-card-foreground ring-1 ring-foreground/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",
|
||||
"group/card flex flex-col gap-3 overflow-hidden rounded-xl bg-card py-3 text-sm text-card-foreground ring-1 ring-foreground/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-2 data-[size=sm]:py-2 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
@@ -25,7 +25,7 @@ function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
|
||||
<div
|
||||
data-slot="card-header"
|
||||
className={cn(
|
||||
"group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3",
|
||||
"group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-3 group-data-[size=sm]/card:px-2.5 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-3 group-data-[size=sm]/card:[.border-b]:pb-2",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
@@ -73,7 +73,7 @@ function CardContent({ className, ...props }: React.ComponentProps<"div">) {
|
||||
return (
|
||||
<div
|
||||
data-slot="card-content"
|
||||
className={cn("px-4 group-data-[size=sm]/card:px-3", className)}
|
||||
className={cn("px-3 group-data-[size=sm]/card:px-2.5", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
@@ -84,7 +84,7 @@ function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
|
||||
<div
|
||||
data-slot="card-footer"
|
||||
className={cn(
|
||||
"flex items-center rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/card:p-3",
|
||||
"flex items-center rounded-b-xl border-t bg-muted/50 p-3 group-data-[size=sm]/card:p-2.5",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
|
||||
@@ -10,35 +10,39 @@ const Toaster = ({ ...props }: ToasterProps) => {
|
||||
return (
|
||||
<Sonner
|
||||
theme={theme as ToasterProps["theme"]}
|
||||
position="top-center"
|
||||
offset={10}
|
||||
mobileOffset={{
|
||||
top: "calc(8px + env(safe-area-inset-top, 0px))",
|
||||
}}
|
||||
gap={6}
|
||||
visibleToasts={2}
|
||||
duration={2800}
|
||||
closeButton={false}
|
||||
className="toaster group"
|
||||
icons={{
|
||||
success: (
|
||||
<CircleCheckIcon className="size-4" />
|
||||
),
|
||||
info: (
|
||||
<InfoIcon className="size-4" />
|
||||
),
|
||||
warning: (
|
||||
<TriangleAlertIcon className="size-4" />
|
||||
),
|
||||
error: (
|
||||
<OctagonXIcon className="size-4" />
|
||||
),
|
||||
loading: (
|
||||
<Loader2Icon className="size-4 animate-spin" />
|
||||
),
|
||||
success: <CircleCheckIcon className="size-3.5 shrink-0" />,
|
||||
info: <InfoIcon className="size-3.5 shrink-0" />,
|
||||
warning: <TriangleAlertIcon className="size-3.5 shrink-0" />,
|
||||
error: <OctagonXIcon className="size-3.5 shrink-0" />,
|
||||
loading: <Loader2Icon className="size-3.5 shrink-0 animate-spin" />,
|
||||
}}
|
||||
style={
|
||||
{
|
||||
"--normal-bg": "var(--popover)",
|
||||
"--normal-text": "var(--popover-foreground)",
|
||||
"--normal-border": "var(--border)",
|
||||
"--border-radius": "var(--radius)",
|
||||
"--border-radius": "calc(var(--radius) * 0.8)",
|
||||
"--width": "min(280px, calc(100vw - 24px))",
|
||||
} as React.CSSProperties
|
||||
}
|
||||
toastOptions={{
|
||||
classNames: {
|
||||
toast: "cn-toast",
|
||||
toast:
|
||||
"cn-toast !min-h-0 !w-full !max-w-[min(280px,calc(100vw-24px))] !items-center !gap-2 !rounded-lg !border !px-3 !py-2 !text-xs !shadow-md",
|
||||
title: "!text-xs !font-semibold !leading-snug",
|
||||
description: "!text-[11px] !leading-snug !text-muted-foreground",
|
||||
icon: "!mr-0 !size-3.5",
|
||||
},
|
||||
}}
|
||||
{...props}
|
||||
|
||||
Reference in New Issue
Block a user