Commit List

A history, grouped by day. The grouping is the point — a flat list of forty commits is unreadable, and "when" is the axis people actually scan along.

src/components/ui/commit-list.tsx

About

From the component's own source, where it was written.

A list of commits, grouped by day.

The grouping is the point: a flat list of forty commits is unreadable, and "when" is the axis people actually scan a history along.

Install

npx astralyx-ui add commit-list

Usage

import { CommitList } from '@/components/ui/commit-list'

<CommitList commits={commits} onSelect={openCommit} />

Composer

Change the props and the source below follows.

Tuesday 6 October

Ada Lovelace

Ada Lovelace committed at 14:12

Verified
Katherine Johnson

Katherine Johnson committed at 11:12

Monday 5 October

Alan Turing

Alan Turing committed at 17:12

Grace Hopper

Grace Hopper committed at 09:12

Verified

Sunday 4 October

Margaret Hamilton

Margaret Hamilton committed at 16:12

Props
tsx
<CommitList commits={commits} locale="en-GB" />

Examples

Grouped history

API

Generated from the source, so it cannot fall behind the code. One table per exported component, then hooks, functions and types.

CommitList

A list of commits, grouped by day.

Extends Omit<ComponentProps<'div'>, 'onSelect'>.

PropTypeDefaultDescription
commitsCommit[]required{ sha, message, author, date, status?, verified?, additions?, deletions?, body? }
localestring'en-GB'Drives the date headings and times through Intl.
onSelect(sha: string) => void—Fires from both the message and the short-sha button.
verifiedLabelReactNode'Verified'Badge on a signed commit.

Types

Commit

FieldTypeDescription
shastring—
messagestring—
authorstring—
dateDateAny date-ish value; grouped by local day.
status?'passed' | 'failed' | 'running'—
verified?boolean—
additions?number—
deletions?number—
body?ReactNode—

Behaviour

TopicDetailDescription
groupingby local dayOrder within a day is preserved exactly as given — the component groups, it never re-sorts.