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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Pulse snapshots it.
| Page | What it shows |
|---|---|
| `/` Downloads | Headline downloads with change vs. the previous period, daily or weekly trend stacked by artifact type or by source, weekly share of downloads by product, and a sortable, searchable leaderboard. |
| `/product/:id` | One product: every artifact with its own counts, version adoption over the last 30 days and version share over time, PyPI downloads by Python version and OS, release cadence, repository health, stars over time, open issues and PRs, recent releases, GitHub traffic. |
| `/product/:id` | One product: downloads by source with stable releases marked, downloads in the 14 days before and after each recent release, every artifact with its own counts, version adoption over the last 30 days and version share over time, PyPI downloads by Python version and OS, release cadence, repository health, stars over time, open issues and PRs, recent releases, GitHub traffic. |
| `/traffic` | GitHub traffic: unique visitors and cloners for the last 14 days with change vs. the 14 before, totals, and daily history for all tracked repos. |
| `/repos` | Repository health: stars and stars gained, open issues and PRs, PRs merged in 30 days, authors in 30 days, last push, with new and active contributors over time, open issues and PRs over time, and release cadence per product (latest release and age, releases in the last 90 days, median gap over the last year, releases per week). `/releases` redirects here. |
| `/docs` | Documentation traffic for the docs sites (Nebari, Nebari Classic, Software Packs, Nebi, JHub Apps): visits per site with change vs. the previous period, visits over time by site, and one table of the top pages over the last 7 days across all sites, with a site filter and search. |
Expand Down
1 change: 1 addition & 0 deletions site/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ pulse-dashboard/
│ │ ├── ShareChart/ # 100% stacked weekly share by product (lib/summary.ts shareRows)
│ │ ├── ReleaseCadence/ # cadence per product, on the Repos page
│ │ ├── RedirectTo/ # retired paths (/releases) to their new home, query kept
│ │ ├── ReleaseImpact/ # downloads 14 days before and after each release (Product page)
│ │ ├── StatRow/ # one slim surface for a page's headline figures; each StatTile has its own (i)
│ │ ├── Filters/, Leaderboard/, StatTile/, TrendChart/, Sparkline/
│ ├── pages/
Expand Down
50 changes: 50 additions & 0 deletions site/src/components/ReleaseImpact/ReleaseImpact.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { render, screen, within } from '@testing-library/react';
import ReleaseImpact from './ReleaseImpact';

const release = (tag: string, date: string) => ({
tag,
date,
prerelease: false,
repo: 'nebari-dev/nebari-operator',
});

describe('ReleaseImpact', () => {
it('shows before, after and change, with dashes for unknown windows', () => {
render(
<ReleaseImpact
days={14}
impacts={[
{
release: release('v1.3.0', '2026-10-30'),
before: 200,
after: null,
change: null,
beforeGap: null,
afterGap: 'filling',
},
{
release: release('v1.2.0', '2026-10-01'),
before: 100,
after: 150,
change: 0.5,
beforeGap: null,
afterGap: null,
},
]}
/>,
);
const table = screen.getByRole('table', {
name: /14 days before and after/,
});
const [filling, done] = within(table).getAllByRole('row').slice(1);
expect(within(done).getByText('+50%')).toBeInTheDocument();
expect(within(done).getByText('150')).toBeInTheDocument();
expect(within(filling).getByText('(still filling)')).toBeInTheDocument();
expect(
within(filling).getByRole('link', { name: /v1.3.0/ }),
).toHaveAttribute(
'href',
'https://github.com/nebari-dev/nebari-operator/releases/tag/v1.3.0',
);
});
});
140 changes: 140 additions & 0 deletions site/src/components/ReleaseImpact/ReleaseImpact.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
import { ExternalLink } from 'lucide-react';
import TableCard from '@/components/TableCard';
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
} from '@/components/ui/table';
import { formatDate, formatDelta, formatNumber } from '@/lib/format';
import {
type ReleaseImpact as Impact,
type ImpactGap,
releaseUrl,
repoName,
} from '@/lib/repos';
import { cn } from '@/lib/utils';

interface ReleaseImpactProps {
impacts: Impact[];
/** Window length on each side of a release, in days. */
days: number;
/** Name the repo next to each tag (products with several repos). */
showRepo?: boolean;
}

const GAP: Record<ImpactGap, string> = {
uncollected: 'before collection began',
filling: 'still filling',
};

