diff --git a/frontend/src/app/components/rate-unit-selector/rate-unit-selector.component.html b/frontend/src/app/components/rate-unit-selector/rate-unit-selector.component.html
new file mode 100644
index 000000000..016d1b555
--- /dev/null
+++ b/frontend/src/app/components/rate-unit-selector/rate-unit-selector.component.html
@@ -0,0 +1,5 @@
+
+
+
diff --git a/frontend/src/app/components/rate-unit-selector/rate-unit-selector.component.scss b/frontend/src/app/components/rate-unit-selector/rate-unit-selector.component.scss
new file mode 100644
index 000000000..e69de29bb
diff --git a/frontend/src/app/components/rate-unit-selector/rate-unit-selector.component.ts b/frontend/src/app/components/rate-unit-selector/rate-unit-selector.component.ts
new file mode 100644
index 000000000..a7d94cec2
--- /dev/null
+++ b/frontend/src/app/components/rate-unit-selector/rate-unit-selector.component.ts
@@ -0,0 +1,45 @@
+import { ChangeDetectionStrategy, Component, OnDestroy, OnInit } from '@angular/core';
+import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
+import { StorageService } from '../../services/storage.service';
+import { StateService } from '../../services/state.service';
+import { Subscription } from 'rxjs';
+
+@Component({
+ selector: 'app-rate-unit-selector',
+ templateUrl: './rate-unit-selector.component.html',
+ styleUrls: ['./rate-unit-selector.component.scss'],
+ changeDetection: ChangeDetectionStrategy.OnPush
+})
+export class RateUnitSelectorComponent implements OnInit, OnDestroy {
+ rateUnitForm: UntypedFormGroup;
+ rateUnitSub: Subscription;
+ units = [
+ { name: 'vb', label: 'sat/vB' },
+ { name: 'wu', label: 'sat/WU' },
+ ];
+
+ constructor(
+ private formBuilder: UntypedFormBuilder,
+ private stateService: StateService,
+ private storageService: StorageService,
+ ) { }
+
+ ngOnInit() {
+ this.rateUnitForm = this.formBuilder.group({
+ rateUnits: ['vb']
+ });
+ this.rateUnitSub = this.stateService.rateUnits$.subscribe((units) => {
+ this.rateUnitForm.get('rateUnits')?.setValue(units);
+ });
+ }
+
+ changeUnits() {
+ const newUnits = this.rateUnitForm.get('rateUnits')?.value;
+ this.storageService.setValue('rate-unit-preference', newUnits);
+ this.stateService.rateUnits$.next(newUnits);
+ }
+
+ ngOnDestroy(): void {
+ this.rateUnitSub.unsubscribe();
+ }
+}
diff --git a/frontend/src/app/services/state.service.ts b/frontend/src/app/services/state.service.ts
index 738893bbc..0c5f5a5d9 100644
--- a/frontend/src/app/services/state.service.ts
+++ b/frontend/src/app/services/state.service.ts
@@ -133,6 +133,7 @@ export class StateService {
hideFlow: BehaviorSubject;
hideAudit: BehaviorSubject;
fiatCurrency$: BehaviorSubject;
+ rateUnits$: BehaviorSubject;
constructor(
@Inject(PLATFORM_ID) private platformId: any,
@@ -225,6 +226,9 @@ export class StateService {
const fiatPreference = this.storageService.getValue('fiat-preference');
this.fiatCurrency$ = new BehaviorSubject(fiatPreference || 'USD');
+
+ const rateUnitPreference = this.storageService.getValue('rate-unit-preference');
+ this.rateUnits$ = new BehaviorSubject(rateUnitPreference || 'vb');
}
setNetworkBasedonUrl(url: string) {
diff --git a/frontend/src/app/shared/components/global-footer/global-footer.component.html b/frontend/src/app/shared/components/global-footer/global-footer.component.html
index 0bac1f9ff..8e5279a94 100644
--- a/frontend/src/app/shared/components/global-footer/global-footer.component.html
+++ b/frontend/src/app/shared/components/global-footer/global-footer.component.html
@@ -10,6 +10,9 @@
+
Sign In
diff --git a/frontend/src/app/shared/shared.module.ts b/frontend/src/app/shared/shared.module.ts
index 542d2f745..9d9606084 100644
--- a/frontend/src/app/shared/shared.module.ts
+++ b/frontend/src/app/shared/shared.module.ts
@@ -35,6 +35,7 @@ import { TxFeeRatingComponent } from '../components/tx-fee-rating/tx-fee-rating.
import { ReactiveFormsModule } from '@angular/forms';
import { LanguageSelectorComponent } from '../components/language-selector/language-selector.component';
import { FiatSelectorComponent } from '../components/fiat-selector/fiat-selector.component';
+import { RateUnitSelectorComponent } from '../components/rate-unit-selector/rate-unit-selector.component';
import { ColoredPriceDirective } from './directives/colored-price.directive';
import { NoSanitizePipe } from './pipes/no-sanitize.pipe';
import { MempoolBlocksComponent } from '../components/mempool-blocks/mempool-blocks.component';
@@ -106,6 +107,7 @@ import { ClockComponent } from '../components/clock/clock.component';
TxFeeRatingComponent,
LanguageSelectorComponent,
FiatSelectorComponent,
+ RateUnitSelectorComponent,
ScriptpubkeyTypePipe,
RelativeUrlPipe,
NoSanitizePipe,
@@ -225,6 +227,7 @@ import { ClockComponent } from '../components/clock/clock.component';
TxFeeRatingComponent,
LanguageSelectorComponent,
FiatSelectorComponent,
+ RateUnitSelectorComponent,
ScriptpubkeyTypePipe,
RelativeUrlPipe,
Hex2asciiPipe,