format_code

This commit is contained in:
NguyenAnhQuan 2025-11-07 18:29:58 +07:00
parent b9940b66a9
commit d9e7ffde26
15 changed files with 71 additions and 41 deletions

View File

@ -60,7 +60,9 @@ h2 {
border: 2px solid transparent; border: 2px solid transparent;
background-clip: padding-box; background-clip: padding-box;
box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1); box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1);
transition: background var(--transition-fast), box-shadow var(--transition-fast); transition:
background var(--transition-fast),
box-shadow var(--transition-fast);
&:hover { &:hover {
background: rgba(0, 127, 207, 0.6); background: rgba(0, 127, 207, 0.6);

View File

@ -2,16 +2,16 @@
// ==================== COLORS ==================== // ==================== COLORS ====================
// Primary Colors // Primary Colors
--primary-color: #42A5F5; --primary-color: #42a5f5;
--primary-hover: #1E88E5; --primary-hover: #1e88e5;
--primary-light: #E3F2FD; --primary-light: #e3f2fd;
--primary-bg: #F5FBFF; --primary-bg: #f5fbff;
// Text Colors // Text Colors
--text-primary: #232323; --text-primary: #232323;
--text-secondary: #5A5A5A; --text-secondary: #5a5a5a;
--text-muted: #8B8B8B; --text-muted: #8b8b8b;
--text-light: #FFFFFF; --text-light: #ffffff;
// Background Colors // Background Colors
--bg-gradient-start: #f0f8ff; --bg-gradient-start: #f0f8ff;
@ -23,13 +23,13 @@
// Border Colors // Border Colors
--border-light: #e3f2fd; --border-light: #e3f2fd;
--border-color: #e8f4fc; --border-color: #e8f4fc;
--border-primary: #42A5F5; --border-primary: #42a5f5;
// Status Colors // Status Colors
--success-color: #10b981; --success-color: #10b981;
--warning-color: #f59e0b; --warning-color: #f59e0b;
--error-color: #ef4444; --error-color: #ef4444;
--info-color: #42A5F5; --info-color: #42a5f5;
// ==================== SPACING ==================== // ==================== SPACING ====================
@ -70,7 +70,8 @@
// ==================== TYPOGRAPHY ==================== // ==================== TYPOGRAPHY ====================
// Font Families // Font Families
--font-primary: --apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; --font-primary:
--apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
--font-mono: 'Courier New', monospace; --font-mono: 'Courier New', monospace;
// Font Sizes // Font Sizes

View File

@ -1,5 +1,4 @@
<script setup lang="ts"> <script setup lang="ts"></script>
</script>
<template> <template>
<div class="card-base"> <div class="card-base">

View File

@ -1,5 +1,4 @@
<script setup lang="ts"> <script setup lang="ts"></script>
</script>
<template> <template>
<div class="card-base scrollable"> <div class="card-base scrollable">

View File

@ -23,7 +23,7 @@ const showPassword = ref(false)
const isFocused = ref(false) const isFocused = ref(false)
const inputType = computed(() => { const inputType = computed(() => {
if (props.type === 'password' ) { if (props.type === 'password') {
return showPassword.value ? 'text' : 'password' return showPassword.value ? 'text' : 'password'
} }
return props.type return props.type

View File

@ -58,11 +58,11 @@ const passwordStrength = computed(() => {
const canProceed = computed(() => { const canProceed = computed(() => {
if (!password.value || passwordError.value) return false if (!password.value || passwordError.value) return false
if (props.validateFormat) { if (props.validateFormat) {
return password.value.length >= 8 && passwordStrength.value.level >= 2 return password.value.length >= 8 && passwordStrength.value.level >= 2
} }
return password.value.length > 0 return password.value.length > 0
}) })
@ -103,7 +103,7 @@ const handleBack = () => {
@input="passwordError = ''" @input="passwordError = ''"
@keyup.enter="handleSubmit" @keyup.enter="handleSubmit"
/> />
<!-- Password Strength Indicator --> <!-- Password Strength Indicator -->
<div v-if="props.validateFormat && password" class="password-strength"> <div v-if="props.validateFormat && password" class="password-strength">
<div class="strength-bar"> <div class="strength-bar">

View File

@ -26,4 +26,3 @@ const isActive = computed(() => {
flex-direction: column; flex-direction: column;
} }
</style> </style>

View File

@ -53,7 +53,13 @@ const tabClasses = computed(() => {
> >
{{ item.label }} {{ item.label }}
</div> </div>
<div class="tabs-ink-bar" :style="{ left: `${items.findIndex(item => item.key === activeKey) * (100 / items.length)}%`, width: `${100 / items.length}%` }" /> <div
class="tabs-ink-bar"
:style="{
left: `${items.findIndex((item) => item.key === activeKey) * (100 / items.length)}%`,
width: `${100 / items.length}%`,
}"
/>
</div> </div>
<div class="tabs-content"> <div class="tabs-content">
<slot /> <slot />
@ -135,4 +141,3 @@ const tabClasses = computed(() => {
} }
} }
</style> </style>

View File

@ -1,6 +1,11 @@
import { useNeptuneStore } from '@/stores/neptuneStore' import { useNeptuneStore } from '@/stores/neptuneStore'
import * as API from '@/api/neptuneApi' import * as API from '@/api/neptuneApi'
import type { GenerateSeedResult, PayloadBuildTransaction, ViewKeyResult, WalletState } from '@/interface' import type {
GenerateSeedResult,
PayloadBuildTransaction,
ViewKeyResult,
WalletState,
} from '@/interface'
import initWasm, { generate_seed, address_from_seed, validate_seed_phrase } from '@neptune/wasm' import initWasm, { generate_seed, address_from_seed, validate_seed_phrase } from '@neptune/wasm'
let wasmInitialized = false let wasmInitialized = false
@ -227,7 +232,9 @@ export function useNeptuneWallet() {
} }
} }
const buildTransactionWithPrimitiveProof = async (args: PayloadBuildTransaction): Promise<any> => { const buildTransactionWithPrimitiveProof = async (
args: PayloadBuildTransaction
): Promise<any> => {
const payload = { const payload = {
spendingKeyHex: store.getSpendingKey, spendingKeyHex: store.getSpendingKey,
inputAdditionRecords: args.inputAdditionRecords, inputAdditionRecords: args.inputAdditionRecords,

View File

@ -42,7 +42,11 @@ const handleCreateAnother = () => {
keystore file should only be used in an offline setting. keystore file should only be used in an offline setting.
</p> </p>
<div class="center-svg" style="margin: 14px auto 12px auto"> <div class="center-svg" style="margin: 14px auto 12px auto">
<img src="@/assets/imgs/logo.png" alt="Neptune Logo" style="max-width: 180px; height: auto;" /> <img
src="@/assets/imgs/logo.png"
alt="Neptune Logo"
style="max-width: 180px; height: auto"
/>
</div> </div>
<div class="btn-row"> <div class="btn-row">
<ButtonCommon <ButtonCommon

View File

@ -26,7 +26,10 @@ const inputBoxFocus = (idx: number) => {
const handleGridInput = (index: number, value: string) => { const handleGridInput = (index: number, value: string) => {
emit('update:valid', true) emit('update:valid', true)
seedWords.value[index] = value seedWords.value[index] = value
emit('update:words', seedWords.value.filter((w) => w.trim())) emit(
'update:words',
seedWords.value.filter((w) => w.trim())
)
} }
const handlePaste = (event: ClipboardEvent) => { const handlePaste = (event: ClipboardEvent) => {
@ -42,7 +45,10 @@ const handlePaste = (event: ClipboardEvent) => {
const filledWords = Array.from({ length: 18 }, (_, i) => words[i] || '') const filledWords = Array.from({ length: 18 }, (_, i) => words[i] || '')
seedWords.value = filledWords seedWords.value = filledWords
emit('update:words', words.filter((w) => w.trim())) emit(
'update:words',
words.filter((w) => w.trim())
)
} }
const handleSubmit = () => { const handleSubmit = () => {

View File

@ -23,8 +23,8 @@ onMounted(async () => {
<template> <template>
<div class="home-container"> <div class="home-container">
<TabsCommon v-model="activeTab" :items="tabItems" size="large" class="main-tabs"> <TabsCommon v-model="activeTab" :items="tabItems" size="large" class="main-tabs">
<!-- WALLET TAB --> <!-- WALLET TAB -->
<TabPaneCommon tab-key="WALLET"> <TabPaneCommon tab-key="WALLET">
<WalletTab :network="network" /> <WalletTab :network="network" />
</TabPaneCommon> </TabPaneCommon>

View File

@ -4,7 +4,6 @@ import { Table, message } from 'ant-design-vue'
import { useNeptuneWallet } from '@/composables/useNeptuneWallet' import { useNeptuneWallet } from '@/composables/useNeptuneWallet'
import { useNeptuneStore } from '@/stores/neptuneStore' import { useNeptuneStore } from '@/stores/neptuneStore'
import { CardBaseScrollable, SpinnerCommon } from '@/components' import { CardBaseScrollable, SpinnerCommon } from '@/components'
import { PER_PAGE } from '@/utils'
import { columns } from '../utils' import { columns } from '../utils'
const { getUtxos } = useNeptuneWallet() const { getUtxos } = useNeptuneWallet()
@ -12,12 +11,15 @@ const neptuneStore = useNeptuneStore()
const loading = ref(false) const loading = ref(false)
const utxosList = computed(() => [...(neptuneStore.getUtxos || []), ...Array.from({ length: 18 }, (_, i) => ({ const utxosList = computed(() => [
additionRecord: `additionRecord${i}`, ...(neptuneStore.getUtxos || []),
amount: `${i}.00000000`, ...Array.from({ length: 18 }, (_, i) => ({
blockHeight: `blockHeight${i}`, additionRecord: `additionRecord${i}`,
utxoHash: `utxoHash${i}`, amount: `${i}.00000000`,
}))]) blockHeight: `blockHeight${i}`,
utxoHash: `utxoHash${i}`,
})),
])
const inUseUtxosCount = computed(() => (utxosList.value?.length ? utxosList.value.length : 0)) const inUseUtxosCount = computed(() => (utxosList.value?.length ? utxosList.value.length : 0))
const inUseUtxosAmount = computed(() => { const inUseUtxosAmount = computed(() => {

View File

@ -26,11 +26,11 @@ const isAmountValid = computed(() => {
if (!outputAmounts.value) return false if (!outputAmounts.value) return false
const num = parseFloat(outputAmounts.value) const num = parseFloat(outputAmounts.value)
if (isNaN(num) || num <= 0) return false if (isNaN(num) || num <= 0) return false
// Check if amount exceeds available balance // Check if amount exceeds available balance
const balance = parseFloat(props.availableBalance) const balance = parseFloat(props.availableBalance)
if (!isNaN(balance) && num > balance) return false if (!isNaN(balance) && num > balance) return false
return true return true
}) })
const isFeeValid = computed(() => { const isFeeValid = computed(() => {
@ -43,12 +43,12 @@ const amountErrorMessage = computed(() => {
if (!outputAmounts.value) return '' if (!outputAmounts.value) return ''
const num = parseFloat(outputAmounts.value) const num = parseFloat(outputAmounts.value)
if (isNaN(num) || num <= 0) return 'Invalid amount' if (isNaN(num) || num <= 0) return 'Invalid amount'
const balance = parseFloat(props.availableBalance) const balance = parseFloat(props.availableBalance)
if (!isNaN(balance) && num > balance) { if (!isNaN(balance) && num > balance) {
return `Insufficient balance. Available: ${props.availableBalance} NPT` return `Insufficient balance. Available: ${props.availableBalance} NPT`
} }
return '' return ''
}) })

View File

@ -3,7 +3,13 @@ import { ref, computed, onMounted, onUnmounted } from 'vue'
import { useNeptuneStore } from '@/stores/neptuneStore' import { useNeptuneStore } from '@/stores/neptuneStore'
import { useNeptuneWallet } from '@/composables/useNeptuneWallet' import { useNeptuneWallet } from '@/composables/useNeptuneWallet'
import { message } from 'ant-design-vue' import { message } from 'ant-design-vue'
import { ButtonCommon, CardBaseScrollable, ModalCommon, SpinnerCommon, PasswordForm } from '@/components' import {
ButtonCommon,
CardBaseScrollable,
ModalCommon,
SpinnerCommon,
PasswordForm,
} from '@/components'
import SeedPhraseDisplayComponent from '@/views/Auth/components/SeedPhraseDisplayComponent.vue' import SeedPhraseDisplayComponent from '@/views/Auth/components/SeedPhraseDisplayComponent.vue'
import SendTransactionComponent from './SendTransactionComponent.vue' import SendTransactionComponent from './SendTransactionComponent.vue'
import { WalletAddress, WalletBalance } from '.' import { WalletAddress, WalletBalance } from '.'