1
0
Fork 0

fix(mobile): resolve horizontal overflow and touch-only affordances

Mobile audit (390x844) found overflow on 6 routes; all now clean.

- Tabs: TabsList is inline-flex and widened the page when several tabs
  were present (roster doc 639px, helpdesk 510px). It now scrolls
  (max-w-full + overflow-x-auto); TabsContent gets min-w-0 and the roster
  Tabs min-w-0 so the org tree's own scroller can clip instead of the
  page growing
- Item: ItemHeader/ItemFooter had flex-basis 100% with min-width auto, so
  a long title forced the card wider instead of shrinking. Shared min-w-0
- ResourceCard: the description rendered twice (once inside ItemContent,
  once as ItemDescription) and both fought for one flex line, crushing
  the content column to 27px. Single description, full-width rows,
  truncating title (min-w-0 + items-stretch so nowrap spans can clip),
  shrink-0 badges
- awards/design: stripe row wraps instead of exceeding the viewport
- leaderboards: flappy table and the shared StandingsTable scroll
  horizontally rather than widening the page
- blackjack: explicit grid-cols-1 (minmax(0,1fr)) so the arena's implicit
  track cannot outgrow the viewport
- campaigns: card readout was revealed only on hover, unreachable on
  touch; now always visible on coarse pointers and hover-revealed only
  on pointer-fine
This commit is contained in:
Jason Fraley 2026-10-12 20:17:21 -04:00
parent d016075481
commit 55f6598569
9 changed files with 30 additions and 21 deletions

View file

