Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR implements a feature to create new trainee profiles via a dialog form, accessible from the Cohorts page. It also includes refactoring work to extract reusable dropdown selector components (GenderSelect, LearningStatusSelect, JobPathSelect) and consolidates error display components. The refactoring improves code reusability but introduces several critical bugs that must be fixed before merging.
Changes:
- Added create trainee functionality with form validation and API integration
- Refactored dropdown selectors into reusable components (GenderSelect, LearningStatusSelect, JobPathSelect)
- Renamed API types and functions for better clarity (SaveTraineeRequestData → UpdateTraineeRequestData, getTraineeInfo → getTrainee)
Reviewed changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| client/src/features/trainee-profile/create/AddTraineeDialog.tsx | Main dialog component for creating new trainees with form state management |
| client/src/features/trainee-profile/create/components/NewTraineeForm.tsx | Form component with input fields for trainee creation |
| client/src/features/trainee-profile/create/components/TextFieldWrapper.tsx | Wrapper component for text inputs with maxLength handling |
| client/src/features/trainee-profile/create/lib/formHelper.ts | Validation logic for trainee creation form |
| client/src/features/trainee-profile/create/data/mutations.ts | React Query mutation hook for creating trainees |
| client/src/features/trainee-profile/create/api/api.ts | API function for trainee creation |
| client/src/features/trainee-profile/create/api/types.ts | Type definition for create trainee request data |
| client/src/features/trainee-profile/profile/components/DropdownSelect.tsx | Reusable dropdown select component |
| client/src/features/trainee-profile/profile/components/GenderSelect.tsx | Gender-specific dropdown selector |
| client/src/features/trainee-profile/profile/components/LearningStatusSelect.tsx | Learning status dropdown selector |
| client/src/features/trainee-profile/profile/components/JobPathSelect.tsx | Job path dropdown selector |
| client/src/features/trainee-profile/personal-info/PersonalInfo.tsx | Updated to use GenderSelect component |
| client/src/features/trainee-profile/employment/EmploymentInfo.tsx | Updated to use JobPathSelect component |
| client/src/features/trainee-profile/education/EducationInfo.tsx | Updated to use LearningStatusSelect component |
| client/src/features/cohorts/components/ActionsCard.tsx | Card component with Add Trainee button |
| client/src/features/cohorts/CohortsPage.tsx | Integrated ActionsCard and improved error/loading states |
| client/src/features/trainee-profile/personal-info/api/api.ts | Renamed functions for clarity (getTraineeInfo → getTrainee, saveTraineeInfo → updateTrainee) |
| client/src/features/trainee-profile/personal-info/api/types.ts | Renamed SaveTraineeRequestData to UpdateTraineeRequestData |
| client/src/features/trainee-profile/personal-info/data/useTraineeInfoData.tsx | Updated to use renamed functions and types |
| client/src/features/trainee-profile/profile/components/TraineeProfile.tsx | Updated to use renamed types |
| client/src/features/trainee-profile/context/useTraineeProfileProvider.tsx | Updated to use renamed types |
| client/src/features/trainee-profile/context/useTraineeProfileContext.tsx | Updated to use renamed types |
| client/src/data/types/Trainee.ts | Added profilePath field to Trainee interface |
| client/src/components/StyledErrorBox.tsx | Reusable styled error box component |
| client/src/components/ButtonWithIcon.tsx | Reusable button component with icon support |
Comments suppressed due to low confidence (1)
client/src/features/trainee-profile/education/EducationInfo.tsx:94
- There's a duplicate Learning Status select. The new LearningStatusSelect component is added on line 75, but the old FormControl with the Learning Status select was not removed (lines 77-94). This will render two identical Learning Status dropdowns on the page. Remove the old FormControl block (lines 77-94).
<LearningStatusSelect isEditing={isEditing} value={editedFields.learningStatus} onChange={handleSelectChange} />
<FormControl variant={isEditing ? 'outlined' : 'standard'} sx={{ mx: 2, my: 1, width: '20ch', gap: '2rem' }}>
<InputLabel htmlFor="learningStatus">Learning status</InputLabel>
<Select
name="learningStatus"
id="learningStatus"
label="Learning status"
value={editedFields?.learningStatus || ''}
inputProps={{ readOnly: isEditing ? false : true }}
IconComponent={isEditing ? ArrowDropDownIcon : NoIcon}
startAdornment=" "
onChange={handleSelectChange}
>
<MenuItem value={LearningStatus.Studying}>Studying</MenuItem>
<MenuItem value={LearningStatus.Graduated}>Graduated</MenuItem>
<MenuItem value={LearningStatus.OnHold}>On hold</MenuItem>
<MenuItem value={LearningStatus.Quit}>Quit</MenuItem>
</Select>
</FormControl>
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
client/src/features/trainee-profile/profile/components/GenderSelect.tsx
Outdated
Show resolved
Hide resolved
client/src/features/trainee-profile/profile/components/DropdownSelect.tsx
Outdated
Show resolved
Hide resolved
client/src/features/trainee-profile/create/components/NewTraineeForm.tsx
Show resolved
Hide resolved
client/src/features/trainee-profile/create/AddTraineeDialog.tsx
Outdated
Show resolved
Hide resolved
client/src/features/trainee-profile/create/components/NewTraineeForm.tsx
Outdated
Show resolved
Hide resolved
client/src/features/trainee-profile/create/AddTraineeDialog.tsx
Outdated
Show resolved
Hide resolved
stasel
reviewed
Feb 11, 2026
client/src/features/trainee-profile/create/components/NewTraineeForm.tsx
Outdated
Show resolved
Hide resolved
client/src/features/trainee-profile/create/AddTraineeDialog.tsx
Outdated
Show resolved
Hide resolved
stasel
approved these changes
Feb 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added a button to add new trainees, and also refactored a little bit (for example, reusing selector components)