diff --git a/marketplace-ui/src/app/modules/release-preview/release-preview.component.html b/marketplace-ui/src/app/modules/release-preview/release-preview.component.html
index 8865d982..8bdc8b58 100644
--- a/marketplace-ui/src/app/modules/release-preview/release-preview.component.html
+++ b/marketplace-ui/src/app/modules/release-preview/release-preview.component.html
@@ -72,7 +72,7 @@
[selectedItem]="getSelectedTabLabel() | translate"
buttonClass="form-select flex-grow-1 text-start content-tab-dropdown"
(itemSelected)="
- onTabChange($event.value)
+ setActiveTab($event.value)
">
diff --git a/marketplace-ui/src/app/modules/release-preview/release-preview.component.ts b/marketplace-ui/src/app/modules/release-preview/release-preview.component.ts
index 85598017..52af3ab7 100644
--- a/marketplace-ui/src/app/modules/release-preview/release-preview.component.ts
+++ b/marketplace-ui/src/app/modules/release-preview/release-preview.component.ts
@@ -74,12 +74,8 @@ export class ReleasePreviewComponent {
this.handlePreviewPage();
}
- setActiveTab(tab: string): void {
- this.activeTab = tab;
- }
-
- onTabChange(event: string) {
- this.setActiveTab(event);
+ setActiveTab(event: string): void {
+ this.activeTab = event;
}
handlePreviewPage(): void {
@@ -108,32 +104,18 @@ export class ReleasePreviewComponent {
getContent(value: string): boolean {
const content = this.readmeContent();
- if (!content || Object.keys(content).length === 0) {
- return false;
- }
-
- const conditions: { [key: string]: boolean } = {
- description:
- content.description !== null &&
- CommonUtils.isContentDisplayedBasedOnLanguage(
- content.description,
- this.languageService.selectedLanguage()
- ),
- demo:
- content.demo !== null &&
- CommonUtils.isContentDisplayedBasedOnLanguage(
- content.demo,
- this.languageService.selectedLanguage()
- ),
- setup:
- content.setup !== null &&
+ if (content && content[value as keyof ReleasePreviewData]) {
+ const tabContent = content[value as keyof ReleasePreviewData];
+ return (
+ tabContent != null &&
+ Object.keys(tabContent).length > 0 &&
CommonUtils.isContentDisplayedBasedOnLanguage(
- content.setup,
+ tabContent,
this.languageService.selectedLanguage()
)
- };
-
- return conditions[value] ?? false;
+ );
+ }
+ return false;
}
getSelectedTabLabel() {