explorer: Add a download button to the clone popover

The Download tab only offered a curl command. Add a button that links
to the same archive URL so people without a terminal can download the
source.
This commit is contained in:
Brandon Oxendine
2026-11-03 14:39:33 +01:00
committed by Rūdolfs Ošiņš
parent 9c790a7d1c
commit ede901bc4f
2 changed files with 32 additions and 7 deletions
+28 -5
View File
@@ -1,9 +1,11 @@
<script lang="ts">
import Clipboard from "@app/components/Clipboard.svelte";
import Icon from "@app/components/Icon.svelte";
export let command: string;
export let fullWidth: boolean = false;
export let showPrompt: boolean = true;
export let downloadHref: string | undefined = undefined;
let clipboard: Clipboard;
</script>
@@ -31,16 +33,25 @@
border: 1px solid var(--color-border-mid);
color: var(--color-text-primary);
}
.clipboard {
.with-download {
padding-right: 3.5rem;
}
.actions {
display: flex;
align-items: center;
justify-content: center;
position: absolute;
right: 0;
right: 0.25rem;
top: 0;
width: 2rem;
height: 100%;
}
.download {
width: 1.5rem;
height: 1.5rem;
display: inline-flex;
justify-content: center;
align-items: center;
color: inherit;
}
.full-width.wrapper,
.full-width.cmd {
@@ -55,6 +66,7 @@
tabindex="0"
class="cmd"
class:full-width={fullWidth}
class:with-download={downloadHref}
on:click={() => {
clipboard.copy();
}}>
@@ -62,7 +74,18 @@
{#if showPrompt}${/if}
{command}
</div>
<div class="clipboard">
<div class="actions">
{#if downloadHref}
<a
class="download"
href={downloadHref}
download
aria-label="Download"
title="Download"
on:click|stopPropagation>
<Icon name="download" />
</a>
{/if}
<Clipboard bind:this={clipboard} text={command} />
</div>
</div>
@@ -40,7 +40,7 @@
baseUrl.port === config.nodes.defaultHttpdPort
? ""
: `:${baseUrl.port}`;
$: archiveUrl = `curl -OJ ${baseUrl.scheme}://${baseUrl.hostname}${portFragment}/raw/${alias ?? id}/archive/${currentRefname}`;
$: archiveUrl = `${baseUrl.scheme}://${baseUrl.hostname}${portFragment}/raw/${alias ?? id}/archive/${currentRefname}`;
$: gitCloneUrl = `git clone ${baseUrl.scheme}://${
baseUrl.hostname
}${portFragment}/${alias ?? parseRepositoryId(id)?.pubkey ?? id}.git ${name}`;
@@ -127,7 +127,9 @@
If you don’t have Radicle installed, you can still download an
archive of the repository.
</label>
<Command command={archiveUrl} />
<Command
command={`curl -OJ ${archiveUrl}`}
downloadHref={archiveUrl} />
<div style:margin-top="1.5rem">
Note that a compressed archive of the source code does not include
any of the social artifacts such as issues or patches nor the git