function Count({
value,
gap,
}: {
value: number | null;
gap: ImpactGap | null;
}) {
const why = gap ? GAP[gap] : 'unknown';
return (
<TableCell className="text-right tabular-nums">
{value === null ? (
<span className="text-muted-foreground" title={why}>
—<span className="sr-only"> ({why})</span>
</span>
) : (
formatNumber(value)
)}
</TableCell>
);
}

/**
* Downloads in the days before each recent stable release against the same
* number of days from its release day, so a release's pull shows as a
* number rather than a bump to eyeball.
*/
function ReleaseImpact({
impacts,
days,
showRepo = false,
}: ReleaseImpactProps) {
return (
<TableCard
title="Downloads around releases"
info={
<ul>
<li>
Downloads in the {days} days before each stable release, against the{' '}
{days} days starting on its release day. The page's source and type
filters apply.
</li>
<li>
A dash means that window is not fully known: it starts before every
source was collected, or it has not finished yet.
</li>
<li>
Releases close together share days, so their windows overlap. Read
the change as a hint, not a cause.
</li>
</ul>
}
footnote={`${impacts.length === 1 ? 'The newest stable release' : `The ${impacts.length} newest stable releases`} with download data on at least one side.`}
>
<Table
aria-label={`Downloads ${days} days before and after each release`}
>
<TableHeader>
<TableRow>
<TableHead>Release</TableHead>
<TableHead>Date</TableHead>
<TableHead className="text-right">{days} days before</TableHead>
<TableHead className="text-right">{days} days after</TableHead>
<TableHead className="text-right">Change</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{impacts.map(
({ release: r, before, after, change, beforeGap, afterGap }) => (
<TableRow key={`${r.repo}:${r.tag}`}>
<TableCell>
<a
href={releaseUrl(r.repo, r.tag)}
target="_blank"
rel="noreferrer"
className="inline-flex items-center gap-1 font-mono text-xs underline-offset-4 hover:underline"
>
{r.tag}
<ExternalLink className="size-3" aria-hidden="true" />
</a>
{showRepo && (
<span className="ml-2 text-muted-foreground text-xs">
{repoName(r.repo)}
</span>
)}
</TableCell>
<TableCell className="whitespace-nowrap text-muted-foreground tabular-nums">
{formatDate(r.date, true)}
</TableCell>
<Count value={before} gap={beforeGap} />
<Count value={after} gap={afterGap} />
<TableCell
className={cn(
'text-right tabular-nums',
change === null && 'text-muted-foreground',
)}
>
{formatDelta(change)}
</TableCell>
</TableRow>
),
)}
</TableBody>
</Table>
</TableCard>
);
}

export default ReleaseImpact;
1 change: 1 addition & 0 deletions site/src/components/ReleaseImpact/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './ReleaseImpact';
41 changes: 41 additions & 0 deletions site/src/components/TrendChart/TrendChart.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { render, screen, within } from '@testing-library/react';
import TrendChart from './TrendChart';

const rows = [
{ date: '2026-10-01', quay: 5 },
{ date: '2026-10-02', quay: 9 },
];

