diff --git a/src/components/Command.svelte b/src/components/Command.svelte new file mode 100644 index 000000000..472dc5bdb --- /dev/null +++ b/src/components/Command.svelte @@ -0,0 +1,37 @@ + + + + +
+ clipboard.copy()} + styleBackgroundColor="var(--color-background-float)" + styleCursor="pointer" + styleJustifyContent="space-between" + stylePadding="0.25rem 0.5rem" + {styleWidth} + variant="ghost"> + $ {command} + + +
diff --git a/src/components/Icon.svelte b/src/components/Icon.svelte index 9fd61d82d..105486cc1 100644 --- a/src/components/Icon.svelte +++ b/src/components/Icon.svelte @@ -17,6 +17,7 @@ | "broom" | "broom-double" | "checkmark" + | "checkout" | "chevron-down" | "chevron-right" | "clock" @@ -237,6 +238,20 @@ + {:else if name === "checkout"} + + + + + + + + + + + + + {:else if name === "chevron-down"} diff --git a/src/views/repo/Patch.svelte b/src/views/repo/Patch.svelte index 2ce7a9f35..6059f4ada 100644 --- a/src/views/repo/Patch.svelte +++ b/src/views/repo/Patch.svelte @@ -28,6 +28,8 @@ import AssigneeInput from "@app/components/AssigneeInput.svelte"; import Border from "@app/components/Border.svelte"; + import Button from "@app/components/Button.svelte"; + import Command from "@app/components/Command.svelte"; import CopyableId from "@app/components/CopyableId.svelte"; import DropdownList from "@app/components/DropdownList.svelte"; import DropdownListItem from "@app/components/DropdownListItem.svelte"; @@ -77,6 +79,7 @@ let cursor: number = $state(0); let more: boolean = $state(false); let patchTeasers: Patch[] = $state([]); + let checkoutPopoverExpanded = $state(false); let patches = $state(initialPatches); let status = $state(initialStatus); @@ -105,6 +108,13 @@ more = patches.more; }); + const checkoutCommand = $derived.by(() => { + if (tab === "revisions" && selectedRevision.id !== patch.id) { + return `rad patch checkout ${formatOid(patch.id)} --revision ${formatOid(selectedRevision.id)}`; + } else { + return `rad patch checkout ${formatOid(patch.id)}`; + } + }); const project = $derived(repo.payloads["xyz.radicle.project"]!); async function editTitle(rid: string, patchId: string, title: string) { @@ -609,13 +619,43 @@ - {#if roles.isDelegateOrAuthor( config.publicKey, repo.delegates.map(delegate => delegate.did), patch.author.did, )} -
- (editingTitle = !editingTitle)} /> -
- {/if} +
+ {#if roles.isDelegateOrAuthor( config.publicKey, repo.delegates.map(delegate => delegate.did), patch.author.did, )} +
+ (editingTitle = !editingTitle)} /> +
+ {/if} + + + {#snippet toggle(onclick)} + + {/snippet} + {#snippet popover()} + + To checkout this patch in your working copy, run: + + + {/snippet} + +
{/if}