Skip to content

Commit

Permalink
new: add loader to transaction list (fixes: #174)
Browse files Browse the repository at this point in the history
  • Loading branch information
SeddikKadi authored and seegwen committed Apr 21, 2022
1 parent 47f5b91 commit 35760f8
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 5 deletions.
18 changes: 15 additions & 3 deletions src/assets/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,15 @@ span.custom-card-destinataire {
text-overflow: ellipsis;
padding-left: 10px;
}

.transactions-loader-container {
position: relative;
height: 40px;
width: 40px;
margin: auto;
}
.custom-modal-card-foot {
padding: 5px !important;
}

// card-opération-anchor-fin

Expand Down Expand Up @@ -406,8 +414,12 @@ span.custom-card-destinataire {
padding-right: 1px;
padding: 5px;
}
.custom-card-transactions{
.custom-card-transactions {
overflow-y: hidden !important;
max-height: calc(70vh - 60px) !important;
}
.custom-modal-container {
max-height: calc(70vh - 65px) !important;
}

.modal-card-head {
Expand Down Expand Up @@ -745,4 +757,4 @@ input {
.inactive .account.card {
opacity: 0.6;
}
}
}
16 changes: 14 additions & 2 deletions src/components/core/RightCol.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,22 @@
showCreditRefreshNotification = false"></button>
</header>
<section class="modal-card-body custom-card-transactions">
<div class="modal-container" ref="transactionsContainer" @scroll="handleScroll">
<div class="modal-container custom-modal-container" ref="transactionsContainer" @scroll="handleScroll">
<div
class=" custom-card is-flex-direction-column is-align-items-center is-justify-content-space-between mb-4"
>
<AllTrs />
</div>
</div>
</section>
<footer class="modal-card-foot">
<footer class="modal-card-foot custom-modal-card-foot">
<div class="transactions-loader-container">
<loading v-model:active="isLoadingTransactionsBatch"
:can-cancel="false"
:is-full-page= "false"
:width= "30"
:height= "30"/>
</div>
</footer>
</div>
</div>
Expand All @@ -47,12 +54,14 @@
import { Options, Vue } from 'vue-class-component';
import ThisWeek from "../rightCol/ThisWeek.vue";
import AllTrs from "../rightCol/AllTrs.vue";
import Loading from 'vue-loading-overlay';
@Options({
name: "RightCol",
components: {
ThisWeek,
AllTrs,
Loading
},
data() {
Expand All @@ -66,6 +75,9 @@
},
isLoadingTransactions(): boolean {
return this.$store.state.lokapi.transactionsLoading
},
isLoadingTransactionsBatch(): boolean {
return this.$store.state.lokapi.transactionsBatchLoading
}
},
watch: {
Expand Down
6 changes: 6 additions & 0 deletions src/store/lokapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export function lokapiStoreFactory(lokApiService: any) {
accountsLoadingError: false,
transactionsLoading: true,
transactionsLoadingError: false,
transactionsBatchLoading: false,
},
actions: {
async login({ commit, dispatch }: any, credentials: { login: string, password: string }) {
Expand Down Expand Up @@ -98,12 +99,14 @@ export function lokapiStoreFactory(lokApiService: any) {
async fetchTransactionsBatch({commit, dispatch, state}:any) {
let transactions = state.transactions.length > 0 ? state.transactions.slice(0) : [],
transactionsIndex = 0
commit("setTransactionsBatchLoading",true)
let next = await transactionsGen.next()
while (!next.done && transactionsIndex < transactionsBatchLength) {
transactionsIndex++
transactions.push(<any>next.value)
next = await transactionsGen.next()
}
commit("setTransactionsBatchLoading",false)
commit("setTransactions", transactions)
},
async genPaymentLink({commit}:any,amount:number) {
Expand Down Expand Up @@ -264,6 +267,9 @@ export function lokapiStoreFactory(lokApiService: any) {
setTransactionsLoadingError(state: any, hasError: boolean) {
state.transactionsLoadingError = hasError
},
setTransactionsBatchLoading(state: any, isLoading: boolean) {
state.transactionsBatchLoading = isLoading
}
},
getters: {
getCurr: (state: any) => {
Expand Down

0 comments on commit 35760f8

Please sign in to comment.