feat(web): add loading skeletons, error boundaries, and accessibility improvements
- Add segment-level loading.tsx for dashboard, search, admin, and auth routes - Add segment-level error.tsx with Vietnamese error messages for all route groups - Add skip-to-content navigation link in root layout - Add id="main-content" to all layout main elements - Add aria-label to nav elements and mobile menu buttons - Improve dashboard nav responsiveness (icon-only on mobile) - Hide user name on small screens in dashboard layout Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -25,27 +25,28 @@ export default function DashboardLayout({ children }: { children: React.ReactNod
|
||||
<span className="text-lg font-bold text-primary">GoodGo</span>
|
||||
</Link>
|
||||
|
||||
<nav className="flex items-center space-x-1">
|
||||
<nav aria-label="Bảng điều khiển" className="flex items-center space-x-1">
|
||||
{navItems.map((item) => (
|
||||
<Link
|
||||
key={item.href}
|
||||
href={item.href}
|
||||
aria-label={item.label}
|
||||
className={cn(
|
||||
'rounded-md px-3 py-2 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground',
|
||||
'rounded-md px-2 py-2 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground sm:px-3',
|
||||
pathname === item.href
|
||||
? 'bg-accent text-accent-foreground'
|
||||
: 'text-muted-foreground',
|
||||
)}
|
||||
>
|
||||
<span className="mr-1.5">{item.icon}</span>
|
||||
{item.label}
|
||||
<span className="sm:mr-1.5">{item.icon}</span>
|
||||
<span className="hidden sm:inline">{item.label}</span>
|
||||
</Link>
|
||||
))}
|
||||
</nav>
|
||||
|
||||
<div className="ml-auto flex items-center space-x-3">
|
||||
{user && (
|
||||
<span className="text-sm text-muted-foreground">
|
||||
<span className="hidden text-sm text-muted-foreground sm:inline">
|
||||
{user.fullName}
|
||||
</span>
|
||||
)}
|
||||
@@ -56,7 +57,7 @@ export default function DashboardLayout({ children }: { children: React.ReactNod
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<main className="mx-auto max-w-7xl px-4 py-6">{children}</main>
|
||||
<main id="main-content" className="mx-auto max-w-7xl px-4 py-6">{children}</main>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user