Blame View
Every line attributed to the commit that last touched it. Consecutive lines from one commit collapse into a single gutter entry — a blame view that repeats itself hides where one commit ends and the next begins.
src/components/ui/blame-view.tsxAbout
From the component's own source, where it was written.
Git blame: every line attributed to the commit that last touched it.
Consecutive lines from the same commit collapse into one gutter entry rather than repeating the author on all forty. A blame view that repeats itself is unreadable, and the repetition hides exactly the thing you are looking for — where one commit's territory ends and the next begins.
Age is shown as a colour ramp on the gutter edge, so "what is old and stable versus new and suspect" is answerable without reading a single date.
Install
npx astralyx-ui add blame-view
Usage
import { BlameView } from '@/components/ui/blame-view'
<BlameView lines={lines} onSelectCommit={openCommit} />Composer
Change the props and the source below follows.
export const controlSize = { xs: 'h-7 gap-1.5 px-3.5 text-xs', sm: 'h-8 gap-1.5 px-3.5 text-sm', md: 'h-9 gap-2 px-4.5 text-sm', lg: 'h-10 gap-2 px-6 text-sm',} as const<BlameView lines={lines} onSelectCommit={openCommit} />Examples
Attribution
<BlameView lines={lines} />API
Generated from the source, so it cannot fall behind the code. One table per exported component, then hooks, functions and types.
BlameView
Extends Omit<ComponentProps<'div'>, 'onSelect'>.
| Prop | Type | Default | Description |
|---|---|---|---|
| lines | BlameLine[] | required | { line, content, sha, author, date, summary? }, in file order. |
| now | Date | — | — |
| onSelectCommit | (sha: string) => void | — | Each gutter entry is a button. |
Types
BlameLine
Git blame: every line attributed to the commit that last touched it.
| Field | Type | Description |
|---|---|---|
| line | number | — |
| content | string | — |
| sha | string | — |
| author | string | — |
| date | Date | — |
| summary? | string | — |
Behaviour
| Topic | Detail | Description |
|---|---|---|
| grouping | automatic | Runs of one commit share a gutter entry; the rest of the run is blank. |
| age ramp | gutter edge | Newer commits are hotter, so "old and stable versus new and suspect" is answerable without reading a date. |