Radish alpha
r
rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5
Radicle web interface
Radicle
Git
radicle-explorer src views repos Share.svelte
<script lang="ts">
  import config from "@app/lib/config";
  import debounce from "lodash/debounce";
  import { toClipboard } from "@app/lib/utils";

  import Button from "@app/components/Button.svelte";
  import Icon from "@app/components/Icon.svelte";

  let shareIcon: "link" | "checkmark" = "link";

  const restoreIcon = debounce(() => {
    shareIcon = "link";
  }, 1000);

  async function copy() {
    const text = new URL(config.nodes.fallbackPublicExplorer).origin.concat(
      window.location.pathname,
    );
    await toClipboard(text);
    shareIcon = "checkmark";
    restoreIcon();
  }
</script>

<Button variant="outline" size="regular" on:click={copy}>
  <Icon name={shareIcon} />
  <span class="global-hide-on-small-desktop-down">Copy link</span>
</Button>