Skip to content

Commit f6bc012

Browse files
Merge pull request #1615 from karinakharchenko/favicon-fix
fix: show favicon on login/registration pages and update color to blue
2 parents 6ae0562 + 8380b15 commit f6bc012

File tree

6 files changed

+31
-30
lines changed

6 files changed

+31
-30
lines changed

frontend/src/app/app.component.ts

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ export class AppComponent {
187187

188188
if (!expirationToken) {
189189
this.setUserLoggedIn(false);
190+
this.setDefaultFavicon();
190191
}
191192

192193
this.navigationTabs = {
@@ -323,35 +324,12 @@ export class AppComponent {
323324
this.whiteLabelSettingsLoaded = true;
324325

325326
if (whiteLabelSettings.favicon) {
326-
const link: HTMLLinkElement | null = document.querySelector("link[rel*='icon']");
327-
if (link) {
328-
link.href = whiteLabelSettings.favicon;
329-
} else {
330-
const newLink = document.createElement('link');
331-
newLink.rel = 'icon';
332-
newLink.href = whiteLabelSettings.favicon;
333-
document.head.appendChild(newLink);
334-
}
327+
const newLink = document.createElement('link');
328+
newLink.rel = 'icon';
329+
newLink.href = whiteLabelSettings.favicon;
330+
document.head.appendChild(newLink);
335331
} else {
336-
const faviconIco = document.createElement('link');
337-
faviconIco.rel = 'icon';
338-
faviconIco.type = 'image/x-icon';
339-
faviconIco.href = 'assets/favicon.ico';
340-
341-
const favicon16 = document.createElement('link');
342-
favicon16.rel = 'icon';
343-
favicon16.type = 'image/png';
344-
favicon16.setAttribute('sizes', '16x16');
345-
favicon16.href = 'assets/favicon-16x16.png';
346-
347-
const favicon32 = document.createElement('link');
348-
favicon32.rel = 'icon';
349-
favicon32.type = 'image/png';
350-
favicon32.setAttribute('sizes', '32x32');
351-
favicon32.href = 'assets/favicon-32x32.png';
352-
353-
document.head.appendChild(favicon16);
354-
document.head.appendChild(favicon32);
332+
this.setDefaultFavicon();
355333
}
356334
});
357335
this._uiSettings.getUiSettings().subscribe((settings) => {
@@ -406,4 +384,27 @@ export class AppComponent {
406384
}
407385
});
408386
}
387+
388+
private setDefaultFavicon() {
389+
const faviconIco = document.createElement('link');
390+
faviconIco.rel = 'icon';
391+
faviconIco.type = 'image/x-icon';
392+
faviconIco.href = 'assets/favicon.ico';
393+
394+
const favicon16 = document.createElement('link');
395+
favicon16.rel = 'icon';
396+
favicon16.type = 'image/png';
397+
favicon16.setAttribute('sizes', '16x16');
398+
favicon16.href = 'assets/favicon-16x16.png';
399+
400+
const favicon32 = document.createElement('link');
401+
favicon32.rel = 'icon';
402+
favicon32.type = 'image/png';
403+
favicon32.setAttribute('sizes', '32x32');
404+
favicon32.href = 'assets/favicon-32x32.png';
405+
406+
document.head.appendChild(faviconIco);
407+
document.head.appendChild(favicon16);
408+
document.head.appendChild(favicon32);
409+
}
409410
}
-35 Bytes
Loading
-167 Bytes
Loading

frontend/src/assets/favicon.ico

-9.74 KB
Binary file not shown.

frontend/src/assets/favicon.svg

Lines changed: 1 addition & 1 deletion
Loading

frontend/src/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<meta name="viewport" content="width=device-width, initial-scale=1">
99
<!--<link rel="icon" type="image/x-icon" href="assets/favicon.ico">
1010
<link rel="icon" type="image/png" sizes="16x16" href="assets/favicon-16x16.png">
11-
<link rel="icon" type="image/png" sizes="32x32" href="assets/favicon-32x32.png"> -->
11+
<link rel="icon" type="image/png" sizes="32x32" href="assets/favicon-32x32.png">-->
1212
</head>
1313
<body style="background-color: #191919; color: #ffffff;">
1414
<app-root class="mainLayout mat-typography"></app-root>

0 commit comments

Comments
 (0)