From 0f1c444351e43d5005068a90f5442840cb2d87f5 Mon Sep 17 00:00:00 2001 From: mastah Date: Fri, 30 Jan 2026 23:57:09 +0100 Subject: [PATCH] Added persistence to generators scope --- src/app/components/app/app.component.html | 12 ++++++------ src/app/components/app/app.component.ts | 24 +++++++++++++++++++++++ 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/app/components/app/app.component.html b/src/app/components/app/app.component.html index 3ffd704..024da75 100644 --- a/src/app/components/app/app.component.html +++ b/src/app/components/app/app.component.html @@ -5,12 +5,12 @@ @if (showControls) {
- REGON - NIP - PESEL - DOWÓD - KOMÓRA - IBAN + REGON + NIP + PESEL + DOWÓD + KOMÓRA + IBAN diff --git a/src/app/components/app/app.component.ts b/src/app/components/app/app.component.ts index 359bc4e..2fb424a 100644 --- a/src/app/components/app/app.component.ts +++ b/src/app/components/app/app.component.ts @@ -36,6 +36,18 @@ export class AppComponent implements OnInit { this.selectedTheme = savedTheme; this.applyTheme(savedTheme); } + + const savedGenerators = localStorage.getItem('generatorSettings'); + if (savedGenerators) { + const settings = JSON.parse(savedGenerators); + this.showRegon = settings.showRegon ?? true; + this.showNip = settings.showNip ?? true; + this.showPesel = settings.showPesel ?? true; + this.showIdentityCard = settings.showIdentityCard ?? true; + this.showIban = settings.showIban ?? true; + this.showMobile = settings.showMobile ?? true; + } + setTimeout(() => { this.isInitialVisible = false; this.cdr.detectChanges(); @@ -48,6 +60,18 @@ export class AppComponent implements OnInit { this.applyTheme(theme); } + saveGeneratorSettings() { + const settings = { + showRegon: this.showRegon, + showNip: this.showNip, + showPesel: this.showPesel, + showIdentityCard: this.showIdentityCard, + showIban: this.showIban, + showMobile: this.showMobile + }; + localStorage.setItem('generatorSettings', JSON.stringify(settings)); + } + private applyTheme(theme: string) { const body = document.body; this.themes.forEach(t => {