diff --git a/src/components/mixins/PaginationSearchMixin.ts b/src/components/mixins/PaginationSearchMixin.ts new file mode 100644 index 000000000..d6580d659 --- /dev/null +++ b/src/components/mixins/PaginationSearchMixin.ts @@ -0,0 +1,33 @@ +import { Component, Vue } from 'vue-property-decorator' + +@Component +export default class PaginationSearchMixin extends Vue { + currentPage = 1 + pageAmount = 10 + query = '' + + get startIndex (): number { + return (this.currentPage - 1) * this.pageAmount + } + + get lastIndex (): number { + return this.currentPage * this.pageAmount + } + + handlePrevClick (current: number): void { + this.currentPage = current + } + + handleNextClick (current: number): void { + this.currentPage = current + } + + handleResetSearch (): void { + this.query = '' + this.currentPage = 1 + } + + getPageItems (items: Array): Array { + return items.slice(this.startIndex, this.lastIndex) + } +} diff --git a/src/store/bridge.ts b/src/store/bridge.ts index bf8bddf28..87098bb5d 100644 --- a/src/store/bridge.ts +++ b/src/store/bridge.ts @@ -39,8 +39,6 @@ const types = flow( 'SET_ASSET_ADDRESS', 'SET_ASSET_BALANCE', 'SET_AMOUNT', - 'SET_SORA_TOTAL', - 'SET_EVM_TOTAL', 'SET_TRANSACTION_CONFIRM', 'SET_SORA_TRANSACTION_HASH', 'SET_SORA_TRANSACTION_DATE', @@ -295,12 +293,6 @@ const mutations = { [types.GET_EVM_NETWORK_FEE_FAILURE] (state) { state.evmNetworkFee = ZeroStringValue }, - [types.SET_SORA_TOTAL] (state, soraTotal: string | number) { - state.soraTotal = soraTotal - }, - [types.SET_EVM_TOTAL] (state, evmTotal: string | number) { - state.evmTotal = evmTotal - }, [types.SET_TRANSACTION_CONFIRM] (state, isTransactionConfirmed: boolean) { state.isTransactionConfirmed = isTransactionConfirmed }, @@ -392,12 +384,6 @@ const actions = { setEvmNetworkFee ({ commit }, evmNetworkFee: CodecString) { commit(types.GET_EVM_NETWORK_FEE_SUCCESS, evmNetworkFee) }, - getSoraTotal ({ commit }, soraTotal: string | number) { - commit(types.SET_SORA_TOTAL, soraTotal) - }, - getevmTotal ({ commit }, evmTotal: string | number) { - commit(types.SET_EVM_TOTAL, evmTotal) - }, setTransactionConfirm ({ commit }, isTransactionConfirmed: boolean) { commit(types.SET_TRANSACTION_CONFIRM, isTransactionConfirmed) }, diff --git a/src/views/Bridge.vue b/src/views/Bridge.vue index fa055c41e..20c14af06 100644 --- a/src/views/Bridge.vue +++ b/src/views/Bridge.vue @@ -249,7 +249,6 @@ export default class Bridge extends Mixins( @Getter('evmBalance', { namespace: 'web3' }) evmBalance!: CodecString @Getter('evmNetwork', { namespace: 'web3' }) evmNetwork!: BridgeNetworks @Getter('subNetworks', { namespace: 'web3' }) subNetworks!: Array - @Getter('defaultNetworkType', { namespace: 'web3' }) defaultNetworkType!: string @Getter('isTransactionConfirmed', { namespace }) isTransactionConfirmed!: boolean @Getter('isValidNetworkType', { namespace: 'web3' }) isValidNetworkType!: boolean @Getter('isSoraToEvm', { namespace }) isSoraToEvm!: boolean diff --git a/src/views/BridgeTransaction.vue b/src/views/BridgeTransaction.vue index 164a81516..969e2bb4c 100644 --- a/src/views/BridgeTransaction.vue +++ b/src/views/BridgeTransaction.vue @@ -233,7 +233,6 @@ export default class BridgeTransaction extends Mixins( @Action('setCurrentTransactionState', { namespace }) setCurrentTransactionState @Action('setInitialTransactionState', { namespace }) setInitialTransactionState @Action('setTransactionStep', { namespace }) setTransactionStep - @Action('setTransactionConfirm', { namespace }) setTransactionConfirm @Action('setHistoryItem', { namespace }) setHistoryItem @Action('signSoraTransactionSoraToEvm', { namespace }) signSoraTransactionSoraToEvm @@ -267,7 +266,6 @@ export default class BridgeTransaction extends Mixins( } activeTransactionStep: any = [this.transactionSteps.from, this.transactionSteps.to] - currentTransactionStep = 1 showConfirmTransactionDialog = false get formattedAmount (): string { @@ -312,11 +310,11 @@ export default class BridgeTransaction extends Mixins( } get isTransactionStep1 (): boolean { - return this.currentTransactionStep === 1 + return this.transactionStep === 1 } get isTransactionStep2 (): boolean { - return this.currentTransactionStep === 2 + return this.transactionStep === 2 } get isTransactionFromPending (): boolean { @@ -369,17 +367,12 @@ export default class BridgeTransaction extends Mixins( } get headerStatus (): string { + const failedAndPendingParams = { step: this.t('bridgeTransaction.steps.step', { step: this.t(`bridgeTransaction.steps.step${this.transactionStep}`) }) } if (this.isTransactionFromPending || this.isTransactionToPending) { - return this.t( - 'bridgeTransaction.status.pending', - { step: this.t('bridgeTransaction.steps.step', { step: this.t(`bridgeTransaction.steps.step${this.currentTransactionStep}`) }) } - ) + return this.t('bridgeTransaction.status.pending', failedAndPendingParams) } if (this.isTransactionFromFailed || this.isTransactionToFailed) { - return this.t( - 'bridgeTransaction.status.failed', - { step: this.t('bridgeTransaction.steps.step', { step: this.t(`bridgeTransaction.steps.step${this.currentTransactionStep}`) }) } - ) + return this.t('bridgeTransaction.status.failed', failedAndPendingParams) } if (this.isTransferCompleted) { return this.t('bridgeTransaction.status.convertionComplete') @@ -572,7 +565,6 @@ export default class BridgeTransaction extends Mixins( } this.initializeTransactionStateMachine() this.isInitRequestCompleted = true - this.currentTransactionStep = this.transactionStep const withAutoRetry = this.prevRoute !== PageNames.BridgeTransactionsHistory await this.handleSendTransactionFrom(withAutoRetry) } @@ -673,7 +665,6 @@ export default class BridgeTransaction extends Mixins( } setFromTransactionCompleted () { - this.currentTransactionStep = 2 this.setTransactionStep(2) this.activeTransactionStep = this.transactionSteps.to } diff --git a/src/views/BridgeTransactionsHistory.vue b/src/views/BridgeTransactionsHistory.vue index 0d4930791..b654426dc 100644 --- a/src/views/BridgeTransactionsHistory.vue +++ b/src/views/BridgeTransactionsHistory.vue @@ -32,7 +32,7 @@