Skip to content

Commit c948ee7

Browse files
gtryusGreg Trihus
andauthored
TT-6954 Implement product name display for /switch-teams route in OrgHead component (#158)
This update modifies the OrgHead component to display the product name instead of the organization name when the user is on the `/switch-teams` route. The change enhances the user experience by ensuring the correct context is presented based on the current route. Key Changes: - Added logic to conditionally render the product name based on the route - Updated tests to verify the new behavior on the `/switch-teams` route Co-authored-by: Greg Trihus <[email protected]>
1 parent cafb733 commit c948ee7

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/renderer/src/components/App/OrgHead.cy.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,4 +442,19 @@ describe('OrgHead', () => {
442442
.should('have.css', 'max-width')
443443
.and('match', /800px|50rem/);
444444
});
445+
446+
it('should display product name instead of organization name when on switch-teams route', () => {
447+
const orgId = 'test-org-id';
448+
const orgName = 'Test Organization';
449+
const orgData = createMockOrganization(orgId, orgName);
450+
451+
// Mount on switch-teams route with organization data
452+
mountOrgHead(createInitialState(), ['/switch-teams'], orgId, orgData);
453+
454+
// Should display product name (from API_CONFIG), not the organization name
455+
// The product name defaults to "Audio Project Manager" or "Audio Project Manager Desktop"
456+
cy.contains('Audio Project Manager').should('be.visible');
457+
// Should NOT display the organization name
458+
cy.contains(orgName).should('not.exist');
459+
});
445460
});

src/renderer/src/components/App/OrgHead.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export const OrgHead = () => {
3636
const commitTeamSettings = useCommitTeamSettings();
3737
const { pathname } = useLocation();
3838
const isTeamScreen = pathname.includes('/team');
39+
const isSwitchTeamsScreen = pathname.includes('/switch-teams');
3940
const ctx = useContext(TeamContext);
4041
const { teamDelete } = ctx?.state ?? {};
4142
const { setMyOrgRole } = useRole();
@@ -92,7 +93,9 @@ export const OrgHead = () => {
9293
display: 'flex',
9394
}}
9495
>
95-
{orgRec?.attributes.name || API_CONFIG.productName}
96+
{isSwitchTeamsScreen
97+
? API_CONFIG.productName
98+
: orgRec?.attributes.name || API_CONFIG.productName}
9699
</Typography>
97100
{isTeamScreen && (
98101
<>

0 commit comments

Comments
 (0)