describe('TrendChart', () => {
it('lists releases in the legend and for screen readers', () => {
render(
<TrendChart
rows={rows}
series={[{ key: 'quay', label: 'Quay', color: 'var(--chart-1)' }]}
releases={[
{ date: '2026-10-02', tags: ['v1.2.0'] },
// Outside the rows: not drawn or announced.
{ date: '2026-09-01', tags: ['v1.0.0'] },
]}
title="Downloads"
/>,
);
const figure = screen.getByRole('figure', { name: 'Downloads' });
expect(
within(screen.getByRole('list', { name: 'Legend' })).getByText('Release'),
).toBeInTheDocument();
expect(figure).toHaveTextContent('Releases: v1.2.0 (Oct 2, 2026).');
expect(figure).not.toHaveTextContent('v1.0.0');
});

it('shows no legend for one series without releases', () => {
render(
<TrendChart
rows={rows}
series={[{ key: 'quay', label: 'Quay', color: 'var(--chart-1)' }]}
title="Downloads"
/>,
);
expect(screen.queryByRole('list', { name: 'Legend' })).toBeNull();
});
});
61 changes: 59 additions & 2 deletions site/src/components/TrendChart/TrendChart.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Clock, TriangleAlert } from 'lucide-react';
import { Clock, Tag, TriangleAlert } from 'lucide-react';
import {
Area,
AreaChart,
Expand All @@ -20,6 +20,7 @@ import {
formatNumber,
formatQuarter,
} from '@/lib/format';
import type { ReleaseMark } from '@/lib/repos';

export type Bucket = 'day' | 'week' | 'month' | 'quarter';

Expand Down Expand Up @@ -78,6 +79,11 @@ interface TrendChartProps {
partialFrom?: string | null;
/** Tooltip note on incomplete rows, e.g. which sources are missing. */
partialNote?: string;
/**
* Releases, one mark per row (day, or week's Monday). Drawn as thin lines
* in the primary hue and named in the tooltip.
*/
releases?: ReleaseMark[];
title: string;
}

Expand All @@ -89,17 +95,20 @@ function ChartTooltip({
notes,
parts,
partial,
released,
}: TooltipProps<number, string> & {
bucket: Bucket;
notes: Map<string, string>;
parts: Map<string, TrendSeries['parts']>;
partial: ((date: string) => string | null) | null;
released: Map<string, string[]>;
}) {
if (!active || !payload?.length) return null;
const items = [...payload].reverse(); // top of the stack first
const sum = items.reduce((acc, p) => acc + (p.value ?? 0), 0);
const note = notes.get(String(label));
const partialNote = partial?.(String(label));
const tags = released.get(String(label));
return (
<div className="max-w-xs rounded-md border bg-popover px-3 py-2 text-popover-foreground text-sm shadow-md">
<p className="mb-1 font-medium">
Expand Down Expand Up @@ -142,6 +151,17 @@ function ChartTooltip({
</span>
</p>
)}
{tags && (
<p className="mt-1 flex items-start gap-1.5 border-t pt-1 text-xs">
<Tag
className="mt-0.5 size-3.5 shrink-0 text-primary"
aria-hidden="true"
/>
<span>
Released <span className="font-mono">{tags.join(', ')}</span>
</span>
</p>
)}
{partialNote && (
<p className="mt-1 flex items-start gap-1.5 border-t pt-1 text-muted-foreground text-xs">
<Clock className="mt-0.5 size-3.5 shrink-0" aria-hidden="true" />
Expand Down Expand Up @@ -178,6 +198,7 @@ function TrendChart({
lines = [],
partialFrom = null,
partialNote,
releases = [],
}: TrendChartProps) {
const stacked = stackedProp ?? series.length > 1;
const bucket: Bucket = bucketProp ?? (weekly ? 'week' : 'day');
Expand All @@ -198,6 +219,10 @@ function TrendChart({
: null
: null;
const shown = lines.filter((l) => rows.some((r) => r.date === l.date));
const releaseRows = releases.filter((m) =>
rows.some((r) => r.date === m.date),
);
const released = new Map(releaseRows.map((m) => [m.date, m.tags]));
const rightHalf = (date: string) =>
rows.findIndex((r) => r.date === date) > rows.length / 2;
// Marker height: the top of the stack (or the tallest series) that day.
Expand All @@ -217,7 +242,19 @@ function TrendChart({
.join(' ')}
</p>
)}
{(series.length > 1 || partialStart) && (
{releaseRows.length > 0 && (
<p className="sr-only">
Releases:{' '}
{releaseRows
.map(
(m) =>
`${m.tags.join(', ')} (${bucketLabel(m.date, bucket, true)})`,
)
.join('; ')}
.
</p>
)}
{(series.length > 1 || partialStart || releaseRows.length > 0) && (
<ul
className="flex flex-wrap gap-x-4 gap-y-1 text-sm"
aria-label="Legend"
Expand All @@ -233,6 +270,15 @@ function TrendChart({
{s.label}
</li>
))}
{releaseRows.length > 0 && (
<li className="flex items-center gap-1.5 text-muted-foreground">
<span
className="inline-block h-3 w-0.5 rounded-full bg-primary"
aria-hidden="true"
/>
Release
</li>
)}
{partialStart && (
<li className="flex items-center gap-1.5 text-muted-foreground">
<span
Expand Down Expand Up @@ -277,6 +323,7 @@ function TrendChart({
notes={notes}
parts={parts}
partial={partial}
released={released}
/>
}
cursor={{
Expand Down Expand Up @@ -309,6 +356,16 @@ function TrendChart({
ifOverflow="hidden"
/>
)}
{releaseRows.map((m) => (
<ReferenceLine
key={`release-${m.date}`}
x={m.date}
stroke="var(--primary)"
strokeOpacity={0.55}
strokeWidth={1.5}
ifOverflow="hidden"
/>
))}
{shown.map((l, i) => (
<ReferenceLine
key={l.date}
Expand Down
Loading
Loading