feat(3/5): add SelectEmployees container for time-off/sick policies (SDK-565)#1614
Merged
jeffredodd merged 6 commits intomainfrom Apr 30, 2026
Merged
feat(3/5): add SelectEmployees container for time-off/sick policies (SDK-565)#1614jeffredodd merged 6 commits intomainfrom
jeffredodd merged 6 commits intomainfrom
Conversation
fcbf391 to
63e1327
Compare
05586fe to
0b75d6d
Compare
63e1327 to
1cc43ea
Compare
0b75d6d to
1bd2878
Compare
1cc43ea to
533317d
Compare
1bd2878 to
16ed8ed
Compare
73686e3 to
c6b5911
Compare
24dcbf6 to
0826592
Compare
serikjensen
approved these changes
Apr 29, 2026
c6b5911 to
4afa962
Compare
Shared stateless UI consumed by both the time-off and holiday container components. Renders the employee table with search, multi-select, optional starting-balance column, reassignment warning, and Back/Continue actions. Storybook stories cover: default, partial/full selection, search filtered, empty results, with/without reassignment warning, pagination. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Fetches active employees, manages selection/search/pagination state, and calls useTimeOffPoliciesAddEmployeesMutation on Continue in standalone mode. In wizard mode, emits TIME_OFF_ADD_EMPLOYEES_DONE with selected UUIDs instead of calling the API. Supports optional per-employee starting balance (sent only when provided). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new time-off “Select Employees” container that fetches active employees, manages selection/search/pagination state, and either calls the “add employees” time-off policy mutation (standalone) or emits a completion event (wizard). Also updates endpoint inventory/reference docs to include the new add_employees endpoint.
Changes:
- Introduces
SelectEmployeesTimeOffcontainer integrating employees list + selection/search/pagination and the add-employees mutation. - Adds unit tests covering rendering, search filtering, Back/Continue actions, and wizard vs standalone behavior.
- Updates endpoint inventory/reference docs to include
PUT /v1/time_off_policies/:timeOffPolicyUuid/add_employeesfor relevant TimeOff components.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| src/components/UNSTABLE_TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesTimeOff.tsx | New container wiring employees list + selection/search/pagination + mutation/event behavior |
| src/components/UNSTABLE_TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesTimeOff.test.tsx | Tests for the new container’s modes and basic UI behavior |
| docs/reference/endpoint-reference.md | Adds the add_employees endpoint to the UNSTABLE_TimeOff component endpoint table |
| docs/reference/endpoint-inventory.json | Adds add_employees endpoint entries and introduces PolicySettings inventory entry |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+2
to
+5
| import { useEmployeesListSuspense } from '@gusto/embedded-api/react-query/employeesList' | ||
| import { useTimeOffPoliciesAddEmployeesMutation } from '@gusto/embedded-api/react-query/timeOffPoliciesAddEmployees' | ||
| import { SelectEmployeesPresentation } from './SelectEmployeesPresentation' | ||
| import type { EmployeeItem } from './SelectEmployeesPresentationTypes' |
Comment on lines
+27
to
+31
| const { data: employeesData, isFetching } = useEmployeesListSuspense({ | ||
| companyId, | ||
| terminated: false, | ||
| page: currentPage, | ||
| per: itemsPerPage, |
Comment on lines
+79
to
+83
| const handleContinue = async () => { | ||
| if (mode === 'wizard') { | ||
| onEvent(componentEvents.TIME_OFF_ADD_EMPLOYEES_DONE, { | ||
| employeeUuids: [...selectedUuids], | ||
| }) |
Comment on lines
+92
to
+95
| employees: [...selectedUuids].map(uuid => ({ | ||
| uuid, | ||
| ...(balances[uuid] !== undefined && { balance: balances[uuid] }), | ||
| })), |
Comment on lines
+152
to
+156
| await waitFor(() => { | ||
| expect(mockAddEmployees).toHaveBeenCalledWith({ | ||
| request: { | ||
| timeOffPolicyUuid: 'policy-456', | ||
| requestBody: { |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Remove useMemo around getPaginationProps (direct call, matches PayrollList pattern) - Forward response.timeOffPolicy in TIME_OFF_ADD_EMPLOYEES_DONE payload - Remove useCallback from handleContinue (memoization was a no-op; fixes stale balances closure) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
4afa962 to
c0c078a
Compare
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.
Summary
SelectEmployeesTimeOffcontainer component for adding employees to time-off/sick policiesuseEmployeesListSuspense, manages selection/search/pagination stateuseTimeOffPoliciesAddEmployeesMutationwith selected UUIDs and optional per-employee starting balancesTIME_OFF_ADD_EMPLOYEES_DONEwith selected UUIDs (no API call)Depends on: #1613
Test plan
npm run test -- --run src/components/UNSTABLE_TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesTimeOff🤖 Generated with Claude Code