Show patch id as well as revision id in breadcrumbs

This commit is contained in:
Rūdolfs Ošiņš
2025-05-22 14:19:35 +02:00
parent 8f31b5673d
commit 43989e53ba
2 changed files with 36 additions and 17 deletions
+26 -4
View File
@@ -4,18 +4,22 @@
import { writeToClipboard } from "@app/lib/invoke";
import debounce from "lodash/debounce";
import Icon from "@app/components/Icon.svelte";
import Popover, { closeFocused } from "@app/components/Popover.svelte";
import DropdownListItem from "@app/components/DropdownListItem.svelte";
import { closeFocused } from "@app/components/Popover.svelte";
import Border from "@app/components/Border.svelte";
import DropdownListItem from "@app/components/DropdownListItem.svelte";
import Icon from "@app/components/Icon.svelte";
import Popover from "@app/components/Popover.svelte";
interface Props {
icon: ComponentProps<typeof Icon>["name"];
id: string;
url: string;
id2?: string;
icon2?: ComponentProps<typeof Icon>["name"];
}
const { icon, id, url }: Props = $props();
const { icon, icon2, id, id2, url }: Props = $props();
let popoverExpanded: boolean = $state(false);
let triggerIcon: ComponentProps<typeof Icon>["name"] = $state("copy");
@@ -54,6 +58,24 @@
<Icon name="copy" />
</div>
</DropdownListItem>
{#if id2 && icon2}
<DropdownListItem
styleGap="0.5rem"
selected={false}
onclick={async () => {
await writeToClipboard(id2);
triggerIcon = "checkmark";
restoreIcon();
closeFocused();
}}
styleWidth="100%">
<div class="global-flex" style:width="100%">
<Icon name={icon2} />
{id2}
<Icon name="copy" />
</div>
</DropdownListItem>
{/if}
<a
style:text-decoration="none"
style:width="100%"
+10 -13
View File
@@ -294,15 +294,6 @@
all: true,
}),
);
function breadcrumbIcon() {
if (selectedRevision.id === revisions[0].id || tab === "patch") {
return patch.state.status === "open"
? ("patch" as const)
: (`patch-${patch.state.status}` as const);
} else {
return "revision";
}
}
function breadcrumbTitle() {
if (tab === "patch") {
if (revisions[0].description.slice(-1)[0].body.trim() === "") {
@@ -440,10 +431,16 @@
</span>
<BreadcrumbCopyButton
url={explorerUrl(`${repo.rid}/patches/${patch.id}`)}
icon={breadcrumbIcon()}
id={revisions[0].id === selectedRevision.id || tab === "patch"
? patch.id
: selectedRevision.id} />
icon={patch.state.status === "open"
? "patch"
: `patch-${patch.state.status}`}
id={patch.id}
icon2={revisions.length > 1 ? "revision" : undefined}
id2={revisions.length > 1 &&
selectedRevision.id !== revisions[0].id &&
tab !== "patch"
? selectedRevision.id
: undefined} />
{/if}
{/snippet}