From 03dfda7a17175ebf664f2e9a8c3e77070ad7db54 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 25 Jun 2018 20:49:49 -0400 Subject: [PATCH] callout component --- src/app/app.module.ts | 2 + src/app/components/callout.component.html | 7 +++ src/app/components/callout.component.ts | 53 +++++++++++++++++++ src/app/settings/change-email.component.html | 5 +- .../settings/change-password.component.html | 5 +- .../deauthorize-sessions.component.html | 5 +- .../settings/delete-account.component.html | 5 +- src/app/settings/purge-vault.component.html | 5 +- src/app/tools/export.component.html | 5 +- src/app/tools/import.component.html | 35 ++++++------ src/app/tools/import.component.ts | 4 +- 11 files changed, 86 insertions(+), 45 deletions(-) create mode 100644 src/app/components/callout.component.html create mode 100644 src/app/components/callout.component.ts diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 18bcc86b..0dedd4e1 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -17,6 +17,7 @@ import { AppComponent } from './app.component'; import { ModalComponent } from './modal.component'; import { AvatarComponent } from './components/avatar.component'; +import { CalloutComponent } from './components/callout.component'; import { FooterComponent } from './layouts/footer.component'; import { FrontendLayoutComponent } from './layouts/frontend-layout.component'; @@ -102,6 +103,7 @@ import { SearchCiphersPipe } from 'jslib/angular/pipes/search-ciphers.pipe'; BulkDeleteComponent, BulkMoveComponent, BulkShareComponent, + CalloutComponent, ChangeEmailComponent, ChangePasswordComponent, CiphersComponent, diff --git a/src/app/components/callout.component.html b/src/app/components/callout.component.html new file mode 100644 index 00000000..0093b78c --- /dev/null +++ b/src/app/components/callout.component.html @@ -0,0 +1,7 @@ + diff --git a/src/app/components/callout.component.ts b/src/app/components/callout.component.ts new file mode 100644 index 00000000..34af2873 --- /dev/null +++ b/src/app/components/callout.component.ts @@ -0,0 +1,53 @@ +import { + Component, + Input, + OnInit, +} from '@angular/core'; + +import { I18nService } from 'jslib/abstractions/i18n.service'; + +@Component({ + selector: 'app-callout', + templateUrl: 'callout.component.html', +}) +export class CalloutComponent implements OnInit { + @Input() type = 'info'; + @Input() icon: string; + @Input() title: string; + + calloutStyle: string; + + constructor(private i18nService: I18nService) { } + + ngOnInit() { + this.calloutStyle = this.type; + + if (this.type === 'warning' || this.type === 'danger') { + if (this.type === 'danger') { + this.calloutStyle = 'danger'; + } + if (this.title === undefined) { + this.title = this.i18nService.t('warning'); + } + if (this.icon === undefined) { + this.icon = 'fa-warning'; + } + } else if (this.type === 'error') { + this.calloutStyle = 'danger'; + if (this.title === undefined) { + this.title = this.i18nService.t('error'); + } + if (this.icon === undefined) { + this.icon = 'fa-bolt'; + } + } else if (this.type === 'tip') { + this.calloutStyle = 'success'; + if (this.title === undefined) { + this.title = this.i18nService.t('tip'); + } + if (this.icon === undefined) { + this.icon = 'fa-lightbulb-o'; + } + } + } +} diff --git a/src/app/settings/change-email.component.html b/src/app/settings/change-email.component.html index 3b3501b2..b78fac20 100644 --- a/src/app/settings/change-email.component.html +++ b/src/app/settings/change-email.component.html @@ -15,10 +15,7 @@

{{'changeEmailDesc' | i18n : newEmail}}

- + {{'loggedOutWarning' | i18n}}
diff --git a/src/app/settings/change-password.component.html b/src/app/settings/change-password.component.html index 0e2c752d..29e14e9a 100644 --- a/src/app/settings/change-password.component.html +++ b/src/app/settings/change-password.component.html @@ -1,7 +1,4 @@ - +{{'loggedOutWarning' | i18n}}
diff --git a/src/app/settings/deauthorize-sessions.component.html b/src/app/settings/deauthorize-sessions.component.html index 0b167a2e..322c78a8 100644 --- a/src/app/settings/deauthorize-sessions.component.html +++ b/src/app/settings/deauthorize-sessions.component.html @@ -9,10 +9,7 @@

{{'exportMasterPassword' | i18n}}

- + {{'exportWarning' | i18n}}
diff --git a/src/app/tools/import.component.html b/src/app/tools/import.component.html index be7df241..23d8f4ac 100644 --- a/src/app/tools/import.component.html +++ b/src/app/tools/import.component.html @@ -14,25 +14,22 @@
- + + + See detailed instructions on our help site at + https://help.bitwarden.com/article/export-your-data/ + + + See detailed instructions on our help site at + https://help.bitwarden.com/article/import-from-lastpass/ + + + Using the KeePassX desktop application, navigate to "Database" → "Export to CSV file" and save the CSV file. + + + In the Avira web vault, go to "Settings" → "My Data" → "Export data" and save the CSV file. + +
diff --git a/src/app/tools/import.component.ts b/src/app/tools/import.component.ts index a68595fc..030f7b67 100644 --- a/src/app/tools/import.component.ts +++ b/src/app/tools/import.component.ts @@ -165,14 +165,14 @@ export class ImportComponent { } } - getFormatName() { + getFormatInstructionTitle() { if (this.format == null) { return null; } const results = this.featuredImportOptions.concat(this.importOptions).filter((o) => o.id === this.format); if (results.length > 0) { - return results[0].name; + return this.i18nService.t('instructionsFor', results[0].name); } return null; }