Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added refresh capability to home screen #25

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/app/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ ion-header .bar-button-default-md, .bar-button-clear-md-default, .bar-button-md-
font-family: 'Poppins', sans-serif;
}

ion-content {
ion-content, ion-content.has-refresher > .scroll-content {
background-image: linear-gradient(-136deg, #2C2E8B 0%, #74298C 47%, #D2508D 100%);
border-top: none;
color: #FFF;
font-family: 'Poppins', sans-serif;
letter-spacing: 0.6px;
Expand Down Expand Up @@ -310,4 +311,8 @@ ion-input {
border-bottom-color: #FFF;
box-shadow: none;
color: #FFF !important;
}

.refresher-refreshing .spinner-ios line, .refresher-refreshing .spinner-ios-small line, .refresher-refreshing .spinner-crescent circle {
stroke: #FFF;
}
47 changes: 33 additions & 14 deletions src/pages/home/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,30 @@
</ion-col>
</ion-row>
</ion-navbar>
</ion-header>

<ion-content padding>

<ion-refresher (ionRefresh)="doRefresh($event)">
<ion-refresher-content>
</ion-refresher-content>
</ion-refresher>

<div class="tokens">
Balance:
<p class="balance" *ngIf="config.defaultAccount">
{{config.defaultAccount.balance | number}}
</p>
</div>
</ion-header>

<ion-content padding>
<ion-row class="home-tabs">
<ion-col col-auto>
<a (click)="displaySection = 'transactionsSection'" [class.active]="displaySection === 'transactionsSection'">Transactions</a>
<a (click)="displaySection = 'transactionsSection'"
[class.active]="displaySection === 'transactionsSection'">Transactions</a>
</ion-col>
<ion-col col-auto>
<a (click)="displaySection = 'newsSection'" [class.active]="displaySection === 'newsSection'">News</a>
<a (click)="displaySection = 'newsSection'"
[class.active]="displaySection === 'newsSection'">News</a>
</ion-col>
</ion-row>
<div [ngSwitch]="displaySection">
Expand All @@ -49,10 +58,12 @@
<div [ngSwitch]="transactionType">

<ion-list *ngSwitchCase="'sent'">
<button ion-item detail-none text-center *ngIf="!config.fromTransactions || config.fromTransactions.length === 0">
<button ion-item detail-none text-center
*ngIf="!config.fromTransactions || config.fromTransactions.length === 0">
No Transactions
</button>
<button ion-item detail-none (click)="onDetailsClicked(transaction)" *ngFor="let transaction of config.fromTransactions">
<button ion-item detail-none (click)="onDetailsClicked(transaction)"
*ngFor="let transaction of config.fromTransactions">
<ion-label>
<ion-grid>
<ion-row align-items-center *ngIf="transaction.type === 0">
Expand All @@ -70,8 +81,10 @@
<ion-col col-auto class="amount sent">
-{{transaction.value | number}}
</ion-col>
<ion-col col-12 *ngIf="currentTransactionHash === transaction.hash" class="details">
<transaction-details [sent]="true" [transaction]="transaction"></transaction-details>
<ion-col col-12 *ngIf="currentTransactionHash === transaction.hash"
class="details">
<transaction-details [sent]="true"
[transaction]="transaction"></transaction-details>
</ion-col>
</ion-row>
<ion-row align-items-center *ngIf="transaction.type === 1">
Expand All @@ -89,8 +102,10 @@
<ion-col col-auto class="amount sent">
-{{transaction.value | number}}
</ion-col>
<ion-col col-12 *ngIf="currentTransactionHash === transaction.hash" class="details">
<transaction-details [sent]="true" [transaction]="transaction"></transaction-details>
<ion-col col-12 *ngIf="currentTransactionHash === transaction.hash"
class="details">
<transaction-details [sent]="true"
[transaction]="transaction"></transaction-details>
</ion-col>
</ion-row>
</ion-grid>
Expand All @@ -99,10 +114,12 @@
</ion-list>

<ion-list *ngSwitchCase="'received'">
<button ion-item detail-none text-center *ngIf="!config.toTransactions || config.toTransactions.length === 0">
<button ion-item detail-none text-center
*ngIf="!config.toTransactions || config.toTransactions.length === 0">
No Transactions
</button>
<button ion-item detail-none (click)="onDetailsClicked(transaction)" *ngFor="let transaction of config.toTransactions">
<button ion-item detail-none (click)="onDetailsClicked(transaction)"
*ngFor="let transaction of config.toTransactions">
<ion-label>
<ion-grid>
<ion-row align-items-center>
Expand All @@ -120,8 +137,10 @@
<ion-col col-auto class="amount received">
+{{transaction.value | number}}
</ion-col>
<ion-col col-12 *ngIf="currentTransactionHash === transaction.hash" class="details">
<transaction-details [sent]="false" [transaction]="transaction"></transaction-details>
<ion-col col-12 *ngIf="currentTransactionHash === transaction.hash"
class="details">
<transaction-details [sent]="false"
[transaction]="transaction"></transaction-details>
</ion-col>
</ion-row>
</ion-grid>
Expand Down
1 change: 1 addition & 0 deletions src/pages/home/home.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ page-home {
background-size: contain;
box-shadow: inset 0 1px 13px 0 rgba(0,0,0,0.00);
color: #FFF;
margin: -24px -24px 24px -24px;
padding: 30px 0;
text-align: center;

Expand Down
18 changes: 15 additions & 3 deletions src/pages/home/home.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ export class HomePage implements OnInit, OnDestroy {

/**
*
* @param {NavController} navCtrl
* @param {Store<AppState>} store
* @param {AppService} appService
* @param navCtrl
* @param store
* @param appService
* @param inAppBrowser
*/
constructor(public navCtrl: NavController, private store: Store<AppState>, private appService: AppService, public inAppBrowser: InAppBrowser) {
this.configState = this.store.select('config');
Expand Down Expand Up @@ -117,4 +118,15 @@ export class HomePage implements OnInit, OnDestroy {
public openLink(url: string) {
this.inAppBrowser.create(url, '_blank');
}

/**
*
* @param refresher
*/
public doRefresh(refresher) {
setTimeout(() => {
this.appService.refreshDefaultAccount();
refresher.complete();
}, 300);
}
}