From eb0167ed5922a199d319042ee0027a5b495165ad Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pawe=C5=82=20Stachel?=
Date: Thu, 5 Oct 2023 14:12:32 +0200
Subject: [PATCH] feat: make transactions default view for account details
---
src/popup/components/AccountCard.vue | 6 +--
src/popup/components/AccountCardMultisig.vue | 2 -
.../components/AccountDetailsNavigation.vue | 18 ++++-----
.../components/DashboardHeaderMultisig.vue | 4 +-
src/popup/router/routeNames.ts | 4 +-
src/popup/router/routes.ts | 38 +++++++++----------
.../bitcoin/views/AccountDetails.vue | 7 ++--
tests/e2e/integration/other.js | 2 +-
tests/e2e/support/commands.js | 3 --
9 files changed, 38 insertions(+), 46 deletions(-)
diff --git a/src/popup/components/AccountCard.vue b/src/popup/components/AccountCard.vue
index 0922a8fbf..bd94e8f39 100644
--- a/src/popup/components/AccountCard.vue
+++ b/src/popup/components/AccountCard.vue
@@ -33,10 +33,9 @@ import {
defineComponent,
PropType,
} from 'vue';
+import { IAccount } from '@/types';
import { PROTOCOL_AETERNITY } from '@/constants';
-import type { IAccount } from '../../types';
-import { ROUTE_ACCOUNT_DETAILS } from '../router/routeNames';
-import { useBalances } from '../../composables';
+import { useBalances } from '@/composables';
import AccountInfo from './AccountInfo.vue';
import BalanceInfo from './BalanceInfo.vue';
@@ -60,7 +59,6 @@ export default defineComponent({
const numericBalance = computed(() => balance.value.toNumber());
return {
- ROUTE_ACCOUNT_DETAILS,
PROTOCOL_AETERNITY,
numericBalance,
};
diff --git a/src/popup/components/AccountCardMultisig.vue b/src/popup/components/AccountCardMultisig.vue
index 841f0bbdb..476e34ae3 100644
--- a/src/popup/components/AccountCardMultisig.vue
+++ b/src/popup/components/AccountCardMultisig.vue
@@ -37,7 +37,6 @@ import { useStore } from 'vuex';
import type { IMultisigAccount } from '@/types';
import { PROTOCOL_AETERNITY } from '@/constants';
import { useMultisigAccounts } from '@/composables';
-import { ROUTE_MULTISIG_DETAILS } from '@/popup/router/routeNames';
import { convertMultisigAccountToAccount } from '@/protocols/aeternity/helpers';
import AccountInfo from './AccountInfo.vue';
@@ -71,7 +70,6 @@ export default defineComponent({
return {
PROTOCOL_AETERNITY,
- ROUTE_MULTISIG_DETAILS,
isPendingAccount,
convertMultisigAccountToAccount,
};
diff --git a/src/popup/components/AccountDetailsNavigation.vue b/src/popup/components/AccountDetailsNavigation.vue
index 3aef07d48..d08ddfceb 100644
--- a/src/popup/components/AccountDetailsNavigation.vue
+++ b/src/popup/components/AccountDetailsNavigation.vue
@@ -29,17 +29,17 @@
import { computed, defineComponent } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
+import { useConnection } from '@/composables';
import {
ROUTE_ACCOUNT_DETAILS,
ROUTE_ACCOUNT_DETAILS_NAMES,
ROUTE_ACCOUNT_DETAILS_NAMES_AUCTIONS,
ROUTE_ACCOUNT_DETAILS_NAMES_CLAIM,
- ROUTE_ACCOUNT_DETAILS_TRANSACTIONS,
+ ROUTE_ACCOUNT_DETAILS_ASSETS,
ROUTE_MULTISIG_DETAILS,
ROUTE_MULTISIG_DETAILS_INFO,
- ROUTE_MULTISIG_DETAILS_TRANSACTIONS,
+ ROUTE_MULTISIG_DETAILS_ASSETS,
} from '../router/routeNames';
-import { useConnection } from '../../composables';
import BtnPill from './buttons/BtnPill.vue';
import Tab from './tabs/Tab.vue';
@@ -69,13 +69,13 @@ export default defineComponent({
const navigationConfigRegular: NavigationElement[] = [
{
- text: t('modals.accountDetails.assets'),
+ text: t('modals.accountDetails.transactions'),
routeName: ROUTE_ACCOUNT_DETAILS,
exact: true,
},
{
- text: t('modals.accountDetails.transactions'),
- routeName: ROUTE_ACCOUNT_DETAILS_TRANSACTIONS,
+ text: t('modals.accountDetails.assets'),
+ routeName: ROUTE_ACCOUNT_DETAILS_ASSETS,
},
{
text: t('modals.accountDetails.names'),
@@ -100,13 +100,13 @@ export default defineComponent({
const navigationConfigMultisig: NavigationElement[] = [
{
- text: t('modals.accountDetails.assets'),
+ text: t('modals.accountDetails.transactions'),
routeName: ROUTE_MULTISIG_DETAILS,
exact: true,
},
{
- text: t('modals.accountDetails.transactions'),
- routeName: ROUTE_MULTISIG_DETAILS_TRANSACTIONS,
+ text: t('modals.accountDetails.assets'),
+ routeName: ROUTE_MULTISIG_DETAILS_ASSETS,
},
{
text: t('modals.accountDetails.details'),
diff --git a/src/popup/components/DashboardHeaderMultisig.vue b/src/popup/components/DashboardHeaderMultisig.vue
index 79d47d3f7..eb16e45fb 100644
--- a/src/popup/components/DashboardHeaderMultisig.vue
+++ b/src/popup/components/DashboardHeaderMultisig.vue
@@ -34,7 +34,7 @@ import { PROTOCOL_AETERNITY } from '@/constants';
import {
useCurrencies,
useMultisigAccounts,
-} from '../../composables';
+} from '@/composables';
import { ROUTE_MULTISIG_DETAILS } from '../router/routeNames';
import TotalWalletAmount from './TotalWalletAmount.vue';
@@ -84,11 +84,11 @@ export default defineComponent({
}
return {
+ ROUTE_MULTISIG_DETAILS,
multisigAccounts,
multisigAccountIdx,
multisigBalancesTotal,
addressList,
- ROUTE_MULTISIG_DETAILS,
selectAccount,
};
},
diff --git a/src/popup/router/routeNames.ts b/src/popup/router/routeNames.ts
index f7e39629d..a8ab45872 100644
--- a/src/popup/router/routeNames.ts
+++ b/src/popup/router/routeNames.ts
@@ -1,7 +1,7 @@
export const ROUTE_INDEX = 'index';
export const ROUTE_ACCOUNT = 'account';
export const ROUTE_ACCOUNT_DETAILS = 'account-details';
-export const ROUTE_ACCOUNT_DETAILS_TRANSACTIONS = 'account-details-transactions';
+export const ROUTE_ACCOUNT_DETAILS_ASSETS = 'account-details-assets';
export const ROUTE_ACCOUNT_DETAILS_NAMES = 'account-details-names';
export const ROUTE_ACCOUNT_DETAILS_NAMES_AUCTIONS = 'account-details-names-auctions';
export const ROUTE_ACCOUNT_DETAILS_NAMES_CLAIM = 'account-details-names-claim';
@@ -12,7 +12,7 @@ export const ROUTE_MULTISIG_TX_DETAILS = 'multisig-tx-details';
export const ROUTE_MULTISIG_DETAILS = 'multisig-account-details';
export const ROUTE_MULTISIG_DETAILS_INFO = 'multisig-account-details-info';
export const ROUTE_MULTISIG_DETAILS_PROPOSAL_DETAILS = 'account-details-multisig-proposal-details';
-export const ROUTE_MULTISIG_DETAILS_TRANSACTIONS = 'multisig-account-details-transactions';
+export const ROUTE_MULTISIG_DETAILS_ASSETS = 'multisig-account-details-assets';
export const ROUTE_TX_DETAILS = 'tx-details';
export const ROUTE_MORE = 'more';
export const ROUTE_NOTIFICATIONS = 'notifications';
diff --git a/src/popup/router/routes.ts b/src/popup/router/routes.ts
index c40856895..17211aab1 100644
--- a/src/popup/router/routes.ts
+++ b/src/popup/router/routes.ts
@@ -8,8 +8,8 @@ import {
ROUTE_INDEX,
ROUTE_ACCOUNT,
ROUTE_ACCOUNT_DETAILS,
+ ROUTE_ACCOUNT_DETAILS_ASSETS,
ROUTE_ACCOUNT_DETAILS_NAMES_AUCTIONS,
- ROUTE_ACCOUNT_DETAILS_TRANSACTIONS,
ROUTE_NOTIFICATIONS,
ROUTE_COIN,
ROUTE_TOKEN,
@@ -20,7 +20,7 @@ import {
ROUTE_NETWORK_SETTINGS,
ROUTE_MULTISIG_ACCOUNT,
ROUTE_MULTISIG_DETAILS,
- ROUTE_MULTISIG_DETAILS_TRANSACTIONS,
+ ROUTE_MULTISIG_DETAILS_ASSETS,
ROUTE_MULTISIG_TX_DETAILS,
ROUTE_TX_DETAILS,
ROUTE_MULTISIG_DETAILS_PROPOSAL_DETAILS,
@@ -123,8 +123,8 @@ export const routes: WalletAppRouteConfig[] = [
props: { viewComponentName: PROTOCOL_VIEW_ACCOUNT_DETAILS },
children: [
{
- path: '',
- name: ROUTE_ACCOUNT_DETAILS,
+ path: 'assets',
+ name: ROUTE_ACCOUNT_DETAILS_ASSETS,
component: AccountDetailsTokens,
meta: {
showFilterBar: true,
@@ -133,8 +133,8 @@ export const routes: WalletAppRouteConfig[] = [
},
},
{
- path: 'transactions',
- name: ROUTE_ACCOUNT_DETAILS_TRANSACTIONS,
+ path: '',
+ name: ROUTE_ACCOUNT_DETAILS,
component: ProtocolSpecificView,
props: { viewComponentName: PROTOCOL_VIEW_ACCOUNT_DETAILS_TRANSACTIONS },
meta: {
@@ -187,7 +187,7 @@ export const routes: WalletAppRouteConfig[] = [
meta: {
title: 'txDetails',
showHeaderNavigation: true,
- backRoute: { name: ROUTE_ACCOUNT_DETAILS_TRANSACTIONS },
+ backRoute: { name: ROUTE_ACCOUNT_DETAILS },
},
},
{
@@ -207,8 +207,8 @@ export const routes: WalletAppRouteConfig[] = [
component: AccountDetailsMultisig,
children: [
{
- path: '',
- name: ROUTE_MULTISIG_DETAILS,
+ path: 'assets',
+ name: ROUTE_MULTISIG_DETAILS_ASSETS,
component: AccountDetailsMultisigTokens,
meta: {
showFilterBar: true,
@@ -217,8 +217,8 @@ export const routes: WalletAppRouteConfig[] = [
},
},
{
- path: 'transactions',
- name: ROUTE_MULTISIG_DETAILS_TRANSACTIONS,
+ path: '',
+ name: ROUTE_MULTISIG_DETAILS,
component: AccountDetailsMultisigTransactions,
meta: {
hideHeader: true,
@@ -244,7 +244,7 @@ export const routes: WalletAppRouteConfig[] = [
meta: {
title: 'txDetails',
showHeaderNavigation: true,
- backRoute: { name: ROUTE_MULTISIG_DETAILS_TRANSACTIONS },
+ backRoute: { name: ROUTE_MULTISIG_DETAILS },
},
},
{
@@ -254,7 +254,7 @@ export const routes: WalletAppRouteConfig[] = [
props: true,
meta: {
title: 'multisigProposalDetails',
- backRoute: { name: ROUTE_MULTISIG_DETAILS_TRANSACTIONS },
+ backRoute: { name: ROUTE_MULTISIG_DETAILS },
showHeaderNavigation: true,
},
},
@@ -269,7 +269,7 @@ export const routes: WalletAppRouteConfig[] = [
props: true,
meta: {
title: 'coinDetails',
- backRoute: { name: ROUTE_MULTISIG_DETAILS },
+ backRoute: { name: ROUTE_MULTISIG_DETAILS_ASSETS },
showHeaderNavigation: true,
showFilterBar: true,
hideSearchBar: true,
@@ -283,7 +283,7 @@ export const routes: WalletAppRouteConfig[] = [
props: true,
meta: {
title: 'coinDetails',
- backRoute: { name: ROUTE_MULTISIG_DETAILS },
+ backRoute: { name: ROUTE_MULTISIG_DETAILS_ASSETS },
showHeaderNavigation: true,
isMultisig: true,
},
@@ -620,7 +620,7 @@ export const routes: WalletAppRouteConfig[] = [
props: true,
meta: {
title: 'coinDetails',
- backRoute: { name: ROUTE_ACCOUNT_DETAILS },
+ backRoute: { name: ROUTE_ACCOUNT_DETAILS_ASSETS },
showHeaderNavigation: true,
showFilterBar: true,
hideSearchBar: true,
@@ -633,7 +633,7 @@ export const routes: WalletAppRouteConfig[] = [
props: true,
meta: {
title: 'coinDetails',
- backRoute: { name: ROUTE_ACCOUNT_DETAILS },
+ backRoute: { name: ROUTE_ACCOUNT_DETAILS_ASSETS },
showHeaderNavigation: true,
},
},
@@ -650,7 +650,7 @@ export const routes: WalletAppRouteConfig[] = [
props: true,
meta: {
title: 'tokenDetails',
- backRoute: { name: ROUTE_ACCOUNT_DETAILS },
+ backRoute: { name: ROUTE_ACCOUNT_DETAILS_ASSETS },
showHeaderNavigation: true,
showFilterBar: true,
hideSearchBar: true,
@@ -663,7 +663,7 @@ export const routes: WalletAppRouteConfig[] = [
props: true,
meta: {
title: 'tokenDetails',
- backRoute: { name: ROUTE_ACCOUNT_DETAILS },
+ backRoute: { name: ROUTE_ACCOUNT_DETAILS_ASSETS },
showHeaderNavigation: true,
},
},
diff --git a/src/protocols/bitcoin/views/AccountDetails.vue b/src/protocols/bitcoin/views/AccountDetails.vue
index 99054f6c1..ec62f4975 100644
--- a/src/protocols/bitcoin/views/AccountDetails.vue
+++ b/src/protocols/bitcoin/views/AccountDetails.vue
@@ -11,7 +11,7 @@ import { defineComponent } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { IonContent, IonPage } from '@ionic/vue';
import { PROTOCOL_VIEW_ACCOUNT_DETAILS } from '@/constants';
-import { ROUTE_ACCOUNT_DETAILS_TRANSACTIONS } from '@/popup/router/routeNames';
+import { ROUTE_ACCOUNT_DETAILS } from '@/popup/router/routeNames';
import AccountDetailsBase from '@/popup/components/AccountDetailsBase.vue';
export default defineComponent({
@@ -27,9 +27,8 @@ export default defineComponent({
const router = useRouter();
(() => {
- // BTC have only one view (transaction list) in ACCOUNT DETAILS
- if (route.name !== ROUTE_ACCOUNT_DETAILS_TRANSACTIONS) {
- router.push({ name: ROUTE_ACCOUNT_DETAILS_TRANSACTIONS });
+ if (route.name !== ROUTE_ACCOUNT_DETAILS) {
+ router.push({ name: ROUTE_ACCOUNT_DETAILS });
}
})();
},
diff --git a/tests/e2e/integration/other.js b/tests/e2e/integration/other.js
index 0254cc1ff..38da34b5f 100644
--- a/tests/e2e/integration/other.js
+++ b/tests/e2e/integration/other.js
@@ -19,7 +19,7 @@ describe('Tests cases not connected to specific page', () => {
{ path: '/notifications', redirect: false },
{ path: '/account-details/names', redirect: true },
{ path: '/more/about', redirect: true },
- { path: '/account-details/transactions', redirect: true },
+ { path: '/account-details/', redirect: true },
].forEach(({ path, redirect }) => {
cy.login({}, path)
.visit('')
diff --git a/tests/e2e/support/commands.js b/tests/e2e/support/commands.js
index e1109f7fa..2f417e4c9 100644
--- a/tests/e2e/support/commands.js
+++ b/tests/e2e/support/commands.js
@@ -1,6 +1,5 @@
import '../../../src/lib/initPolyfills';
import { v4 as uuid } from 'uuid';
-import { ROUTE_ACCOUNT_DETAILS_TRANSACTIONS } from '../../../src/popup/router/routeNames';
import { STUB_CURRENCY, STUB_ACCOUNT } from '../../../src/constants/stubs';
import {
formatDate,
@@ -280,8 +279,6 @@ Cypress.Commands.add('addNetwork', (name, nodeUrl, middlewareUrl) => {
Cypress.Commands.add('openTransactions', () => {
cy.get('[data-cy=account-card-base]')
- .click()
- .get(`[data-cy=${ROUTE_ACCOUNT_DETAILS_TRANSACTIONS}]`)
.click()
.get('[data-cy=loader]')
.should('be.visible');