Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelsc committed Oct 18, 2023
1 parent ceff25d commit aed44e2
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 29 deletions.
2 changes: 1 addition & 1 deletion src/app/components/dashboard/dashboard.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ export class DashboardComponent implements OnInit {
text += ` (${this.unit.convertToPref(value, 'ETHER', type)})`
}
}

return text
}

Expand Down
12 changes: 6 additions & 6 deletions src/app/components/help/help.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,12 @@
</ion-list>

<ng-template #gnosisSetupGuides>
<ion-list>
<ion-item lines="none" (click)="openBrowser('https://docs.gnosischain.com/node/manual/')">
<ion-icon slot="start" name="bulb-outline"></ion-icon>
<ion-label>Interactive Setup Guide</ion-label>
</ion-item>
</ion-list>
<ion-list>
<ion-item lines="none" (click)="openBrowser('https://docs.gnosischain.com/node/manual/')">
<ion-icon slot="start" name="bulb-outline"></ion-icon>
<ion-label>Interactive Setup Guide</ion-label>
</ion-item>
</ion-list>
</ng-template>

<ion-list-header>
Expand Down
2 changes: 0 additions & 2 deletions src/app/models/StorageTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ export interface ApiNetwork {
name: string
}



export class NetworkMainCurrency {
static readonly ETH = new NetworkMainCurrency('ETHER', 'Ether', 'ETH')
static readonly GNO = new NetworkMainCurrency('GNO', 'mGNO', 'GNO')
Expand Down
4 changes: 2 additions & 2 deletions src/app/pipes/mcurrency.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ export class McurrencyPipe implements PipeTransform {
if (typeof args[1] == 'string') {
return this.unit.convertNonFiat(value, args[0] as string, args[1] as string, displayAble)
} else if (typeof args[1] == 'object' && this.unit.isCurrency(args[1])) {
return this.unit.convert(value, args[0] as string, args[1], displayAble)
return this.unit.convert(value, args[0] as string, args[1], displayAble)
} else {
console.warn("illegal usage of mcurrency pipe. Usage: value | mcurrency:from:to or value | mcurrency:from:currency")
console.warn('illegal usage of mcurrency pipe. Usage: value | mcurrency:from:to or value | mcurrency:from:currency')
}
}
}
2 changes: 0 additions & 2 deletions src/app/services/api.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,6 @@ export class ApiService extends CacheModule {
return cfg.protocol + '://' + cfg.net + cfg.host
}


