mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-15 19:30:38 +08:00
Show patch id as well as revision id in breadcrumbs
This commit is contained in:
@@ -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
@@ -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}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user