From 52e087e4dda5213885f062952572306aeb99caf4 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 6 Nov 2018 12:13:11 -0500 Subject: [PATCH] icon code --- src/angular/components/icon.component.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/angular/components/icon.component.ts b/src/angular/components/icon.component.ts index 4b127c07db..0e2dabfc25 100644 --- a/src/angular/components/icon.component.ts +++ b/src/angular/components/icon.component.ts @@ -6,6 +6,8 @@ import { import { CipherType } from '../../enums/cipherType'; +import { CipherView } from '../../models/view/cipherView'; + import { EnvironmentService } from '../../abstractions/environment.service'; import { StateService } from '../../abstractions/state.service'; @@ -13,12 +15,21 @@ import { ConstantsService } from '../../services/constants.service'; import { Utils } from '../../misc/utils'; +const IconMap = { + 'fa-globe': String.fromCharCode(0xf0ac), + 'fa-sticky-note-o': String.fromCharCode(0xf24a), + 'fa-id-card-o': String.fromCharCode(0xf2c3), + 'fa-credit-card': String.fromCharCode(0xf09d), + 'fa-android': String.fromCharCode(0xf17b), + 'fa-apple': String.fromCharCode(0xf179), +}; + @Component({ selector: 'app-vault-icon', templateUrl: 'icon.component.html', }) export class IconComponent implements OnChanges { - @Input() cipher: any; + @Input() cipher: CipherView; icon: string; image: string; fallbackImage: string; @@ -59,6 +70,10 @@ export class IconComponent implements OnChanges { } } + get iconCode(): string { + return IconMap[this.icon]; + } + private setLoginIcon() { if (this.cipher.login.uri) { let hostnameUri = this.cipher.login.uri;