mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-12-01 03:00:27 +08:00
41 lines
1.1 KiB
Svelte
41 lines
1.1 KiB
Svelte
<script lang="ts">
|
|
import type { BaseUrl, Patch, Revision } from "@http-client";
|
|
|
|
import { cachedGetDiff } from "@app/views/projects/router";
|
|
import { formatCommit } from "@app/lib/utils";
|
|
|
|
import DiffStatBadge from "@app/components/DiffStatBadge.svelte";
|
|
import Link from "@app/components/Link.svelte";
|
|
import Loading from "@app/components/Loading.svelte";
|
|
|
|
export let repoId: string;
|
|
export let baseUrl: BaseUrl;
|
|
export let patch: Patch;
|
|
export let latestRevision: Revision;
|
|
</script>
|
|
|
|
{#await cachedGetDiff(baseUrl, repoId, latestRevision.base, latestRevision.oid)}
|
|
<Loading small />
|
|
{:then { diff }}
|
|
<Link
|
|
title="Compare {formatCommit(latestRevision.base)}..{formatCommit(
|
|
latestRevision.oid,
|
|
)}"
|
|
route={{
|
|
resource: "repo.patch",
|
|
repo: repoId,
|
|
node: baseUrl,
|
|
patch: patch.id,
|
|
view: {
|
|
name: "diff",
|
|
fromCommit: latestRevision.base,
|
|
toCommit: latestRevision.oid,
|
|
},
|
|
}}>
|
|
<DiffStatBadge
|
|
hoverable
|
|
insertions={diff.stats.insertions}
|
|
deletions={diff.stats.deletions} />
|
|
</Link>
|
|
{/await}
|