Responsiveness fixes.

This commit is contained in:
softsimon 2020-07-19 13:46:30 +07:00
parent cfb60c0bad
commit fbb8185c82
No known key found for this signature in database
GPG key ID: 488D7DCFB5A430D7
8 changed files with 40 additions and 14 deletions

View file

@ -8,11 +8,11 @@
"secure": false, "secure": false,
"ws": true "ws": true
}, },
"/api/bisq": { "/bisq/api": {
"target": "http://localhost:8999/", "target": "http://localhost:8999/",
"secure": false, "secure": false,
"pathRewrite": { "pathRewrite": {
"^/api/bisq": "/api/v1/bisq" "^/bisq/api": "/api/v1/bisq"
} }
}, },
"/api": { "/api": {

View file

@ -25,7 +25,7 @@
<br> <br>
<ngb-pagination [collectionSize]="totalCount" [rotate]="true" [pageSize]="itemsPerPage" [(page)]="page" (pageChange)="pageChange(page)" [maxSize]="5" [boundaryLinks]="true"></ngb-pagination> <ngb-pagination [size]="paginationSize" [collectionSize]="totalCount" [rotate]="true" [pageSize]="itemsPerPage" [(page)]="page" (pageChange)="pageChange(page)" [maxSize]="paginationMaxSize" [boundaryLinks]="true"></ngb-pagination>
</div> </div>

View file

@ -19,6 +19,9 @@ export class BisqBlocksComponent implements OnInit {
fiveItemsPxSize = 250; fiveItemsPxSize = 250;
loadingItems: number[]; loadingItems: number[];
isLoading = true; isLoading = true;
// @ts-ignore
paginationSize: 'sm' | 'lg' = 'md';
paginationMaxSize = 10;
pageSubject$ = new Subject<number>(); pageSubject$ = new Subject<number>();
@ -31,11 +34,15 @@ export class BisqBlocksComponent implements OnInit {
this.seoService.setTitle('Blocks', true); this.seoService.setTitle('Blocks', true);
this.itemsPerPage = Math.max(Math.round(this.contentSpace / this.fiveItemsPxSize) * 5, 10); this.itemsPerPage = Math.max(Math.round(this.contentSpace / this.fiveItemsPxSize) * 5, 10);
this.loadingItems = Array(this.itemsPerPage); this.loadingItems = Array(this.itemsPerPage);
if (document.body.clientWidth < 768) {
this.paginationSize = 'sm';
this.paginationMaxSize = 3;
}
this.pageSubject$ this.pageSubject$
.pipe( .pipe(
tap(() => this.isLoading = true), tap(() => this.isLoading = true),
switchMap((page) => this.bisqApiService.listBlocks$((page - 1) * 10, this.itemsPerPage)) switchMap((page) => this.bisqApiService.listBlocks$((page - 1) * this.itemsPerPage, this.itemsPerPage))
) )
.subscribe((response) => { .subscribe((response) => {
this.isLoading = false; this.isLoading = false;

View file

@ -4,7 +4,7 @@
<table class="table table-borderless table-striped"> <table class="table table-borderless table-striped">
<tbody> <tbody>
<tr> <tr>
<td>Inputs</td> <td class="td-width">Inputs</td>
<td>{{ totalInput / 100 | number: '1.2-2' }} BSQ</td> <td>{{ totalInput / 100 | number: '1.2-2' }} BSQ</td>
</tr> </tr>
<tr> <tr>
@ -20,9 +20,9 @@
</div> </div>
<div class="col-sm"> <div class="col-sm">
<table class="table table-borderless table-striped"> <table class="table table-borderless table-striped">
<tbody> <tbody class="mobile-even">
<tr> <tr>
<td>Type</td> <td class="td-width">Type</td>
<td><app-bisq-icon class="mr-1" [txType]="tx.txType"></app-bisq-icon> {{ tx.txTypeDisplayString }}</td> <td><app-bisq-icon class="mr-1" [txType]="tx.txType"></app-bisq-icon> {{ tx.txTypeDisplayString }}</td>
</tr> </tr>
<tr> <tr>

View file

@ -0,0 +1,11 @@
@media (max-width: 767.98px) {
.td-width {
width: 150px;
}
.mobile-even tr:nth-of-type(even) {
background-color: #181b2d;
}
.mobile-even tr:nth-of-type(odd) {
background-color: inherit;
}
}

View file

@ -4,11 +4,10 @@
<div class="clearfix"></div> <div class="clearfix"></div>
<div class="table-responsive-sm">
<table class="table table-borderless table-striped"> <table class="table table-borderless table-striped">
<thead> <thead>
<th style="width: 20%;">Transaction</th> <th style="width: 20%;">Transaction</th>
<th style="width: 20%;">Type</th> <th class="d-none d-sm-block" style="width: 20%;">Type</th>
<th style="width: 20%;">Amount</th> <th style="width: 20%;">Amount</th>
<th style="width: 20%;">Confirmed</th> <th style="width: 20%;">Confirmed</th>
<th class="d-none d-md-block" style="width: 20%;">Height</th> <th class="d-none d-md-block" style="width: 20%;">Height</th>
@ -16,11 +15,12 @@
<tbody *ngIf="!isLoading; else loadingTmpl"> <tbody *ngIf="!isLoading; else loadingTmpl">
<tr *ngFor="let tx of transactions; trackBy: trackByFn"> <tr *ngFor="let tx of transactions; trackBy: trackByFn">
<td><a [routerLink]="['/tx/' | relativeUrl, tx.id]" [state]="{ data: tx }">{{ tx.id | slice : 0 : 8 }}</a></td> <td><a [routerLink]="['/tx/' | relativeUrl, tx.id]" [state]="{ data: tx }">{{ tx.id | slice : 0 : 8 }}</a></td>
<td> <td class="d-none d-md-block">
<app-bisq-icon class="mr-1" [txType]="tx.txType"></app-bisq-icon> <app-bisq-icon class="mr-1" [txType]="tx.txType"></app-bisq-icon>
<span class="d-none d-md-inline"> {{ tx.txTypeDisplayString }}</span> <span class="d-none d-md-inline"> {{ tx.txTypeDisplayString }}</span>
</td> </td>
<td> <td>
<app-bisq-icon class="d-inline d-sm-none mr-1" [txType]="tx.txType"></app-bisq-icon>
<ng-template [ngIf]="tx.txType === 'PAY_TRADE_FEE'" [ngIfElse]="defaultTxType"> <ng-template [ngIf]="tx.txType === 'PAY_TRADE_FEE'" [ngIfElse]="defaultTxType">
{{ tx.burntFee / 100 | number: '1.2-2' }}<span class="d-none d-md-inline"> BSQ</span> {{ tx.burntFee / 100 | number: '1.2-2' }}<span class="d-none d-md-inline"> BSQ</span>
</ng-template> </ng-template>
@ -33,11 +33,10 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div>
<br> <br>
<ngb-pagination [collectionSize]="totalCount" [rotate]="true" [pageSize]="itemsPerPage" [(page)]="page" (pageChange)="pageChange(page)" [maxSize]="5" [boundaryLinks]="true"></ngb-pagination> <ngb-pagination [size]="paginationSize" [collectionSize]="totalCount" [rotate]="true" [pageSize]="itemsPerPage" [(page)]="page" (pageChange)="pageChange(page)" [maxSize]="paginationMaxSize" [boundaryLinks]="true"></ngb-pagination>
</div> </div>

View file

@ -21,6 +21,10 @@ export class BisqTransactionsComponent implements OnInit {
loadingItems: number[]; loadingItems: number[];
pageSubject$ = new Subject<number>(); pageSubject$ = new Subject<number>();
// @ts-ignore
paginationSize: 'sm' | 'lg' = 'md';
paginationMaxSize = 10;
constructor( constructor(
private bisqApiService: BisqApiService, private bisqApiService: BisqApiService,
private seoService: SeoService, private seoService: SeoService,
@ -32,10 +36,15 @@ export class BisqTransactionsComponent implements OnInit {
this.itemsPerPage = Math.max(Math.round(this.contentSpace / this.fiveItemsPxSize) * 5, 10); this.itemsPerPage = Math.max(Math.round(this.contentSpace / this.fiveItemsPxSize) * 5, 10);
this.loadingItems = Array(this.itemsPerPage); this.loadingItems = Array(this.itemsPerPage);
if (document.body.clientWidth < 768) {
this.paginationSize = 'sm';
this.paginationMaxSize = 3;
}
this.pageSubject$ this.pageSubject$
.pipe( .pipe(
tap(() => this.isLoading = true), tap(() => this.isLoading = true),
switchMap((page) => this.bisqApiService.listTransactions$((page - 1) * 10, this.itemsPerPage)) switchMap((page) => this.bisqApiService.listTransactions$((page - 1) * this.itemsPerPage, this.itemsPerPage))
) )
.subscribe((response) => { .subscribe((response) => {
this.isLoading = false; this.isLoading = false;

View file

@ -171,7 +171,7 @@ body {
} }
.table-striped tbody tr:nth-of-type(odd) { .table-striped tbody tr:nth-of-type(odd) {
background-color: #181b2d !important; background-color: #181b2d;
} }
.bordertop { .bordertop {