Skip to content

Commit 05f45bf

Browse files
authored
refactor: Removed additional themes (#353)
1 parent 4049378 commit 05f45bf

File tree

10 files changed

+11
-114
lines changed

10 files changed

+11
-114
lines changed

packages/angular-sdk-components/src/lib/_components/infra/navbar/navbar.component.html

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,9 @@
4747
</div>
4848
</mat-list-item>
4949
<mat-menu #menu="matMenu">
50-
<button mat-menu-item [matMenuTriggerFor]="themes">Switch Theme</button>
5150
<button mat-menu-item>Profile</button>
5251
<button mat-menu-item (click)="navPanelLogoutClick()">{{ localizedVal('Log off', localeCategory) }}</button>
5352
</mat-menu>
54-
<mat-menu #themes="matMenu">
55-
<button *ngFor="let theme of themeService.getThemes()" mat-menu-item (click)="themeService.setTheme(theme.id)">
56-
<div class="theme-menu-item">
57-
<div class="color-preview" [style.background-color]="theme.primary"></div>
58-
<span>{{ theme.displayName }}</span>
59-
</div>
60-
</button>
61-
</mat-menu>
6253
</mat-list>
6354
</div>
6455
</div>

packages/angular-sdk-components/src/lib/_components/infra/navbar/navbar.component.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { logout } from '@pega/auth/lib/sdk-auth-manager';
66
import { AngularPConnectData, AngularPConnectService } from '../../../_bridge/angular-pconnect';
77
import { ProgressSpinnerService } from '../../../_messages/progress-spinner.service';
88
import { Utils } from '../../../_helpers/utils';
9-
import { ThemeService } from '../../../_services/theme.service';
109

1110
interface NavBarProps {
1211
// If any, enter additional props that only exist on this component
@@ -56,8 +55,7 @@ export class NavbarComponent implements OnInit, OnDestroy {
5655
private chRef: ChangeDetectorRef,
5756
private psService: ProgressSpinnerService,
5857
private ngZone: NgZone,
59-
private utils: Utils,
60-
public themeService: ThemeService
58+
private utils: Utils
6159
) {}
6260

6361
ngOnInit(): void {

packages/angular-sdk-components/src/lib/_components/infra/root-container/root-container.component.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { interval, Subscription } from 'rxjs';
55
import { AngularPConnectData, AngularPConnectService } from '../../../_bridge/angular-pconnect';
66
import { ServerConfigService } from '../../../_services/server-config.service';
77
import { ProgressSpinnerService } from '../../../_messages/progress-spinner.service';
8-
import { ThemeService } from '../../../_services/theme.service';
98
import { ReferenceComponent } from '../reference/reference.component';
109
import { PreviewViewContainerComponent } from '../Containers/preview-view-container/preview-view-container.component';
1110
import { ModalViewContainerComponent } from '../Containers/modal-view-container/modal-view-container.component';
@@ -59,13 +58,10 @@ export class RootContainerComponent implements OnInit, OnDestroy {
5958
constructor(
6059
private angularPConnect: AngularPConnectService,
6160
private psService: ProgressSpinnerService,
62-
private ngZone: NgZone,
63-
private themeService: ThemeService
61+
private ngZone: NgZone
6462
) {}
6563

6664
ngOnInit(): void {
67-
const themeClass = this.themeService.getDefaultTheme();
68-
this.themeService.setTheme(themeClass);
6965
const { containers } = PCore.getStore().getState();
7066
const items = Object.keys(containers).filter(item => item.includes('root'));
7167

packages/angular-sdk-components/src/lib/_services/theme.service.spec.ts

Lines changed: 0 additions & 16 deletions
This file was deleted.

packages/angular-sdk-components/src/lib/_services/theme.service.ts

Lines changed: 0 additions & 36 deletions
This file was deleted.

packages/angular-sdk-components/src/lib/_types/Theme.interface.ts

Lines changed: 0 additions & 5 deletions
This file was deleted.

projects/angular-test-app/src/app/_samples/embedded/embedded.component.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import { MainScreenComponent } from './main-screen/main-screen.component';
1515

1616
import { getSdkComponentMap } from 'packages/angular-sdk-components/src/lib/_bridge/helpers/sdk_component_map';
1717
import localSdkComponentMap from 'packages/angular-sdk-components/src/sdk-local-component-map';
18-
import { ThemeService } from 'packages/angular-sdk-components/src/lib/_services/theme.service';
1918
import { initializeAuthentication } from './utils';
2019

2120
declare global {
@@ -44,8 +43,7 @@ export class EmbeddedComponent implements OnInit, OnDestroy {
4443

4544
constructor(
4645
private psservice: ProgressSpinnerService,
47-
private ngZone: NgZone,
48-
private themeService: ThemeService
46+
private ngZone: NgZone
4947
) {}
5048

5149
ngOnInit() {
@@ -66,8 +64,8 @@ export class EmbeddedComponent implements OnInit, OnDestroy {
6664
document.addEventListener('SdkConstellationReady', () => this.handleSdkConstellationReady());
6765

6866
const { authConfig, theme } = await getSdkConfig();
69-
this.themeService.setTheme(theme);
70-
67+
document.body.classList.remove(...['light', 'dark']);
68+
document.body.classList.add(theme);
7169
initializeAuthentication(authConfig);
7270

7371
// Login if needed, without doing an initial main window redirect

projects/angular-test-app/src/app/_samples/full-portal/full-portal.component.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,11 @@ export class FullPortalComponent implements OnInit, OnDestroy {
4747
private scservice: ServerConfigService
4848
) {}
4949

50-
ngOnInit() {
51-
this.scservice.readSdkConfig().then(() => {
52-
this.initialize();
53-
});
50+
async ngOnInit() {
51+
const { theme } = await this.scservice.readSdkConfig();
52+
document.body.classList.remove(...['light', 'dark']);
53+
document.body.classList.add(theme);
54+
this.initialize();
5455
}
5556

5657
ngOnDestroy() {

projects/angular-test-app/src/themes.scss

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -257,16 +257,6 @@
257257
--mat-sys-pressed-state-layer-opacity: 0.12;
258258
}
259259

260-
.azure {
261-
@include mat.theme(
262-
(
263-
color: mat.$azure-palette,
264-
typography: Roboto,
265-
density: 0
266-
)
267-
);
268-
}
269-
270260
.light {
271261
@include mat.theme(
272262
(
@@ -277,26 +267,6 @@
277267
);
278268
}
279269

280-
.green {
281-
@include mat.theme(
282-
(
283-
color: mat.$green-palette,
284-
typography: Roboto,
285-
density: 0
286-
)
287-
);
288-
}
289-
290-
.red {
291-
@include mat.theme(
292-
(
293-
color: mat.$red-palette,
294-
typography: Roboto,
295-
density: 0
296-
)
297-
);
298-
}
299-
300270
//Mixins
301271
@mixin generate-theme-vars() {
302272
--app-alert-error-color: rgb(82, 21, 8);

sdk-config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"comment_sdk_config": "This is the configuration file for the Angular-SDK",
33
"sdk_optional_configs_doc_comment": "See the document(link below) for more details on all the available config settings",
44
"sdk_optional_configs_doc": "https://docs.pega.com/bundle/constellation-sdk/page/constellation-sdks/sdks/configuring-sdk-config-json.html",
5-
"theme": "light",
5+
"theme": "dark",
66
"authConfig": {
77
"authService": "pega",
88

0 commit comments

Comments
 (0)