fix(stats): restore leaderboard spacing
This commit is contained in:
@@ -368,7 +368,7 @@ function formatUpdatedAtLabel(value: { date: string; time: string }) {
|
||||
}
|
||||
|
||||
function TopModelsSection(props: { data: StatsHomeData["usage"]; leaderboard: StatsHomeData["leaderboard"] }) {
|
||||
const [product, setProduct] = createSignal<UsageProduct>("All Users")
|
||||
const [product, setProduct] = createSignal<UsageProduct>("Go")
|
||||
const [range, setRange] = createSignal<UsageRange>("2M")
|
||||
const [sheet, setSheet] = createSignal<"product" | "range">()
|
||||
const [activeModel, setActiveModel] = createSignal<string>()
|
||||
@@ -409,7 +409,6 @@ function TopModelsSection(props: { data: StatsHomeData["usage"]; leaderboard: St
|
||||
onActiveModelChange={setActiveModel}
|
||||
/>
|
||||
</Show>
|
||||
<div id="leaderboard" data-slot="leaderboard-pattern" aria-hidden="true" />
|
||||
<Show
|
||||
when={leaderboard().length > 0}
|
||||
fallback={
|
||||
@@ -418,7 +417,7 @@ function TopModelsSection(props: { data: StatsHomeData["usage"]; leaderboard: St
|
||||
>
|
||||
<Leaderboard data={leaderboard()} activeModel={activeModel()} onActiveModelChange={setActiveModel} />
|
||||
</Show>
|
||||
<div data-slot="chart-footer">
|
||||
<div data-slot="chart-footer" hidden>
|
||||
<StatsFilters product={product()} range={range()} onProductSelect={setProduct} onRangeSelect={setRange} />
|
||||
<div data-slot="top-models-mobile-controls">
|
||||
<MobileFilterButton
|
||||
@@ -848,13 +847,50 @@ function Leaderboard(props: {
|
||||
activeModel: string | undefined
|
||||
onActiveModelChange: (model: string | undefined) => void
|
||||
}) {
|
||||
const featured = createMemo(() => props.data.slice(0, 3))
|
||||
const columns = createMemo(() =>
|
||||
[0, 1, 2].map((index) => props.data.slice(3 + index * 5, 8 + index * 5)).filter((column) => column.length > 0),
|
||||
)
|
||||
|
||||
return (
|
||||
<div data-component="leaderboard" role="list" aria-label="Model token leaderboard">
|
||||
<div data-slot="leaderboard-scroll" aria-label="Scrollable model token leaderboard">
|
||||
<div id="leaderboard" data-component="leaderboard" role="list" aria-label="Model token leaderboard">
|
||||
<div data-slot="leaderboard-featured">
|
||||
<For each={featured()}>
|
||||
{(entry) => (
|
||||
<LeaderboardCard
|
||||
entry={entry}
|
||||
size="featured"
|
||||
active={props.activeModel === entry.model}
|
||||
onActiveModelChange={props.onActiveModelChange}
|
||||
/>
|
||||
)}
|
||||
</For>
|
||||
</div>
|
||||
<div data-slot="leaderboard-pattern" aria-hidden="true" />
|
||||
<div data-slot="leaderboard-compact">
|
||||
<For each={columns()}>
|
||||
{(column) => (
|
||||
<div data-slot="leaderboard-column">
|
||||
<For each={column}>
|
||||
{(entry) => (
|
||||
<LeaderboardCard
|
||||
entry={entry}
|
||||
size="compact"
|
||||
active={props.activeModel === entry.model}
|
||||
onActiveModelChange={props.onActiveModelChange}
|
||||
/>
|
||||
)}
|
||||
</For>
|
||||
</div>
|
||||
)}
|
||||
</For>
|
||||
</div>
|
||||
<div data-slot="leaderboard-mobile" aria-label="Scrollable model token leaderboard">
|
||||
<For each={props.data}>
|
||||
{(entry) => (
|
||||
<LeaderboardCard
|
||||
entry={entry}
|
||||
size="featured"
|
||||
active={props.activeModel === entry.model}
|
||||
onActiveModelChange={props.onActiveModelChange}
|
||||
/>
|
||||
@@ -867,13 +903,14 @@ function Leaderboard(props: {
|
||||
|
||||
function LeaderboardCard(props: {
|
||||
entry: LeaderboardEntry
|
||||
size: "featured" | "compact"
|
||||
active: boolean
|
||||
onActiveModelChange: (model: string | undefined) => void
|
||||
}) {
|
||||
return (
|
||||
<article
|
||||
data-component="leader-card"
|
||||
data-size="featured"
|
||||
data-size={props.size}
|
||||
data-active={props.active ? "true" : undefined}
|
||||
role="listitem"
|
||||
tabIndex={0}
|
||||
@@ -986,17 +1023,19 @@ function MarketShareSection(props: { data: StatsHomeData["market"] }) {
|
||||
<span>[*]</span>
|
||||
<strong>{inspecting() ? formatMarketDate(activeDay()) : formatMarketRange(data())}</strong>
|
||||
</p>
|
||||
<FilterPills
|
||||
items={ranges}
|
||||
selected={range()}
|
||||
label="Date range"
|
||||
variant="range"
|
||||
onSelect={(item) => {
|
||||
setRange(item)
|
||||
setActiveAuthor(undefined)
|
||||
setInspecting(false)
|
||||
}}
|
||||
/>
|
||||
<div hidden>
|
||||
<FilterPills
|
||||
items={ranges}
|
||||
selected={range()}
|
||||
label="Date range"
|
||||
variant="range"
|
||||
onSelect={(item) => {
|
||||
setRange(item)
|
||||
setActiveAuthor(undefined)
|
||||
setInspecting(false)
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
@@ -1215,7 +1254,7 @@ function marketDateParts(label: string) {
|
||||
}
|
||||
|
||||
function TokenCostSection(props: { data: StatsHomeData["tokenCost"] }) {
|
||||
const [product, setProduct] = createSignal<TokenProduct>("Zen")
|
||||
const [product, setProduct] = createSignal<TokenProduct>("Go")
|
||||
const [activeIndex, setActiveIndex] = createSignal(2)
|
||||
const data = createMemo(() => props.data[product()])
|
||||
const visible = createMemo(() => data().slice(0, 13))
|
||||
@@ -1233,7 +1272,7 @@ function TokenCostSection(props: { data: StatsHomeData["tokenCost"] }) {
|
||||
>
|
||||
<TokenCostChart data={visible()} activeIndex={selectedIndex()} onActiveIndexChange={setActiveIndex} />
|
||||
</Show>
|
||||
<div data-slot="token-footer">
|
||||
<div data-slot="token-footer" hidden>
|
||||
<FilterPills
|
||||
items={tokenProducts}
|
||||
selected={product()}
|
||||
@@ -1313,7 +1352,7 @@ function MetricBar(props: { value: number; max: number; active: boolean }) {
|
||||
}
|
||||
|
||||
function SessionCostSection(props: { data: StatsHomeData["sessionCost"] }) {
|
||||
const [product, setProduct] = createSignal<TokenProduct>("Zen")
|
||||
const [product, setProduct] = createSignal<TokenProduct>("Go")
|
||||
const [activeIndex, setActiveIndex] = createSignal(2)
|
||||
const data = createMemo(() => props.data[product()])
|
||||
const visible = createMemo(() => data().slice(0, 16))
|
||||
@@ -1334,7 +1373,7 @@ function SessionCostSection(props: { data: StatsHomeData["sessionCost"] }) {
|
||||
>
|
||||
<SessionCostChart data={visible()} activeIndex={selectedIndex()} onActiveIndexChange={setActiveIndex} />
|
||||
</Show>
|
||||
<div data-slot="token-footer">
|
||||
<div data-slot="token-footer" hidden>
|
||||
<FilterPills
|
||||
items={tokenProducts}
|
||||
selected={product()}
|
||||
|
||||
Reference in New Issue
Block a user