Skip to content

Commit f1a7a55

Browse files
authored
Clickable each items on on-chain-data board (#838)
* add clickable area * add e2e testing * fix on feedback
1 parent ea8f8e7 commit f1a7a55

3 files changed

Lines changed: 35 additions & 3 deletions

File tree

src/components/dapp-staking/my-staking/OnChainData.vue

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
>
5252
<div class="animate__animated" :class="isDisplay ? inAnimation : outAnimation">
5353
<div class="row--dapp">
54-
<div class="column--dapp-name">
54+
<div class="column--dapp-name" @click="goDappPageLink(dapp.address)">
5555
<img class="img--logo" :src="dapp.iconUrl" :alt="dapp.name" />
5656
<div class="column--name">
5757
<span class="text--name"> {{ dapp.name }} </span>
@@ -96,6 +96,8 @@ import TokenBalance from 'src/components/common/TokenBalance.vue';
9696
import { DappCombinedInfo, SmartContractState } from 'src/v2/models';
9797
import { useStore } from 'src/store';
9898
import { paginate } from '@astar-network/astar-sdk-core';
99+
import { networkParam, Path } from 'src/router/routes';
100+
import { useRouter } from 'vue-router';
99101
100102
enum Filter {
101103
tvl = 'dappStaking.stakingTvl',
@@ -111,6 +113,7 @@ interface Data {
111113
iconUrl: string;
112114
name: string;
113115
balance: string;
116+
address: string;
114117
}
115118
116119
const numItemsTablet = 8;
@@ -141,6 +144,7 @@ export default defineComponent({
141144
const isDisplay = ref<boolean>(true);
142145
const goToNext = ref<boolean>(true);
143146
const sortBy = ref<SortBy>(SortBy.amountHighToLow);
147+
const router = useRouter();
144148
145149
const numItems = computed<number>(() =>
146150
width.value > screenSize.md ? numItemsTablet : numItemsMobile
@@ -153,6 +157,12 @@ export default defineComponent({
153157
);
154158
const isShiden = computed<boolean>(() => currentNetworkName.value === 'Shiden');
155159
160+
const goDappPageLink = (address: string | undefined): void => {
161+
const base = networkParam + Path.DappStaking + Path.Dapp;
162+
const url = `${base}?dapp=${address?.toLowerCase()}`;
163+
router.push(url);
164+
};
165+
156166
const getDappStyle = (index: number): string => {
157167
if (screenSize.md > width.value) {
158168
return '';
@@ -205,6 +215,7 @@ export default defineComponent({
205215
return {
206216
iconUrl: it.dapp.iconUrl,
207217
name: it.dapp.name,
218+
address: it.dapp.address,
208219
balance,
209220
};
210221
} else {
@@ -268,6 +279,7 @@ export default defineComponent({
268279
changePage,
269280
getDappStyle,
270281
getBorderStyle,
282+
goDappPageLink,
271283
};
272284
},
273285
});

src/components/dapp-staking/my-staking/styles/on-chain-data.scss

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,15 @@
181181
display: flex;
182182
align-items: center;
183183
column-gap: 12px;
184+
max-width: 255px;
185+
height: 48px;
186+
border-radius: 6px;
187+
padding: 0px 12px;
188+
cursor: pointer;
189+
&:hover {
190+
background: rgba(255, 255, 255, 0.1);
191+
}
192+
184193
@media (min-width: $md) {
185194
column-gap: 16px;
186195
}
@@ -233,8 +242,8 @@
233242

234243
.divider {
235244
border-top: 1px solid rgba(255, 255, 255, 0.2);
236-
margin-top: 20px;
237-
margin-bottom: 20px;
245+
margin-top: 8px;
246+
margin-bottom: 8px;
238247
}
239248

240249
.body--dark {

tests/test_specs/dappstaking.spec.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,15 @@ test.describe('on dapp staking screen', () => {
8686
const stakeButton = page.getByRole('button', { name: 'Stake Now' });
8787
await expect(stakeButton).toBeVisible();
8888
});
89+
90+
test('should clickable item on the on chain data after loading is complete', async ({ page }) => {
91+
const closeButton = page.locator('.modal-close');
92+
await closeButton.click();
93+
await page.waitForSelector('.loader', { state: 'hidden' });
94+
const onChainCard = page
95+
.locator('.wrapper--onchain-data .column--dapp-name:first-child')
96+
.first();
97+
await expect(onChainCard).toBeVisible();
98+
await onChainCard.click();
99+
});
89100
});

0 commit comments

Comments
 (0)