forked from lthn/blockchain
Ui develop (#234)
* added send icon as pseudo element * fix pagination on mining toggle * fix pagination on mining toggle * fix pagination on mining toggle offset form 0
This commit is contained in:
parent
b508c40313
commit
543c110ed9
9 changed files with 87 additions and 72 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -5800,8 +5800,8 @@ __webpack_require__.r(__webpack_exports__);
|
|||
/*! no static exports found */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
__webpack_require__(/*! /Users/mekasan/Projects/Projects/zano/src/gui/qt-daemon/html_source/src/polyfills.ts */"./src/polyfills.ts");
|
||||
module.exports = __webpack_require__(/*! /Users/mekasan/Projects/Projects/zano/src/gui/qt-daemon/html_source/node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/jit-polyfills.js */"./node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/jit-polyfills.js");
|
||||
__webpack_require__(/*! /Users/mekasan/Projects/Projects/zano_3/src/gui/qt-daemon/html_source/src/polyfills.ts */"./src/polyfills.ts");
|
||||
module.exports = __webpack_require__(/*! /Users/mekasan/Projects/Projects/zano_3/src/gui/qt-daemon/html_source/node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/jit-polyfills.js */"./node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/jit-polyfills.js");
|
||||
|
||||
|
||||
/***/ })
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -51,7 +51,7 @@ export class PaginationService {
|
|||
getOffset() {
|
||||
const mining = this.variables.currentWallet.exclude_mining_txs;
|
||||
const currentPage = (this.variables.currentWallet.currentPage);
|
||||
let offset = (currentPage * this.variables.count);
|
||||
let offset = ((currentPage - 1) * this.variables.count);
|
||||
if (!mining) { return offset; }
|
||||
const pages = this.paginationStore.value;
|
||||
if (pages && pages.length) {
|
||||
|
|
|
|||
|
|
@ -24,13 +24,11 @@ export class PaginationStore {
|
|||
}
|
||||
setPage(pageNumber: number, offset: number) {
|
||||
const pages = this.subject.getValue();
|
||||
const current = (this.variablesService.currentWallet.currentPage);
|
||||
const isForward = this.isForward(pages, current);
|
||||
let newPages: Pages[] = [];
|
||||
if (pages && pages.length) {
|
||||
newPages = pages.slice(0);
|
||||
}
|
||||
isForward ? newPages.push({page: pageNumber, offset}) : newPages.pop();
|
||||
newPages.push({page: pageNumber, offset});
|
||||
this.subject.next(newPages);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -64,9 +64,16 @@
|
|||
}
|
||||
|
||||
&.send {
|
||||
|
||||
.status-transaction {
|
||||
mask: url(../../assets/icons/send.svg) no-repeat center;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.status-transaction::after {
|
||||
display: block;
|
||||
content:'';
|
||||
background:url("../../assets/icons/send-red.svg") no-repeat center;
|
||||
width: 13px;
|
||||
height: 13px;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ export class WalletComponent implements OnInit, OnDestroy {
|
|||
|
||||
changeTab(index) {
|
||||
if (((this.tabs[index].link === '/send' || this.tabs[index].link === '/contracts' || this.tabs[index].link === '/staking') && (this.variablesService.daemon_state !== 2 || !this.variablesService.currentWallet.loaded))
|
||||
|| ((this.tabs[index].link === '/send' || this.tabs[index].link === '/contracts') && this.variablesService.currentWallet.is_watch_only && this.variablesService.currentWallet.is_auditable)) {
|
||||
|| ((this.tabs[index].link === '/send' || this.tabs[index].link === '/contracts') && this.variablesService.currentWallet.is_watch_only && this.variablesService.currentWallet.is_auditable)) {
|
||||
return;
|
||||
}
|
||||
this.tabs.forEach((tab) => {
|
||||
|
|
@ -203,6 +203,9 @@ export class WalletComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
toggleMiningTransactions() {
|
||||
this.mining = !this.mining;
|
||||
const total_history_item = this.variablesService.currentWallet.total_history_item;
|
||||
const count = this.variablesService.count;
|
||||
this.variablesService.currentWallet.totalPages = Math.ceil( total_history_item / count);
|
||||
this.variablesService.currentWallet.exclude_mining_txs = this.mining;
|
||||
this.variablesService.currentWallet.currentPage = 1;
|
||||
this.getRecentTransfers();
|
||||
|
|
@ -210,22 +213,29 @@ export class WalletComponent implements OnInit, OnDestroy {
|
|||
|
||||
getRecentTransfers () {
|
||||
const offset = this.pagination.getOffset();
|
||||
const mining = this.variablesService.currentWallet.exclude_mining_txs;
|
||||
const pages = this.paginationStore.value;
|
||||
if (!pages) {
|
||||
this.paginationStore.setPage(1, 40); // add back page for the first page
|
||||
if (!pages && mining) {
|
||||
this.paginationStore.setPage(1, 0); // add back page for the first page
|
||||
}
|
||||
|
||||
this.backend.getRecentTransfers(
|
||||
this.walletID,
|
||||
offset,
|
||||
this.variablesService.count, this.variablesService.currentWallet.exclude_mining_txs, (status, data) => {
|
||||
const page = (this.variablesService.currentWallet.currentPage + 1);
|
||||
this.paginationStore.setPage(page, data.last_item_index); // add back page for current page
|
||||
if (data.history.length < this.variablesService.count) {
|
||||
this.variablesService.currentWallet.totalPages = (page - 1); // stop paginate
|
||||
const isForward = this.paginationStore.isForward(pages, this.variablesService.currentWallet.currentPage);
|
||||
if (mining && isForward && pages && pages.length === 1) {
|
||||
this.variablesService.currentWallet.currentPage = 1; // set init page after navigation back
|
||||
}
|
||||
const page = this.variablesService.currentWallet.currentPage + 1;
|
||||
if (isForward && mining && data.history.length === this.variablesService.count) {
|
||||
this.paginationStore.setPage(page, data.last_item_index); // add back page for current page
|
||||
}
|
||||
if (mining && data.history.length < this.variablesService.count) {
|
||||
this.variablesService.currentWallet.totalPages = this.variablesService.currentWallet.currentPage; // stop paginate
|
||||
}
|
||||
if (status && data.total_history_items) {
|
||||
this.variablesService.currentWallet.history.splice(0, this.variablesService.currentWallet.history.length);
|
||||
this.variablesService.currentWallet.history.splice(0, this.variablesService.currentWallet.history.length);
|
||||
this.ngZone.run(() => {
|
||||
this.pagination.paginate(this.variablesService.currentWallet.currentPage);
|
||||
if (data.history.length !== 0) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue