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.tsx

About

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.

68export const controlSize = {
69 xs: 'h-7 gap-1.5 px-3.5 text-xs',
70 sm: 'h-8 gap-1.5 px-3.5 text-sm',
71 md: 'h-9 gap-2 px-4.5 text-sm',
72 lg: 'h-10 gap-2 px-6 text-sm',
73} as const
Props
tsx
<BlameView lines={lines} onSelectCommit={openCommit} />

Examples

Attribution

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'>.

PropTypeDefaultDescription
linesBlameLine[]required{ line, content, sha, author, date, summary? }, in file order.
nowDate——
onSelectCommit(sha: string) => void—Each gutter entry is a button.

Types

BlameLine

Git blame: every line attributed to the commit that last touched it.

FieldTypeDescription
linenumber—
contentstring—
shastring—
authorstring—
dateDate—
summary?string—

Behaviour

TopicDetailDescription
groupingautomaticRuns of one commit share a gutter entry; the rest of the run is blank.
age rampgutter edgeNewer commits are hotter, so "old and stable versus new and suspect" is answerable without reading a date.