Skip to content

Commit d5fa4a0

Browse files
authored
Merge pull request #1643 from topcoder-platform/PM-4710
PM-4710: restore gating workflow guidance
2 parents 61bfd5f + 36b1090 commit d5fa4a0

File tree

3 files changed

+76
-9
lines changed

3 files changed

+76
-9
lines changed

src/apps/work/src/pages/challenges/ChallengeEditorPage/components/ReviewersField/AiReviewTab.module.scss

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,15 +200,31 @@
200200
min-height: 42px;
201201
}
202202

203+
.checkboxRow {
204+
align-items: center;
205+
display: flex;
206+
gap: 8px;
207+
min-height: 42px;
208+
}
209+
203210
.checkboxField input {
204211
accent-color: #137d60;
205212
}
206213

214+
.checkboxRow span,
207215
.checkboxField span {
208216
color: #3a3f45;
209217
font-size: 14px;
210218
}
211219

220+
.checkboxDescription {
221+
color: #70757a;
222+
display: block;
223+
font-size: 12px;
224+
line-height: 1.5;
225+
margin-top: -2px;
226+
}
227+
212228
.workflowEditors {
213229
display: flex;
214230
flex-direction: column;

src/apps/work/src/pages/challenges/ChallengeEditorPage/components/ReviewersField/AiReviewTab.spec.tsx

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,4 +219,45 @@ describe('AiReviewTab review mode options', () => {
219219
expect(screen.queryByRole('heading', { name: 'Workflow1' }))
220220
.toBeNull()
221221
})
222+
223+
it('shows gating workflow helper text for checked and unchecked workflows', async () => {
224+
mockedFetchAiReviewConfigByChallenge.mockResolvedValueOnce({
225+
...baseConfiguration,
226+
workflows: [
227+
{
228+
id: 'draft-1',
229+
isGating: true,
230+
weightPercent: 20,
231+
workflowId: 'workflow-1',
232+
},
233+
{
234+
id: 'draft-2',
235+
isGating: false,
236+
weightPercent: 80,
237+
workflowId: 'workflow-2',
238+
},
239+
],
240+
})
241+
mockedFetchWorkflows.mockResolvedValueOnce([
242+
{
243+
id: 'workflow-1',
244+
name: 'Workflow 1',
245+
},
246+
{
247+
id: 'workflow-2',
248+
name: 'Workflow 2',
249+
},
250+
])
251+
252+
render(
253+
<AiReviewTab
254+
challengeId='challenge-1'
255+
reviewers={persistedAiReviewers}
256+
/>,
257+
)
258+
259+
expect(await screen.findAllByText(/Submissions below threshold are locked\./))
260+
.toHaveLength(2)
261+
expect(screen.getByText(/Pass\/fail gate\./)).not.toBeNull()
262+
})
222263
})

src/apps/work/src/pages/challenges/ChallengeEditorPage/components/ReviewersField/AiReviewTab.tsx

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ const ManualWorkflowEditor: FC<ManualWorkflowEditorProps> = (
247247
props: ManualWorkflowEditorProps,
248248
) => {
249249
const workflowId = normalizeReviewerText(props.workflow.workflowId)
250+
const gatingDescriptionId = `${props.workflowKey}-gating-description`
250251
const isAssigned = props.assignedWorkflowIds.has(workflowId)
251252
const handleWorkflowChange = useCallback(
252253
(event: ChangeEvent<HTMLSelectElement>): void => {
@@ -319,15 +320,24 @@ const ManualWorkflowEditor: FC<ManualWorkflowEditorProps> = (
319320
/>
320321
</label>
321322

322-
<label className={styles.checkboxField}>
323-
<input
324-
checked={props.workflow.isGating === true}
325-
disabled={props.readOnly}
326-
onChange={handleGatingChange}
327-
type='checkbox'
328-
/>
329-
<span>Use as gating workflow</span>
330-
</label>
323+
<div className={styles.checkboxField}>
324+
<label className={styles.checkboxRow}>
325+
<input
326+
aria-describedby={gatingDescriptionId}
327+
checked={props.workflow.isGating === true}
328+
disabled={props.readOnly}
329+
onChange={handleGatingChange}
330+
type='checkbox'
331+
/>
332+
<span>Use as gating workflow</span>
333+
</label>
334+
<span className={styles.checkboxDescription} id={gatingDescriptionId}>
335+
{props.workflow.isGating
336+
? 'Pass/fail gate. '
337+
: undefined}
338+
Submissions below threshold are locked.
339+
</span>
340+
</div>
331341
</div>
332342

333343
{workflowId

0 commit comments

Comments
 (0)