Allow track and untrack of a project through the TrackButton

- Add support for checking the tracking table from `radicle-httpd` to
  get a more precise information if the project is being tracked by the
  local node.
- If a user isn't authenticated with their local httpd instance, we
  still show the Popover to explain how to do it on the CLI
This commit is contained in:
Sebastian Martinez
2023-12-19 16:47:08 +01:00
parent 5f116cff95
commit 8152cda2ac
5 changed files with 143 additions and 23 deletions
+11 -4
View File
@@ -5,11 +5,11 @@
import IconSmall from "@app/components/IconSmall.svelte";
import Popover from "@app/components/Popover.svelte";
export let disabled: boolean;
export let projectId: string;
export let seedCount: number;
export let seeding: boolean;
$: buttonTitle = seeding ? "Seeding" : "Seed";
export let editSeeding: (() => Promise<void>) | undefined;
</script>
<style>
@@ -30,14 +30,21 @@
<Popover popoverPositionTop="3rem" popoverPositionRight="0">
<Button
{disabled}
slot="toggle"
let:toggle
on:click={toggle}
on:click={async () => {
if (editSeeding) {
await editSeeding();
} else {
toggle();
}
}}
size="large"
variant={seeding ? "secondary-toggle-on" : "secondary-toggle-off"}>
<IconSmall name="network" />
<span>
{buttonTitle}
{seeding ? "Seeding" : "Seed"}
<span style:font-weight="var(--font-weight-regular)">
{seedCount}
</span>