Skip to content

Commit

Permalink
feat: added 'help' button on header (#772)
Browse files Browse the repository at this point in the history
* fix: display EVM withdraw when users have balance in withdrawal

* fix: added help button on header

* fix: removed release note on the template.md

* fix: test

* fix: test (2)

* fix: display ModalConectionTrouble when app is loading
  • Loading branch information
impelcrypto authored May 10, 2023
1 parent edc1ed5 commit e454c09
Show file tree
Hide file tree
Showing 14 changed files with 182 additions and 95 deletions.
5 changes: 0 additions & 5 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@
- [ ] documentation changes
- [ ] tested on mobile devices

**Release notes:**

- (ex: feat: updated dApp staking to V2)
- (ex: fix: modified styling bugs on the Assets page)

**This pull request makes the following changes:**

**Adds**
Expand Down
2 changes: 1 addition & 1 deletion src/components/assets/NativeAssetList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
</div>
</div>

<div class="row--bg--extend row--details-native bg--accent">
<div v-if="numEvmDeposit" class="row--bg--extend row--details-native bg--accent">
<div class="row__left">
<span class="text--md">{{ $t('assets.yourEvmDeposit') }}</span>
</div>
Expand Down
64 changes: 0 additions & 64 deletions src/components/common/ConnectionTrouble.vue

This file was deleted.

1 change: 1 addition & 0 deletions src/components/common/ModalConnectionTrouble.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
:title="$t('assets.modals.connectionTroubles.connectionTroubles')"
:is-closing="isClosingModal"
:close-modal="closeModal"
class-name="highest-z-index"
>
<div class="wrapper--modal-connection-trouble">
<div class="row--description">
Expand Down
3 changes: 1 addition & 2 deletions src/components/header/AccountButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<img class="icon" width="16" :src="iconWallet" />
<template v-if="width >= screenSize.sm">
<span class="text--address">
{{ getShortenAddress(account) }}
{{ getShortenAddress(account, 4) }}
</span>
</template>
</button>
Expand Down Expand Up @@ -51,7 +51,6 @@ export default defineComponent({
align-items: center;
padding: 8px 16px 8px 12px;
border-radius: 16px;
margin-left: 16px;
transition: all 0.3s ease 0s;
background: transparent;
color: #fff;
Expand Down
3 changes: 3 additions & 0 deletions src/components/header/Header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<template #left>
<div class="icon"><logo /></div>
</template>
<trouble-help />
<template v-if="!currentAccount">
<connect-button @click="openSelectModal">
<astar-icon-wallet />
Expand Down Expand Up @@ -61,6 +62,7 @@ import { useStore } from 'src/store';
import { useRoute } from 'vue-router';
import { getHeaderName } from 'src/router/routes';
import { useBreakpoints } from 'src/hooks';
import TroubleHelp from 'src/components/header/TroubleHelp.vue';
import ConnectButton from 'src/components/header/ConnectButton.vue';
import AccountButton from 'src/components/header/AccountButton.vue';
import NetworkButton from 'src/components/header/NetworkButton.vue';
Expand Down Expand Up @@ -89,6 +91,7 @@ export default defineComponent({
Logo,
ModalUpdateWallet,
HeaderComp,
TroubleHelp,
},
setup() {
const { width, screenSize } = useBreakpoints();
Expand Down
5 changes: 0 additions & 5 deletions src/components/header/NetworkButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@
<img v-show="currentLogo" class="icon" width="16" :src="currentLogo" />
<div class="column--network-name">
<template v-if="width >= screenSize.md">
<span class="text--network">
{{ currentNetworkName }}
</span>
</template>
<template v-else-if="width >= screenSize.sm">
<span class="text--network">
{{ currentNetworkName.replace('Network', '') }}
</span>
Expand Down
157 changes: 157 additions & 0 deletions src/components/header/TroubleHelp.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
<template>
<div class="wrapper--trouble-help">
<button
type="button"
:class="width >= screenSize.sm ? 'btn--help' : 'm-btn--help'"
@click="setShowModal(true)"
>
<div class="icon--help">
<astar-icon-help size="20" />
</div>
<template v-if="width >= screenSize.sm">
{{ $t('help') }}
</template>
</button>
<modal-connection-trouble v-if="showModal" :set-is-open="setShowModal" :show="showModal" />
</div>
</template>

<script lang="ts">
import { defineComponent, ref } from 'vue';
import { useBreakpoints } from 'src/hooks';
import ModalConnectionTrouble from 'src/components/common/ModalConnectionTrouble.vue';
export default defineComponent({
components: { ModalConnectionTrouble },
setup() {
const { width, screenSize } = useBreakpoints();
const showModal = ref<boolean>(false);
const setShowModal = (isOpen: boolean): void => {
showModal.value = isOpen;
};
return {
width,
screenSize,
showModal,
setShowModal,
};
},
});
</script>

<style lang="scss" scoped>
@import 'src/css/quasar.variables.scss';
@import 'src/css/utils.scss';
.wrapper--trouble-help {
margin-right: 8px;
@media (min-width: $lg) {
margin-right: 16px;
}
}
.btn--help {
display: flex;
height: 32px;
flex-direction: row;
align-items: center;
padding: 8px 16px 8px 16px;
background: transparent;
border-radius: 16px;
margin-left: 8px;
transition: all 0.3s ease 0s;
color: #fff;
border: 1px solid $gray-4;
@media (min-width: $lg) {
color: $navy-1;
border: 1px solid $navy-3;
}
}
.btn--help:hover {
background: $astar-blue;
border: 1px solid transparent;
.icon--help {
color: $gray-1;
}
@media (min-width: $lg) {
background: #fff;
border: 1px solid $gray-4;
.icon--help {
color: $navy-1;
}
}
}
.m-btn--help {
padding-left: 10px;
width: 32px;
height: 32px;
border: 1px solid $navy-3;
border-radius: 16px;
margin-left: 16px;
transition: all 0.3s ease 0s;
background: transparent;
color: $gray-3;
border: 1px solid $gray-4;
@media (min-width: $lg) {
border: 1px solid $navy-3;
}
}
.m-btn--help:hover {
background: $astar-blue;
border: 1px solid transparent;
.icon--help {
color: $gray-1;
}
@media (min-width: $lg) {
background: #fff;
}
}
.icon--help {
margin-right: 4px;
transition: all 0.3s ease 0s;
color: $gray-3;
margin-left: -6px;
margin-top: -1px;
@media (min-width: $lg) {
color: $navy-3;
}
}
.body--dark {
.btn--help {
background: transparent;
color: #fff;
border: 1px solid $gray-4;
}
.btn--help:hover {
background: $astar-blue;
border: 1px solid transparent;
.icon--help {
color: $gray-1;
}
}
.icon--help {
color: $gray-3;
}
.m-btn--help {
background: transparent;
color: $gray-3;
border: 1px solid $gray-4;
}
.m-btn--help:hover {
background: $astar-blue;
border: 1px solid transparent;
.icon--help {
color: $gray-1;
}
}
}
</style>
3 changes: 0 additions & 3 deletions src/components/sidenav/SidebarDesktop.vue
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@
</nav>

<div class="wrapper--bottom">
<connection-trouble />
<social-media-links />
<div class="wrapper--option">
<light-dark-mode />
Expand All @@ -114,7 +113,6 @@ import LocaleChanger from '../common/LocaleChanger.vue';
import SocialMediaLinks from '../common/SocialMediaLinks.vue';
import LightDarkMode from '../common/LightDarkMode.vue';
import Logo from '../common/Logo.vue';
import ConnectionTrouble from 'src/components/common/ConnectionTrouble.vue';
import { useRouter } from 'vue-router';
import { Path as RoutePath } from 'src/router/routes';
import IconSideNft from './components/IconSideNFT.vue';
Expand All @@ -127,7 +125,6 @@ export default defineComponent({
LightDarkMode,
LocaleChanger,
Logo,
ConnectionTrouble,
IconSideNft,
IconEcosystem,
Balloon,
Expand Down
3 changes: 0 additions & 3 deletions src/components/sidenav/SidebarOption.vue
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@
</div>
</div>
</q-expansion-item>
<connection-trouble />
<div class="button--close" @click="closeMobileNavi">X {{ $t('sidenavi.close') }}</div>
</q-list>
</div>
Expand All @@ -181,12 +180,10 @@ import { useStore } from 'src/store';
import { socialUrl, docsUrl } from 'src/links';
import { languagesSelector } from 'src/i18n';
import { i18n } from 'src/boot/i18n';
import ConnectionTrouble from 'src/components/common/ConnectionTrouble.vue';
export default defineComponent({
components: {
LightDarkMode,
ConnectionTrouble,
},
emits: ['closeNavi'],
setup(props, { emit }) {
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/en-US/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export default {
isComingSoon: '{value} is coming soon',
amountToken: '{amount} {token}',
select: 'Select',
help: 'Help',
sort: {
sortBy: 'Sort by',
amountHightToLow: 'Amount: High to Low',
Expand Down Expand Up @@ -116,7 +117,6 @@ export default {
language: 'Language',
theme: 'Theme',
close: 'Close',
connectionTrouble: 'Connection Trouble?',
comingsoon: 'Something ink!redible coming soon',
},
drawer: {
Expand Down
4 changes: 2 additions & 2 deletions tests/dappstaking.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ test.describe('init screen', () => {
await expect(page.getByRole('button', { name: 'box icon Connect' })).toBeVisible();
});

test('should display the Astar Network button', async ({ page }) => {
await expect(page.getByRole('button', { name: 'Astar Network' })).toBeVisible();
test('should display the Astar button', async ({ page }) => {
await expect(page.getByRole('button', { name: 'Astar' })).toBeVisible();
});

test('should display install extension popup when click Talisman button', async ({ page }) => {
Expand Down
16 changes: 16 additions & 0 deletions tests/header.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { test, expect } from '@playwright/test';
import { clickPolicyButton } from 'src/modules/playwright';

test.beforeEach(async ({ page }) => {
await page.goto('/astar/assets');
});

test.describe('init screen', () => {
test('has connection trouble', async ({ page }) => {
await clickPolicyButton(page);
const connectionTroubleButton = page.locator('.btn--help');
await connectionTroubleButton.click();
const connectionTroubleModal = page.locator('.wrapper--modal-connection-trouble');
await expect(connectionTroubleModal).toBeVisible();
});
});
Loading

0 comments on commit e454c09

Please sign in to comment.