Skip to content

Commit 6e93105

Browse files
Merge pull request #559 from microsoft/psl-23528-bug
fix: Disable 3 dots option from Default Teams(fix for bug 23528)
2 parents 006cb65 + 852a416 commit 6e93105

File tree

2 files changed

+53
-10
lines changed

2 files changed

+53
-10
lines changed

src/frontend/src/components/common/TeamSelector.tsx

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ import {
1818
Radio,
1919
RadioGroup,
2020
Tab,
21-
TabList
21+
TabList,
22+
Tooltip
2223
} from '@fluentui/react-components';
2324
import {
2425
ChevronUpDown16Regular,
@@ -61,7 +62,14 @@ const TeamSelector: React.FC<TeamSelectorProps> = ({
6162
const [selectionLoading, setSelectionLoading] = useState(false);
6263
const [uploadedTeam, setUploadedTeam] = useState<TeamConfig | null>(null);
6364
const [uploadSuccessMessage, setUploadSuccessMessage] = useState<string | null>(null);
64-
65+
// Helper function to check if a team is a default team
66+
const isDefaultTeam = (team: TeamConfig): boolean => {
67+
const defaultTeamIds = ['team-1', 'team-2', 'team-3'];
68+
const defaultTeamNames = ['Human Resources Team', 'Product Marketing Team', 'Retail Customer Success Team'];
69+
70+
return defaultTeamIds.includes(team.team_id) ||
71+
defaultTeamNames.includes(team.name);
72+
};
6573
const loadTeams = async () => {
6674
setLoading(true);
6775
setError(null);
@@ -399,7 +407,7 @@ const TeamSelector: React.FC<TeamSelectorProps> = ({
399407

400408
const renderTeamCard = (team: TeamConfig, index?: number) => {
401409
const isSelected = tempSelectedTeam?.team_id === team.team_id;
402-
410+
const isDefault = isDefaultTeam(team);
403411
return (
404412
<div
405413
key={team.team_id || `team-${index}`}
@@ -452,13 +460,32 @@ const TeamSelector: React.FC<TeamSelectorProps> = ({
452460
</div>
453461

454462
{/* Three-dot Menu Button */}
455-
<Button
456-
icon={<MoreHorizontal20Regular />}
457-
appearance="subtle"
458-
size="small"
459-
onClick={(e) => handleDeleteTeam(team, e)}
460-
className={styles.moreButton}
461-
/>
463+
{isDefault ? (
464+
<Tooltip
465+
content="Default teams cannot be deleted."
466+
relationship="label"
467+
positioning="above-start"
468+
withArrow
469+
mountNode={document.querySelector('[role="dialog"]') || undefined}
470+
>
471+
<Button
472+
icon={<MoreHorizontal20Regular />}
473+
appearance="subtle"
474+
size="small"
475+
disabled={true}
476+
className={`${styles.moreButton} ${styles.moreButtonDisabled || ''}`}
477+
onClick={(e) => e.stopPropagation()}
478+
/>
479+
</Tooltip>
480+
) : (
481+
<Button
482+
icon={<MoreHorizontal20Regular />}
483+
appearance="subtle"
484+
size="small"
485+
onClick={(e) => handleDeleteTeam(team, e)}
486+
className={styles.moreButton}
487+
/>
488+
)}
462489
</div>
463490
);
464491
};

src/frontend/src/styles/TeamSelector.module.css

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,23 @@
407407
background-color: var(--colorNeutralBackground3) !important;
408408
color: var(--colorNeutralForeground1) !important;
409409
}
410+
.moreButtonDisabled {
411+
color: var(--colorNeutralForeground4) !important;
412+
background-color: transparent !important;
413+
cursor: not-allowed !important;
414+
opacity: 0.6 !important;
415+
}
416+
417+
.moreButtonDisabled:hover {
418+
background-color: transparent !important;
419+
color: var(--colorNeutralForeground4) !important;
420+
opacity: 0.6 !important;
421+
}
410422

423+
/* Ensure tooltips appear above other dialog content */
424+
:global(.fui-Tooltip) {
425+
z-index: 9999 !important;
426+
}
411427
/* Team Selector Button */
412428
.teamSelectorButton {
413429
width: 100%;

0 commit comments

Comments
 (0)