From 446341bcb0c5d89b60f4cf6c4e532abb83417bea Mon Sep 17 00:00:00 2001
From: moreal <dev.moreal@gmail.com>
Date: Thu, 16 May 2024 14:41:22 +0900
Subject: [PATCH] feat(popup): obsolete bridge feature

---
 popup/src/router.js            |  12 --
 popup/src/views/Bridge.vue     |  64 -----------
 popup/src/views/BridgeWNCG.vue | 197 ---------------------------------
 popup/src/views/Index.vue      |   9 +-
 4 files changed, 1 insertion(+), 281 deletions(-)
 delete mode 100644 popup/src/views/Bridge.vue
 delete mode 100644 popup/src/views/BridgeWNCG.vue

diff --git a/popup/src/router.js b/popup/src/router.js
index b52eac0..7b506e6 100644
--- a/popup/src/router.js
+++ b/popup/src/router.js
@@ -5,8 +5,6 @@ import InitiateMnemonic from "@/views/InitiateMnemonic.vue";
 import Login from "@/views/Login.vue";
 import ForgotPassword from "@/views/ForgotPassword.vue";
 import Send from "@/views/Send.vue";
-import BridgeWNCG from "@/views/BridgeWNCG.vue";
-import Bridge from "@/views/Bridge.vue";
 import Confirmation from "@/views/Confirmation.vue";
 
 let router = createRouter({
@@ -42,16 +40,6 @@ let router = createRouter({
             name: 'send',
             component: Send
         },
-        {
-            path: '/bridge',
-            name: 'bridge',
-            component: Bridge
-        },
-        {
-            path: '/bridge/ncg2wncg',
-            name: 'ncg2wncg',
-            component: BridgeWNCG
-        },
         {
             path: '/confirmation',
             name: 'confirmation',
diff --git a/popup/src/views/Bridge.vue b/popup/src/views/Bridge.vue
deleted file mode 100644
index af92b1b..0000000
--- a/popup/src/views/Bridge.vue
+++ /dev/null
@@ -1,64 +0,0 @@
-<template>
-  <div class="wrap pa-0 d-flex flex-column justify-space-between">
-    <div>
-      <signed-in-header></signed-in-header>
-      <div class="text-left px-2 d-flex justify-space-between align-center" style="background-color: #2a2a2a">
-        <v-btn icon dark size="large" @click="$router.replace({'name':'index'})"><v-icon color="grey">mdi-arrow-left</v-icon></v-btn>
-        <strong style="font-weight:600">BRIDGE</strong>
-        <v-btn icon dark size="large" disabled></v-btn>
-      </div>
-      <div class="pa-4 mt-2">
-        <v-card dark outlined color="#333">
-          <v-card-title>NCG <v-icon size="small" class="mx-2">mdi-arrow-right</v-icon> WNCG(ERC-20)</v-card-title>
-          <v-card-text>
-            <ul class="text-left">
-              <li>{{t('bridgeWNCGDesc1')}}</li>
-              <li>{{t('bridgeWNCGDesc2')}}</li>
-              <li>{{t('bridgeWNCGDesc3')}}</li>
-              <li>{{t('bridgeWNCGDesc4')}}</li>
-              <li>{{t('bridgeWNCGDesc5')}}</li>
-            </ul>
-          </v-card-text>
-          <v-card-actions>
-            <v-btn color="pointyellow" class="point-btn flex-fill" @click="$router.replace({name: 'ncg2wncg'})">{{t('doBridge')}}</v-btn>
-          </v-card-actions>
-        </v-card>
-        <v-row>
-          <v-col class="text-left py-1">
-            <div class="pl-2 mt-1">
-
-            </div>
-          </v-col>
-        </v-row>
-      </div>
-    </div>
-  </div>
-</template>
-
-<script>
-
-import SignedInHeader from "@/components/SignedInHeader.vue";
-import t from "@/utils/i18n"
-
-export default {
-    name: 'Bridge',
-    components: {
-        SignedInHeader
-    },
-    computed: {
-    },
-    data() {
-        return {
-        }
-    },
-    async created() {
-    },
-    methods: {
-      t,
-    }
-}
-</script>
-
-<style scoped lang="scss">
-
-</style>
diff --git a/popup/src/views/BridgeWNCG.vue b/popup/src/views/BridgeWNCG.vue
deleted file mode 100644
index a78d896..0000000
--- a/popup/src/views/BridgeWNCG.vue
+++ /dev/null
@@ -1,197 +0,0 @@
-<template>
-  <div class="wrap pa-0 d-flex flex-column justify-space-between">
-    <div>
-      <signed-in-header></signed-in-header>
-      <div class="text-left px-2 d-flex justify-space-between align-center" style="background-color: #2a2a2a">
-        <v-btn icon dark size="large" @click="$router.replace({'name':'bridge'})"><v-icon color="grey">mdi-arrow-left</v-icon></v-btn>
-        <strong style="font-weight:600">NCG -> WNCG (ERC-20)</strong>
-        <v-btn icon dark size="large" disabled></v-btn>
-      </div>
-
-      <div class="mt-10">
-        <v-form ref="sendForm">
-        <v-row class="px-6">
-          <v-col cols="4" class="pb-0 text-left">{{t('sender')}}</v-col>
-          <v-col class="py-0 text-left">
-            <div class="box">
-              <account-selector :accounts="accounts" :account="account" only-select></account-selector>
-              <div class="grey--text hex ml-2">{{shortAddress(account.address)}}</div>
-            </div>
-          </v-col>
-        </v-row>
-        <v-row class="px-6 mt-9">
-          <v-col cols="4" class="pb-0 py-0 text-left">{{t('receiver')}}<br>(ERC-20)</v-col>
-          <v-col class="py-0">
-            <v-text-field :rules="receiverRule" validate-on-blur tabindex="1" color="grey" style="color: grey" outlined dark dense v-model="receiver"></v-text-field>
-          </v-col>
-        </v-row>
-        <v-row class="px-6">
-          <v-col cols="4" class="pb-0 text-left">{{t('balance')}}</v-col>
-          <v-col class="py-0 text-left">
-            <v-text-field color="grey" style="color: grey" outlined dark dense readonly :placeholder="ncgBalancePlaceholder" :loading="balanceLoading">
-              <template v-slot:append><span class="mt-1">NCG</span></template>
-            </v-text-field>
-          </v-col>
-        </v-row>
-        <v-row class="px-6">
-          <v-col cols="4" class="pb-0 text-left">{{t('amount')}}</v-col>
-          <v-col class="py-0">
-            <v-text-field :rules="amountRule" validate-on-blur tabindex="2" color="grey" placeholder="0" style="color: grey" outlined dark dense v-model="amount">
-              <template v-slot:append><span class="mt-1">NCG</span></template>
-            </v-text-field>
-          </v-col>
-        </v-row>
-        <v-row class="px-6">
-          <v-col cols="4" class="pb-0 text-left">{{t('feeEstimated')}}</v-col>
-          <v-col class="py-0"><v-text-field color="grey" style="color: grey;" placeholder="0" outlined dark dense readonly :value="amount * 0.01">
-            <template v-slot:append><span class="mt-1">NCG</span></template>
-          </v-text-field></v-col>
-        </v-row>
-        </v-form>
-      </div>
-    </div>
-    <div class="pb-10 px-8">
-      <div class="d-flex">
-        <v-btn dark x-large
-               class="flex-fill point-btn confirm-btn"
-               color="pointyellow"
-               tabindex="3"
-               :disabled="!isValidInput"
-               @click="confirmSend"
-        >{{t('next')}}</v-btn>
-      </div>
-    </div>
-
-    <v-dialog dark v-model="confirmDialog" fullscreen>
-      <v-card>
-        <v-card-title class="py-8">NCG {{t('transfer')}}</v-card-title>
-        <v-card-text class="mt-4">
-          <v-row>
-            <v-col class="text-left py-1">
-              <v-chip size="small" color="#444" label>{{t('sender')}} : {{account.name}}</v-chip>
-              <div class="hex pl-2 mt-1">
-                {{account.address}} <copy-btn style="margin-left:-8px;" :text="account.address" icon x-small><v-icon size="x-small" color="grey">mdi-content-copy</v-icon></copy-btn>
-              </div>
-            </v-col>
-          </v-row>
-          <v-row>
-            <v-col class="text-left py-1">
-              <v-chip size="small" color="#444" label>{{t('receiver')}} (ERC-20)</v-chip>
-              <div class="hex pl-2 mt-1">
-                {{receiver}} <copy-btn style="margin-left:-8px;" :text="receiver" icon x-small><v-icon size="x-small" color="grey">mdi-content-copy</v-icon></copy-btn>
-              </div>
-            </v-col>
-          </v-row>
-          <v-row>
-            <v-col class="text-left py-1">
-              <v-chip size="small" color="#444" label>{{t('amount')}}</v-chip>
-              <div class="hex pl-2 mt-1">
-                {{amount}} NCG
-              </div>
-            </v-col>
-          </v-row>
-          <v-row>
-            <v-col class="text-left py-1">
-              <v-chip size="small" color="#444" label>{{t('feeEstimated')}}</v-chip>
-              <div class="hex pl-2 mt-1">
-                {{amount * 0.01}} NCG
-              </div>
-            </v-col>
-          </v-row>
-        </v-card-text>
-
-        <v-card-actions class="mt-8 px-8 fixed-bottom">
-          <v-btn color="secondary" class="flex-fill" @click="confirmDialog = false" :disabled="loading">{{t('cancel')}}</v-btn>
-          <v-btn color="pointyellow" class="point-btn flex-fill send-btn" @click="bridgeWNCG" :loading="loading">{{t('doBridge')}}</v-btn>
-        </v-card-actions>
-      </v-card>
-    </v-dialog>
-  </div>
-</template>
-
-<script>
-import SignedInHeader from "@/components/SignedInHeader.vue";
-import AccountManager from "@/components/AccountManager.vue";
-import {mapGetters} from "vuex";
-import AccountSelector from "@/components/buttons/AccountSelector.vue";
-import rule from "@/utils/rules"
-import CopyBtn from "@/components/buttons/CopyBtn.vue";
-import bg from "@/api/background"
-import t from "@/utils/i18n";
-import utils from "@/utils/utils";
-
-export default {
-    name: 'BridgeWNCG',
-    components: {
-        CopyBtn,
-        AccountSelector,
-        AccountManager,
-        SignedInHeader
-    },
-    computed: {
-        ...mapGetters('Account', ['accounts', 'account', 'balance', 'balanceLoading']),
-        isValidInput() {
-            return this.receiver && this.amount > 0
-        },
-        amountRule() {
-            return [rule.required, rule.canNotZero, rule.ncgAmount,
-                // (v) => (Number(v) >= 100 || 'Minimum 100 NCG'),
-                (v) => (Number(v) <= 5000 || 'Maximum 5000 NCG'),
-                (v) => (Number(v) <= Number(this.balance) || 'Exceeded balance')]
-        },
-        receiverRule() {
-            return [rule.required, rule.address]
-        },
-        ncgBalancePlaceholder() {
-            return String(!this.balanceLoading && this.balance || '')
-        }
-
-    },
-    data() {
-        return {
-            receiver: '',
-            amount: 0,
-            nonce: 0,
-            signature: '',
-            loading: false,
-            confirmDialog: false
-        }
-    },
-    async created() {
-        this.$store.dispatch('Account/refreshBalance')
-    },
-    methods: {
-        t,
-        shortAddress: utils.shortAddress,
-        async confirmSend() {
-            if (this.$refs['sendForm'].validate()) {
-                this.nonce = await bg.wallet.nextNonce()
-                this.confirmDialog = true
-            }
-        },
-        async bridgeWNCG() {
-            this.loading = true
-            let tx = await bg.wallet.bridgeWNCG(this.account.address, this.receiver, this.amount, this.nonce)
-            await this.$store.dispatch('Account/loadTxs')
-            this.loading = false
-            this.$router.replace({name: 'index'})
-        }
-    }
-}
-</script>
-
-<style scoped lang="scss">
-.box {
-  border: 1px solid #555;
-  padding: 4px 0px;
-  border-radius: 4px;
-}
-::v-deep .v-input {
-  input {
-    font-size: 14px !important;
-    color: #eee;
-    font-family: "Roboto mono", Helvetica, Arial, sans-serif;
-  }
-}
-
-</style>
diff --git a/popup/src/views/Index.vue b/popup/src/views/Index.vue
index e6a5481..fdabe65 100644
--- a/popup/src/views/Index.vue
+++ b/popup/src/views/Index.vue
@@ -15,12 +15,6 @@
         </div>
       </div>
       <div class="mt-4">
-        <v-btn dark size="large" color="#666666" class="mx-1 action-btn" :disabled="balanceLoading" @click="$router.replace({name: 'bridge'})">
-          <div>
-            {{t('bridge')}}
-            <div style="font-size: 10px;color:#888;letter-spacing: 0px">WNCG</div>
-          </div>
-        </v-btn>
         <v-btn dark large
                color="#F0B90B"
                class="mx-1 action-btn point-btn"
@@ -47,8 +41,7 @@
                 <span class="ml-3" :class="tx.status">{{tx.status}}</span>
               </span>
               <span class="tx-type">
-                <span v-if="tx.action === 'bridgeWNCG'">Bridge WNCG</span>
-                <span v-else>{{ tx.type == 'transfer_asset5' ? 'Transfer Asset' : tx.type}}</span>
+                <span>{{ tx.type == 'transfer_asset5' ? 'Transfer Asset' : tx.type}}</span>
               </span>
             </div>
             <div style="margin-right: -16px;" class="d-flex align-center">