Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion projects/v3/src/app/pages/home/home.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<h2 class="headline-2"
[innerHTML]="experience.name"></h2>

<div class="button-group-no-gap" *ngIf="projectBrief">
<div class="button-group-no-gap" *ngIf="projectBrief && showProjectHub">
<ion-button fill="clear"
size="small"
class="project-brief-btn"
Expand Down
13 changes: 13 additions & 0 deletions projects/v3/src/app/pages/home/home.page.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ describe('HomePage', () => {
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({
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 2 additions & 0 deletions projects/v3/src/app/pages/home/home.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,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;
Expand Down Expand Up @@ -205,6 +206,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();
Expand Down
2 changes: 2 additions & 0 deletions projects/v3/src/app/services/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ interface AuthEndpointExperience {
};
featureToggle: {
pulseCheckIndicator: boolean;
showProjectHub: boolean;
};
}

Expand Down Expand Up @@ -240,6 +241,7 @@ export class AuthService {
}
featureToggle {
pulseCheckIndicator
showProjectHub
}
}
email
Expand Down
1 change: 1 addition & 0 deletions projects/v3/src/app/services/demo.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1714,6 +1714,7 @@ export class DemoService {
"progress": 0,
"featureToggle": {
"pulseCheckIndicator": true,
"showProjectHub": true,
},
"projectId": 1,
};
Expand Down
2 changes: 2 additions & 0 deletions projects/v3/src/app/services/experience.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export interface Experience {
truncateDescription: boolean;
featureToggle: {
pulseCheckIndicator: boolean;
showProjectHub: boolean;
};
progress: number;
config: {
Expand Down Expand Up @@ -191,6 +192,7 @@ export class ExperienceService {
truncateDescription
featureToggle {
pulseCheckIndicator
showProjectHub
}
}
}`
Expand Down
4 changes: 2 additions & 2 deletions projects/v3/src/app/services/storage.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion projects/v3/src/environments/environment.custom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const environment = {
assessmentPagination: <CUSTOM_ENABLE_ASSESSMENT_PAGINATION>,
},
snowAnimation: {
enabled: true,
enabled: false,
snowflakeCount: 30,
},
};