mirror of
https://seed.radicle.dev/rad:z4D5UCArafTzTQpDZNQRuqswh3ury.git
synced 2026-11-21 10:40:41 +08:00
Allow seeding a missing repo from a reference
Following a link to a repo we don't have only led to the explorer, but the reason it's missing is usually that we haven't seeded it yet. A deep link that can't be opened now says so instead of doing nothing.
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
import type { Config } from "@bindings/config/Config";
|
||||
|
||||
import { writeToClipboard } from "@app/lib/invoke";
|
||||
import { seedRepo } from "@app/lib/seedRepo";
|
||||
import { explorerHost } from "@app/lib/utils";
|
||||
|
||||
import ContextMenu from "@app/components/ContextMenu.svelte";
|
||||
@@ -35,33 +36,37 @@
|
||||
x: number;
|
||||
y: number;
|
||||
target: HTMLElement;
|
||||
url: string;
|
||||
url?: string;
|
||||
uri: string;
|
||||
/** A repo that isn't on this node, offered for seeding. */
|
||||
seedRid?: string;
|
||||
config: Config;
|
||||
onclose: () => void;
|
||||
}
|
||||
|
||||
const { x, y, target, url, uri, config, onclose }: Props = $props();
|
||||
const { x, y, target, url, uri, seedRid, config, onclose }: Props = $props();
|
||||
</script>
|
||||
|
||||
<ContextMenu {x} {y} {target} {onclose}>
|
||||
<a
|
||||
class="menu-item"
|
||||
role="menuitem"
|
||||
href={url}
|
||||
target="_blank"
|
||||
rel="noreferrer noopener">
|
||||
<Icon name="open-external" />
|
||||
Open in {explorerHost(config)}
|
||||
</a>
|
||||
<button
|
||||
class="menu-item"
|
||||
role="menuitem"
|
||||
onclick={() => writeToClipboard(url)}>
|
||||
<Icon name="link" />
|
||||
Copy link to {explorerHost(config)}
|
||||
</button>
|
||||
<div class="menu-separator"></div>
|
||||
{#if url}
|
||||
<a
|
||||
class="menu-item"
|
||||
role="menuitem"
|
||||
href={url}
|
||||
target="_blank"
|
||||
rel="noreferrer noopener">
|
||||
<Icon name="open-external" />
|
||||
Open in {explorerHost(config)}
|
||||
</a>
|
||||
<button
|
||||
class="menu-item"
|
||||
role="menuitem"
|
||||
onclick={() => writeToClipboard(url)}>
|
||||
<Icon name="link" />
|
||||
Copy link to {explorerHost(config)}
|
||||
</button>
|
||||
<div class="menu-separator"></div>
|
||||
{/if}
|
||||
<button
|
||||
class="menu-item"
|
||||
role="menuitem"
|
||||
@@ -69,4 +74,14 @@
|
||||
<Icon name="copy" />
|
||||
Copy rad: URI
|
||||
</button>
|
||||
{#if seedRid}
|
||||
<div class="menu-separator"></div>
|
||||
<button
|
||||
class="menu-item"
|
||||
role="menuitem"
|
||||
onclick={() => void seedRepo(seedRid).catch(console.error)}>
|
||||
<Icon name="seed" />
|
||||
Seed repository
|
||||
</button>
|
||||
{/if}
|
||||
</ContextMenu>
|
||||
|
||||
Reference in New Issue
Block a user