Files
radicle-explorer/src/views/projects/DiffStatBadgeLoader.svelte
T
Rūdolfs Ošiņš 698a833e42 Overhaul app responsiveness
We introduce more breakpoints to cover mobile, small-desktop,
medium-desktop and large-desktop viewports.
2024-05-06 16:43:05 +02:00

49 lines
1.2 KiB
Svelte

<script lang="ts">
import type { BaseUrl, Patch, Revision } from "@httpd-client";
import { HttpdClient } from "@httpd-client";
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 projectId: string;
export let baseUrl: BaseUrl;
export let patch: Patch;
export let latestRevision: Revision;
$: diffPromise = api.project.getDiff(
projectId,
latestRevision.base,
latestRevision.oid,
);
const api = new HttpdClient(baseUrl);
</script>
{#await diffPromise}
<Loading small />
{:then { diff }}
<Link
title="Compare {formatCommit(latestRevision.base)}..{formatCommit(
latestRevision.oid,
)}"
route={{
resource: "project.patch",
project: projectId,
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}