Skip to content

Commit

Permalink
Merge branch 'develop' into feature/swap-layout
Browse files Browse the repository at this point in the history
  • Loading branch information
stefashkaa authored Jun 5, 2024
2 parents 6162bd1 + 4ae390c commit 49b8584
Show file tree
Hide file tree
Showing 38 changed files with 372 additions and 82 deletions.
3 changes: 3 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ export default class App extends Mixins(mixins.TransactionMixin, NodeErrorMixin)
@mutation.referrals.resetStorageReferrer private resetStorageReferrer!: FnWithoutArgs;
@action.wallet.settings.setApiKeys private setApiKeys!: (apiKeys: WALLET_TYPES.ApiKeysObject) => Promise<void>;
@action.wallet.settings.subscribeOnExchangeRatesApi subscribeOnExchangeRatesApi!: AsyncFnWithoutArgs;
@action.wallet.subscriptions.resetNetworkSubscriptions private resetNetworkSubscriptions!: AsyncFnWithoutArgs;
@action.wallet.subscriptions.resetInternalSubscriptions private resetInternalSubscriptions!: AsyncFnWithoutArgs;
@action.wallet.subscriptions.activateNetwokSubscriptions private activateNetwokSubscriptions!: AsyncFnWithoutArgs;
Expand Down Expand Up @@ -231,6 +232,8 @@ export default class App extends Mixins(mixins.TransactionMixin, NodeErrorMixin)
this.setEvmNetworksApp(data.EVM_NETWORKS_IDS);
this.setSubNetworkApps(data.SUB_NETWORKS);
this.subscribeOnExchangeRatesApi();
if (data.PARACHAIN_IDS) {
api.bridgeProxy.sub.parachainIds = data.PARACHAIN_IDS;
}
Expand Down
Binary file modified src/assets/fonts/polkaswap_icons.ttf
Binary file not shown.
2 changes: 2 additions & 0 deletions src/components/App/Header/AppHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<app-header-menu />
</div>
<select-language-dialog />
<select-currency-dialog />
</header>
</template>

