mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-21 06:10:44 +08:00
Add track button to project header
This replaces the "Nodes <counter>" tab in the project view. Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
<script lang="ts">
|
||||
import { pluralize } from "@app/lib/pluralize";
|
||||
|
||||
import Button from "@app/components/Button.svelte";
|
||||
import Command from "@app/components/Command.svelte";
|
||||
import IconSmall from "@app/components/IconSmall.svelte";
|
||||
import Popover from "@app/components/Popover.svelte";
|
||||
|
||||
export let projectId: string;
|
||||
export let trackings: number;
|
||||
export let tracking: boolean;
|
||||
|
||||
$: buttonTitle = tracking ? "Tracking" : "Track";
|
||||
$: command = tracking ? "untrack" : "track";
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.track-label {
|
||||
display: block;
|
||||
font-size: var(--font-size-small);
|
||||
font-weight: var(--font-weight-regular);
|
||||
margin-bottom: 0.75rem;
|
||||
}
|
||||
</style>
|
||||
|
||||
<Popover
|
||||
popoverPositionTop="3rem"
|
||||
popoverPositionRight="0"
|
||||
popoverWidth="26rem">
|
||||
<Button
|
||||
slot="toggle"
|
||||
size="large"
|
||||
variant="outline"
|
||||
title="Tracked by {trackings} {pluralize('node', trackings)}">
|
||||
{#if tracking}
|
||||
<IconSmall name="tracking-on" />
|
||||
{:else}
|
||||
<IconSmall name="tracking-off" />
|
||||
{/if}
|
||||
<span>
|
||||
{buttonTitle}
|
||||
<span
|
||||
style:color="var(--color-foreground-dim)"
|
||||
style:font-weight="var(--font-weight-regular)">
|
||||
{trackings}
|
||||
</span>
|
||||
</span>
|
||||
</Button>
|
||||
|
||||
<svelte:fragment slot="popover">
|
||||
<div class="track-label">
|
||||
Use the <a
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
href="https://radicle.xyz/#try"
|
||||
class="txt-link txt-bold">
|
||||
Radicle CLI
|
||||
</a>
|
||||
to {command} this project.
|
||||
<br />
|
||||
<br />
|
||||
Tracking means subscribing to updates from this repository. It also helps with
|
||||
increasing its availability over the Radicle network.
|
||||
</div>
|
||||
<Command command={`rad ${command} ${projectId}`} />
|
||||
</svelte:fragment>
|
||||
</Popover>
|
||||
Reference in New Issue
Block a user