Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(frontend): move wallet connect btn out of menu into header #3103

Merged
merged 24 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
efcd376
feat(frontend): refactor MenuWallet to MenuYourAdresses, moving the w…
loki344 Oct 24, 2024
c650aed
feat(frontend): introduce WalletConnectMenu and integrate it into Hea…
loki344 Oct 24, 2024
6b1eda8
feat(frontend): introduce WalletConnectMenu and integrate it into Hea…
loki344 Oct 24, 2024
3173169
Merge remote-tracking branch 'origin/feat(frontend)/move-wallet-conne…
loki344 Oct 24, 2024
e8245a1
feat(frontend): format
loki344 Oct 24, 2024
c99caf5
feat(frontend): MR feedback
loki344 Oct 25, 2024
66f04c2
feat(frontend): test i18n workflow
loki344 Oct 25, 2024
1f177d2
feat(frontend): test i18n workflow
loki344 Oct 25, 2024
1b9a33a
🤖 Updated i18n files
github-actions[bot] Oct 25, 2024
0767acd
feat(frontend): refactor WalletConnectButton to handle empty default …
loki344 Oct 25, 2024
1fec0f3
feat(frontend): WalletConnectSession render conditionally connect or …
loki344 Oct 25, 2024
9c4e078
feat(frontend): use existing wallet connect session to display connec…
loki344 Oct 25, 2024
97cc7db
feat(frontend): use existing wallet connect session to display connec…
loki344 Oct 25, 2024
7cfb803
feat(frontend): revert unwanted change
loki344 Oct 25, 2024
d7aeda7
Merge branch 'main' into feat(frontend)/move-wallet-connect-btn
loki344 Oct 28, 2024
d4cc49a
Merge branch 'main' into feat(frontend)/move-wallet-connect-btn
loki344 Oct 28, 2024
911abcf
Merge remote-tracking branch 'origin/main' into feat(frontend)/move-w…
loki344 Oct 29, 2024
91d454f
feat(frontend): mr feedback, transition
loki344 Oct 29, 2024
5926cd0
🤖 Apply formatting changes
github-actions[bot] Oct 29, 2024
60c27b8
feat(frontend): mr feedback, close tag
loki344 Oct 29, 2024
77b3378
Merge remote-tracking branch 'origin/feat(frontend)/move-wallet-conne…
loki344 Oct 29, 2024
d9f2c4e
🤖 Apply formatting changes
github-actions[bot] Oct 29, 2024
b8e210a
Merge branch 'main' into feat(frontend)/move-wallet-connect-btn
loki344 Oct 29, 2024
22dd910
Merge branch 'main' into feat(frontend)/move-wallet-connect-btn
loki344 Oct 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
<script lang="ts">
import IconWalletConnect from '$lib/components/icons/IconWalletConnect.svelte';
import { ethAddressNotLoaded } from '$lib/derived/address.derived';

export let ariaLabel: string | undefined = undefined;
</script>

<button on:click class="tertiary text-primary h-10" disabled={$ethAddressNotLoaded}>
<button
AntonioVentilii-DFINITY marked this conversation as resolved.
Show resolved Hide resolved
aria-label={ariaLabel}
on:click
class="tertiary text-primary h-10"
class:icon={!$$slots.default}
AntonioVentilii-DFINITY marked this conversation as resolved.
Show resolved Hide resolved
disabled={$ethAddressNotLoaded}
>
<IconWalletConnect size="24" />
<slot />
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
import { initWalletConnectListener } from '$eth/services/eth-listener.services';
import { walletConnectPaired } from '$eth/stores/wallet-connect.store';
import type { OptionWalletConnectListener } from '$eth/types/wallet-connect';
import { TRACK_COUNT_WALLET_CONNECT_MENU_OPEN } from '$lib/constants/analytics.contants';
import { ethAddress } from '$lib/derived/address.derived';
import { modalWalletConnect, modalWalletConnectAuth } from '$lib/derived/modal.derived';
import { trackEvent } from '$lib/services/analytics.services';
import { busy } from '$lib/stores/busy.store';
import { i18n } from '$lib/stores/i18n.store';
import { loading } from '$lib/stores/loader.store';
Expand Down Expand Up @@ -336,12 +338,23 @@
$: walletConnectPaired.set(nonNullish(listener));

