From 87d495013284f170ca0d6de36bb0178970a20d38 Mon Sep 17 00:00:00 2001 From: trtshen Date: Thu, 29 Jan 2026 17:09:44 +0800 Subject: [PATCH] [CORE-8130] featuretoggle: projecthub --- projects/v3/src/app/pages/home/home.page.html | 2 +- projects/v3/src/app/pages/home/home.page.spec.ts | 13 +++++++++++++ projects/v3/src/app/pages/home/home.page.ts | 2 ++ projects/v3/src/app/services/auth.service.ts | 2 ++ projects/v3/src/app/services/demo.service.ts | 1 + projects/v3/src/app/services/experience.service.ts | 2 ++ projects/v3/src/app/services/storage.service.ts | 4 ++-- projects/v3/src/environments/environment.custom.ts | 7 +++++++ 8 files changed, 30 insertions(+), 3 deletions(-) diff --git a/projects/v3/src/app/pages/home/home.page.html b/projects/v3/src/app/pages/home/home.page.html index b2b131a00..5f7ac178e 100644 --- a/projects/v3/src/app/pages/home/home.page.html +++ b/projects/v3/src/app/pages/home/home.page.html @@ -45,7 +45,7 @@

-
+
{ beforeEach(() => { sharedService.refreshJWT.and.returnValue(Promise.resolve()); storageService.get.and.returnValue({ name: 'Test Experience', cardUrl: 'test-url' }); + storageService.getFeature.and.returnValue(true); achievementService.getIsPointsConfigured.and.returnValue(true); achievementService.getEarnedPoints.and.returnValue(100); homeService.getPulseCheckStatuses.and.returnValue(of({ @@ -165,6 +166,18 @@ describe('HomePage', () => { expect(component.experience).toEqual({ name: 'Test Experience', cardUrl: 'test-url' }); }); + it('should set project hub visibility from feature toggle', async () => { + await component.updateDashboard(); + expect(storageService.getFeature).toHaveBeenCalledWith('showProjectHub'); + expect(component.showProjectHub).toBe(true); + }); + + it('should hide project hub when feature toggle is disabled', async () => { + storageService.getFeature.and.returnValue(false); + await component.updateDashboard(); + expect(component.showProjectHub).toBe(false); + }); + it('should call service methods to fetch data', async () => { await component.updateDashboard(); expect(homeService.getMilestones).toHaveBeenCalled(); diff --git a/projects/v3/src/app/pages/home/home.page.ts b/projects/v3/src/app/pages/home/home.page.ts index 48d8f3498..3eec51301 100644 --- a/projects/v3/src/app/pages/home/home.page.ts +++ b/projects/v3/src/app/pages/home/home.page.ts @@ -61,6 +61,7 @@ export class HomePage implements OnInit, OnDestroy, AfterViewChecked { // project brief data from team storage projectBrief: ProjectBrief | null = null; + showProjectHub = false; // Expose Math to template Math = Math; @@ -210,6 +211,7 @@ export class HomePage implements OnInit, OnDestroy, AfterViewChecked { async updateDashboard() { await this.sharedService.refreshJWT(); // refresh JWT token [CORE-6083] this.experience = this.storageService.get("experience"); + this.showProjectHub = this.storageService.getFeature('showProjectHub'); this.homeService.getMilestones({ forceRefresh: true }); this.achievementService.getAchievements(); this.homeService.getProjectProgress(); diff --git a/projects/v3/src/app/services/auth.service.ts b/projects/v3/src/app/services/auth.service.ts index ded993515..6ae7aca10 100644 --- a/projects/v3/src/app/services/auth.service.ts +++ b/projects/v3/src/app/services/auth.service.ts @@ -118,6 +118,7 @@ interface AuthEndpointExperience { }; featureToggle: { pulseCheckIndicator: boolean; + showProjectHub: boolean; }; } @@ -240,6 +241,7 @@ export class AuthService { } featureToggle { pulseCheckIndicator + showProjectHub } } email diff --git a/projects/v3/src/app/services/demo.service.ts b/projects/v3/src/app/services/demo.service.ts index 472e290d9..2b7dc4f76 100644 --- a/projects/v3/src/app/services/demo.service.ts +++ b/projects/v3/src/app/services/demo.service.ts @@ -1714,6 +1714,7 @@ export class DemoService { "progress": 0, "featureToggle": { "pulseCheckIndicator": true, + "showProjectHub": true, }, "projectId": 1, }; diff --git a/projects/v3/src/app/services/experience.service.ts b/projects/v3/src/app/services/experience.service.ts index a3d7dbeda..5b36e02d8 100644 --- a/projects/v3/src/app/services/experience.service.ts +++ b/projects/v3/src/app/services/experience.service.ts @@ -90,6 +90,7 @@ export interface Experience { truncateDescription: boolean; featureToggle: { pulseCheckIndicator: boolean; + showProjectHub: boolean; }; progress: number; config: { @@ -191,6 +192,7 @@ export class ExperienceService { truncateDescription featureToggle { pulseCheckIndicator + showProjectHub } } }` diff --git a/projects/v3/src/app/services/storage.service.ts b/projects/v3/src/app/services/storage.service.ts index 6d94f3f7a..241478801 100644 --- a/projects/v3/src/app/services/storage.service.ts +++ b/projects/v3/src/app/services/storage.service.ts @@ -154,10 +154,10 @@ export class BrowserStorageService { /** * Retrieves the status of a specified feature toggle. (controlled by the backend) * - * @param name - The name of the feature toggle to check. Currently supports 'pulseCheckIndicator'. + * @param name - The name of the feature toggle to check. Currently supports 'pulseCheckIndicator' and 'showProjectHub'. * @returns A boolean indicating whether the specified feature toggle is enabled. */ - getFeature(name: 'pulseCheckIndicator'): boolean { + getFeature(name: 'pulseCheckIndicator' | 'showProjectHub'): boolean { return this.get('experience')?.featureToggle?.[name] || false; } diff --git a/projects/v3/src/environments/environment.custom.ts b/projects/v3/src/environments/environment.custom.ts index f22f5157d..cb62cd1bb 100644 --- a/projects/v3/src/environments/environment.custom.ts +++ b/projects/v3/src/environments/environment.custom.ts @@ -60,4 +60,11 @@ export const environment = { goMobile: false, projecthub: '', helpline: '', + featureToggles: { + assessmentPagination: , + }, + snowAnimation: { + enabled: false, + snowflakeCount: 30, + }, };