Something went wrong. Try again.
Monorepo for Tangled forked from tangled.org/core
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263<script lang="ts"> import type { Snippet } from "svelte"; import Layers from "$icon/layers"; import type { CommitSummary } from "#lib/components/repo/types.ts"; import Tag from "#lib/components/ui/Tag.svelte"; import PullVersionList from "#lib/components/repo/pulls/PullVersionList.svelte"; import { type Range } from "#lib/components/ui/RangeSelector.svelte"; import type { PullSubmission } from "#lib/api/index.ts"; import TextSwap from "#lib/components/ui/TextSwap.svelte";
interface Props { commits: CommitSummary[]; versions?: PullSubmission[]; versionRange?: Range; oncommitVersions?: (range: Range) => void; showChangeIds?: boolean; actions?: Snippet; }
let { versions, commits, versionRange, oncommitVersions, showChangeIds = $bindable(true), actions }: Props = $props();
const hasChangeIds = $derived(commits.some((commit) => commit.changeId !== undefined));
// several commits can carry one change id, so the two counts differ const count = $derived( showChangeIds ? new Set(commits.map((commit) => commit.changeId ?? commit.hash)).size : commits.length );</script>
<div class="flex justify-between"> <div class="flex items-center gap-xs px-sm py-2xs"> <Layers class="size-3.5" /> {#if hasChangeIds} <button type="button" class="cursor-pointer" title={showChangeIds ? "Show commit hashes" : "Show change IDs"} onclick={() => (showChangeIds = !showChangeIds)} > <TextSwap value={showChangeIds ? "Changes" : "Commits"} /> </button> {:else} <span>Commits</span> {/if} <Tag color="inset">{count}</Tag> </div> <div class="flex gap-xs"> {@render actions?.()} {#if versions && versionRange} <PullVersionList {versions} range={versionRange} oncommit={oncommitVersions} /> {/if} </div></div>