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: Wallet account view 4 #678

Open
wants to merge 58 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
f7e82c0
add basic wallet connection
janmichek Oct 25, 2023
0a703fe
fix header styles
janmichek Oct 25, 2023
8c2c797
add basic connection UI
janmichek Oct 26, 2023
d8b2949
componentize UI
janmichek Oct 26, 2023
84d0241
print basic account information
janmichek Oct 26, 2023
4fa3684
fix scanning wallet
janmichek Oct 31, 2023
8e51885
add hint
janmichek Oct 31, 2023
4a025cf
add disconnect action
janmichek Oct 31, 2023
7ac1dec
display all account information
janmichek Oct 31, 2023
3062026
create dropdown UI
janmichek Nov 1, 2023
4f8a619
fix header controls
janmichek Nov 1, 2023
0e2c3d2
fix css selector
janmichek Nov 1, 2023
676fc42
fix network id connection
janmichek Nov 1, 2023
2e7589f
extend button UI
janmichek Nov 1, 2023
1d8aec0
detect denied status
janmichek Nov 1, 2023
c8e883f
handle denied state
janmichek Nov 1, 2023
ba20011
fix imports
janmichek Nov 1, 2023
1ba4594
fix loading transitions
janmichek Nov 1, 2023
64c6159
fix connection controls
janmichek Nov 2, 2023
4b1d5ec
change button style
janmichek Nov 2, 2023
5121c1b
remove comments
janmichek Nov 2, 2023
9affa85
remove unused code
janmichek Nov 2, 2023
c3b2c63
update navigation when wallet changed
janmichek Nov 6, 2023
9685710
fix reloading page after wallet disconnect
janmichek Nov 9, 2023
be6bc87
fix identicon image
janmichek Nov 9, 2023
a411e38
fix identicon
janmichek Nov 9, 2023
62e7d3c
fix cors
janmichek Nov 13, 2023
547e4d5
fix cors attempt
janmichek Nov 13, 2023
0bd93c3
fix cors attempt
janmichek Nov 13, 2023
d41469c
fix cors attempt
janmichek Nov 13, 2023
dce5b01
fix cors attempt
janmichek Nov 13, 2023
fa3f3dd
fix cors attempt
janmichek Nov 13, 2023
0cac19e
fix cors attempt
janmichek Nov 13, 2023
dbf3f55
fix cors attempt
janmichek Nov 13, 2023
d81ea05
fix cors attempt
janmichek Nov 13, 2023
e131740
fix cors attempt
janmichek Nov 13, 2023
0f0949d
fix cors attempt
janmichek Nov 13, 2023
f05bfd8
fix cors attempt
janmichek Nov 13, 2023
9ba06a0
fix cors attempt
janmichek Nov 13, 2023
7bcaa55
regenerate yarn.lock
janmichek Dec 20, 2023
ec1918c
fix code style
janmichek Dec 20, 2023
717178f
fix after rebase
janmichek Mar 11, 2024
60d1a50
enlarge button
janmichek Mar 19, 2024
ccff919
fix env example
janmichek Mar 19, 2024
0f92db7
improve ui
janmichek Mar 19, 2024
5c69a5b
change hint
janmichek Mar 19, 2024
7b3afdd
change hint
janmichek Mar 19, 2024
1a78c91
fix code style
janmichek May 23, 2024
2a1c571
regenerate yarn lock
janmichek May 23, 2024
1a09bb1
regenerate yarn lock
janmichek May 23, 2024
c9e201d
Merge branch 'develop' into Wallet-assets-listing
janmichek May 29, 2024
d365eaa
regenerate yarn lock
janmichek May 29, 2024
6f3aa2c
regenerate yarn lock
janmichek May 29, 2024
fa8e136
remove duplicate dependency
janmichek Jun 3, 2024
2e5a0f1
remove unused code
janmichek Jun 3, 2024
889b7de
Merge branch 'develop' into Wallet-assets-listing
janmichek Jun 5, 2024
25d1940
Merge branch 'develop' into Wallet-assets-listing
janmichek Jun 5, 2024
e3c47a9
regenerate yarn lock
janmichek Jun 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export default defineNuxtConfig({
WEBSOCKET_URL: process.env.WEBSOCKET_URL,
DEX_BACKEND_URL: process.env.DEX_BACKEND_URL,
NETWORK_NAME: process.env.NETWORK_NAME,
NETWORK_ID: process.env.NETWORK_ID,
ALTERNATIVE_NETWORK_URL: process.env.ALTERNATIVE_NETWORK_URL,
ALTERNATIVE_NETWORK_NAME: process.env.ALTERNATIVE_NETWORK_NAME,
AE_TOKEN_ID: process.env.AE_TOKEN_ID,
Expand All @@ -43,6 +44,7 @@ export default defineNuxtConfig({
SH_DEX_CONTRACTS: process.env.SH_DEX_CONTRACTS?.split(';'),
},
},

janmichek marked this conversation as resolved.
Show resolved Hide resolved
postcss: {
plugins: {
autoprefixer: {},
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
},
"dependencies": {
"@aeternity/aepp-sdk": "^13.3.2",
"@download/blockies": "^1.0.3",
"@sentry/tracing": "^7.108.0",
"@sentry/vite-plugin": "^2.16.1",
"@sentry/vue": "^7.108.0",
Expand Down
19 changes: 19 additions & 0 deletions src/components/AppDropdown.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<template>
<VMenu>
<span>
<slot/>
</span>

<template #popper>
<slot name="menu"/>
</template>
</VMenu>
</template>

<style>
.v-popper__popper.v-popper--theme-menu .v-popper__inner {
margin: 0 var(--space-2);
color: var(--color-midnight);
padding: var(--space-2) var(--space-1);
}
</style>
26 changes: 6 additions & 20 deletions src/components/AppIdenticon.vue
Original file line number Diff line number Diff line change
@@ -1,34 +1,20 @@
<template>
<canvas
ref="identicon"
class="app-identicon"/>
<img
:src="`https://avatars.z52da5wt.xyz/${hash}`"
class="identicon">
</template>

<script setup>
import { renderIcon } from '@download/blockies'
import { ref } from 'vue'

const props = defineProps({
id: {
defineProps({
hash: {
type: String,
required: true,
},
})

onMounted(render)

const identicon = ref()

function render() {
renderIcon(
{ seed: props.id },
identicon.value,
)
}
</script>

<style scoped>
.app-identicon {
.identicon {
display: inline-block;
border-radius: 50%;
}
Expand Down
26 changes: 11 additions & 15 deletions src/components/AppTooltip.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,19 @@ defineProps({
.v-popper {
display: inline-block;

&__popper {
&.v-popper--theme-tooltip {
.v-popper__inner {
margin: 0 var(--space-2);
padding: var(--space-3);
background: var(--color-midnight);
color: var(--color-white);
border: none;
word-break: break-word;
/* stylelint-disable max-nesting-depth */
/* as it is 3rd party component */
@media (--desktop) {
word-break: normal;
}
&__popper.v-popper--theme-tooltip {
.v-popper__inner {
margin: 0 var(--space-2);
padding: var(--space-3);
background: var(--color-midnight);
color: var(--color-white);
border: none;
word-break: break-word;

@media (--desktop) {
word-break: normal;
}
}
}
}

</style>
2 changes: 2 additions & 0 deletions src/components/TheHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
:class="[
'header__network-select',
{ 'header__network-select--open': isMobileMenuOpen }]"/>

<the-wallet-account-controls class="u-hidden-mobile"/>
</div>
<div
v-if="isSyncing"
Expand Down
63 changes: 63 additions & 0 deletions src/components/TheWalletAccountControls.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<template>
<app-dropdown v-if="status === 'connected'">
<div class="wallet-account-controls">
<app-identicon
:hash="aeSdk.address"
class="wallet-account-controls__identicon"/>
<app-link
class="wallet-account-controls__link"
to="/wallet">
{{ formatEllipseHash(aeSdk.address) }}
</app-link>
</div>
<template #menu>
<app-button @click="disconnectWallet">
Disconnect Wallet
</app-button>
</template>
</app-dropdown>

<app-button
v-else
class="wallet-account-controls__button"
to="/wallet">
Connect Wallet
</app-button>
</template>
<script setup>
import { storeToRefs } from 'pinia'
import { formatEllipseHash } from '@/utils/format'
import { useWalletStore } from '@/stores/wallet'

const { go } = useRouter()

const walletStore = useWalletStore()
const { aeSdk, status } = storeToRefs(walletStore)
const { disconnect } = walletStore

function disconnectWallet() {
disconnect()
go()
}
</script>

<style scoped>
.wallet-account-controls {
display: flex;
align-items: center;

&__identicon {
margin-right: var(--space-1);
width: 32px;
}

&__link {
font-family: var(--font-monospaced);
font-size: 13px;
}

&__button {
color: var(--color-white) !important;
}
}
</style>
2 changes: 1 addition & 1 deletion src/components/TokenSymbolIcon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<app-identicon
v-else
:id="contractId"/>
:hash="contractId"/>
</template>
<script setup>
import { useRuntimeConfig } from 'nuxt/app'
Expand Down
98 changes: 98 additions & 0 deletions src/components/WalletAccountPanel.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<template>
<account-details-panel
v-if="accountDetails"
class="wallet-account-panel__account-details-panel"
:account-details="accountDetails"/>

<client-only>
<app-tabs
v-if="isTabsVisible"
v-model="activeTabIndex">
<app-tab title="Activities">
<account-activities-panel/>
</app-tab>
<app-tab title="Transactions">
<account-transactions-panel/>
</app-tab>
<app-tab title="AENS Names">
<account-names-panel/>
</app-tab>
<app-tab
title="Tokens"
:is-preselected="isTokensTabSelected">
<account-tokens-panel/>
</app-tab>
</app-tabs>
</client-only>
</template>
<script setup>
import { storeToRefs } from 'pinia'
import { useRoute, useRouter } from 'nuxt/app'
import { useWalletStore } from '@/stores/wallet'
import { useAccountStore } from '@/stores/accountDetails'
import { isDesktop } from '@/utils/screen'

const walletStore = useWalletStore()
const accountStore = useAccountStore()
const { aeSdk } = storeToRefs(walletStore)
const { accountDetails, accountTokens } = storeToRefs(accountStore)
const { fetchAccount } = accountStore

const TAB_KEYS = ['activities', 'transactions', 'aens-names', 'tokens']

const { push, replace } = useRouter()

const route = useRoute()

const isTabsVisible = computed(() => process.client &&
((accountDetails.value && !accountDetails.value?.notExistent) ||
!!accountTokens.value?.data.length))

const isTokensTabSelected = computed(() => process.client &&
accountDetails.value?.notExistent &&
!!accountTokens.value?.data.length)

const activeTabIndex = computed({
get() {
const { type: activeTabName } = route.query

if (activeTabName === undefined) {
return 0
}

return TAB_KEYS.indexOf(activeTabName)
},
set(index) {
const newRoute = {
query: {
type: TAB_KEYS[index],
},
}

if (activeTabIndex.value === index) {
// if navigating back
return replace(newRoute)
}

return push(newRoute)
},
})

if (process.client) {
const limit = isDesktop() ? null : 3
await fetchAccount(aeSdk.value.address, { limit })
watch(() => aeSdk.value.address, async() => {
await fetchAccount(aeSdk.value.address, { limit })
})
}
</script>

<style scoped>
.wallet-account-panel__account-details-panel {
margin-bottom: var(--space-4);

@media (--desktop) {
margin-bottom: var(--space-6);
}
}
</style>
12 changes: 12 additions & 0 deletions src/components/WalletConnectButton.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<template>
<app-button @click="initWallet()">
Connect Wallet
</app-button>
</template>

<script setup>
import { useWalletStore } from '@/stores/wallet'

const walletStore = useWalletStore()
const { initWallet } = walletStore
</script>