Add Releases and Release views

- Add the Releases list and Release page
- Add modals to create, delete and redact releases
- Register artifacts and add or remove their locations
- Download, seed and unseed artifacts from the release page
- Share one artifact node state and show its status
- Pick the release commit from a list
- Rename Stop seeding to Unseed

Co-authored-by: Daniel Norman <daniel@norman.life>
Co-authored-by: Rūdolfs Ošiņš <rudolfs@osins.org>
This commit is contained in:
Brandon Oxendine
2026-10-08 18:21:48 +02:00
committed by Rūdolfs Ošiņš
co-authored by Daniel Norman Rūdolfs Ošiņš
parent 837766212e
commit 595a81150b
41 changed files with 6235 additions and 137 deletions
+2
View File
@@ -37,6 +37,7 @@
import useLocalStorage from "@app/lib/useLocalStorage.svelte";
import { isMac } from "@app/lib/utils";
import ArtifactNodeStatusButton from "@app/components/ArtifactNodeStatusButton.svelte";
import { badgeCounter } from "@app/components/BadgeCounterSwitch.svelte";
import Button from "@app/components/Button.svelte";
import Icon from "@app/components/Icon.svelte";
@@ -718,6 +719,7 @@
<span class="update-badge">New Update</span>
{/if}
</Button>
<ArtifactNodeStatusButton />
<NodeStatusButton />
</div>
</div>
@@ -0,0 +1,410 @@
<script lang="ts">
import type { ArtifactProgress } from "@bindings/artifact/ArtifactProgress";
import type { Artifact } from "@bindings/cob/release/Artifact";
import type { UnlistenFn } from "@tauri-apps/api/event";
import { listen } from "@tauri-apps/api/event";
import { artifactNodeRunning } from "@app/lib/events";
import { invoke } from "@app/lib/invoke";
import * as releases from "@app/lib/releases";
import { formatBytes } from "@app/lib/utils";
import Button from "@app/components/Button.svelte";
import Checkbox from "@app/components/Checkbox.svelte";
import Command from "@app/components/Command.svelte";
import DelegateBadge from "@app/components/DelegateBadge.svelte";
import ExternalLink from "@app/components/ExternalLink.svelte";
import Icon from "@app/components/Icon.svelte";
import Popover from "@app/components/Popover.svelte";
interface Props {
artifact: Artifact;
delegateIds: Set<string>;
releaseId: string;
rid: string;
/// Whether the node already seeds this artifact, asked of the node rather
/// than assumed from what this component did.
seeding: boolean;
onDownloaded: () => void;
}
const {
artifact,
delegateIds,
releaseId,
rid,
seeding,
onDownloaded,
}: Props = $props();
let activeTab: "app" | "cli" | "browser" = $state("app");
let expanded = $state(false);
// Which transfer is running: a download writes to disk, a fetch only fills
// the node's store.
let running: "download" | "fetch" | undefined = $state();
let progress: ArtifactProgress | undefined = $state();
let downloadError: string | undefined = $state();
let finished: "download" | "fetch" | undefined = $state();
let seed = $state(true);
$effect(() => {
if (seeding) {
seed = true;
}
});
// Clear the outcome of a finished download once the popover closes, so a
// later visit starts fresh.
$effect(() => {
if (!expanded && !running) {
finished = undefined;
downloadError = undefined;
}
});
// The node reports byte movement per CID, so a shared event channel
// is filtered down to this artifact.
$effect(() => {
// Events only exist under Tauri, not against the test HTTP API.
if (!window.__TAURI_INTERNALS__) {
return;
}
let unlisten: UnlistenFn | undefined;
let cancelled = false;
void listen<ArtifactProgress>("artifact_progress", event => {
if (event.payload.cid === artifact.cid) {
progress = event.payload;
}
}).then(fn => {
if (cancelled) {
fn();
} else {
unlisten = fn;
}
});
return () => {
cancelled = true;
unlisten?.();
};
});
const percent = $derived.by(() => {
if (!progress?.total || progress.offset === undefined) {
return undefined;
}
return Math.min(100, Math.round((progress.offset / progress.total) * 100));
});
const phaseLabel = $derived.by(() => {
switch (progress?.phase) {
case "connecting":
return "Connecting…";
case "tryingLocation":
return "Trying a location…";
case "locationFailed":
return "Location failed, trying another…";
case "downloading":
return "Downloading…";
case "exporting":
return "Writing to disk…";
default:
return "Starting…";
}
});
async function transfer(kind: "download" | "fetch") {
downloadError = undefined;
finished = undefined;
running = kind;
progress = undefined;
try {
const done = await invoke<boolean>("download_artifact", {
rid,
releaseId,
cid: artifact.cid,
saveAs: kind === "download" ? artifact.name : undefined,
seed,
});
if (!done) {
return;
}
finished = kind;
// Seeding is the node's state, not ours; ask what actually happened.
onDownloaded();
} catch {
downloadError = `${kind === "download" ? "Download" : "Fetch"} failed. The artifact node may be offline, or no location is reachable.`;
} finally {
running = undefined;
progress = undefined;
}
}
const webLocations = $derived(
releases.webLocations(artifact.locations, delegateIds),
);
// Any location at all can be fetched with the CLI, web locations included.
const downloadable = $derived(seeding || artifact.locations.length > 0);
const downloadLabel = $derived(seeding ? "Save" : "Download");
// The app and CLI tabs fetch through the artifact node, so they are only
// usable while it answers. The browser tab does not need it.
const nodeRunning = $derived($artifactNodeRunning);
const START_COMMAND = "rad-artifact node start";
const command = $derived(
`rad-artifact download --cid ${artifact.cid} --repo ${rid} --seed`,
);
</script>
<style>
.popover {
width: 24rem;
padding: 1rem;
border: 1px solid var(--color-border-subtle);
border-radius: var(--border-radius-sm);
background-color: var(--color-surface-canvas);
font: var(--txt-body-m-regular);
}
.start-command {
margin-bottom: 0.75rem;
}
.tabs {
display: flex;
gap: 2px;
margin-bottom: 1rem;
}
label {
display: block;
margin-bottom: 0.75rem;
color: var(--color-text-secondary);
}
.warning {
display: flex;
align-items: center;
gap: 0.5rem;
margin-bottom: 0.75rem;
color: var(--color-feedback-warning-text);
}
.locations {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.location {
display: flex;
align-items: center;
gap: 0.5rem;
min-width: 0;
}
.url {
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: var(--color-text-secondary);
}
.progress-track {
height: 0.25rem;
border-radius: var(--border-radius-sm);
background-color: var(--color-surface-subtle);
overflow: hidden;
margin-top: 0.5rem;
}
.progress-bar {
height: 100%;
background-color: var(--color-fill-secondary);
transition: width 0.1s linear;
}
.status {
display: flex;
align-items: center;
justify-content: space-between;
gap: 0.5rem;
margin-top: 0.5rem;
color: var(--color-text-tertiary);
font: var(--txt-body-s-regular);
}
.error {
margin-top: 0.75rem;
color: var(--color-foreground-red);
font: var(--txt-body-s-regular);
}
.success {
display: flex;
align-items: center;
gap: 0.5rem;
margin-top: 0.75rem;
color: var(--color-foreground-success);
font: var(--txt-body-s-regular);
}
.actions {
display: flex;
gap: 0.5rem;
}
.seed-option {
margin-top: 0.75rem;
}
</style>
<Popover placement="bottom-end" popoverPadding="0" bind:expanded>
{#snippet toggle(onclick)}
<Button
{onclick}
styleHeight="1.75rem"
disabled={!downloadable}
title={downloadable
? undefined
: "This artifact has no location to download from"}>
<Icon name="download" />{downloadLabel}
</Button>
{/snippet}
{#snippet popover()}
<div class="popover">
<div class="tabs">
<Button
styleWidth="100%"
flatRight
bordered
active={activeTab === "app"}
onclick={() => (activeTab = "app")}>
<Icon name="download" />App
</Button>
<Button
styleWidth="100%"
bordered
flatLeft
flatRight
active={activeTab === "cli"}
onclick={() => (activeTab = "cli")}>
<Icon name="logo" />CLI
</Button>
<Button
styleWidth="100%"
flatLeft
bordered
disabled={webLocations.length === 0}
title={webLocations.length === 0
? "This artifact has no web locations"
: undefined}
active={activeTab === "browser"}
onclick={() => (activeTab = "browser")}>
<Icon name="open-external" />Browser
</Button>
</div>
{#if activeTab === "app"}
<label for="download-artifact">
{#if nodeRunning === false}
Your artifact node is not running, so nothing can be downloaded
here. Start it with:
{:else if seeding}
Save a copy of the file from your artifact node's store.
{:else}
Download through your artifact node, which checks what arrives
against the CID. Fetch only adds it to the node's store.
{/if}
</label>
{#if nodeRunning === false}
<div class="start-command">
<Command command={START_COMMAND} styleWidth="100%" />
</div>
{/if}
<div class="actions">
<Button
styleWidth="100%"
disabled={running !== undefined || nodeRunning === false}
title={nodeRunning === false
? "Your artifact node is not running"
: undefined}
onclick={() => transfer("download")}>
<Icon name="download" />
{running === "download"
? seeding
? "Saving…"
: "Downloading…"
: downloadLabel}
</Button>
{#if !seeding}
<Button
styleWidth="100%"
disabled={running !== undefined || nodeRunning === false}
title={nodeRunning === false
? "Your artifact node is not running"
: "Fetch into your artifact node's store without saving a file"}
onclick={() => transfer("fetch")}>
<Icon name="arrow-down" />
{running === "fetch" ? "Fetching…" : "Fetch"}
</Button>
{/if}
</div>
{#if running}
<div class="progress-track">
<div class="progress-bar" style:width="{percent ?? 0}%"></div>
</div>
<div class="status">
<span>{phaseLabel}</span>
{#if progress?.offset !== undefined}
<span>
{formatBytes(progress.offset)}{progress.total
? ` / ${formatBytes(progress.total)}`
: ""}
</span>
{/if}
</div>
{:else if finished}
<div class="success">
<Icon name="checkmark" />
{finished === "download" ? "Saved" : "Fetched"}{seeding
? " and seeding"
: ""}.
</div>
{/if}
{#if downloadError}
<div class="error">{downloadError}</div>
{/if}
{#if !seeding}
<div class="seed-option">
<Checkbox bind:checked={seed}>Seed after fetching</Checkbox>
</div>
{/if}
{:else if activeTab === "cli"}
{#if nodeRunning === false}
<label for="start-command">
Your artifact node is not running. Start it with:
</label>
<div class="start-command">
<Command command={START_COMMAND} styleWidth="100%" />
</div>
{/if}
<label for="download-command">
Use the Radicle Artifact CLI to download this artifact.
</label>
<Command {command} styleWidth="100%" />
{:else}
<div class="warning">
<Icon name="warning" />
These downloads are not checked against the CID.
</div>
<div class="locations">
{#each webLocations as location (`${location.user.did}:${location.url}`)}
<div class="location">
{#if delegateIds.has(location.user.did)}
<DelegateBadge tooltip="Location added by a delegate" />
{/if}
<span class="url" title={location.url}>{location.url}</span>
<ExternalLink href={location.url} title="Download" />
</div>
{/each}
</div>
{/if}
</div>
{/snippet}
</Popover>
@@ -0,0 +1,267 @@
<script lang="ts">
import type { ArtifactBinaries } from "@bindings/artifact/ArtifactBinaries";
import type { ArtifactNodeStatus } from "@bindings/artifact/ArtifactNodeStatus";
import { artifactNodeRunning } from "@app/lib/events";
import { poll } from "@app/lib/interval";
import { invoke } from "@app/lib/invoke";
import { formatBytes, formatUptime } from "@app/lib/utils";
import Button from "@app/components/Button.svelte";
import Command from "@app/components/Command.svelte";
import Icon from "@app/components/Icon.svelte";
import Id from "@app/components/Id.svelte";
import Popover from "@app/components/Popover.svelte";
// Installs both `rad-artifact` and `rad-artifact-node`.
const INSTALL_COMMAND =
"curl -sSf https://files.radicle.dev/releases/radicle-artifact/install | sh";
let popoverExpanded: boolean = $state(false);
const running = $derived($artifactNodeRunning);
let status: ArtifactNodeStatus | undefined = $state();
let binaries: ArtifactBinaries | undefined = $state();
// Undefined while the check is outstanding, so the guidance does not flash
// "install" at someone who has it.
const installed = $derived(
binaries === undefined ? undefined : binaries.cli && binaries.node,
);
$effect(() => {
if (!popoverExpanded) {
return;
}
let cancelled = false;
invoke<ArtifactBinaries>("artifact_binaries")
.then(binaries_ => {
if (!cancelled) {
binaries = binaries_;
}
})
.catch(() => {
if (!cancelled) {
binaries = undefined;
}
});
return () => {
cancelled = true;
};
});
// Cleared on close, so a reopened popover never shows an old snapshot.
$effect(() => {
if (!popoverExpanded) {
status = undefined;
return;
}
return poll(async active => {
try {
const status_ = await invoke<ArtifactNodeStatus>(
"artifact_node_status",
);
if (active()) {
status = status_;
}
} catch {
if (active()) {
status = undefined;
}
}
}, 3000);
});
const uptime = $derived(
status
? formatUptime(Math.max(0, Date.now() / 1000 - status.startedAtUnix))
: undefined,
);
</script>
<style>
.state {
margin-left: auto;
color: var(--color-text-tertiary);
font: var(--txt-body-s-regular);
}
.popover {
display: flex;
flex-direction: column;
gap: 0.75rem;
width: 32rem;
padding: 1rem;
border: 1px solid var(--color-border-subtle);
border-radius: var(--border-radius-sm);
background-color: var(--color-surface-canvas);
font: var(--txt-body-m-regular);
}
.stats {
display: grid;
grid-template-columns: auto 1fr;
gap: 0.375rem 1rem;
}
.key {
color: var(--color-text-tertiary);
white-space: nowrap;
}
.value {
color: var(--color-text-secondary);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.endpoint {
color: var(--color-text-secondary);
word-break: break-all;
}
.list {
display: flex;
flex-direction: column;
gap: 0.25rem;
min-width: 0;
}
.detail {
color: var(--color-text-tertiary);
}
.warning {
display: flex;
align-items: center;
gap: 0.5rem;
color: var(--color-feedback-warning-text);
}
</style>
<Popover
popoverPadding="0"
placement="top-start"
bind:expanded={popoverExpanded}>
{#snippet toggle(onclick)}
<Button
variant="naked"
{onclick}
active={popoverExpanded}
styleWidth="100%"
styleJustifyContent="flex-start">
<span style:color="var(--color-text-tertiary)">
<Icon name="parcel" />
</span>
Artifacts
{#if running !== undefined}
<span class="state">{running ? "Seeding" : "Offline"}</span>
{/if}
</Button>
{/snippet}
{#snippet popover()}
<div class="popover">
{#if status}
{#if status.relayUnreachable}
<div class="warning">
<Icon name="warning" />
No relay connected: peers may not reach this node.
</div>
{/if}
<div class="stats">
<span class="key">Endpoint</span>
<span class="endpoint">
<Id
id={status.endpointId}
clipboard={status.endpointId}
label="endpoint"
shorten={false} />
</span>
<span class="key">Uptime</span>
<span class="value">{uptime}</span>
<span class="key">Seeding</span>
<span class="value">
{status.seededCount}
{status.seededCount === 1 ? "artifact" : "artifacts"}
({formatBytes(status.seededBytesLogical)})
</span>
<span class="key">Store</span>
<span class="endpoint">
<Id
id={status.storePath}
clipboard={status.storePath}
label="store path"
shorten={false} />
</span>
<span class="key">Connections</span>
<span class="value">{status.connectionsActive} active</span>
<span class="key">Traffic</span>
<span class="value">
{formatBytes(status.inBytes)} in, {formatBytes(status.outBytes)} out
</span>
<span class="key">Relay</span>
{#if status.relays[0]}
{@const relay = status.relays[0]}
<span class="list" title={relay.lastError}>
<span class="value">{relay.url}</span>
<span class="detail">
{#if relay.connected}
Connected{relay.latencyMs !== undefined
? `, ${relay.latencyMs}ms`
: ""}
{:else}
Disconnected
{/if}
</span>
</span>
{:else}
<span class="value">None</span>
{/if}
{#if status.pkarrUri}
<span class="key">Pkarr key</span>
<span class="endpoint">
<Id
id={status.pkarrUri}
clipboard={status.pkarrUri}
label="pkarr key"
shorten={false} />
</span>
{/if}
{#if status.pkarrRelays.length > 0}
<span class="key">Pkarr relays</span>
<span class="list">
{#each status.pkarrRelays as relay (relay)}
<span class="endpoint">
<Id
id={relay}
clipboard={relay}
label="pkarr relay"
shorten={false} />
</span>
{/each}
</span>
{/if}
</div>
{:else if running === false && installed !== undefined}
<div style:line-height="1.625rem">
{#if installed}
The artifact node is not running, so artifacts cannot be downloaded
or seeded from this app.
{:else if binaries?.cli}
The artifact seeding daemon is not installed, so artifacts cannot be
downloaded or seeded from this app.
{:else}
The artifact tools are not installed, so artifacts cannot be
downloaded or seeded from this app.
{/if}
<div style:margin-top="1rem">
{installed ? "Start it with:" : "Install them with:"}
<div style:margin-top="0.5rem">
{#if installed}
<Command
styleWidth="fit-content"
command="rad-artifact node start" />
{:else}
<Command styleWidth="100%" command={INSTALL_COMMAND} />
{/if}
</div>
</div>
</div>
{:else}
<span class="value">Checking the artifact node…</span>
{/if}
</div>
{/snippet}
</Popover>
+26
View File
@@ -0,0 +1,26 @@
<script lang="ts">
import Icon from "@app/components/Icon.svelte";
import TooltipBadge from "@app/components/TooltipBadge.svelte";
interface Props {
tooltip?: string;
}
const { tooltip = "Delegate" }: Props = $props();
</script>
<style>
.delegate {
display: inline-flex;
align-items: center;
color: var(--color-text-tertiary);
}
</style>
<TooltipBadge {tooltip} tight>
{#snippet badge()}
<span class="delegate" aria-label={tooltip}>
<Icon name="badge" />
</span>
{/snippet}
</TooltipBadge>
+10 -3
View File
@@ -8,9 +8,16 @@
empty?: Snippet;
items: T[];
styleDropdownMinWidth?: string;
styleDropdownMaxHeight?: string;
}
const { item, empty, items, styleDropdownMinWidth }: Props = $props();
const {
item,
empty,
items,
styleDropdownMinWidth,
styleDropdownMaxHeight = "60vh",
}: Props = $props();
let dropdownElement: HTMLDivElement | undefined = undefined;
@@ -34,7 +41,6 @@
<style>
.dropdown {
align-items: center;
max-height: 60vh;
overflow-y: auto;
}
.dropdown-item {
@@ -46,7 +52,8 @@
<div
class="dropdown"
bind:this={dropdownElement}
style:min-width={styleDropdownMinWidth}>
style:min-width={styleDropdownMinWidth}
style:max-height={styleDropdownMaxHeight}>
{#each items as i}
<div class="dropdown-item">
{@render item(i)}
+4
View File
@@ -87,6 +87,7 @@
| "offline"
| "online"
| "open-external"
| "parcel"
| "patch"
| "patch-archived"
| "patch-draft"
@@ -580,6 +581,9 @@
<path d="M6 2.5V3.5H3.5V12.5H12.5V10H13.5V13.5H2.5V2.5H6Z" />
<path
d="M6.29297 9L11.793 3.5L8.5 3.5L8.5 2.5L13.5 2.5L13.5 7.5L12.5 7.5L12.5 4.20703L7 9.70703L6.29297 9Z" />
{:else if name === "parcel"}
<path
d="M2.5 10.7129L7.5 13.6289V8.78613L2.5 5.87011V10.7129ZM8.5 8.78613V13.6289L13.5 10.7129V5.87011L8.5 8.78613ZM5.99121 6.75L8 7.92089L13.0078 5L11 3.82812L5.99121 6.75ZM2.99121 5L5 6.17089L10.0078 3.25L8 2.07812L2.99121 5ZM14.5 11C14.5 11.1778 14.4055 11.342 14.252 11.4316L8.25195 14.9316C8.09627 15.0224 7.90373 15.0224 7.74805 14.9316L1.74805 11.4316C1.59451 11.342 1.5 11.1778 1.5 11V5C1.5 4.82221 1.59451 4.65798 1.74805 4.56835L7.74805 1.06835C7.90373 0.977541 8.09627 0.977541 8.25195 1.06835L14.252 4.56835C14.4055 4.65798 14.5 4.82221 14.5 5V11Z" />
{:else if name === "patch"}
<path
d="M5.5 12C5.5 11.1716 4.82843 10.5 4 10.5C3.17157 10.5 2.5 11.1716 2.5 12C2.5 12.8284 3.17157 13.5 4 13.5C4.82843 13.5 5.5 12.8284 5.5 12ZM13.5 12C13.5 11.1716 12.8284 10.5 12 10.5C11.1716 10.5 10.5 11.1716 10.5 12C10.5 12.8284 11.1716 13.5 12 13.5C12.8284 13.5 13.5 12.8284 13.5 12ZM7.5 2.5H11.5V3.5H9.20703L12.5 6.79297V9.5498C13.6411 9.78142 14.5 10.7905 14.5 12C14.5 13.3807 13.3807 14.5 12 14.5C10.6193 14.5 9.5 13.3807 9.5 12C9.5 10.7905 10.3589 9.78142 11.5 9.5498V7.20703L8.5 4.20703V6.5H7.5V2.5ZM5.5 4C5.5 3.17157 4.82843 2.5 4 2.5C3.17157 2.5 2.5 3.17157 2.5 4C2.5 4.82843 3.17157 5.5 4 5.5C4.82843 5.5 5.5 4.82843 5.5 4ZM6.5 4C6.5 5.20943 5.64105 6.21753 4.5 6.44922V9.5498C5.64114 9.78142 6.5 10.7905 6.5 12C6.5 13.3807 5.38071 14.5 4 14.5C2.61929 14.5 1.5 13.3807 1.5 12C1.5 10.7905 2.35886 9.78142 3.5 9.5498V6.44922C2.35895 6.21753 1.5 5.20943 1.5 4C1.5 2.61929 2.61929 1.5 4 1.5C5.38071 1.5 6.5 2.61929 6.5 4Z" />
+6 -1
View File
@@ -30,6 +30,9 @@
popoverPadding?: string;
expanded?: boolean;
styleDisplay?: string;
/* Popovers portal to the body at a z-index that sits below the modal
layer, so one opened from inside a modal needs to be raised above it. */
styleZIndex?: string;
}
/* eslint-disable prefer-const */
@@ -41,6 +44,7 @@
popoverPadding,
expanded = $bindable(false),
styleDisplay = undefined,
styleZIndex = undefined,
}: Props = $props();
/* eslint-enable prefer-const */
@@ -120,7 +124,8 @@
use:portal
bind:this={floatingEl}
class="popover"
style:padding={popoverPadding}>
style:padding={popoverPadding}
style:z-index={styleZIndex}>
{@render popover()}
</div>
{/if}
+149
View File
@@ -0,0 +1,149 @@
<script lang="ts">
import type { Release } from "@bindings/cob/release/Release";
import type { RepoInfo } from "@bindings/repo/RepoInfo";
import debounce from "lodash/debounce";
import { writeToClipboard } from "@app/lib/invoke";
import { routeToPath } from "@app/lib/router";
import {
absoluteTimestamp,
authorForNodeId,
formatOid,
formatTimestamp,
} from "@app/lib/utils";
import DelegateBadge from "@app/components/DelegateBadge.svelte";
import Icon from "@app/components/Icon.svelte";
import NodeId from "@app/components/NodeId.svelte";
interface Props {
release: Release;
repo: RepoInfo;
delegateIds: Set<string>;
}
const { release, repo, delegateIds }: Props = $props();
let releaseIdCopied = $state(false);
const resetReleaseIdCopied = debounce(() => {
releaseIdCopied = false;
}, 1000);
async function copyReleaseId() {
await writeToClipboard(release.id);
releaseIdCopied = true;
resetReleaseIdCopied();
}
</script>
<style>
.meta-row {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0.5rem;
font: var(--txt-body-m-regular);
}
.author-chip,
.release-id-chip,
.tag-chip,
.commit-chip,
.time-chip {
display: inline-flex;
align-items: center;
height: 2rem;
padding: 0 0.5rem;
border: 1px solid var(--color-border-subtle);
border-radius: var(--border-radius-sm);
background-color: var(--color-surface-canvas);
color: var(--color-text-tertiary);
font: var(--txt-body-m-regular);
}
.author-chip {
gap: 0.375rem;
}
.tag-chip,
.time-chip {
gap: 0.375rem;
}
.release-id-chip,
.commit-chip {
gap: 0.375rem;
cursor: pointer;
text-decoration: none;
}
.release-id-chip:hover,
.release-id-chip:focus-visible,
.commit-chip:hover,
.commit-chip:focus-visible {
background-color: var(--color-surface-subtle);
color: var(--color-text-primary);
}
.rid-icon-value,
.commit-value {
font: var(--txt-code-regular);
}
.rid-icon-default,
.rid-icon-hover {
display: inline-flex;
align-items: center;
}
.rid-icon-hover {
display: none;
}
.release-id-chip:hover .rid-icon-default,
.release-id-chip:focus-visible .rid-icon-default {
display: none;
}
.release-id-chip:hover .rid-icon-hover,
.release-id-chip:focus-visible .rid-icon-hover {
display: inline-flex;
}
</style>
<div class="meta-row">
<div class="author-chip" title="Release creator">
<NodeId {...authorForNodeId(release.creator)} />
{#if delegateIds.has(release.creator.did)}
<DelegateBadge />
{/if}
</div>
<button
type="button"
class="release-id-chip"
title={releaseIdCopied ? "Copied to clipboard" : "Copy release ID"}
onclick={copyReleaseId}>
{#if releaseIdCopied}
<Icon name="checkmark" />
{:else}
<span class="rid-icon-default"><Icon name="hash" /></span>
<span class="rid-icon-hover"><Icon name="copy" /></span>
{/if}
<span class="rid-icon-value">{formatOid(release.id)}</span>
</button>
{#if release.tagName}
<span class="tag-chip" title="Tag this release was cut from">
<Icon name="label" />
<span>{release.tagName}</span>
</span>
{/if}
<a
class="commit-chip"
title="Browse the released commit"
href={routeToPath({
resource: "repo.commit",
rid: repo.rid,
commit: release.oid,
})}>
<Icon name="commit" />
<span class="commit-value">{formatOid(release.oid)}</span>
</a>
<span class="time-chip" title={absoluteTimestamp(release.createdAt)}>
<Icon name="clock" />
<span>Created {formatTimestamp(release.createdAt)}</span>
</span>
</div>
+117
View File
@@ -0,0 +1,117 @@
<script lang="ts">
import type { Release } from "@bindings/cob/release/Release";
import type { ReleaseScope } from "@bindings/cob/release/ReleaseScope";
import { push } from "@app/lib/router";
import {
absoluteTimestamp,
authorForNodeId,
formatTimestamp,
} from "@app/lib/utils";
import DelegateBadge from "@app/components/DelegateBadge.svelte";
import Icon from "@app/components/Icon.svelte";
import Id from "@app/components/Id.svelte";
import InlineTitle from "@app/components/InlineTitle.svelte";
import NodeId from "@app/components/NodeId.svelte";
interface Props {
scope: ReleaseScope;
delegateIds: Set<string>;
release: Release;
rid: string;
}
const { scope, delegateIds, release, rid }: Props = $props();
const title = $derived(release.title || release.tagName || release.id);
</script>
<style>
.release-teaser {
display: flex;
align-items: flex-start;
gap: 0.25rem;
min-height: 5rem;
background-color: var(--color-surface-canvas);
padding: 1rem;
cursor: pointer;
font: var(--txt-body-l-regular);
word-break: break-word;
width: 100%;
}
.release-teaser:hover {
background-color: var(--color-surface-subtle);
}
.icon {
padding: 0;
margin-right: 1rem;
color: var(--color-text-tertiary);
}
.tag {
font: var(--txt-body-s-regular);
color: var(--color-text-tertiary);
border: 1px solid var(--color-border-subtle);
border-radius: var(--border-radius-sm);
padding: 0 0.375rem;
white-space: nowrap;
}
.counter {
display: flex;
align-items: center;
gap: 0.25rem;
font: var(--txt-body-m-regular);
border: 1px solid var(--color-border-subtle);
border-radius: var(--border-radius-sm);
height: 1.5rem;
padding: 0 0.5rem;
color: var(--color-text-tertiary);
}
</style>
<!-- svelte-ignore a11y_click_events_have_key_events -->
<div
tabindex="0"
role="button"
class="release-teaser"
onclick={() => {
void push({
resource: "repo.release",
rid,
release: release.id,
scope,
});
}}>
<div class="global-chip icon">
<Icon name="parcel" />
</div>
<div
class="global-flex"
style:flex-direction="column"
style:align-items="flex-start">
<div class="global-flex" style:flex-wrap="wrap">
<InlineTitle content={title} />
{#if release.tagName}
<span class="tag">{release.tagName}</span>
{/if}
</div>
<div class="global-flex txt-body-m-regular" style:flex-wrap="wrap">
<NodeId {...authorForNodeId(release.creator)} />
{#if delegateIds.has(release.creator.did)}
<DelegateBadge />
{/if}
created
<Id id={release.id} clipboard={release.id} label="release ID" />
<span title={absoluteTimestamp(release.createdAt)}>
{formatTimestamp(release.createdAt)}
</span>
</div>
</div>
<div class="global-flex" style:margin-left="auto">
<div class="counter" title="Artifacts">
<Icon name="attach" />
{release.artifacts.length}
</div>
</div>
</div>
+53 -2
View File
@@ -52,6 +52,7 @@
</script>
<script lang="ts">
import type { ReleaseCounts } from "@bindings/cob/release/ReleaseCounts";
import type { Config } from "@bindings/config/Config";
import type { RepoInfo } from "@bindings/repo/RepoInfo";
import type { CrossfadeParams } from "svelte/transition";
@@ -194,6 +195,37 @@
return () => resetDynamicInterval("seededNotReplicated");
});
// Kept while navigating inside the repo, so the badge doesn't flicker.
let releaseCount = $state<number | undefined>(undefined);
let countedRid: string | undefined = undefined;
$effect(() => {
const rid = activeRepo?.rid;
if (rid === undefined) {
releaseCount = undefined;
countedRid = undefined;
return;
}
if (countedRid !== rid) {
releaseCount = undefined;
countedRid = rid;
}
let cancelled = false;
invoke<ReleaseCounts>("release_counts", { rid })
.then(counts => {
if (!cancelled) releaseCount = counts.delegate + counts.other;
})
.catch(() => {
if (!cancelled) releaseCount = undefined;
});
return () => {
cancelled = true;
};
});
const filteredRepos = $derived(
filterQuery.trim()
? repos.filter(r =>
@@ -517,6 +549,14 @@
activeRid() === rid
);
}
function isReleases(rid: string): boolean {
return (
($activeRoute.resource === "repo.releases" ||
$activeRoute.resource === "repo.release") &&
activeRid() === rid
);
}
</script>
<style>
@@ -1161,6 +1201,17 @@
isPatches(repo.rid),
activeProject?.meta.patches.open || undefined,
)}
{@render subItem(
repo.name,
router.routeToPath({
resource: "repo.releases",
rid: repo.rid,
}),
"parcel",
"Releases",
isReleases(repo.rid),
releaseCount || undefined,
)}
</div>
{/if}
{/snippet}
@@ -1168,7 +1219,7 @@
{#snippet subItem(
repoName: string,
href: string,
icon: "branch" | "issue" | "patch",
icon: "branch" | "issue" | "patch" | "parcel",
label: string,
active: boolean,
count: number | undefined,
@@ -1283,7 +1334,7 @@
role="menuitem"
onclick={() => confirmUnseed(repo)}>
<Icon name="seed" />
Stop seeding
Unseed
</button>
{:else}
<button
+49
View File
@@ -0,0 +1,49 @@
<script lang="ts">
import type { Snippet } from "svelte";
import HoverPopover from "@app/components/HoverPopover.svelte";
interface Props {
tooltip: string;
badge: Snippet;
tight?: boolean;
}
const { tooltip, badge, tight = false }: Props = $props();
</script>
<style>
.badge {
display: inline-flex;
align-items: center;
flex-shrink: 0;
}
/* HoverPopover wraps its trigger in an inline-block container and a block
button, whose line boxes push the badge off the centre line of whatever
it sits beside. Neither needs a box of its own here. */
.badge :global(.container),
.badge :global([role="button"]) {
display: inline-flex;
align-items: center;
line-height: 0;
}
.tight:not(:first-child) {
margin-left: -0.25rem;
}
.tooltip {
font: var(--txt-body-s-regular);
color: var(--color-text-primary);
white-space: nowrap;
}
</style>
<span class="badge" class:tight>
<HoverPopover stylePadding="0.25rem 0.5rem">
{#snippet toggle()}
{@render badge()}
{/snippet}
{#snippet popover()}
<span class="tooltip">{tooltip}</span>
{/snippet}
</HoverPopover>
</span>
+26
View File
@@ -0,0 +1,26 @@
<script lang="ts">
import TooltipBadge from "@app/components/TooltipBadge.svelte";
interface Props {
tooltip?: string;
}
const { tooltip = "You are the author" }: Props = $props();
</script>
<style>
.you {
font: var(--txt-body-s-regular);
color: var(--color-text-tertiary);
border: 1px solid var(--color-border-subtle);
border-radius: var(--border-radius-sm);
padding: 0 0.375rem;
white-space: nowrap;
}
</style>
<TooltipBadge {tooltip}>
{#snippet badge()}
<span class="you" aria-label={tooltip}>You</span>
{/snippet}
</TooltipBadge>