Skip to content

Commit

Permalink
chore: add TransactionResultModal confirmText
Browse files Browse the repository at this point in the history
  • Loading branch information
AricRedemption committed Apr 14, 2024
1 parent 258bbc2 commit 18039f6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
3 changes: 3 additions & 0 deletions src/global-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ type SuccessResult = {
fromAddress: string
toAdddress: string
amount: number
confirmText?: string
token: {
symbol: string
decimal: number
Expand All @@ -16,9 +17,11 @@ type FailedResult = {
status: 'failed'
message: string
router?: string
confirmText?: string
}
type WarningResult = {
status: 'warning'
message: string
confirmText?: string
}
export type TransactionResult = SuccessResult | FailedResult | WarningResult
1 change: 1 addition & 0 deletions src/pages/wallet/SendToken.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ async function send() {
router: 'ft-merge',
status: 'failed',
message: err.message,
confirmText: 'Merge',
}
}
} else {
Expand Down
16 changes: 7 additions & 9 deletions src/pages/wallet/components/TransactionResultModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type SuccessResult = {
fromAddress: string
toAdddress: string
amount: number
confirmText?: string
token: {
symbol: string
decimal: number
Expand All @@ -28,15 +29,18 @@ type SuccessTxsResult = {
chain: Chain
status: 'successTxs'
txIds: string[]
confirmText?: string
}
type FailedResult = {
status: 'failed'
message: string
router?: string
confirmText?: string
}
type WarningResult = {
status: 'warning'
message: string
confirmText?: string
}
export type TransactionResult = SuccessTxsResult | SuccessResult | FailedResult | WarningResult
const props = defineProps({
Expand Down Expand Up @@ -163,20 +167,14 @@ const toResultTxs = async (txId: string) => {
Cancel
</button>
<button
class="main-btn-bg rounded-lg py-3 text-sm text-sky-100 px-4"
class="main-btn-bg rounded-lg py-3 text-sm w-[133px] text-sky-100 px-4"
@click="$router.push({ name: (result as FailedResult).router })"
>
Go To
{{
(result as FailedResult)
.router!.split('-')
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
.join(' ')
}}
{{ result?.confirmText || 'Confirm' }}
</button>
</div>
<button v-else class="main-btn-bg w-full rounded-lg py-3 text-sm text-sky-100 outline-none" @click="ok">
OK
{{ result?.confirmText || 'Confirm' }}
</button>
</template>
</Modal>
Expand Down

0 comments on commit 18039f6

Please sign in to comment.