mirror of
https://github.com/Retropex/mempool.git
synced 2025-05-12 18:20:41 +02:00
Add amount mode selector to footer
This commit is contained in:
parent
80da024bbb
commit
c7f48b4390
@ -0,0 +1,7 @@
|
||||
<div [formGroup]="amountForm" class="text-small text-center">
|
||||
<select formControlName="mode" class="custom-select custom-select-sm form-control-secondary form-control mx-auto" style="width: 70px;" (change)="changeMode()">
|
||||
<option value="btc" i18n="shared.btc|BTC">BTC</option>
|
||||
<option value="sats" i18n="shared.sat|sat">sat</option>
|
||||
<option value="fiat" i18n="shared.fiat|Fiat">Fiat</option>
|
||||
</select>
|
||||
</div>
|
@ -0,0 +1,36 @@
|
||||
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
|
||||
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
|
||||
import { StorageService } from '../../services/storage.service';
|
||||
import { StateService } from '../../services/state.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-amount-selector',
|
||||
templateUrl: './amount-selector.component.html',
|
||||
styleUrls: ['./amount-selector.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
})
|
||||
export class AmountSelectorComponent implements OnInit {
|
||||
amountForm: UntypedFormGroup;
|
||||
modes = ['btc', 'sats', 'fiat'];
|
||||
|
||||
constructor(
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private stateService: StateService,
|
||||
private storageService: StorageService,
|
||||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.amountForm = this.formBuilder.group({
|
||||
mode: ['btc']
|
||||
});
|
||||
this.stateService.viewAmountMode$.subscribe((mode) => {
|
||||
this.amountForm.get('mode')?.setValue(mode);
|
||||
});
|
||||
}
|
||||
|
||||
changeMode() {
|
||||
const newMode = this.amountForm.get('mode')?.value;
|
||||
this.storageService.setValue('view-amount-mode', newMode);
|
||||
this.stateService.viewAmountMode$.next(newMode);
|
||||
}
|
||||
}
|
@ -27,6 +27,9 @@
|
||||
<div class="selector">
|
||||
<app-rate-unit-selector></app-rate-unit-selector>
|
||||
</div>
|
||||
<div class="selector d-none d-sm-flex">
|
||||
<app-amount-selector></app-amount-selector>
|
||||
</div>
|
||||
@if (!env.customize?.theme) {
|
||||
<div class="selector d-none d-sm-flex">
|
||||
<app-theme-selector></app-theme-selector>
|
||||
@ -39,7 +42,8 @@
|
||||
</div>
|
||||
@if (!env.customize?.theme) {
|
||||
<div class="selector d-flex d-sm-none justify-content-center ml-auto mr-auto mt-0">
|
||||
<app-theme-selector></app-theme-selector>
|
||||
<app-amount-selector class="add-margin"></app-amount-selector>
|
||||
<app-theme-selector class="add-margin"></app-theme-selector>
|
||||
</div>
|
||||
}
|
||||
@if (!enterpriseInfo?.footer_img) {
|
||||
|
@ -76,6 +76,11 @@ footer .selector {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
footer .add-margin {
|
||||
margin-left: 5px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
footer .row.link-tree {
|
||||
max-width: 1140px;
|
||||
margin: 0 auto;
|
||||
|
@ -35,6 +35,7 @@ import { LanguageSelectorComponent } from '../components/language-selector/langu
|
||||
import { FiatSelectorComponent } from '../components/fiat-selector/fiat-selector.component';
|
||||
import { RateUnitSelectorComponent } from '../components/rate-unit-selector/rate-unit-selector.component';
|
||||
import { ThemeSelectorComponent } from '../components/theme-selector/theme-selector.component';
|
||||
import { AmountSelectorComponent } from '../components/amount-selector/amount-selector.component';
|
||||
import { BrowserOnlyDirective } from './directives/browser-only.directive';
|
||||
import { ServerOnlyDirective } from './directives/server-only.directive';
|
||||
import { ColoredPriceDirective } from './directives/colored-price.directive';
|
||||
@ -131,6 +132,7 @@ import { OnlyVsizeDirective, OnlyWeightDirective } from './components/weight-dir
|
||||
FiatSelectorComponent,
|
||||
ThemeSelectorComponent,
|
||||
RateUnitSelectorComponent,
|
||||
AmountSelectorComponent,
|
||||
ScriptpubkeyTypePipe,
|
||||
RelativeUrlPipe,
|
||||
NoSanitizePipe,
|
||||
@ -278,6 +280,7 @@ import { OnlyVsizeDirective, OnlyWeightDirective } from './components/weight-dir
|
||||
FiatSelectorComponent,
|
||||
RateUnitSelectorComponent,
|
||||
ThemeSelectorComponent,
|
||||
AmountSelectorComponent,
|
||||
ScriptpubkeyTypePipe,
|
||||
RelativeUrlPipe,
|
||||
Hex2asciiPipe,
|
||||
|
Loading…
Reference in New Issue
Block a user