Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions web/src/features/maps/MapList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,9 @@ function MapStats({
if (!hasTiers && newest.length === 0 && playedThisWeek.length === 0)
return null;
return (
<Card className="grid gap-5 p-4 sm:grid-cols-2 sm:gap-6 xl:grid-cols-3">
<Card className="grid gap-5 p-4 sm:grid-cols-2 sm:gap-6 md:flex">
{hasTiers && (
<div className="min-w-0 sm:col-span-2 xl:col-span-1">
<div className="min-w-0 sm:col-span-2 md:shrink-0">
<TierSpread
byTier={stats.by_tier}
untiered={stats.maps - tiered}
Expand Down Expand Up @@ -442,7 +442,7 @@ function MapStatsList({
tierCount: number | null | undefined;
}) {
return (
<section className="border-border flex min-w-0 flex-col gap-3 border-t pt-4 sm:border-t-0 sm:pt-0 xl:border-l xl:pl-6">
<section className="border-border flex min-w-0 flex-1 flex-col gap-3 border-t pt-4 sm:border-t-0 sm:pt-0 md:border-l md:pl-6">
<h2 className="text-sm font-bold">
{href ? (
<Link href={href} className="hover:text-accent">
Expand Down
75 changes: 37 additions & 38 deletions web/src/ui/TierSpread.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,18 @@ export function TierSpread({
if (total === 0) return null;
const tierCount = byTier.length;
return (
<section aria-label="Maps by tier" className="flex min-w-0 flex-col gap-3">
<h2 className="text-sm font-bold">Difficulty</h2>
<div className="flex flex-col gap-1">
<section
aria-label="Maps by tier"
className="flex w-fit max-w-full min-w-0 flex-col gap-3"
>
<div className="flex items-center justify-between gap-4">
<h2 className="text-sm font-bold">Difficulty</h2>
<Link
href={tierHref(null)}
scroll={false}
aria-current={selected == null ? "true" : undefined}
className={classNames(
"flex h-7 items-center gap-3 self-start rounded-sm px-2 text-sm transition-colors duration-(--duration-fast)",
"flex h-7 items-center gap-2 rounded-sm px-2 text-xs transition-colors duration-(--duration-fast)",
selected == null
? "bg-text/8 text-text"
: "text-text-muted hover:text-accent",
Expand All @@ -43,41 +46,37 @@ export function TierSpread({
{number.format(total)}
</span>
</Link>
<ul
className="grid w-fit grid-flow-col grid-cols-2 gap-x-6 gap-y-1"
style={{
gridTemplateRows: `repeat(${Math.ceil(tierCount / 2)}, minmax(0, 1fr))`,
}}
>
{byTier.map((count, index) => {
const tier = index + 1;
const active = tier === selected;
return (
<li key={tier} className="min-w-0">
<Link
href={tierHref(tier)}
scroll={false}
aria-current={active ? "true" : undefined}
aria-label={`Tier ${tier}: ${number.format(count)} maps`}
className={classNames(
"group flex h-6 items-center gap-2 rounded-sm px-2 transition-colors duration-(--duration-fast)",
active && "bg-text/8",
)}
>
<TierBadge
tier={tier}
tierCount={tierCount}
className="w-8"
/>
<span className="text-text-muted group-hover:text-accent w-6 text-xs tabular-nums transition-colors duration-(--duration-fast)">
{number.format(count)}
</span>
</Link>
</li>
);
})}
</ul>
</div>
<ul
className="grid w-fit grid-flow-col grid-cols-2 gap-x-6 gap-y-1"
style={{
gridTemplateRows: `repeat(${Math.ceil(tierCount / 2)}, minmax(0, 1fr))`,
}}
>
{byTier.map((count, index) => {
const tier = index + 1;
const active = tier === selected;
return (
<li key={tier} className="min-w-0">
<Link
href={tierHref(tier)}
scroll={false}
aria-current={active ? "true" : undefined}
aria-label={`Tier ${tier}: ${number.format(count)} maps`}
className={classNames(
"group flex h-6 items-center gap-2 rounded-sm px-2 transition-colors duration-(--duration-fast)",
active && "bg-text/8",
)}
>
<TierBadge tier={tier} tierCount={tierCount} className="w-8" />
<span className="text-text-muted group-hover:text-accent w-6 text-xs tabular-nums transition-colors duration-(--duration-fast)">
{number.format(count)}
</span>
</Link>
</li>
);
})}
</ul>
{untiered > 0 && (
<p className="text-text-subtle text-xs">
{number.format(untiered)} without a tier
Expand Down