Skip to content

Commit

Permalink
feat: update startup port
Browse files Browse the repository at this point in the history
  • Loading branch information
AricRedemption committed Apr 2, 2024
1 parent ed04f1a commit 8857fee
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 99 deletions.
35 changes: 19 additions & 16 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<script setup lang="ts">
import { FEEB } from './data/config'
import { useRoute } from 'vue-router'
import useStorage from '@/lib/storage'
import { gotoWelcome } from '@/lib/utils'
import { getNetwork } from './lib/network'
import { computed, Ref, inject } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { toast } from './components/ui/toast'
import { useQueryClient } from '@tanstack/vue-query'
import BgHueImg from './assets/images/bg-hue.png?url'
import { computed, Ref, inject, onMounted } from 'vue'
import Toaster from '@/components/ui/toast/Toaster.vue'
import TheFooter from './components/the-footer/Index.vue'
import TheHeader from './components/headers/TheHeader.vue'
import { API_NET, API_TARGET, Wallet } from 'meta-contract'
import { getCurrentAccount, getPrivateKey } from './lib/account'
import SecondaryHeader from './components/headers/SecondaryHeader.vue'
import {
migrateV2,
migrationSync,
Expand All @@ -23,7 +23,6 @@ import {
} from '@/lib/migrate'
const route = useRoute()
const router = useRouter()
const storage = useStorage()
const queryClient = useQueryClient()
Expand All @@ -43,7 +42,10 @@ const secondaryHeaderTitle = computed(() => {
async function checkMigrate() {
if (!(await storage.get(ACCOUNT_Sync_Migrated_KEY))) {
const result = await migrationSync()
const { code, message } = await migrationSync()
if (code === -1) {
toast({ title: `Migrate Failed`, toastType: 'fail', description: message })
}
}
if (!(await storage.get(ACCOUNT_V2_Migrated_KEY)) && (await needMigrationV2())) {
await migrateV2()
Expand All @@ -52,25 +54,26 @@ async function checkMigrate() {
}
const wallet: Ref<any> = inject('wallet')!
checkMigrate().then(async () => {
const currentAccout = await getCurrentAccount()
if (currentAccout) {
const network = await getNetwork()
const wif = await getPrivateKey()
wallet.value = new Wallet(wif, network as API_NET, FEEB, API_TARGET.MVC)
} else {
gotoWelcome('/welcome')
}
onMounted(() => {
checkMigrate().then(async () => {
const currentAccout = await getCurrentAccount()
if (currentAccout) {
const network = await getNetwork()
const wif = await getPrivateKey()
wallet.value = new Wallet(wif, network as API_NET, FEEB, API_TARGET.MVC)
} else {
gotoWelcome('/welcome')
}
})
})
</script>

<template>
<div
id="app"
class="ext-app relative flex h-150 w-90 items-center justify-center overflow-y-auto xs:h-screen xs:w-screen xs:bg-gray-200/10 text-black-secondary"
>
<Toaster />

<!-- bg -->
<div
class="fixed left-0 top-0 isolate z-[-1] hidden h-1/2 w-full select-none bg-cover bg-center bg-no-repeat xs:block"
Expand Down
2 changes: 1 addition & 1 deletion src/assets/icons-v3/copy.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 7 additions & 6 deletions src/lib/migrate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {

export const ACCOUNT_Sync_Migrated_KEY = 'accounts_sync_migrated'
export const ACCOUNT_V2_Migrated_KEY = 'accounts_v2_migrated'
export const ACCOUNT_V3_Migrated_KEY = 'accounts_v3_migrated'
export const ACCOUNT_V2_Encrypted_KEY = 'accounts_v2_encrypted'
export const Error_Accounts_Migrate_Log_Key = 'error_accounts_migrate_log'

Expand Down Expand Up @@ -46,9 +47,9 @@ const addMigrateErrorAccount = async (address: string, mnemonic: string, storage
}

enum MigrateResultCode {
SUCCESS = 0,
FAILED = -1,
NO_fOUND = 1,
SUCCESS = -1,
UNDO = 0,
FAILED = 1,
}

interface MigrateResult {
Expand Down Expand Up @@ -102,7 +103,7 @@ export async function migrationSync(): Promise<MigrateResult> {
if (v2Account) {
await storage.set(ACCOUNT_Sync_Migrated_KEY, true)
return {
code: MigrateResultCode.SUCCESS,
code: MigrateResultCode.UNDO,
message: `Account already exists.`,
}
}
Expand Down Expand Up @@ -152,8 +153,8 @@ export async function migrationSync(): Promise<MigrateResult> {
}
await storage.set(ACCOUNT_Sync_Migrated_KEY, true)
return {
code: MigrateResultCode.NO_fOUND,
message: 'Sync account data is not found.',
code: MigrateResultCode.UNDO,
message: 'No cache, no migration needed.',
}
}

Expand Down
16 changes: 5 additions & 11 deletions src/pages/wallet/AccountHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,7 @@ import EditName from '@/pages/accounts/components/EditName.vue'
import CloseIcon from '@/assets/icons-v3/close.svg'
import BtcLogo from '@/assets/images/btc-logo.svg?url'
import SpaceLogo from '@/assets/images/space-logo.svg?url'
import {
Drawer,
DrawerClose,
DrawerContent,
DrawerHeader,
DrawerTitle,
} from '@/components/ui/drawer'
import { Drawer, DrawerClose, DrawerContent, DrawerHeader, DrawerTitle } from '@/components/ui/drawer'
const { toast } = useToast()
Expand Down Expand Up @@ -66,12 +60,12 @@ const copy = (address: string, type: string) => {
<EditName v-model:open="openEditNameModal" :account="account" />
</FlexBox>
<div class="flex items-center gap-x-4">
<CopyIcon class="cursor-pointer" @click="isOpen = true" />
<CopyIcon class="cursor-pointer hover:text-blue-primary" @click="isOpen = true" />
<SettingMenu />
<ServiceMenu class="cursor-pointer" />
</div>
</div>
<Drawer v-model:open="isOpen">
<Drawer v-model:open="isOpen" activeSnapPoint="#wallet">
<DrawerContent>
<DrawerHeader>
<DrawerTitle class="text-center relative">
Expand All @@ -88,15 +82,15 @@ const copy = (address: string, type: string) => {
<div>Bitcoin</div>
<div class="text-xs text-gray-primary break-all w-64">{{ btcAddress }}</div>
</div>
<CopyIcon class="cursor-pointer" @click="copy(btcAddress, 'Bitcoin')" />
<CopyIcon class="cursor-pointer hover:text-blue-primary" @click="copy(btcAddress, 'Bitcoin')" />
</FlexBox>
<FlexBox ai="center" :gap="2">
<img :src="SpaceLogo" alt="Bitcoin" class="w-8" />
<div>
<div>Microvisionchain</div>
<div class="text-xs text-gray-primary break-all w-64">{{ btcAddress }}</div>
</div>
<CopyIcon class="cursor-pointer" @click="copy(mvcAddress, 'Microvisionchain')" />
<CopyIcon class="cursor-pointer hover:text-blue-primary" @click="copy(mvcAddress, 'Microvisionchain')" />
</FlexBox>
</FlexBox>
</DrawerContent>
Expand Down
12 changes: 4 additions & 8 deletions src/pages/wallet/components/AssetTabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'
<template>
<div class="border-t border-primary-teal border-opacity-10 pt-4">
<Tabs default-value="Cypto" class="w-full">
<TabsList class="w-full">
<TabsList class="p-0 gap-6">
<TabsTrigger value="Cypto">Cypto</TabsTrigger>
<TabsTrigger value="NFTs"> NFTs</TabsTrigger>
<TabsTrigger value="Activity">Activity</TabsTrigger>
<!-- <TabsTrigger value="Activity">Activity</TabsTrigger> -->
</TabsList>
<TabsContent value="Cypto">
<AssetList />
Expand All @@ -24,15 +24,11 @@ import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'
</template>

<style scoped lang="css">
div[role='tablist'] {
@apply p-0 justify-start gap-6;
}
button[role='tab'] {
:deep(button[role='tab']) {
@apply text-gray-primary p-0;
}
button[role='tab'][aria-selected='true'] {
:deep(button[role='tab'][aria-selected='true']) {
@apply bg-tab-selected text-transparent bg-clip-text shadow-none;
}
</style>
3 changes: 1 addition & 2 deletions vite-config/vite.dev.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import wasm from 'vite-plugin-wasm'
import topLevelAwait from 'vite-plugin-top-level-await'
import { nodePolyfills } from 'vite-plugin-node-polyfills'
import VueDevTools from 'vite-plugin-vue-devtools'
// import Inspector from 'vite-plugin-vue-inspector' // OR vite-plugin-vue-inspector

const env = loadEnv('', process.cwd())

Expand All @@ -18,7 +17,7 @@ export default defineConfig({
plugins: [alias(), vue(), VueDevTools(), nodePolyfills(), wasm(), topLevelAwait(), svgLoader()],

server: {
port: 5146,
port: 3000,
open: true,
},
})
Loading

0 comments on commit 8857fee

Please sign in to comment.