Skip to content
This repository was archived by the owner on Nov 18, 2021. It is now read-only.
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
75 changes: 32 additions & 43 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -1,46 +1,9 @@
{
"hosting": [ {
"target": "production",
"public": "dist",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
],
"headers": [
{
"source": "**/*",
"headers": [
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "X-Frame-Options",
"value": "DENY"
},
{
"key": "X-XSS-Protection",
"value": "1; mode=block"
}
]
}
]
},
"hosting": [
{
"target": "staging",
"target": "production",
"public": "dist",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
"rewrites": [
{
"source": "**",
Expand All @@ -52,9 +15,35 @@
"source": "**/*",
"headers": [
{
"key": "Content-Security-Policy",
"value": "frame-ancestors 'self' https://bancor-v2-beta.web.app https://bancor.network https://*.bancor.network; default-src 'self'; connect-src https://bancor.network https://ropsten-ptdczarhfq-nw.a.run.app/welcome wss://*.blocknative.com https://*.bancor.network https://*.keeperdao.com https://*.sentry.io https://raw.githubusercontent.com/Velua/eth-tokens-registry/master/tokens.json wss://*.alchemyapi.io; font-src https://fonts.gstatic.com; img-src 'self' data: https://etherscan.io https://*.etherscan.io https://raw.githubusercontent.com https://storage.googleapis.com; script-src 'self' 'unsafe-eval' https://www.google-analytics.com/analytics.js https://www.googletagmanager.com/gtag/js; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com/;"
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "X-Frame-Options",
"value": "DENY"
},
{
"key": "X-XSS-Protection",
"value": "1; mode=block"
}
]
}
]
},
{
"target": "staging",
"public": "dist",
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
],
"headers": [
{
"source": "**/*",
"headers": [
{
"key": "X-Content-Type-Options",
"value": "nosniff"
Expand All @@ -72,4 +61,4 @@
]
}
]
}
}
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
"vue-analytics": "^5.17.2",
"vue-class-component": "^7.2.3",
"vue-content-loader": "^2.0.0",
"vue-gtag": "^1.14.0",
"vue-i18n": "8.24.4",
"vue-property-decorator": "^9.1.2",
"vue-router": "^3.5.1",
Expand Down
5 changes: 0 additions & 5 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,7 @@ export default class App extends BaseComponent {

try {
await vxm.bancor.init(initParams);
// @ts-ignore
this.loading = false;
// @ts-ignore
this.$gtag.event("initBancor", {
event_category: this.$route.params.service
});
} catch (e) {
await wait(1000);
try {
Expand Down
8 changes: 6 additions & 2 deletions src/components/modals/ModalBase.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
icon="chevron-left"
:class="darkMode ? 'text-dark' : 'text-light'"
class="cursor"
@click="onHide"
@click="hide"
/>
</div>
<span
Expand All @@ -38,7 +38,7 @@
v-else
class="cursor font-size-lg"
:class="darkMode ? 'text-dark' : 'text-light'"
@click="onHide"
@click="hide"
icon="times"
/>
</b-col>
Expand Down Expand Up @@ -94,6 +94,10 @@ export default class ModalBase extends BaseComponent {
];
}

hide() {
this.show = false;
}

@Emit("onHide")
onHide() {
this.show = false;
Expand Down
22 changes: 16 additions & 6 deletions src/components/modals/ModalTxAction.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<template>
<modal-base v-model="txMetaData.showTxModal" size="sm" @input="close">
<modal-base
v-model="txMetaData.showTxModal"
size="sm"
@input="close"
@onHide="onHideCallBack"
>
<div
v-if="showSlotContent"
class="text-center"
Expand Down Expand Up @@ -100,6 +105,7 @@ export default class ModalTxAction extends BaseComponent {
@Prop({ required: false }) icon?: string;
@Prop({ default: "primary" }) iconVariant!: string;
@Prop({ required: false }) redirectOnSuccess?: string;
@Prop() onHide!: Function;

get currentStatus() {
if (this.txMetaData.sections.length)
Expand Down Expand Up @@ -134,11 +140,8 @@ export default class ModalTxAction extends BaseComponent {
selectedPromptReceiver$.next(id);
}

async close() {
if (this.txMetaData.txBusy) return;
if (this.redirectOnSuccess && this.txMetaData.success) {
await this.$router.replace({ name: this.redirectOnSuccess });
}
onHideCallBack() {
if (this.txMetaData.stepIndex <= 1) this.onHide();
this.txMetaData = {
showTxModal: false,
txBusy: false,
Expand All @@ -149,5 +152,12 @@ export default class ModalTxAction extends BaseComponent {
prompt: null
};
}

async close() {
if (this.txMetaData.txBusy) return;
if (this.redirectOnSuccess && this.txMetaData.success) {
await this.$router.replace({ name: this.redirectOnSuccess });
}
}
}
</script>
16 changes: 0 additions & 16 deletions src/components/pool/ModalPoolAction.vue
Original file line number Diff line number Diff line change
Expand Up @@ -148,24 +148,8 @@ export default class ModalPoolAction extends BaseComponent {
txResult = await vxm.bancor.addLiquidity(params);
else txResult = await vxm.bancor.removeLiquidity(params);
this.success = txResult;
// @ts-ignore
this.$gtag.event(
this.withdrawLiquidity ? "removeLiquidity" : "addLiquidity",
{
event_category: "success",
event_label: this.$route.params.account
}
);
} catch (e) {
this.error = e.message;
// @ts-ignore
this.$gtag.event(
this.withdrawLiquidity ? "removeLiquidity" : "addLiquidity",
{
event_category: "error",
event_label: this.$route.params.account
}
);
} finally {
this.txBusy = false;
}
Expand Down
17 changes: 10 additions & 7 deletions src/components/swap/SwapHome.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
<b-button-group class="d-flex w-100 text-center mt-2 mb-3 pt-3">
<b-button
id="market"
@click="$router.push({ name: 'Swap' })"
@click="limit = false"
:variant="
limit ? 'outline-primary' + (darkMode ? '-dark' : '') : 'primary'
"
>{{ $t("market") }}
</b-button>
<b-button
id="limit"
@click="$router.push({ name: 'SwapLimit' })"
@click="limit = true"
:variant="
!limit ? 'outline-primary' + (darkMode ? '-dark' : '') : 'primary'
"
Expand All @@ -36,24 +36,27 @@
>
{{ $t("trade_at_pre_det") }}
</b-popover>
<router-view />
<swap-limit v-if="limit" />
<swap-market v-else />
</content-block>
</template>

<script lang="ts">
import { Component } from "vue-property-decorator";
import ContentBlock from "@/components/common/ContentBlock.vue";
import BaseComponent from "@/components/BaseComponent.vue";
import SwapMarket from "@/components/swap/SwapMarket.vue";
import SwapLimit from "@/components/swap/SwapLimit.vue";

@Component({
components: {
ContentBlock
ContentBlock,
SwapLimit,
SwapMarket
}
})
export default class SwapHome extends BaseComponent {
get limit() {
return this.$route.name === "SwapLimit";
}
limit = false;
}
</script>

Expand Down
8 changes: 4 additions & 4 deletions src/components/swap/SwapLimit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ export default class SwapLimit extends BaseTxAction {
}

this.$router.replace({
name: "SwapLimit",
name: "Swap",
query: {
from: id,
to: to
Expand All @@ -455,7 +455,7 @@ export default class SwapLimit extends BaseTxAction {
}

this.$router.replace({
name: "SwapLimit",
name: "Swap",
query: {
from: from,
to: id
Expand All @@ -465,7 +465,7 @@ export default class SwapLimit extends BaseTxAction {

invertSelection() {
this.$router.replace({
name: "SwapLimit",
name: "Swap",
query: {
from: this.token2.id,
to: this.token1.id
Expand Down Expand Up @@ -746,7 +746,7 @@ export default class SwapLimit extends BaseTxAction {
if (this.$route.query.from) defaultQuery.from = this.$route.query.from;
// @ts-ignore
if (this.$route.query.to) defaultQuery.to = this.$route.query.to;
await this.$router.replace({ name: "SwapLimit", query: defaultQuery });
await this.$router.replace({ name: "Swap", query: defaultQuery });
}
}
}
Expand Down
Loading