async getAllTestNetNames() {
const debug = await this.storage.isDebugMode()
const re: string[][] = []
Expand Down Expand Up @@ -502,7 +501,6 @@ export interface Response extends HttpResponse {
cached: boolean
}


export function initializeApiService(service: ApiService): () => Promise<void> {
return () => service.initialize()
}
2 changes: 1 addition & 1 deletion src/app/services/storage.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,4 +281,4 @@ export interface StoredShare {

export interface DevModeEnabled {
enabled: boolean
}
}
5 changes: 2 additions & 3 deletions src/app/services/unitconv.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export type RewardType = 'cons' | 'exec' | 'rpl'
providedIn: 'root',
})
export class UnitconvService {

public pref: PreferredCurrency = {
Cons: { value: 'ETHER', type: 'cons', unit: Unit.ETHER } as Currency,
Exec: { value: 'ETHER', type: 'exec', unit: Unit.ETHER } as Currency,
Expand Down Expand Up @@ -394,8 +393,8 @@ interface CurrencyPipe {
}

interface StoredPref {
prefered: string | null,
prefered: string | null
coinbaseSpot: string
symbol: string
rounding: number
}
}
4 changes: 3 additions & 1 deletion src/app/tab-blocks/tab-blocks.page.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<ion-header>
<ion-toolbar>
<ion-buttons slot="end">
<ion-button (click)="unit.switchCurrencyPipe()" *ngIf="(unit.pref.Exec.value != 'ETHER' && unit.pref.Exec.value != 'FINNEY') || classReference.currencyPipe.Exec != null ">
<ion-button
(click)="unit.switchCurrencyPipe()"
*ngIf="(unit.pref.Exec.value != 'ETHER' && unit.pref.Exec.value != 'FINNEY') || classReference.currencyPipe.Exec != null ">
<ion-icon size="small" name="swap-vertical-outline"></ion-icon>
</ion-button>
</ion-buttons>
Expand Down
4 changes: 3 additions & 1 deletion src/app/tab-validators/tab-validators.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
</ion-button>
</ion-buttons>
<ion-buttons slot="end">
<ion-button (click)="unit.switchCurrencyPipe()" *ngIf="(unit.pref.Cons.value != 'ETHER' && unit.pref.Cons.value != 'FINNEY') || classReference.currencyPipe.Cons != null">
<ion-button
(click)="unit.switchCurrencyPipe()"
*ngIf="(unit.pref.Cons.value != 'ETHER' && unit.pref.Cons.value != 'FINNEY') || classReference.currencyPipe.Cons != null">
<ion-icon size="small" name="swap-vertical-outline"></ion-icon>
</ion-button>
</ion-buttons>
Expand Down
5 changes: 3 additions & 2 deletions src/app/tab-validators/tab-validators.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,9 @@ export class Tab2Page {
cssClass: 'my-custom-class',
header: 'Define stake share',
message:
'If you own partial amounts of these validators, specify the amount of ' + this.api.getCurrenciesFormatted()+ ' for a custom dashboard. First value defines your consensus share, second value your execution share.',
'If you own partial amounts of these validators, specify the amount of ' +
this.api.getCurrenciesFormatted() +
' for a custom dashboard. First value defines your consensus share, second value your execution share.',
inputs: [
{
name: 'share',
Expand Down Expand Up @@ -616,5 +618,4 @@ export class Tab2Page {

await alert.present()
}

}
11 changes: 5 additions & 6 deletions src/app/utils/CacheModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,19 @@ export class CacheModule {
this.cache = result
}
try {
let kiloBytes = null;
let kiloBytes = null
if (this.hardStorage) {
const size = new TextEncoder().encode(JSON.stringify(this.cache, replacer)).length
kiloBytes = Math.round(size *100 / 1024) / 100;
}
kiloBytes = Math.round((size * 100) / 1024) / 100
}
console.log('[CacheModule] initialized with ', kiloBytes == null ? '(unknown size)' : '(' + kiloBytes + ' KiB)', this.cache)
if (kiloBytes && kiloBytes > 1000) {
console.warn('[CacheModule] storage cap exceeded (1 MB), clearing cache')
await this.clearHardCache()
}
} catch (e) {
console.warn("could not calculate cache size")
console.warn('could not calculate cache size')
}

} else {
this.initialized = new Promise<Map<string, CachedData>>((resolve) => {
resolve(new Map<string, CachedData>())
Expand All @@ -77,7 +76,7 @@ export class CacheModule {

private getStoreForCacheKey(cacheKey: string): Map<string, CachedData> {
// rationale: don't store big data objects in hardStorage due to severe performance impacts
const storeHard = cacheKey.indexOf('app/dashboard') >= 0 || cacheKey.indexOf("beaconcha.in") < 0 // or store all non beaconchain requests
const storeHard = cacheKey.indexOf('app/dashboard') >= 0 || cacheKey.indexOf('beaconcha.in') < 0 // or store all non beaconchain requests
return storeHard ? this.cache : this.hotOnly
}

Expand Down
15 changes: 13 additions & 2 deletions src/app/utils/EthereumUnits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default class Unit {
public static CNYETH = new Unit('元', new BigNumber('1'), 2, 'XXX-CNY', 'Renminbi')
public static HKDETH = new Unit('HK$', new BigNumber('1'), 2, 'XXX-HKD', 'Hong Kong Dollar')
public static NZDETH = new Unit('NZ$', new BigNumber('1'), 2, 'XXX-NZD', 'New Zealand Dollar')
public static BTCETH = new Unit('₿', new BigNumber('1'), 6, 'XXX-BTC', 'Bitcoin')
public static BTCETH = new Unit('₿', new BigNumber('1'), 6, 'XXX-BTC', 'Bitcoin')

private constructor(symbol: string, value: BigNumber, rounding = 2, coinbaseSpot = null, settingsName = null) {
this.display = symbol
Expand All @@ -66,7 +66,18 @@ export default class Unit {
}

public toString(): string {
return this.value.toString() + " " + this.display + " (rounding: " + this.rounding + ", coinbaseSpot: " + this.coinbaseSpot + ", settingName: " + this.settingName + ")"
return (
this.value.toString() +
' ' +
this.display +
' (rounding: ' +
this.rounding +
', coinbaseSpot: ' +
this.coinbaseSpot +
', settingName: ' +
this.settingName +
')'
)
}

readonly display: string
Expand Down

0 comments on commit aed44e2

Please sign in to comment.