Something went wrong. Try again.
Monorepo for Tangled forked from tangled.org/core
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273<script lang="ts"> import ShieldCheck from "$icon/shield-check"; import type { VerifiedSignature } from "#lib/components/repo/commitSignature.ts"; import CopyButton from "#lib/components/ui/CopyButton.svelte"; import Tooltip from "#lib/components/ui/Tooltip.svelte"; import { uniquePrefixLength } from "#lib/format.ts"; import { shiftKey } from "#lib/shiftKey.svelte.ts";
interface Props { hash: string; shortHash: string; changeId?: string; changeIds?: string[]; signature?: VerifiedSignature; full?: boolean; }
let { hash, shortHash, changeId, changeIds = [], signature, full = false }: Props = $props();
const shortChangeId = $derived(shiftKey.held ? changeId?.slice(0, 8) : undefined); const prefix = $derived(changeId ? uniquePrefixLength(changeId, changeIds) : 0); const target = $derived(shortChangeId ? "change ID" : "SHA");</script>
{#snippet signed()} <span class="flex flex-col gap-2xs"> <span class="font-medium">Verified signature</span> {#if signature?.committer} <span>Signed by {signature.committer}</span> {/if} {#if signature?.fingerprint} <span class="typography-monospace-small break-all opacity-80" >{signature.fingerprint}</span > {/if} <span class="opacity-80">Click to copy {target}</span> </span>{/snippet}
<Tooltip content={signature ? signed : `Copy ${target}`}> <CopyButton value={shortChangeId && changeId ? changeId : hash} aria-label={shortChangeId ? `Copy change ID ${shortChangeId}` : `Copy SHA ${shortHash}${signature ? ", verified signature" : ""}`} class={signature ? "min-h-5 bg-background-success-subtle py-0 typography-monospace-small text-foreground-success-strong hover:bg-background-success-subtle-hover" : "typography-monospace-small"} > <span class="flex items-center gap-2xs"> {#if signature} <ShieldCheck class="size-3.5 shrink-0" aria-hidden="true" /> {/if} {#if shortChangeId} <span ><span class="font-[500] text-foreground-default" >{shortChangeId.slice(0, prefix)}</span ><span class="text-foreground-muted">{shortChangeId.slice(prefix)}</span></span > {:else if full} <span class={["sm:hidden", shiftKey.held && "text-foreground-subtle"]} >{shortHash}</span > <span class={["hidden sm:inline", shiftKey.held && "text-foreground-subtle"]} >{hash}</span > {:else} <span class={[shiftKey.held && "text-foreground-subtle"]}>{shortHash}</span> {/if} </span> </CopyButton></Tooltip>