Skip to content

Commit

Permalink
chore: update UI
Browse files Browse the repository at this point in the history
  • Loading branch information
AricRedemption committed Aug 26, 2024
1 parent c02ec1f commit aa8bcc7
Show file tree
Hide file tree
Showing 15 changed files with 65 additions and 49 deletions.
2 changes: 1 addition & 1 deletion src/assets/icons-v3/expense.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/assets/icons-v3/income.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 13 additions & 13 deletions src/components/AssetLogo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ import ExpenseLogo from '@/assets/icons-v3/expense.svg'
import BTCNetworkLogo from '@/assets/icons-v3/network_btc.svg'
import MVCNetworkLogo from '@/assets/icons-v3/network_mvc.svg'
const {
logo,
chain,
symbol,
logoSize = 'size-6',
} = defineProps<{
logo?: string
chain?: Chain
symbol?: string
type?: 'network' | 'activity'
flow?: 'Send' | 'Receive' | 'Transfer' | string
logoSize?: string
}>()
withDefaults(
defineProps<{
logo?: string
chain?: Chain
symbol?: string
logoSize?: string
type?: 'network' | 'activity'
flow?: 'Send' | 'Receive' | 'Transfer' | string
}>(),
{
logoSize: 'size-6',
}
)
</script>

<template>
Expand Down
15 changes: 10 additions & 5 deletions src/components/Copy.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@ import { twMerge } from 'tailwind-merge'
import CopyIcon from '@/assets/icons-v3/copy.svg'
import { ClipboardStore } from '@/stores/ClipboardStore'
const { text, title } = defineProps<{
text: string
title?: string
showContent?: boolean
}>()
withDefaults(
defineProps<{
text: string
title?: string
showContent?: boolean
}>(),
{
showContent: true,
}
)
</script>

