Improve panel layout overflow on small screens
All checks were successful
CI / Deploy / test (push) Successful in 1m15s
CI / Deploy / deploy (push) Successful in 1m4s

- Prevent horizontal overflow in the main layout
- Stack game room controls vertically on narrow viewports
- Truncate long room and user labels to keep cards stable
This commit is contained in:
syntaxbullet
2026-04-10 12:13:03 +02:00
parent 454ded8b26
commit 222f32d98f
2 changed files with 15 additions and 15 deletions

View File

@@ -221,7 +221,7 @@ export default function Layout({
}
return (
<div className="min-h-screen flex">
<div className="min-h-screen flex overflow-x-hidden">
{/* Mobile header bar */}
<div className="fixed top-0 left-0 right-0 z-40 flex items-center h-14 px-4 bg-background md:hidden">
<button
@@ -286,11 +286,11 @@ export default function Layout({
</aside>
<main className={cn(
"flex-1 transition-all duration-200",
"min-w-0 flex-1 overflow-x-hidden transition-all duration-200",
"mt-14 md:mt-0",
collapsed ? "md:ml-16" : "md:ml-60"
)}>
<div className="max-w-[1600px] mx-auto px-4 py-6 md:px-6 md:py-8">
<div className="min-w-0 max-w-[1600px] mx-auto px-4 py-6 md:px-6 md:py-8">
{children}
</div>
</main>

View File

@@ -126,7 +126,7 @@ function CompactRoomBar({
return (
<div className="sticky top-[4.5rem] z-30 md:top-6">
<div className="rounded-[24px] border border-white/10 bg-background/82 p-3 shadow-[0_18px_50px_rgba(0,0,0,0.28)] backdrop-blur-xl">
<div className="flex flex-wrap items-center justify-between gap-3">
<div className="flex flex-col gap-3 sm:flex-row sm:flex-wrap sm:items-center sm:justify-between">
<div className="flex min-w-0 flex-wrap items-center gap-2">
<span className={cn("rounded-full border px-3 py-1 text-[11px] font-semibold uppercase tracking-[0.18em]", stateChip(state))}>
{stateLabel(state)}
@@ -142,7 +142,7 @@ function CompactRoomBar({
</div>
<button
onClick={onExit}
className="rounded-full border border-white/10 bg-black/10 px-3 py-1.5 text-sm text-text-secondary transition-colors hover:text-foreground"
className="rounded-full border border-white/10 bg-black/10 px-3 py-1.5 text-sm text-text-secondary transition-colors hover:text-foreground sm:self-auto self-start"
>
Leave
</button>
@@ -260,7 +260,7 @@ export function GameRoom({ userId, role }: { userId: string; role?: string }) {
return (
<div className="space-y-6">
<section className={cn("overflow-hidden rounded-[32px] border p-5 shadow-[0_24px_80px_rgba(0,0,0,0.22)] sm:p-6", gameSurfaceClass(plugin.slug))}>
<div className="flex flex-wrap items-center justify-between gap-3">
<div className="flex flex-col gap-3 sm:flex-row sm:flex-wrap sm:items-center sm:justify-between">
<button
onClick={exitRoom}
className="inline-flex items-center gap-2 rounded-full border border-white/10 bg-black/10 px-3 py-1.5 text-sm text-text-secondary transition-colors hover:text-foreground"
@@ -294,7 +294,7 @@ export function GameRoom({ userId, role }: { userId: string; role?: string }) {
</div>
<p className="mt-2 max-w-2xl text-sm text-text-secondary">{plugin.description}</p>
<div className="mt-4 flex flex-wrap gap-2">
<span className="rounded-full border border-white/10 bg-black/10 px-3 py-1.5 text-xs text-text-secondary">
<span className="break-all rounded-full border border-white/10 bg-black/10 px-3 py-1.5 text-xs text-text-secondary">
Room ID {roomCode}
</span>
{roomFacts.map(fact => (
@@ -306,7 +306,7 @@ export function GameRoom({ userId, role }: { userId: string; role?: string }) {
</div>
</div>
<div className="mt-5 grid gap-3 sm:grid-cols-3">
<div className="mt-5 grid gap-3 md:grid-cols-3">
<div className="rounded-2xl border border-white/10 bg-black/12 px-4 py-3">
<div className="flex items-center gap-2 text-[11px] uppercase tracking-[0.18em] text-text-disabled">
<Users className="h-3.5 w-3.5" />
@@ -339,7 +339,7 @@ export function GameRoom({ userId, role }: { userId: string; role?: string }) {
{hostPlayer && (
<div className="mt-4 flex items-center justify-between gap-3 rounded-2xl border border-white/10 bg-black/10 px-4 py-3 text-sm">
<span className="text-text-tertiary">Host</span>
<span className="font-semibold text-foreground">{hostPlayer.username}</span>
<span className="min-w-0 truncate text-right font-semibold text-foreground">{hostPlayer.username}</span>
</div>
)}
</div>
@@ -347,13 +347,13 @@ export function GameRoom({ userId, role }: { userId: string; role?: string }) {
<div className="mt-5 space-y-3">
{sessionReplaced && (
<div className="flex flex-wrap items-center justify-between gap-3 rounded-2xl border border-warning/20 bg-warning/10 px-4 py-3">
<div className="flex flex-col gap-3 rounded-2xl border border-warning/20 bg-warning/10 px-4 py-3 sm:flex-row sm:flex-wrap sm:items-center sm:justify-between">
<div className="text-sm text-warning">
Another tab claimed this room session. Actions from this tab are currently disabled.
</div>
<button
onClick={rejoin}
className="rounded-full border border-warning/20 px-3 py-1.5 text-xs font-semibold uppercase tracking-[0.18em] text-warning transition-colors hover:bg-warning/10"
className="self-start rounded-full border border-warning/20 px-3 py-1.5 text-xs font-semibold uppercase tracking-[0.18em] text-warning transition-colors hover:bg-warning/10"
>
Rejoin Here
</button>
@@ -389,7 +389,7 @@ export function GameRoom({ userId, role }: { userId: string; role?: string }) {
{roomStatus === "waiting" && (
<div className="grid gap-6 xl:grid-cols-[minmax(0,1fr)_320px]">
<section className="rounded-[32px] border border-white/10 bg-card/70 p-5 shadow-[0_20px_60px_rgba(0,0,0,0.16)] sm:p-6">
<div className="flex flex-wrap items-start justify-between gap-4">
<div className="flex flex-col gap-4 sm:flex-row sm:flex-wrap sm:items-start sm:justify-between">
<div>
<div className="text-[11px] uppercase tracking-[0.2em] text-text-disabled">Waiting Room</div>
<h2 className="mt-3 font-display text-3xl font-semibold text-foreground">
@@ -461,9 +461,9 @@ export function GameRoom({ userId, role }: { userId: string; role?: string }) {
<div className="text-[11px] uppercase tracking-[0.2em] text-text-disabled">Room Settings</div>
<div className="mt-4 space-y-3">
{roomFacts.map(fact => (
<div key={fact.label} className="flex items-center justify-between gap-3 rounded-2xl border border-white/10 bg-black/10 px-4 py-3 text-sm">
<div key={fact.label} className="flex flex-col gap-1 rounded-2xl border border-white/10 bg-black/10 px-4 py-3 text-sm sm:flex-row sm:items-center sm:justify-between sm:gap-3">
<span className="text-text-tertiary">{fact.label}</span>
<span className="font-semibold text-foreground">{fact.value}</span>
<span className="min-w-0 font-semibold text-foreground sm:text-right">{fact.value}</span>
</div>
))}
</div>
@@ -505,7 +505,7 @@ export function GameRoom({ userId, role }: { userId: string; role?: string }) {
<div className="mt-4 space-y-3">
{spectators.map(spectator => (
<div key={spectator.discordId} className="flex items-center justify-between gap-3 rounded-2xl border border-white/10 bg-black/10 px-4 py-3 text-sm">
<span className="font-medium text-foreground">{spectator.username}</span>
<span className="min-w-0 truncate font-medium text-foreground">{spectator.username}</span>
<span className="text-text-tertiary">Watching</span>
</div>
))}