Skip to content

Commit 7e76235

Browse files
authored
feat: Disable Suggest Groups button if the free team has exceeded the limit (#11133)
1 parent 85086d0 commit 7e76235

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

packages/client/components/RetroGroupPhase.tsx

+17-3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import useTooltip from '../hooks/useTooltip'
1515
import AutogroupMutation from '../mutations/AutogroupMutation'
1616
import ResetReflectionGroupsMutation from '../mutations/ResetReflectionGroupsMutation'
1717
import {Elevation} from '../styles/elevation'
18+
import {Threshold} from '../types/constEnums'
1819
import {phaseLabelLookup} from '../utils/meetings/lookups'
1920
import GroupingKanban from './GroupingKanban'
2021
import MeetingContent from './MeetingContent'
@@ -69,6 +70,9 @@ const RetroGroupPhase = (props: Props) => {
6970
tier
7071
useAI
7172
}
73+
team {
74+
qualAIMeetingsCount
75+
}
7276
}
7377
`,
7478
meetingRef
@@ -83,9 +87,12 @@ const RetroGroupPhase = (props: Props) => {
8387
organization,
8488
autogroupReflectionGroups,
8589
resetReflectionGroups,
86-
localStage
90+
localStage,
91+
team
8792
} = meeting
8893
const {useAI, tier} = organization
94+
const {qualAIMeetingsCount} = team
95+
const teamOverLimit = qualAIMeetingsCount >= Threshold.MAX_QUAL_AI_MEETINGS && tier === 'starter'
8996
const isGroupPhaseActive = localStage?.phaseType === 'group' && !localStage?.isComplete
9097
const {openTooltip, closeTooltip, tooltipPortal, originRef} = useTooltip<HTMLDivElement>(
9198
MenuPosition.UPPER_CENTER
@@ -97,7 +104,12 @@ const RetroGroupPhase = (props: Props) => {
97104
: ''
98105
}`
99106
const tooltipResetText = `Reset your groups to the way they were before you clicked Suggest Groups`
100-
const tooltipText = showSuggestGroups ? tooltipSuggestGroupsText : tooltipResetText
107+
const teamOverLimitText = `You have reached the limit. Please upgrade to a paid plan to continue using this feature.`
108+
const tooltipText = showSuggestGroups
109+
? teamOverLimit
110+
? teamOverLimitText
111+
: tooltipSuggestGroupsText
112+
: tooltipResetText
101113

102114
const handleAutoGroupClick = () => {
103115
AutogroupMutation(atmosphere, {meetingId}, {onError, onCompleted})
@@ -125,7 +137,9 @@ const RetroGroupPhase = (props: Props) => {
125137
(showSuggestGroups ? (
126138
<ButtonWrapper>
127139
<StyledButton
128-
disabled={!autogroupReflectionGroups?.length || !isGroupPhaseActive}
140+
disabled={
141+
!autogroupReflectionGroups?.length || !isGroupPhaseActive || teamOverLimit
142+
}
129143
onClick={handleAutoGroupClick}
130144
>
131145
{'Suggest Groups ✨'}

0 commit comments

Comments
 (0)