<template>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/actions/transfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { API_NET, API_TARGET, FtManager, Wallet, mvc } from 'meta-contract'
export type Receiver = {
address: string
amount: string
decimal:string
decimal?: string
}
export type TransferTask = {
genesis?: string
Expand Down
13 changes: 4 additions & 9 deletions src/pages/authorize/components/TransferRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,20 @@ import type { TransferTask, Receiver } from '@/lib/actions/transfer'
import { shortestAddress } from '@/lib/formatters'
import Decimal from 'decimal.js'
const props = defineProps<{
defineProps<{
task: TransferTask
receiver: Receiver
}>()
function prettyAmount(task: TransferTask, receiver: Receiver) {
// 如果没有genesis,说明是space,需要除以10^8
if (!task.genesis) {
return Number(receiver.amount) / 1e8 + ' SPACE'
}
return new Decimal(receiver.amount).div(10 ** Number(receiver.decimal)).toFixed()
function prettyAmount(receiver: Receiver) {
return new Decimal(receiver.amount).div(10 ** Number(receiver?.decimal || 8)).toFixed(Number(receiver?.decimal || 8))
}
</script>

<template>
<tr>
<td class="td-cell">{{ task.genesis ? 'Token' : 'SPACE' }}</td>
<td class="td-cell">{{ prettyAmount(task, receiver) }}</td>
<td class="td-cell">{{ prettyAmount(receiver) }}</td>
<td class="td-cell" :title="receiver.address">{{ shortestAddress(receiver.address) }}</td>
</tr>
</template>
Expand Down
4 changes: 2 additions & 2 deletions src/pages/wallet/AccountHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ getServiceNetwork().then((_serviceNetwork) => {
})
const { data: btcMetaidInfo } = useMetaidInfoQuery(btcAddress, {
enabled: computed(() => !!btcAddress),
enabled: computed(() => !!btcAddress.value),
})
const { data: mvcMetaidInfo } = useMetaidInfoQuery(mvcAddress, {
enabled: computed(() => !!mvcAddress && btcAddress.value !== mvcAddress.value),
enabled: computed(() => !!mvcAddress.value && btcAddress.value !== mvcAddress.value),
})
getNetwork().then((_network) => (network.value = _network))
Expand Down
2 changes: 1 addition & 1 deletion src/pages/wallet/Bridge/components/BTCBridge.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { calcBalance } from '@/lib/formatters'
import { assetReqReturnType } from '@/queries/types/bridge'
import { Protocol } from '@/lib/types/protocol'
import { useRouter } from 'vue-router'
import BridgeHistory from './bridge-history.vue'
import BridgeHistory from './BridgeHistory.vue'
const router = useRouter()
const flippedControl = ref(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,20 @@
</Button>
</DialogTrigger>

<DialogContent class="w-md p-4 bg-white">
<DialogContent class="p-1 xs:p-4 bg-white rounded-xl">
<DialogHeader>
<DialogTitle class="text-xl">History</DialogTitle>
<DialogClose class="right-0 top-0" />
</DialogHeader>

<Tabs v-model:value="activeKey" :default-value="items[0].key">
<TabsList>
<TabsTrigger v-for="item in items" :key="item.key" :value="item.key">
<TabsList class="gap-x-4">
<TabsTrigger
v-for="item in items"
:key="item.key"
:value="item.key"
class="p-0 data-[state=active]:shadow-none data-[state=active]:text-blue-primary data-[state=active]:underline data-[state=active]:underline-offset-4"
>
{{ item.label }}
</TabsTrigger>
</TabsList>
Expand All @@ -32,11 +37,11 @@

<script setup>
import { ref, computed, watch } from 'vue'
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogClose, DialogTrigger } from '@/components/ui/dialog'
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'
import BridgeHistoryPanel from './bridge-history-panel.vue'
import { Button } from '@/components/ui/button'
import { FileClockIcon } from 'lucide-vue-next'
import BridgeHistoryPanel from './BridgeHistoryPanel.vue'
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogClose, DialogTrigger } from '@/components/ui/dialog'
const props = defineProps({
protocolType: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<div class="border-b border-[#EBEBEB]/5 my-2" />
<div class="flex items-center justify-between">
<div class="left">
<span class="info">{{ item.amount }} {{ item.symbol }}</span>
<span class="info">{{ calcBalance(item.amount, item.decimals, item.symbol) }}</span>
</div>
<div class="right">{{ item.timestamp }}</div>
</div>
Expand All @@ -51,6 +51,7 @@ import { ArrowRight } from 'lucide-vue-next'
import { Button } from '@/components/ui/button'
import { Chain } from '@metalet/utxo-wallet-service'
import { useChainWalletsStore } from '@/stores/ChainWalletsStore'
import { calcBalance } from '@/lib/formatters'
const props = defineProps({
type: {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/wallet/Bridge/components/MRC20Bridge.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { Protocol } from '@/lib/types/protocol'
import { SwapType } from '@/queries/runes'
import { useRouter } from 'vue-router'
import { toast } from '@/components/ui/toast'
import BridgeHistory from './bridge-history.vue'
import BridgeHistory from './BridgeHistory.vue'
const router = useRouter()
const flippedControl = ref(false)
Expand Down
8 changes: 6 additions & 2 deletions src/pages/wallet/MRC20.vue
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,19 @@ const toSend = () => {
<div class="flex items-center justify-between w-full">
<div class="text-xs text-gray-500">Deployer</div>
<div class="flex items-center gap-x-2">
<AssetLogo :logo="asset?.deployAvatar" :symbol="asset?.deployName" class="size-5 shrink-0 rounded-full text-xs" />
<AssetLogo
:logo="asset?.deployAvatar"
:symbol="asset?.deployName"
class="size-5 shrink-0 rounded-full text-xs"
/>
<span>{{ asset?.deployName || '--' }}</span>
</div>
</div>
<div class="flex items-center justify-between w-full">
<div class="text-xs text-gray-500">Token ID</div>
<div class="flex items-center hover:text-blue-primary gap-x-2">
<div class="text-base">{{ truncateStr(mrc20Id, 6) }}</div>
<CopyIcon :text="mrc20Id" :title="'Token ID Copied'" />
<CopyIcon :text="mrc20Id" title="Token ID Copied" />
</div>
</div>
</div>
Expand Down
5 changes: 3 additions & 2 deletions src/pages/wallet/SendToken.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import TransactionResultModal from './components/TransactionResultModal.vue'
import { Drawer, DrawerClose, DrawerContent, DrawerFooter, DrawerHeader } from '@/components/ui/drawer'
import { useIconsStore } from '@/stores/IconsStore'
import { CoinCategory } from '@/queries/exchange-rates'
import { prettifyAddress } from '@/lib/formatters'
const route = useRoute()
const router = useRouter()
Expand Down Expand Up @@ -225,11 +226,11 @@ async function send() {
<div class="p-4 space-y-4 text-ss">
<FlexBox ai="center" jc="between">
<div class="text-gray-primary">From</div>
<div class="break-all w-[228px]">{{ address }}</div>
<div class="break-all" :title="address">{{ prettifyAddress(address) }}</div>
</FlexBox>
<FlexBox ai="center" jc="between">
<div class="text-gray-primary">To</div>
<div class="break-all w-[228px]">{{ recipient }}</div>
<div class="break-all" :title="recipient">{{ prettifyAddress(recipient) }}</div>
</FlexBox>
<FlexBox ai="center" jc="between">
<div class="text-gray-primary">Amount</div>
Expand Down
9 changes: 5 additions & 4 deletions src/pages/wallet/components/ActivityItem.vue
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<script lang="ts" setup>
import { computed } from 'vue'
import Decimal from 'decimal.js'
import { toTx } from '@/lib/helpers'
import { FlexBox } from '@/components'
import { type Chain } from '@/lib/types'
import { FTAsset, type Asset } from '@/data/assets'
import { getBrowserHost } from '@/lib/host'
import AssetLogo from '@/components/AssetLogo.vue'
import { useIconsStore } from '@/stores/IconsStore'
import { FTAsset, type Asset } from '@/data/assets'
import type { Activity } from '@/queries/activities'
import LoadingIcon from '@/components/LoadingIcon.vue'
import { prettifyTimestamp, prettifyTxId, truncateStr } from '@/lib/formatters'
import { useIconsStore } from '@/stores/IconsStore'
import { CoinCategory } from '@/queries/exchange-rates'
import Decimal from 'decimal.js'
import { prettifyTimestamp, prettifyTxId } from '@/lib/formatters'
const props = defineProps<{
asset: Asset
Expand Down Expand Up @@ -94,6 +94,7 @@ const toActivityTx = async () => {
type="activity"
class="w-[38px] text-lg"
:flow="flow"
logo-size="size-4"
/>
<div>
<div :class="['flex items-center gap-x-2 text-sm', { 'text-orange-primary': !isConfirmed }]">
Expand Down
4 changes: 4 additions & 0 deletions tailwind.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ module.exports = {
},

extend: {
spacing: {
4.5: "1.125rem",
7.5: "1.875rem",
},
colors: {
'black-primary': '#141416',
'black-secondary': '#303133',
Expand Down

0 comments on commit aa8bcc7

Please sign in to comment.