From c67bab6e8c00538146bf7cd73705b39d7baa038c Mon Sep 17 00:00:00 2001 From: Christian Badura Date: Mon, 28 Oct 2024 10:30:37 +0100 Subject: [PATCH 1/3] fix: add bg color variable in theme designer, fix minor typos and such --- src/app/theme/theme-designer/theme-designer.component.html | 3 --- src/app/theme/theme-designer/theme-designer.component.ts | 3 +++ src/app/theme/theme-designer/theme-variables.ts | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/app/theme/theme-designer/theme-designer.component.html b/src/app/theme/theme-designer/theme-designer.component.html index 32b8b77..f39adc0 100644 --- a/src/app/theme/theme-designer/theme-designer.component.html +++ b/src/app/theme/theme-designer/theme-designer.component.html @@ -266,9 +266,6 @@ id="th_designer_item_color_{{ item }}" [formControlName]="item" [value]="group.formGroup.value[item]" - [pTooltip]="'THEME.TOOLTIPS.ITEM_COLOR' | translate" - tooltipPosition="top" - tooltipEvent="hover" /> diff --git a/src/app/theme/theme-designer/theme-designer.component.ts b/src/app/theme/theme-designer/theme-designer.component.ts index 4f777aa..dd8d074 100644 --- a/src/app/theme/theme-designer/theme-designer.component.ts +++ b/src/app/theme/theme-designer/theme-designer.component.ts @@ -148,6 +148,9 @@ export class ThemeDesignerComponent implements OnInit { this.themeApi.getThemeByName({ name: this.themeName }) ]).subscribe(([currentTheme, data]) => { this.theme = data.resource + if (!(this.theme.properties as any).sidebar['menu-item-bg-color']) { + ;(this.theme.properties as any).sidebar['menu-item-bg-color'] = '#ffffff' + } this.basicForm.patchValue(this.theme) this.basicForm.controls['name'].disable() this.propertiesForm.reset() diff --git a/src/app/theme/theme-designer/theme-variables.ts b/src/app/theme/theme-designer/theme-variables.ts index acd0502..72e2029 100644 --- a/src/app/theme/theme-designer/theme-variables.ts +++ b/src/app/theme/theme-designer/theme-variables.ts @@ -24,7 +24,7 @@ export const themeVariables: ThemeVariablesType = { 'text-secondary-color', 'body-bg-color', 'content-bg-color', - 'content-alt-bg-colorr', + 'content-alt-bg-color', 'overlay-content-bg-color', 'hover-bg-color', 'solid-surface-text-color', @@ -42,9 +42,10 @@ export const themeVariables: ThemeVariablesType = { 'menu-text-color', 'menu-bg-color', 'menu-item-text-color', + 'menu-item-bg-color', 'menu-item-hover-bg-color', 'menu-active-item-text-color', 'menu-active-item-bg-color', - 'inline-menu-border-color' + 'menu-inline-border-color' ] } From 0aacf4b64679420d0f0f8347712eb7d89fa48ca3 Mon Sep 17 00:00:00 2001 From: Christian Badura Date: Mon, 28 Oct 2024 11:59:58 +0100 Subject: [PATCH 2/3] fix: designer tests --- .../theme-designer.component.spec.ts | 32 +++++++++++++++++++ .../theme-designer.component.ts | 3 -- .../theme/theme-designer/theme-variables.ts | 2 +- 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/src/app/theme/theme-designer/theme-designer.component.spec.ts b/src/app/theme/theme-designer/theme-designer.component.spec.ts index 8371627..5bf6e68 100644 --- a/src/app/theme/theme-designer/theme-designer.component.spec.ts +++ b/src/app/theme/theme-designer/theme-designer.component.spec.ts @@ -1190,4 +1190,36 @@ describe('ThemeDesignerComponent', () => { expect(component.getImageUrl(theme, RefType.Logo)).toBe(theme.logoUrl) expect(component.getImageUrl(theme, RefType.Favicon)).toBe(theme.faviconUrl) }) + + it('should get display name', () => { + const themeData = { + id: 'id', + description: 'desc', + logoUrl: 'logo_url', + faviconUrl: 'fav_url', + name: 'themeName', + properties: { + font: { + 'font-family': 'myFont' + }, + general: { + 'primary-color': 'rgb(0,0,0)' + } + } + } + const themeResponse = { + resource: themeData + } + themeApiSpy.getThemeByName.and.returnValue(of(themeResponse) as any) + component.mode = 'EDIT' + component.themeName = 'themeName' + + component.ngOnInit() + + expect(component.theme).toBe(themeData) + expect(themeApiSpy.getThemeByName).toHaveBeenCalledOnceWith({ name: 'themeName' }) + const res = component.getDisplayName() + + expect(res).toBe('themeName') + }) }) diff --git a/src/app/theme/theme-designer/theme-designer.component.ts b/src/app/theme/theme-designer/theme-designer.component.ts index dd8d074..4f777aa 100644 --- a/src/app/theme/theme-designer/theme-designer.component.ts +++ b/src/app/theme/theme-designer/theme-designer.component.ts @@ -148,9 +148,6 @@ export class ThemeDesignerComponent implements OnInit { this.themeApi.getThemeByName({ name: this.themeName }) ]).subscribe(([currentTheme, data]) => { this.theme = data.resource - if (!(this.theme.properties as any).sidebar['menu-item-bg-color']) { - ;(this.theme.properties as any).sidebar['menu-item-bg-color'] = '#ffffff' - } this.basicForm.patchValue(this.theme) this.basicForm.controls['name'].disable() this.propertiesForm.reset() diff --git a/src/app/theme/theme-designer/theme-variables.ts b/src/app/theme/theme-designer/theme-variables.ts index 72e2029..bb86092 100644 --- a/src/app/theme/theme-designer/theme-variables.ts +++ b/src/app/theme/theme-designer/theme-variables.ts @@ -46,6 +46,6 @@ export const themeVariables: ThemeVariablesType = { 'menu-item-hover-bg-color', 'menu-active-item-text-color', 'menu-active-item-bg-color', - 'menu-inline-border-color' + 'inline-menu-border-color' ] } From ccaff11c75bb9235c01396ca316dfee2480c44a2 Mon Sep 17 00:00:00 2001 From: Christian Badura Date: Mon, 28 Oct 2024 12:01:14 +0100 Subject: [PATCH 3/3] fix: rename var again --- src/app/theme/theme-designer/theme-variables.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/theme/theme-designer/theme-variables.ts b/src/app/theme/theme-designer/theme-variables.ts index bb86092..72e2029 100644 --- a/src/app/theme/theme-designer/theme-variables.ts +++ b/src/app/theme/theme-designer/theme-variables.ts @@ -46,6 +46,6 @@ export const themeVariables: ThemeVariablesType = { 'menu-item-hover-bg-color', 'menu-active-item-text-color', 'menu-active-item-bg-color', - 'inline-menu-border-color' + 'menu-inline-border-color' ] }