onDestroy(() => walletConnectPaired.set(false));

const openWalletConnectAuth = async () => {
modalStore.openWalletConnectAuth();

await trackEvent({
name: TRACK_COUNT_WALLET_CONNECT_MENU_OPEN
});
};
</script>

{#if nonNullish(listener)}
<WalletConnectButton on:click={disconnect}
>{$i18n.wallet_connect.text.disconnect}</WalletConnectButton
>
{:else}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AntonioVentilii-DFINITY How do you test the wallet connect functionality locally?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I generally connect with https://app.uniswap.org/

<WalletConnectButton ariaLabel={$i18n.wallet_connect.text.name} on:click={openWalletConnectAuth}
></WalletConnectButton>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/> instead of ></WalletConnectButton> ?

{/if}

{#if $modalWalletConnectAuth}
Expand Down
10 changes: 5 additions & 5 deletions src/frontend/src/lib/components/core/Menu.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { IconUser, Popover } from '@dfinity/gix-components';
import { goto } from '$app/navigation';
import { page } from '$app/stores';
import MenuWallet from '$lib/components/core/MenuWallet.svelte';
import MenuAddresses from '$lib/components/core/MenuAddresses.svelte';
import SignOut from '$lib/components/core/SignOut.svelte';
import AboutWhyOisy from '$lib/components/hero/about/AboutWhyOisy.svelte';
import IconGitHub from '$lib/components/icons/IconGitHub.svelte';
Expand Down Expand Up @@ -39,8 +39,8 @@
let dAppExplorerRoute = false;
$: dAppExplorerRoute = isRouteDappExplorer($page);

let walletOptions = true;
$: walletOptions = !settingsRoute;
let addressesOption = true;
$: addressesOption = !settingsRoute && !dAppExplorerRoute;
</script>

<ButtonIcon
Expand All @@ -55,8 +55,8 @@

<Popover bind:visible anchor={button} direction="rtl">
<div class="flex flex-col gap-4" data-tid={NAVIGATION_MENU}>
{#if walletOptions}
<MenuWallet on:icMenuClick={hidePopover} />
{#if addressesOption}
<MenuAddresses on:icMenuClick={hidePopover} />
{/if}

{#if !dAppExplorerRoute && !settingsRoute}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,19 @@
import { createEventDispatcher } from 'svelte';
import BtcWalletAddress from '$btc/components/core/BtcWalletAddress.svelte';
import EthWalletAddress from '$eth/components/core/EthWalletAddress.svelte';
import { walletConnectPaired } from '$eth/stores/wallet-connect.store';
import IcWalletAddress from '$icp/components/core/IcWalletAddress.svelte';
import WalletAddresses from '$lib/components/core/WalletAddresses.svelte';
import IconWalletConnect from '$lib/components/icons/IconWalletConnect.svelte';
import ButtonMenu from '$lib/components/ui/ButtonMenu.svelte';
import Hr from '$lib/components/ui/Hr.svelte';
import { TRACK_COUNT_WALLET_CONNECT_MENU_OPEN } from '$lib/constants/analytics.contants';
import {
networkBitcoin,
networkEthereum,
networkICP,
pseudoNetworkChainFusion
} from '$lib/derived/network.derived';
import { trackEvent } from '$lib/services/analytics.services';
import { i18n } from '$lib/stores/i18n.store';
import { modalStore } from '$lib/stores/modal.store';

const dispatch = createEventDispatcher();

const click = () => dispatch('icMenuClick');

const openWalletConnectAuth = async () => {
click();
modalStore.openWalletConnectAuth();

await trackEvent({
name: TRACK_COUNT_WALLET_CONNECT_MENU_OPEN
});
};
</script>

{#if $networkICP}
Expand All @@ -44,14 +28,3 @@
{/if}

<Hr />

<ButtonMenu
ariaLabel={$i18n.wallet_connect.text.name}
on:click={openWalletConnectAuth}
disabled={$walletConnectPaired}
>
<IconWalletConnect />
{$i18n.wallet_connect.text.name}
</ButtonMenu>

<Hr />