Radish alpha
r
Radicle web interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
Simplify reactive code
Alexis Sellier committed 5 years ago
commit 451ae1fdc35f18ebc46e8c01b80dde1380af9ba1
parent 8819c8c6f771b1dd78c0ca7204ecd77d84541f3e
2 files changed +9 -11
modified src/Connect.svelte
@@ -8,9 +8,7 @@

  let walletUnavailable = !window.ethereum;

-
  const connecting = derived(session, ($s) => {
-
    return $s.connection === Connection.Connecting;
-
  });
+
  $: connecting = $session.connection === Connection.Connecting;
</script>

<style>
@@ -20,10 +18,10 @@
  on:click={connectWallet}
  {style}
  class="connect {className}"
-
  disabled={$connecting || walletUnavailable}
-
  data-waiting={$connecting || null}
+
  disabled={connecting || walletUnavailable}
+
  data-waiting={connecting || null}
>
-
  {#if $connecting}
+
  {#if connecting}
    Connecting...
  {:else}
    {caption}
modified src/Header.svelte
@@ -13,8 +13,8 @@
  let sessionButton = null;
  let sessionButtonHover = false;

-
  const address = derived(session, $s => { return $s.address });
-
  const tokenBalance = derived(session, $s => { return $s.tokenBalance });
+
  $: address = $session.address;
+
  $: tokenBalance = $session.tokenBalance;
</script>

<style>
@@ -82,9 +82,9 @@
      <a use:link href="/vesting/">Vesting</a>
    </span>

-
    {#if $address}
+
    {#if address}
      <span class="balance">
-
        {formatBalance($tokenBalance)} <strong>RAD</strong>
+
        {formatBalance(tokenBalance)} <strong>RAD</strong>
      </span>

      <button class="address outline small" bind:this={sessionButton}
@@ -95,7 +95,7 @@
        {#if sessionButtonHover}
          Disconnect
        {:else}
-
          {formatAddress($address)}
+
          {formatAddress(address)}
        {/if}
      </button>
    {:else}