@ -87,7 +87,7 @@ export function StripeEditor({
</button>
</div>
{stripes.map((stripe, idx) => (
<div key={idx} className="flex items-center gap-2 bg-zinc-900 rounded px-2 py-1.5">
<div key={idx} className="flex flex-wrap items-center gap-2 bg-zinc-900 rounded px-2 py-1.5">
<input
type="color"
value={stripe.color}

View file

@ -243,7 +243,9 @@ export function CampaignCard({ campaign, size = "lg" }: CampaignCardProps) {
</div>
{isSmall ? (
<footer className="absolute inset-x-0 bottom-0 z-20 flex translate-y-4 items-center bg-black/60 px-2 py-2.5 opacity-0 backdrop-blur-sm transition-all duration-300 ease-out group-hover:translate-y-0 group-hover:opacity-100 motion-reduce:transition-none">
// Touch devices never hover: keep the readout permanently visible on
// coarse pointers and reserve the slide-in reveal for mice.
<footer className="absolute inset-x-0 bottom-0 z-20 flex translate-y-0 items-center bg-black/60 px-2 py-2.5 opacity-100 backdrop-blur-sm transition-all duration-300 ease-out pointer-fine:translate-y-4 pointer-fine:opacity-0 pointer-fine:group-hover:translate-y-0 pointer-fine:group-hover:opacity-100 motion-reduce:transition-none">
<div className="flex min-w-0 flex-1 items-center justify-center gap-1.5 border-r border-white/15 text-xs text-white/80">
<CrosshairIcon aria-hidden="true" className="size-3.5 shrink-0 text-white/60" />
<span className="sr-only">Missions</span>

View file

@ -100,7 +100,7 @@ export function ResourceCard({ resource }: ResourceCardProps) {
className="cursor-pointer group transition-all duration-200 hover:scale-[1.01] hover:[box-shadow:inset_0_2px_8px_rgba(255,255,255,0.33)]"
>
<ItemHeader>
<div className="flex items-center gap-2">
<div className="flex min-w-0 items-center gap-2">
{icon ? (
<ItemMedia variant="image">
<img src={icon.url} alt={resource.name} className="size-full object-cover" />
@ -115,12 +115,14 @@ export function ResourceCard({ resource }: ResourceCardProps) {
) : (
<ItemMedia variant="icon">{typeIcons[resource.type]}</ItemMedia>
)}
<ItemTitle className="flex flex-col">
<span className="font-mono text-xs text-muted-foreground">{resource.codeName}</span>
<span>{resource.name}</span>
<ItemTitle className="flex min-w-0 flex-col items-stretch">
<span className="min-w-0 truncate font-mono text-xs text-muted-foreground">
{resource.codeName}
</span>
<span className="min-w-0 truncate">{resource.name}</span>
</ItemTitle>
</div>
<div className="flex items-center gap-2">
<div className="flex shrink-0 items-center gap-2">
<span
className={`text-[10px] font-semibold uppercase tracking-wider px-1.5 py-0.5 rounded ${typeColors[resource.type] ?? "bg-muted text-muted-foreground"}`}
>
@ -135,9 +137,6 @@ export function ResourceCard({ resource }: ResourceCardProps) {
</ItemHeader>
<ItemContent>
<div className="flex flex-col gap-3 w-full">
{truncatedDescription && (
<p className="text-sm text-muted-foreground line-clamp-2">{truncatedDescription}</p>
)}
<div className="flex flex-wrap items-center gap-x-4 gap-y-1.5 text-xs text-muted-foreground">
<span className="flex items-center gap-1 font-medium text-foreground">
{resource.baseValue.toLocaleString()} credits
@ -155,10 +154,10 @@ export function ResourceCard({ resource }: ResourceCardProps) {
</div>
</div>
</ItemContent>
<ItemDescription>
<ItemDescription className="basis-full">
{truncatedDescription ?? `${resource.type} resource (${resource.unitOfMeasure})`}
</ItemDescription>
<span className="text-xs text-muted-foreground group-hover:text-primary transition-colors flex items-center gap-1">
<span className="basis-full text-xs text-muted-foreground group-hover:text-primary transition-colors flex items-center gap-1">
View details <ChevronRightIcon className="size-3" />
</span>
</Item>

View file

@ -40,7 +40,8 @@ export function StandingsTable({
}
return (
<table className={cn("w-full text-sm", className)}>
<div className="overflow-x-auto">
<table className={cn("w-full text-sm", className)}>
<thead>
<tr className="text-left text-xs uppercase tracking-wider text-muted-foreground">
<th className="px-4 py-2 font-medium">#</th>
@ -73,6 +74,7 @@ export function StandingsTable({
);
})}
</tbody>
</table>
</table>
</div>
);
}

View file

@ -299,7 +299,7 @@ export function BlackjackArena({
</p>
)}
<div className="grid min-w-0 gap-6 xl:grid-cols-[minmax(0,1fr)_minmax(22rem,28rem)]">
<div className="grid grid-cols-1 min-w-0 gap-6 xl:grid-cols-[minmax(0,1fr)_minmax(22rem,28rem)]">
<section className="min-w-0">
{view === "lobby" ? (
<BlackjackLobby

View file

@ -137,7 +137,8 @@ export function FlappyLeaderboard({ refreshKey = 0, currentUserId, activePilots
No pilots on the board yet. Be the first to pass a pipe!
</p>
) : (
<table className="w-full text-sm">
<div className="overflow-x-auto">
<table className="w-full text-sm">
<thead>
<tr className="text-left text-xs uppercase tracking-wider text-muted-foreground">
<th className="px-4 py-2 font-medium">#</th>
@ -191,6 +192,7 @@ export function FlappyLeaderboard({ refreshKey = 0, currentUserId, activePilots
))}
</tbody>
</table>
</div>
)}
</div>
);

View file

@ -599,7 +599,7 @@ export function RosterView({
return (
<RosterViewerContext.Provider value={viewer}>
<RosterDisplayContext.Provider value={leadOrActual}>
<Tabs defaultValue="org">
<Tabs defaultValue="org" className="min-w-0">
<TabsList variant="line">
<TabsTrigger value="org" className="gap-1.5">
<NetworkIcon className="size-3" />

View file

@ -142,7 +142,9 @@ function ItemHeader({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="item-header"
className={cn("flex basis-full items-center justify-between gap-2", className)}
// min-w-0 lets long titles shrink instead of forcing the card (and page)
// wider than its container; children opt into truncation.
className={cn("flex min-w-0 basis-full items-center justify-between gap-2", className)}
{...props}
/>
);
@ -152,7 +154,7 @@ function ItemFooter({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="item-footer"
className={cn("flex basis-full items-center justify-between gap-2", className)}
className={cn("flex min-w-0 basis-full items-center justify-between gap-2", className)}
{...props}
/>
);

View file

@ -9,7 +9,9 @@ import { cn } from "@/lib/utils";
const Tabs = TabsPrimitive.Root;
const tabsListVariants = cva(
"inline-flex items-center justify-center text-muted-foreground",
// max-w-full + overflow-x-auto keep multi-tab lists from widening the page
// on narrow screens: they scroll horizontally instead.
"inline-flex max-w-full items-center justify-center overflow-x-auto text-muted-foreground [scrollbar-width:none]",
{
variants: {
variant: {
@ -62,7 +64,7 @@ const TabsContent = React.forwardRef<
<TabsPrimitive.Content
ref={ref}
className={cn(
"mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
"mt-2 min-w-0 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
className,
)}
{...props}