Something went wrong. Try again.
Monorepo for Tangled forked from tangled.org/core
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131<script lang="ts"> import RevIdButton from "#lib/components/repo/pulls/RevIdButton.svelte"; import CommitBodyToggle from "#lib/components/repo/CommitBodyToggle.svelte"; import DiffStatPill from "#lib/components/repo/DiffStatPill.svelte"; import MessageSquare from "$icon/message-square"; import type { CommitStatuses } from "#lib/api/commitStatuses.ts"; import ProfilePopover from "#lib/components/profile/ProfilePopover.svelte"; import Avatar from "#lib/components/ui/Avatar.svelte"; import PipelineWorkflows from "#lib/components/repo/pipelines/PipelineWorkflows.svelte"; import type { CommitSummary } from "#lib/components/repo/types.ts";
interface Props { ownerHandle: string; repoName: string; commit: CommitSummary; pipelineStatuses?: Promise<CommitStatuses>; showAvatar?: boolean; /** reserve the change id column even when this commit has none */ showChangeId?: boolean; onclick?: (event: MouseEvent) => void; onpointerenter?: () => void; onpointerleave?: () => void; }
let { ownerHandle, repoName, commit, pipelineStatuses, showAvatar = true, showChangeId = false, onclick, onpointerenter, onpointerleave }: Props = $props();
let expanded = $state(false);
const hasBody = $derived(commit.body.trim() !== "");</script>
<div role="none" {onpointerenter} {onpointerleave} class="relative grid min-h-10 flex-1 grid-cols-[minmax(0,1fr)] gap-x-xs pr-sm sm:grid-cols-[auto_minmax(0,1fr)_6rem]"> {#if onclick} <button data-testid="commitRow" data-hash={commit.hash} type="button" class="absolute inset-x-0 top-0 h-10 cursor-pointer" aria-label="Show changes in {commit.shortHash}" {onclick} ></button> {/if} <div class="col-start-1 row-start-1 hidden h-10 items-center gap-2xs sm:flex"> <RevIdButton id={commit.hash} /> {#if commit.changeId} <RevIdButton id={commit.changeId} kind="change-id" /> {:else if showChangeId} <div class="invisible"> <RevIdButton id={commit.hash} kind="change-id" /> </div> {/if} </div> <div class="pointer-events-none relative col-start-1 row-start-1 flex h-10 min-w-0 items-center gap-xs sm:col-start-2" > {#if showAvatar} {#if commit.authorHandle && commit.authorDid} <ProfilePopover identifier={commit.authorDid}> <Avatar did={commit.authorDid} handle={commit.authorHandle} size="large" class="pointer-events-auto cursor-pointer" /> </ProfilePopover> {:else} <Avatar handle={commit.authorName} size="large" /> {/if} {/if} {#if commit.subject.trim()} <span class="min-w-0 truncate">{commit.subject}</span> {:else} <span class="min-w-0 truncate text-foreground-subtle italic">Empty commit message</span> {/if} {#if hasBody} <CommitBodyToggle class="pointer-events-auto hidden sm:block" {expanded} onclick={() => (expanded = !expanded)} /> {/if} {#if pipelineStatuses} {#await pipelineStatuses then statuses} {#if statuses[commit.hash]} <div class="pointer-events-auto hidden shrink-0 sm:block"> <PipelineWorkflows {ownerHandle} {repoName} size="mini" variant="symbol" pipeline={statuses[commit.hash]} /> </div> {/if} {/await} {/if} </div> <div class="pointer-events-none relative col-start-3 row-start-1 hidden h-10 items-center justify-end gap-sm sm:flex" > {#if commit.commentCount} <div class="flex items-center gap-2xs text-foreground-muted"> <span>{commit.commentCount}</span> <MessageSquare class="size-3.5" /> </div> {/if} {#if commit.stat} <DiffStatPill stat={commit.stat} size="small" /> {/if} </div> {#if hasBody && expanded} <pre class="col-span-2 col-start-2 row-start-2 mb-xs hidden typography-monospace-regular wrap-anywhere whitespace-pre-wrap sm:block">{commit.body}</pre> {/if}</div>