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

Improve sora card styles #1000

Merged
merged 4 commits into from
Mar 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 7 additions & 5 deletions src/components/SoraCard/steps/TermsAndConditions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ import TranslationMixin from '@/components/mixins/TranslationMixin';
import { Components, TosExternalLinks } from '@/consts';
import { lazyComponent } from '@/router';
import { getter } from '@/store/decorators';
import { delay } from '@/utils';

type TermsAndConditionsType = 't&c' | 'privacyPolicy' | 'unsupported';

@Component({
components: {
Expand Down Expand Up @@ -70,19 +73,18 @@ export default class TermsAndConditions extends Mixins(TranslationMixin, mixins.
this.$emit('confirm');
}

openDialog(policy: string): void {
async openDialog(policy: TermsAndConditionsType): Promise<void> {
if (policy === 't&c') {
this.link = this.termsLink;
this.dialogTitle = this.termsAndConditionsTitle;
}
if (policy === 'privacyPolicy') {
} else if (policy === 'privacyPolicy') {
this.link = this.privacyLink;
this.dialogTitle = this.privacyPolicyTitle;
}
if (policy === 'unsupported') {
} else if (policy === 'unsupported') {
this.link = '';
this.dialogTitle = this.unsupportedCountriesTitle;
}
await delay(); // small delay is required for dialog re-rendering
this.showDialog = true;
}
}
Expand Down
35 changes: 11 additions & 24 deletions src/components/SoraCard/steps/ToSDialog.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<template>
<dialog-base :visible.sync="isVisible" class="terms-of-service-dialog" :title="title">
<div v-if="srcLink" v-loading="loading" class="tos__section">
<iframe @load="onIFrameLoad" :src="srcLink" width="100%" height="600px" frameborder="0"></iframe>
</div>
<div v-else>
<widget v-if="srcLink" class="tos__section" with-border :src="srcLink" />
<template v-else>
<div class="sora-card__excuse">
{{ t('card.blacklistedCountriesExcuse') }}
</div>
Expand All @@ -14,7 +12,7 @@
</li>
</ul>
</div>
</div>
</template>
</dialog-base>
</template>

Expand All @@ -25,10 +23,13 @@ import { components, mixins } from '@soramitsu/soraneo-wallet-web';

import TranslationMixin from '@/components/mixins/TranslationMixin';
import { state } from '@/store/decorators';
import { lazyComponent } from '@/router';
import { Components } from '@/consts';

@Component({
components: {
DialogBase: components.DialogBase,
Widget: lazyComponent(Components.Widget),
},
})
export default class TermsAndConditionsDialog extends Mixins(TranslationMixin, mixins.DialogMixin) {
Expand All @@ -37,9 +38,6 @@ export default class TermsAndConditionsDialog extends Mixins(TranslationMixin, m

@state.settings.displayRegions private displayRegions!: Nullable<Intl.DisplayNames>;

loading = true;
flags: string[] = [];

countryCodeEmoji = countryCodeEmoji;

formatCountryName(key: string, defaultValue: string): string {
Expand Down Expand Up @@ -81,38 +79,27 @@ export default class TermsAndConditionsDialog extends Mixins(TranslationMixin, m
sy: 'Syria',
th: 'Thailand',
us: 'United States',
};

onIFrameLoad(): void {
this.loading = false;
}
} as const;
}
</script>

<style lang="scss">
.terms-of-service-dialog .el-dialog {
margin-top: 12vh !important;
max-width: 1000px !important;
.dialog-wrapper.terms-of-service-dialog .el-dialog:not(.is-fullscreen) {
max-width: 1000px;
}
</style>

<style lang="scss" scoped>
.tos__section {
width: 100%;
height: 600px;
background-color: transparent;
box-shadow: var(--s-shadow-element);
border-radius: 10px;
padding: 0;
padding-left: $basic-spacing;
padding-right: $inner-spacing-tiny;
padding-top: $inner-spacing-mini;
overflow: hidden;
margin-bottom: calc(var(--s-basic-spacing) * 2);
}

.sora-card {
&__unsupported-countries {
margin-top: 24px;
padding-left: 0;
display: grid;
grid-template-columns: 1fr 1fr;

Expand Down
4 changes: 2 additions & 2 deletions src/components/pages/Moonpay/Moonpay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<template #title>
<moonpay-logo :theme="libraryTheme" />
</template>
<moonpay-widget :src="widgetUrl" />
<widget :src="widgetUrl" />
</dialog-base>
</template>

Expand All @@ -28,7 +28,7 @@ import type { MoonpayTransaction } from '@/utils/moonpay';
components: {
DialogBase: components.DialogBase,
MoonpayLogo,
MoonpayWidget: lazyComponent(Components.MoonpayWidget),
Widget: lazyComponent(Components.Widget),
},
})
export default class Moonpay extends Mixins(MoonpayBridgeInitMixin) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="widget-container" v-loading="widgetLoading">
<div class="widget-container" :class="{ 'widget-container--bordered': withBorder }" v-loading="widgetLoading">
<iframe v-if="src" class="widget" :src="src" @load="onLoadWidget" />
</div>
</template>
Expand All @@ -8,8 +8,9 @@
import { Component, Vue, Prop, Watch } from 'vue-property-decorator';

@Component
export default class MoonpayWidget extends Vue {
export default class Widget extends Vue {
@Prop({ default: '', type: String }) readonly src!: string;
@Prop({ default: false, type: Boolean }) readonly withBorder!: boolean;

@Watch('src', { immediate: true })
private onChangeSrc(value) {
Expand All @@ -33,16 +34,27 @@ export default class MoonpayWidget extends Vue {
</style>

<style lang="scss" scoped>
.widget-container {
display: flex;
border: none;
width: 100%;
min-height: 600px;
overflow: hidden;
}
$widget-border-radius: 20px;

.widget {
flex: 1;
border: none;
border-radius: 20px;
border-radius: $widget-border-radius;

&-container {
display: flex;
border: none;
width: 100%;
min-height: 600px;
overflow: hidden;

&--bordered {
.widget {
box-shadow: var(--s-shadow-element);
padding: $widget-border-radius $inner-spacing-mini;
margin: $inner-spacing-tiny;
}
}
}
}
</style>
2 changes: 1 addition & 1 deletion src/consts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ export enum Components {
BridgeSelectNetwork = 'pages/Bridge/SelectNetwork',
// Moonpay Page
Moonpay = 'pages/Moonpay/Moonpay',
MoonpayWidget = 'pages/Moonpay/Widget',
MoonpayNotification = 'pages/Moonpay/Notification',
MoonpayConfirmation = 'pages/Moonpay/Confirmation',
MoonpayHistoryButton = 'pages/Moonpay/HistoryButton',
Expand Down Expand Up @@ -205,6 +204,7 @@ export enum Components {
ValueStatusWrapper = 'shared/ValueStatusWrapper',
TransactionDetails = 'shared/TransactionDetails',
PoolInfo = 'shared/PoolInfo',
Widget = 'shared/Widget',
// Shared Buttons
SortButton = 'shared/Button/SortButton',
SvgIconButton = 'shared/Button/SvgIconButton/SvgIconButton',
Expand Down
4 changes: 2 additions & 2 deletions src/views/MoonpayHistory.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
/>
</template>
<template v-else>
<moonpay-widget :src="detailsWidgetUrl" />
<widget :src="detailsWidgetUrl" />
<s-button
v-if="isCompletedTransaction"
:type="actionButtonType"
Expand Down Expand Up @@ -103,7 +103,7 @@ const DetailsView = 'details';
MoonpayLogo,
FormattedAmount: components.FormattedAmount,
GenericPageHeader: lazyComponent(Components.GenericPageHeader),
MoonpayWidget: lazyComponent(Components.MoonpayWidget),
Widget: lazyComponent(Components.Widget),
HistoryPagination: components.HistoryPagination,
},
})
Expand Down
1 change: 0 additions & 1 deletion src/views/SoraCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ export default class SoraCard extends Mixins(mixins.LoadingMixin, SubscriptionsM

@Watch('soraCardEnabled', { immediate: true })
private checkAvailability(value: Nullable<boolean>): void {
console.info('SoraCard.vue::soraCardEnabled:', value); // For tests on PR env
if (value === false) {
goTo(PageNames.Swap);
}
Expand Down