forked from lthn/blockchain
Merge branch 'ui_develop' into develop
This commit is contained in:
commit
97ffe61e71
22 changed files with 17671 additions and 158 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__(/*! /home/user/zano_tmp/src/gui/qt-daemon/html_source/src/polyfills.ts */"./src/polyfills.ts");
|
||||
module.exports = __webpack_require__(/*! /home/user/zano_tmp/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/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");
|
||||
|
||||
|
||||
/***/ })
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
|
|
@ -32,6 +32,7 @@
|
|||
"highcharts": "^7.0.3",
|
||||
"idlejs": "^2.0.1",
|
||||
"json-bignumber": "^1.0.1",
|
||||
"lodash": "^4.17.20",
|
||||
"ngx-contextmenu": "^5.1.1",
|
||||
"ngx-papaparse": "^3.0.3",
|
||||
"qrcode": "^1.3.0",
|
||||
|
|
|
|||
|
|
@ -146,6 +146,9 @@ export class BackendService {
|
|||
case 'ALREADY_EXISTS':
|
||||
error_translate = 'ERRORS.FILE_EXIST';
|
||||
break;
|
||||
case 'FAILED':
|
||||
BackendService.Debug(0, `Error: (${error}) was triggered by command: ${command}`);
|
||||
break;
|
||||
default:
|
||||
error_translate = error;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,17 @@
|
|||
import { Injectable, NgZone } from '@angular/core';
|
||||
import { VariablesService } from './variables.service';
|
||||
import { PaginationStore } from './pagination.store';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class PaginationService {
|
||||
|
||||
constructor(
|
||||
private variables: VariablesService,
|
||||
private ngZone: NgZone
|
||||
private ngZone: NgZone,
|
||||
private paginationStore: PaginationStore
|
||||
) { }
|
||||
|
||||
paginate(currentPage = 1) {
|
||||
|
|
@ -44,4 +47,23 @@ export class PaginationService {
|
|||
this.variables.currentWallet.pages = Array.from(Array((endPage + 1) - startPage).keys()).map(i => startPage + i);
|
||||
});
|
||||
}
|
||||
|
||||
getOffset() {
|
||||
const mining = this.variables.currentWallet.exclude_mining_txs;
|
||||
const currentPage = (this.variables.currentWallet.currentPage);
|
||||
let offset = (currentPage * this.variables.count);
|
||||
if (!mining) { return offset; }
|
||||
const pages = this.paginationStore.value;
|
||||
if (pages && pages.length) {
|
||||
const max = _.maxBy(pages, 'page');
|
||||
const isForward = this.paginationStore.isForward(pages, currentPage);
|
||||
if (isForward) {
|
||||
offset = max.offset;
|
||||
} else {
|
||||
const index = pages.findIndex(item => item.page === (currentPage));
|
||||
offset = pages[index].offset;
|
||||
}
|
||||
}
|
||||
return offset;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,41 @@
|
|||
import {Injectable} from '@angular/core';
|
||||
import {Observable, BehaviorSubject} from 'rxjs';
|
||||
import {VariablesService} from './variables.service';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
export interface Pages {
|
||||
page: number;
|
||||
offset: number;
|
||||
}
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class PaginationStore {
|
||||
constructor(
|
||||
private variablesService: VariablesService
|
||||
) {
|
||||
}
|
||||
private subject = new BehaviorSubject<Pages[]>(null);
|
||||
pages$: Observable<Pages[]> = this.subject.asObservable();
|
||||
|
||||
isForward(pages, currentPage) {
|
||||
const max = _.maxBy(pages, 'page');
|
||||
return !max || max.page < currentPage || max.page === currentPage;
|
||||
}
|
||||
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();
|
||||
this.subject.next(newPages);
|
||||
}
|
||||
|
||||
get value() {
|
||||
return this.subject.value;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
import {Injectable} from '@angular/core';
|
||||
|
||||
@Injectable()
|
||||
export class UtilsService {
|
||||
getMinWidthByScale(scale: number) {
|
||||
switch (scale) {
|
||||
case 7.5 : return 900;
|
||||
case 10 : return 1200;
|
||||
case 12.5 : return 1500;
|
||||
case 15 : return 1800;
|
||||
default : return 1200;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -8,11 +8,13 @@ import {ContextMenuComponent} from 'ngx-contextmenu';
|
|||
import {IntToMoneyPipe} from './_helpers/pipes/int-to-money.pipe';
|
||||
import {BigNumber} from 'bignumber.js';
|
||||
import {ModalService} from './_helpers/services/modal.service';
|
||||
import {UtilsService} from './_helpers/services/utils.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
templateUrl: './app.component.html',
|
||||
styleUrls: ['./app.component.scss']
|
||||
styleUrls: ['./app.component.scss'],
|
||||
providers: [UtilsService]
|
||||
})
|
||||
export class AppComponent implements OnInit, OnDestroy {
|
||||
|
||||
|
|
@ -37,7 +39,8 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
public variablesService: VariablesService,
|
||||
private ngZone: NgZone,
|
||||
private intToMoneyPipe: IntToMoneyPipe,
|
||||
private modalService: ModalService
|
||||
private modalService: ModalService,
|
||||
private utilsService: UtilsService
|
||||
) {
|
||||
translate.addLangs(['en', 'fr', 'de', 'it', 'pt']);
|
||||
translate.setDefaultLang('en');
|
||||
|
|
@ -249,7 +252,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
const wallet = this.variablesService.getWallet(wallet_id);
|
||||
if (wallet) {
|
||||
if(wallet.history.length > 40) {
|
||||
wallet.history.splice(0, 1);
|
||||
wallet.history.splice(40, 1);
|
||||
}
|
||||
this.ngZone.run(() => {
|
||||
|
||||
|
|
@ -553,6 +556,9 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
this.renderer.addClass(document.body, 'theme-' + this.variablesService.defaultTheme);
|
||||
}
|
||||
if (this.variablesService.settings.hasOwnProperty('scale') && [7.5, 10, 12.5, 15].indexOf(this.variablesService.settings.scale) !== -1) {
|
||||
const width = this.utilsService.getMinWidthByScale(this.variablesService.settings.scale);
|
||||
const app = document.documentElement.querySelector('app-root');
|
||||
this.renderer.setStyle(app, 'min-width', width + 'px');
|
||||
this.renderer.setStyle(document.documentElement, 'font-size', this.variablesService.settings.scale + 'px');
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -32,9 +32,11 @@ import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
|
|||
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { NgSelectModule } from '@ng-select/ng-select';
|
||||
|
||||
// SERVICES
|
||||
import { BackendService } from './_helpers/services/backend.service';
|
||||
import { ModalService } from './_helpers/services/modal.service';
|
||||
import { PaginationStore } from './_helpers/services/pagination.store';
|
||||
// SERVICES
|
||||
import { MoneyToIntPipe } from './_helpers/pipes/money-to-int.pipe';
|
||||
import { IntToMoneyPipe } from './_helpers/pipes/int-to-money.pipe';
|
||||
import { HistoryTypeMessagesPipe } from './_helpers/pipes/history-type-messages.pipe';
|
||||
|
|
@ -146,6 +148,7 @@ export function highchartsFactory() {
|
|||
providers: [
|
||||
BackendService,
|
||||
ModalService,
|
||||
PaginationStore,
|
||||
MoneyToIntPipe,
|
||||
IntToMoneyPipe,
|
||||
{ provide: HIGHCHARTS_MODULES, useFactory: highchartsFactory }
|
||||
|
|
|
|||
|
|
@ -71,9 +71,16 @@
|
|||
}
|
||||
|
||||
&.received {
|
||||
|
||||
.status-transaction {
|
||||
mask: url(../../assets/icons/receive.svg) no-repeat center;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.status-transaction::after {
|
||||
display: block;
|
||||
content:'';
|
||||
background:url("../../assets/icons/receive-green.svg") no-repeat center;
|
||||
width: 13px;
|
||||
height: 13px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,11 +4,13 @@ import {BackendService} from '../_helpers/services/backend.service';
|
|||
import {FormControl, FormGroup, Validators} from '@angular/forms';
|
||||
import {Location} from '@angular/common';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import {UtilsService} from '../_helpers/services/utils.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-settings',
|
||||
templateUrl: './settings.component.html',
|
||||
styleUrls: ['./settings.component.scss']
|
||||
styleUrls: ['./settings.component.scss'],
|
||||
providers: [UtilsService]
|
||||
})
|
||||
export class SettingsComponent implements OnInit {
|
||||
|
||||
|
|
@ -103,7 +105,8 @@ export class SettingsComponent implements OnInit {
|
|||
private backend: BackendService,
|
||||
private location: Location,
|
||||
public translate: TranslateService,
|
||||
private ngZone: NgZone
|
||||
private ngZone: NgZone,
|
||||
private utilsService: UtilsService
|
||||
) {
|
||||
this.theme = this.variablesService.settings.theme;
|
||||
this.scale = this.variablesService.settings.scale;
|
||||
|
|
@ -147,6 +150,9 @@ export class SettingsComponent implements OnInit {
|
|||
setScale(scale) {
|
||||
this.scale = scale;
|
||||
this.variablesService.settings.scale = this.scale;
|
||||
const width = this.utilsService.getMinWidthByScale(this.scale);
|
||||
const app = document.documentElement.querySelector('app-root');
|
||||
this.renderer.setStyle(app, 'min-width', width + 'px');
|
||||
this.renderer.setStyle(document.documentElement, 'font-size', this.scale + 'px');
|
||||
this.backend.storeAppData();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,11 +9,12 @@ import { LOCKED_BALANCE_HELP_PAGE } from '../_shared/constants';
|
|||
|
||||
import icons from '../../assets/icons/icons.json';
|
||||
import { PaginationService } from '../_helpers/services/pagination.service';
|
||||
import { PaginationStore } from '../_helpers/services/pagination.store';
|
||||
|
||||
@Component({
|
||||
selector: 'app-wallet',
|
||||
templateUrl: './wallet.component.html',
|
||||
styleUrls: ['./wallet.component.scss']
|
||||
styleUrls: ['./wallet.component.scss'],
|
||||
})
|
||||
export class WalletComponent implements OnInit, OnDestroy {
|
||||
subRouting1;
|
||||
|
|
@ -96,7 +97,8 @@ export class WalletComponent implements OnInit, OnDestroy {
|
|||
private ngZone: NgZone,
|
||||
private translate: TranslateService,
|
||||
private intToMoneyPipe: IntToMoneyPipe,
|
||||
private pagination: PaginationService
|
||||
private pagination: PaginationService,
|
||||
private paginationStore: PaginationStore
|
||||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
|
|
@ -207,12 +209,23 @@ export class WalletComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
|
||||
getRecentTransfers () {
|
||||
const offset = this.pagination.getOffset();
|
||||
const pages = this.paginationStore.value;
|
||||
if (!pages) {
|
||||
this.paginationStore.setPage(1, 40); // add back page for the first page
|
||||
}
|
||||
|
||||
this.backend.getRecentTransfers(
|
||||
this.walletID,
|
||||
(this.variablesService.currentWallet.currentPage - 1) * this.variablesService.count,
|
||||
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
|
||||
}
|
||||
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) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" id="icons" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 384 384" style="enable-background:new 0 0 384 384;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill:#5cda9d;}
|
||||
</style>
|
||||
<path id="receive" class="st0" d="M64.2,309.6l58.2-210.4l48.1,71.6L178,182l12.7,4.7l81.9,30.4L64.2,309.6 M0,384l384-170.3
|
||||
l-178.7-66.4L106.3,0L0,384L0,384z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 573 B |
10
src/gui/qt-daemon/html_source/src/assets/icons/send-red.svg
Normal file
10
src/gui/qt-daemon/html_source/src/assets/icons/send-red.svg
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" id="icons" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 384 384" style="enable-background:new 0 0 384 384;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill:#ff5252;}
|
||||
</style>
|
||||
<path id="send" class="st0" d="M319.8,74.4l-58.2,210.4l-48.1-71.6L206,202l-12.7-4.7l-81.9-30.4L319.8,74.4 M384,0L0,170.3
|
||||
l178.7,66.4L277.7,384L384,0L384,0z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 573 B |
|
|
@ -3,6 +3,7 @@ import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
|||
|
||||
import { AppModule } from './app/app.module';
|
||||
import { environment } from './environments/environment';
|
||||
import 'lodash';
|
||||
|
||||
if (environment.production) {
|
||||
enableProdMode();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue