Skip to content

Commit 7ec83bf

Browse files
committed
Added support for custom logo in Wss
1 parent d5eea20 commit 7ec83bf

File tree

6 files changed

+53
-18
lines changed

6 files changed

+53
-18
lines changed

packages/angular-sdk-components/src/lib/_components/designSystemExtension/wss-quick-create/wss-quick-create.component.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
.quick-link-button:hover .quick-link-icon {
2+
transform: scale(1.2) rotateZ(10deg);
3+
}
4+
15
.wss-quick-create-header {
26
background-color: var(--mat-sys-surface-container);
37
}

packages/angular-sdk-components/src/lib/_components/template/app-shell/app-shell.component.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
<component-mapper name="NavBar" [props]="{ pConn$, appName$, pages$, caseTypes$ }"></component-mapper>
44
</div>
55
<div *ngIf="bShowAppShell$ && portalTemplate === 'wss'">
6-
<component-mapper name="WssNavBar" [props]="{ pConn$, appName$, homePage: pages$[0], pages$: links, caseTypes$ }"></component-mapper>
6+
<component-mapper
7+
name="WssNavBar"
8+
[props]="{ pConn$, appName$, homePage: pages$[0], pages$: links, caseTypes$, portalLogoImage$: imageURL }"
9+
></component-mapper>
710
</div>
811
<div [ngClass]="{ 'appshell-main': portalTemplate !== 'wss', 'appshell-main-wss': portalTemplate === 'wss' }">
912
<div *ngFor="let kid of arChildren$">

packages/angular-sdk-components/src/lib/_components/template/app-shell/app-shell.component.ts

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { Subscription } from 'rxjs';
55
import { AngularPConnectData, AngularPConnectService } from '../../../_bridge/angular-pconnect';
66
import { ErrorMessagesService } from '../../../_messages/error-messages.service';
77
import { ComponentMapperComponent } from '../../../_bridge/component-mapper/component-mapper.component';
8+
import { Utils } from '../../../_helpers/utils';
89

910
interface IPage {
1011
classID: string;
@@ -24,7 +25,7 @@ interface AppShellProps {
2425
portalTemplate: string;
2526
readOnly?: boolean;
2627
showAppHeaderBar: boolean;
27-
showAppName: boolean;
28+
showAppName: any;
2829
}
2930

3031
@Component({
@@ -44,19 +45,22 @@ export class AppShellComponent implements OnInit, OnDestroy {
4445
caseTypes$?: object[];
4546
arChildren$: any[];
4647
bShowAppShell$ = false;
47-
appName$ = 'PEGA';
48+
appName$ = '';
4849
errorMessagesSubscription: Subscription;
4950
sErrorMessages = '';
5051
snackBarRef: any;
5152
bOkDisplayError = false;
5253
portalTemplate: string;
5354
links: any = [];
55+
imageURL: string | Blob;
56+
localizedVal = PCore.getLocaleUtils().getLocaleValue;
5457

5558
constructor(
5659
private angularPConnect: AngularPConnectService,
5760
private erService: ErrorMessagesService,
5861
private snackBar: MatSnackBar,
59-
private ngZone: NgZone
62+
private ngZone: NgZone,
63+
private utils: Utils
6064
) {}
6165

6266
ngOnInit() {
@@ -142,6 +146,12 @@ export class AppShellComponent implements OnInit, OnDestroy {
142146
updateSelf() {
143147
this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as AppShellProps;
144148

149+
const showAppName = this.configProps$.showAppName;
150+
const envInfo = PCore.getEnvironmentInfo();
151+
const appNameToDisplay = showAppName ? envInfo.getApplicationLabel() : '';
152+
const portalClass = this.pConn$.getValue('.classID', ''); // 2nd arg empty string until typedef marked correctly
153+
const envPortalName = envInfo.getPortalName();
154+
145155
this.ngZone.run(() => {
146156
// making a copy, so can add info
147157
this.pages$ = this.configProps$.pages;
@@ -153,6 +163,30 @@ export class AppShellComponent implements OnInit, OnDestroy {
153163
this.caseTypes$ = this.configProps$.caseTypes;
154164
this.arChildren$ = this.pConn$.getChildren();
155165
});
166+
167+
const portalLogo = this.configProps$.portalLogo;
168+
// using the default icon then fetch it from the static folder (not auth involved)
169+
if (
170+
!portalLogo ||
171+
portalLogo.toLowerCase().includes('pzpega-logo-mark') ||
172+
portalLogo.toLowerCase().includes('py-logo') ||
173+
portalLogo.toLowerCase().includes('py-full-logo')
174+
) {
175+
const portalLogoImage = this.utils.getIconPath(this.utils.getSDKStaticContentUrl()).concat('pzpega-logo-mark.svg');
176+
this.imageURL = portalLogoImage;
177+
}
178+
// not using default icon to fetch it using the way which uses authentication
179+
else {
180+
PCore.getAssetLoader()
181+
.getSvcImageUrl(portalLogo)
182+
.then(data => {
183+
this.imageURL = data;
184+
})
185+
.catch(() => {
186+
console.error(`${this.localizedVal('Unable to load the image for the portal logo/icon with the insName', 'AppShell')}:${portalLogo}`);
187+
});
188+
}
189+
this.appName$ = this.localizedVal(appNameToDisplay || '', '', `${portalClass}!PORTAL!${envPortalName}`.toUpperCase());
156190
}
157191

158192
// fpr show/hiding error messages in the SnackBar component

packages/angular-sdk-components/src/lib/_components/template/wss-nav-bar/wss-nav-bar.component.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,19 @@
55
<img src="{{ portalLogoImage$ }}" class="psdk-nav-logo" />
66
</div>
77
<div class="psdk-nav-portal-info">
8-
<div class="psdk-nav-portal-app">{{ portalApp$ }}</div>
8+
<div class="psdk-nav-portal-app">{{ appName$ }}</div>
99
</div>
1010
</div>
1111

12+
<span class="spacer"></span>
13+
1214
<div *ngFor="let page of navPages$">
13-
<div class="flex-box mat-list-item" style="cursor: pointer" (click)="navPanelButtonClick(page)">
15+
<div class="flex-box mat-list-item" style="cursor: pointer; font-size: 1rem; text-transform: capitalize" (click)="navPanelButtonClick(page)">
1416
<div mat-button class="psdk-nav-button-span">{{ page.pyLabel }}</div>
1517
</div>
1618
</div>
1719

18-
<span class="spacer"></span>
20+
<!-- <span class="spacer"></span> -->
1921

2022
<mat-list>
2123
<mat-list-item [matMenuTriggerFor]="menu" class="psdk-profile-list-item">

packages/angular-sdk-components/src/lib/_components/template/wss-nav-bar/wss-nav-bar.component.scss

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@
2121
}
2222

2323
.psdk-nav-logo {
24-
width: 3.75rem;
25-
padding: 0.625rem;
26-
margin-right: 1.25rem;
24+
max-width: 100%;
25+
height: 3rem;
2726
}
2827

2928
.psdk-nav-svg-icon {

packages/angular-sdk-components/src/lib/_components/template/wss-nav-bar/wss-nav-bar.component.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export class WssNavBarComponent implements OnInit, OnDestroy {
2727
@Input() pages$: any[];
2828
@Input() caseTypes$: any[];
2929
@Input() homePage: any;
30+
@Input() portalLogoImage$: string;
3031

3132
// For interaction with AngularPConnect
3233
angularPConnectData: AngularPConnectData = {};
@@ -36,10 +37,6 @@ export class WssNavBarComponent implements OnInit, OnDestroy {
3637
navExpandCollapse$: string;
3738
bShowCaseTypes$ = false;
3839

39-
portalApp$: string | undefined = '';
40-
portalLogoImage$: string;
41-
showAppName$ = false;
42-
4340
portalOperator$: string | undefined;
4441
portalOperatorInitials$: string;
4542

@@ -126,12 +123,8 @@ export class WssNavBarComponent implements OnInit, OnDestroy {
126123

127124
// const oData = this.pConn$.getDataObject();
128125

129-
this.portalLogoImage$ = this.utils.getSDKStaticContentUrl().concat('assets/pzpega-logo-mark.svg');
130126
this.portalOperator$ = PCore.getEnvironmentInfo().getOperatorName();
131127
this.portalOperatorInitials$ = this.utils.getInitials(this.portalOperator$ ?? '');
132-
this.showAppName$ = this.configProps$.showAppName;
133-
134-
this.portalApp$ = PCore.getEnvironmentInfo().getApplicationLabel();
135128
});
136129
}
137130

0 commit comments

Comments
 (0)