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 2 #608

Closed
wants to merge 45 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
402afba
add basic wallet connection
janmichek Oct 25, 2023
74576cd
fix header styles
janmichek Oct 25, 2023
1dac610
add basic connection UI
janmichek Oct 26, 2023
5639532
componentize UI
janmichek Oct 26, 2023
ae7d7ed
print basic account information
janmichek Oct 26, 2023
ce3b328
fix scanning wallet
janmichek Oct 31, 2023
537e189
add hint
janmichek Oct 31, 2023
d2cc405
add disconnect action
janmichek Oct 31, 2023
1c75b47
display all account information
janmichek Oct 31, 2023
8b970d7
create dropdown UI
janmichek Nov 1, 2023
be278cc
fix header controls
janmichek Nov 1, 2023
4f36862
fix css selector
janmichek Nov 1, 2023
ffdbf50
fix network id connection
janmichek Nov 1, 2023
297d827
extend button UI
janmichek Nov 1, 2023
feedfad
detect denied status
janmichek Nov 1, 2023
e8d196a
handle denied state
janmichek Nov 1, 2023
6163ae5
fix imports
janmichek Nov 1, 2023
c4602f1
fix loading transitions
janmichek Nov 1, 2023
ba34af9
fix connection controls
janmichek Nov 2, 2023
b0aab34
change button style
janmichek Nov 2, 2023
3e69c45
remove comments
janmichek Nov 2, 2023
79b49fc
remove unused code
janmichek Nov 2, 2023
e9d5994
update navigation when wallet changed
janmichek Nov 6, 2023
5702dbe
fix reloading page after wallet disconnect
janmichek Nov 9, 2023
d064f67
fix identicon image
janmichek Nov 9, 2023
c1dfd0f
fix identicon
janmichek Nov 9, 2023
03781ca
fix cors
janmichek Nov 13, 2023
5347df0
fix cors attempt
janmichek Nov 13, 2023
7d047f7
fix cors attempt
janmichek Nov 13, 2023
8a30703
fix cors attempt
janmichek Nov 13, 2023
f74ff96
fix cors attempt
janmichek Nov 13, 2023
ad69bc5
fix cors attempt
janmichek Nov 13, 2023
92ec1f0
fix cors attempt
janmichek Nov 13, 2023
2dbab2f
fix cors attempt
janmichek Nov 13, 2023
8305257
fix cors attempt
janmichek Nov 13, 2023
1c2dc57
fix cors attempt
janmichek Nov 13, 2023
0583226
fix cors attempt
janmichek Nov 13, 2023
e30b30a
fix cors attempt
janmichek Nov 13, 2023
627bbbe
fix cors attempt
janmichek Nov 13, 2023
b713f94
Merge branch 'develop' into Wallet-assets-listing
janmichek Nov 23, 2023
9d7ba60
Merge branch 'develop' into Wallet-assets-listing
janmichek Dec 20, 2023
680a318
regenerate yarn.lock
janmichek Dec 20, 2023
3eaadaa
fix code style
janmichek Dec 20, 2023
b41faae
Merge branch 'develop' into Wallet-assets-listing
janmichek Mar 11, 2024
ab07217
fix after rebase
janmichek Mar 11, 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
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ NUXT_PUBLIC_NETWORK_NAME=MAINNET
NUXT_PUBLIC_NETWORK_ID=ae_mainnet
NUXT_PUBLIC_ALTERNATIVE_NETWORK_URL=http://localhost:8081
NUXT_PUBLIC_ALTERNATIVE_NETWORK_NAME=TESTNET
NUXT_PUBLIC_NETWORK_ID="ae_mainnet"
NUXT_PUBLIC_AE_TOKEN_ID=ct_J3zBY8xxjsRr3QojETNw48Eb38fjvEuJKkQ6KzECvubvEcvCa
NUXT_PUBLIC_DEBUG_MODE=false
NUXT_PUBLIC_SH_DEX_CONTRACTS='ct_2mfj3FoZxnhkSw5RZMcP8BfPoB1QR4QiYGNCdkAvLZ1zfF6paW;ct_azbNZ1XrPjXfqBqbAh1ffLNTQ1sbnuUDFvJrXjYz7JQA1saQ3'
Expand Down
2 changes: 2 additions & 0 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,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 @@ -41,6 +42,7 @@ export default defineNuxtConfig({
SH_DEX_CONTRACTS: process.env.SH_DEX_CONTRACTS?.split(';'),
},
},

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 @@ -27,7 +27,6 @@
},
"dependencies": {
"@aeternity/aepp-sdk": "^13.2.2",
"@download/blockies": "^1.0.3",
"@vuepic/vue-datepicker": "^7.1.0",
"@sentry/tracing": "^7.88.0",
"@sentry/vue": "^7.88.0",
Expand Down
18 changes: 9 additions & 9 deletions src/components/AppButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,6 @@ defineProps({
type: String,
default: null,
},
target: {
type: String,
default: '_blank',
},
size: {
type: String,
default: null,
validator: val => ['lg'].includes(val),
},
variant: {
type: String,
default: 'primary',
Expand All @@ -66,6 +57,15 @@ defineProps({
'light']
.includes(val),
},
target: {
type: String,
default: '_blank',
},
size: {
type: String,
default: null,
validator: val => ['lg'].includes(val),
},
type: {
type: String,
default: 'button',
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: 0 !important;
}
</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>
3 changes: 3 additions & 0 deletions src/components/TheHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,15 @@
:class="[
'header__network-select',
{ 'header__network-select--open': isNavigationOpen }]"/>

<the-wallet-account-controls class="u-hidden-mobile"/>
</div>
</header>
</template>

<script setup>
const route = useRoute()

const isNavigationOpen = ref(false)

onMounted(() => {
Expand Down
65 changes: 65 additions & 0 deletions src/components/TheWalletAccountControls.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<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
variant="link"
@click="exit">
Exit 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 exit() {
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>
Loading
Loading