Something went wrong. Try again.
Monorepo for Tangled forked from tangled.org/core
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071<script lang="ts"> import type { Snippet } from "svelte"; import Layers from "$icon/layers"; import Circle from "$icon/circle"; import type { CommitSummary } from "$lib/components/repo/types"; 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"; import Separator from "$lib/components/ui/Separator.svelte"; 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 isInterdiff = $derived(!!versionRange && versionRange.start != versionRange.end);
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-2 px-3 py-1"> <Layers class="size-4" /> {#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="gray" size="regular">{count}</Tag> {#if isInterdiff} <Tag icon={Circle} color="highlight" size="regular">Interdiff</Tag> {/if} </div> <div class="flex gap-2"> {@render actions?.()} {#if versions && versionRange} <Separator orientation="vertical" class="first:hidden" /> <PullVersionList {versions} range={versionRange} oncommit={oncommitVersions} /> {/if} </div></div>