Expand Down Expand Up @@ -44,6 +45,7 @@ import type Theme from '@soramitsu-ui/ui-vue2/lib/types/Theme';
AppHeaderMenu,
AppLogoButton,
SelectLanguageDialog: lazyComponent(Components.SelectLanguageDialog),
SelectCurrencyDialog: lazyComponent(Components.SelectCurrencyDialog),
PairTokenLogo: lazyComponent(Components.PairTokenLogo),
WalletAvatar: components.WalletAvatar,
},
Expand Down
57 changes: 27 additions & 30 deletions src/components/App/Header/AppHeaderMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@
:disabled="disabled"
>
{{ text }}
<span v-if="value === HeaderMenuType.Currency" class="current-currency">
{{ currency?.toUpperCase() }}
</span>
</s-dropdown-item>
<div @click="openNotificationDialog" class="notif-option el-dropdown-menu__item header-menu__item">
<bell-icon class="notif-option__bell notif-option__bell--dropdown" />
<span class="notif-option__text">{{ t('browserNotificationDialog.title') }}</span>
</div>
</template>
</s-dropdown>
</s-button>
Expand All @@ -45,12 +44,13 @@ import { Component, Mixins } from 'vue-property-decorator';
import TranslationMixin from '@/components/mixins/TranslationMixin';
import { getter, mutation, state } from '@/store/decorators';
import BellIcon from './BellIcon.vue';
import type { Currency } from '@soramitsu/soraneo-wallet-web/lib/types/currency';
enum HeaderMenuType {
HideBalances = 'hide-balances',
Theme = 'theme',
Language = 'language',
Currency = 'currency',
Notification = 'notification',
Disclaimer = 'disclaimer',
}
Expand All @@ -64,25 +64,23 @@ type MenuItem = {
const BREAKPOINT = 1440;
@Component({
components: {
BellIcon,
},
})
@Component
export default class AppHeaderMenu extends Mixins(TranslationMixin) {
readonly iconSize = 28;
readonly HeaderMenuType = HeaderMenuType;
@state.settings.disclaimerVisibility disclaimerVisibility!: boolean;
@state.settings.userDisclaimerApprove userDisclaimerApprove!: boolean;
@state.wallet.settings.shouldBalanceBeHidden private shouldBalanceBeHidden!: boolean;
@state.wallet.settings.currency currency!: Currency;
@getter.libraryTheme private libraryTheme!: Theme;
@getter.settings.notificationActivated notificationActivated!: boolean;
@mutation.wallet.settings.toggleHideBalance private toggleHideBalance!: FnWithoutArgs;
@mutation.settings.setAlertSettingsPopup private setAlertSettingsPopup!: (flag: boolean) => void;
@mutation.settings.setSelectLanguageDialogVisibility private setLanguageDialogVisibility!: (flag: boolean) => void;
@mutation.settings.setSelectCurrencyDialogVisibility private setCurrencyDialogVisibility!: (flag: boolean) => void;
@mutation.settings.toggleDisclaimerDialogVisibility private toggleDisclaimerDialogVisibility!: FnWithoutArgs;
get mediaQueryList(): MediaQueryList {
Expand Down Expand Up @@ -139,12 +137,22 @@ export default class AppHeaderMenu extends Mixins(TranslationMixin) {
icon: 'basic-globe-24',
text: this.t('headerMenu.switchLanguage'),
},
{
value: HeaderMenuType.Currency,
icon: 'various-lightbulb-24',
text: this.t('headerMenu.selectCurrency'),
},
{
value: HeaderMenuType.Disclaimer,
icon: 'info-16',
text: this.disclaimerText,
disabled: this.disclaimerDisabled,
},
{
value: HeaderMenuType.Notification,
icon: 'notifications-bell-24',
text: this.t('browserNotificationDialog.title'),
},
];
}
Expand Down Expand Up @@ -180,10 +188,16 @@ export default class AppHeaderMenu extends Mixins(TranslationMixin) {
case HeaderMenuType.Language:
this.setLanguageDialogVisibility(true);
break;
case HeaderMenuType.Currency:
this.setCurrencyDialogVisibility(true);
break;
case HeaderMenuType.Disclaimer:
if (this.disclaimerDisabled) return;
this.toggleDisclaimerDialogVisibility();
break;
case HeaderMenuType.Notification:
this.openNotificationDialog();
break;
}
}
}
Expand Down Expand Up @@ -234,27 +248,10 @@ $icon-size: 28px;
}
}
}
}
}
.notif-option {
display: flex;
&__bell {
width: $icon-size;
height: $icon-size;
margin: auto 0;
fill: var(--s-color-base-content-tertiary);
&--dropdown {
margin-top: $inner-spacing-mini;
margin-right: $basic-spacing-mini;
}
}
&:hover {
.notif-option__bell {
fill: var(--s-color-base-content-secondary);
.current-currency {
margin-left: 5px;
color: var(--s-color-base-content-tertiary);
}
}
}
Expand Down
17 changes: 0 additions & 17 deletions src/components/App/Header/BellIcon.vue

This file was deleted.

155 changes: 155 additions & 0 deletions src/components/App/Settings/Currency/SelectCurrencyDialog.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
<template>
<dialog-base :visible.sync="visibility" :title="t('currencyDialog.currency')" class="select-currency-dialog">
<search-input
ref="search"
v-model="query"
class="select-currency__search"
autofocus
:placeholder="t('currencyDialog.searchPlaceholder')"
@clear="handleClearSearch"
/>
<s-scrollbar class="select-currency-scrollbar">
<s-radio-group v-model="selectedCurrency" class="select-currency-list s-flex">
<s-radio
v-for="currency in filteredCurrencies"
:key="currency.key"
:label="currency.key"
:value="currency.key"
:disabled="currency.disabled"
size="medium"
class="select-currency-list__item s-flex"
>
<div :ref="currency.key === selectedCurrency ? 'selectedEl' : undefined" class="select-currency-item s-flex">
<div class="select-currency-item__value">
{{ currency.name }}
</div>
<div class="select-currency-item__name">
{{ currency.symbol }}
</div>
</div>
</s-radio>
</s-radio-group>
</s-scrollbar>
</dialog-base>
</template>

<script lang="ts">
import { components } from '@soramitsu/soraneo-wallet-web';
import { Component, Mixins, Ref } from 'vue-property-decorator';
import TranslationMixin from '@/components/mixins/TranslationMixin';
import { state, mutation } from '@/store/decorators';
import type { CurrencyFields, Currency } from '@soramitsu/soraneo-wallet-web/lib/types/currency';
@Component({
components: {
DialogBase: components.DialogBase,
SearchInput: components.SearchInput,
},
})
export default class SelectCurrencyDialog extends Mixins(TranslationMixin) {
@state.wallet.settings.currencies currencies!: Array<CurrencyFields>;
query = '';
@Ref('selectedEl') selectedEl!: Nullable<[HTMLDivElement]>;
@state.settings.selectCurrencyDialogVisibility private selectCurrencyDialogVisibility!: boolean;
@state.wallet.settings.currency private currency!: Currency;
@mutation.settings.setSelectCurrencyDialogVisibility private setDialogVisibility!: (flag: boolean) => void;
@mutation.wallet.settings.setFiatCurrency private setCurrency!: (currency: Currency) => Promise<void>;
get visibility(): boolean {
return this.selectCurrencyDialogVisibility;
}
set visibility(flag: boolean) {
this.setDialogVisibility(flag);
if (flag) {
this.$nextTick(() => {
this.selectedEl?.[0]?.scrollIntoView?.({ behavior: 'smooth' });
});
}
}
get selectedCurrency(): any {
return this.currency;
}
set selectedCurrency(value: any) {
this.setCurrency(value);
}
get filteredCurrencies() {
const currencies = this.currencies;
if (this.query) {
const query = this.query.toLowerCase().trim();
return currencies.filter(
(item) =>
item.name.toLowerCase().includes(query) ||
item.symbol.toLowerCase().includes(query) ||
item.key.toLocaleLowerCase().includes(query)
);
}
return currencies;
}
public handleClearSearch(): void {
this.query = '';
}
}
</script>

<style lang="scss">
.dialog-wrapper.select-currency-dialog {
.el-radio {
margin-right: 0;
}
}
.select-currency-scrollbar {
@include scrollbar(-$inner-spacing-big);
}
</style>

<style lang="scss" scoped>
$item-height: 66px;
$list-items: 7;
.select-currency-list {
height: 600px;
flex-direction: column;
max-height: calc(#{$item-height} * #{$list-items});
&__item {
align-items: center;
height: $item-height;
padding: $inner-spacing-small $inner-spacing-big;
border-radius: var(--s-border-radius-mini);
}
.select-currency-item {
flex-direction: column;
&__value {
color: var(--s-color-base-content-primary);
font-size: var(--s-font-size-medium);
line-height: var(--s-line-height-medium);
font-weight: 600;
}
&__name {
color: var(--s-color-base-content-secondary);
font-size: var(--s-font-size-mini);
line-height: var(--s-line-height-medium);
font-weight: 300;
}
}
}
.select-currency__search {
margin-bottom: $basic-spacing;
}
</style>
10 changes: 8 additions & 2 deletions src/components/pages/OrderBook/BookWidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ export default class BookWidget extends Mixins(TranslationMixin, mixins.LoadingM
@getter.orderBook.currentOrderBook currentOrderBook!: OrderBook;
@getter.orderBook.orderBookId orderBookId!: string;
@getter.settings.nodeIsConnected nodeIsConnected!: boolean;
@getter.wallet.settings.exchangeRate private exchangeRate!: number;
@getter.wallet.settings.currencySymbol private currencySymbol!: string;
@mutation.orderBook.setQuoteValue setQuoteValue!: (value: string) => void;
@mutation.orderBook.setSide setSide!: (side: PriceVariant) => void;
Expand Down Expand Up @@ -221,9 +223,11 @@ export default class BookWidget extends Mixins(TranslationMixin, mixins.LoadingM
get fiatValue(): string {
if (!this.quoteAsset) return ZeroStringValue;
const fiat = this.getFiatAmount(this.lastDealPrice.toString(), this.quoteAsset);
const fiatUsd = this.getFiatAmount(this.lastDealPrice.toString(), this.quoteAsset) || '0';
return fiat ? `$${fiat}` : '';
const currentFiat = new FPNumber(fiatUsd).mul(this.exchangeRate).toLocaleString();
return currentFiat ? `${this.currencySymbol}${currentFiat}` : '';
}
getComputedClassTrend(): string {
Expand Down Expand Up @@ -439,6 +443,8 @@ $mono-font: 'JetBrainsMono';
margin-left: $inner-spacing-big;
font-size: var(--s-font-size-big);
font-weight: 450;
unicode-bidi: bidi-override;
direction: ltr;
}
.trend-icon {
Expand Down
8 changes: 5 additions & 3 deletions src/components/pages/Stats/BarChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
:is-error="isFetchingError"
@retry="updateData"
>
<formatted-amount class="chart-price" :value="amount.amount">
<template v-if="!fees" #prefix>$</template>
<formatted-amount v-if="fees" class="chart-price" :value="amount.amount">
{{ amount.suffix }}
<template>&nbsp;{{ XOR.symbol }}</template>
</formatted-amount>
<formatted-amount v-else class="chart-price" :value="amount.amount" is-fiat-value>
{{ amount.suffix }}
<template v-if="fees">&nbsp;{{ XOR.symbol }}</template>
</formatted-amount>
<price-change :value="priceChange" />
<v-chart ref="chart" class="chart" :option="chartSpec" autoresize />
Expand Down
3 changes: 1 addition & 2 deletions src/components/pages/Stats/TvlChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
:is-error="isFetchingError"
@retry="updateData"
>
<formatted-amount class="chart-price" :value="amount.amount">
<template #prefix>$</template>
<formatted-amount class="chart-price" :value="amount.amount" is-fiat-value>
{{ amount.suffix }}
</formatted-amount>
<price-change :value="priceChange" />
Expand Down
Loading

0 comments on commit 49b8584

Please sign in to comment.