@@ -15,6 +15,7 @@ import useTooltip from '../hooks/useTooltip'
15
15
import AutogroupMutation from '../mutations/AutogroupMutation'
16
16
import ResetReflectionGroupsMutation from '../mutations/ResetReflectionGroupsMutation'
17
17
import { Elevation } from '../styles/elevation'
18
+ import { Threshold } from '../types/constEnums'
18
19
import { phaseLabelLookup } from '../utils/meetings/lookups'
19
20
import GroupingKanban from './GroupingKanban'
20
21
import MeetingContent from './MeetingContent'
@@ -69,6 +70,9 @@ const RetroGroupPhase = (props: Props) => {
69
70
tier
70
71
useAI
71
72
}
73
+ team {
74
+ qualAIMeetingsCount
75
+ }
72
76
}
73
77
` ,
74
78
meetingRef
@@ -83,9 +87,12 @@ const RetroGroupPhase = (props: Props) => {
83
87
organization,
84
88
autogroupReflectionGroups,
85
89
resetReflectionGroups,
86
- localStage
90
+ localStage,
91
+ team
87
92
} = meeting
88
93
const { useAI, tier} = organization
94
+ const { qualAIMeetingsCount} = team
95
+ const teamOverLimit = qualAIMeetingsCount >= Threshold . MAX_QUAL_AI_MEETINGS && tier === 'starter'
89
96
const isGroupPhaseActive = localStage ?. phaseType === 'group' && ! localStage ?. isComplete
90
97
const { openTooltip, closeTooltip, tooltipPortal, originRef} = useTooltip < HTMLDivElement > (
91
98
MenuPosition . UPPER_CENTER
@@ -97,7 +104,12 @@ const RetroGroupPhase = (props: Props) => {
97
104
: ''
98
105
} `
99
106
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
101
113
102
114
const handleAutoGroupClick = ( ) => {
103
115
AutogroupMutation ( atmosphere , { meetingId} , { onError, onCompleted} )
@@ -125,7 +137,9 @@ const RetroGroupPhase = (props: Props) => {
125
137
( showSuggestGroups ? (
126
138
< ButtonWrapper >
127
139
< StyledButton
128
- disabled = { ! autogroupReflectionGroups ?. length || ! isGroupPhaseActive }
140
+ disabled = {
141
+ ! autogroupReflectionGroups ?. length || ! isGroupPhaseActive || teamOverLimit
142
+ }
129
143
onClick = { handleAutoGroupClick }
130
144
>
131
145
{ 'Suggest Groups ✨' }
0 commit comments