feat: HolidayPolicyDetail functional component (data + wire-up)#1601
Conversation
…removal Wire up the functional HolidayPolicyDetail container that fetches the holiday pay policy and employee list, handles tab state, employee search, and the remove-employee flow via useHolidayPayPoliciesRemoveEmployeesMutation. ViewHolidaySchedule and ViewHolidayEmployees stubs now delegate to HolidayPolicyDetail with the appropriate default tab. Includes unit tests and endpoint inventory updates. SDK-571
… pattern
Wrap the HolidaysTab DataView in a Box with BoxHeader and the EmployeeTable
in a Box with withPadding={false}, matching the card layout pattern used in
the Employee Dashboard views.
ActionsLayout used Children.toArray to count grid columns, but React fragments are counted as a single child, producing repeat(1, max-content) instead of the intended multi-column layout. Add countGridChildren helper that flattens fragments before counting. Also convert story PolicyActions components to hooks so the fragment is passed directly as the actions prop rather than wrapped in an opaque component element.
serikjensen
left a comment
There was a problem hiding this comment.
Just a couple of things on this one! it looks like it is pulling in some hooks patterns from elsewhere in the codebase that we should avoid using here
|
|
||
| const removeEmployeesMutation = useHolidayPayPoliciesRemoveEmployeesMutation() | ||
|
|
||
| const errorHandling = composeErrorHandler([], { submitError, setSubmitError }) |
There was a problem hiding this comment.
oh noes, it's getting confused with some hook patterns from elsewhere in the codebase. I think we can remove this one since errorHandling isn't actually doing anything here. This util will become more relevant when we're doing hooks down the line
|
|
||
| export function HolidayPolicyDetail({ FallbackComponent, ...props }: HolidayPolicyDetailProps) { | ||
| return ( | ||
| <BaseBoundaries |
There was a problem hiding this comment.
Once again, it's getting confused with some hooks patterns. In your case you can just use the Base component here. BaseBoundaries separates some of the layout stuffs out because hooks are non suspense
| ) | ||
|
|
||
| return ( | ||
| <BaseLayout error={errorHandling.errors}> |
There was a problem hiding this comment.
This would then go away once you update Root to use the Base component since that uses BaseLayout under the hood
Replaces BaseBoundaries + useBaseSubmit + composeErrorHandler + BaseLayout with BaseComponent and useBase(), matching the pattern used elsewhere in the codebase (e.g. HolidaySelectionForm). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
HolidayPolicyDetail.tsxcontainer that fetches holiday pay policy and employee data viauseHolidayPayPoliciesGetSuspenseanduseEmployeesListSuspense, joins them to build the employee table, and wires up the remove-employee flow viauseHolidayPayPoliciesRemoveEmployeesMutation.ViewHolidayScheduleandViewHolidayEmployeesstubs now delegate toHolidayPolicyDetailwithdefaultTab="holidays"anddefaultTab="employees"respectively, maintaining the same public interface.TIME_OFF_BACK_TO_LIST.PUT /v1/companies/:companyUuid/holiday_pay_policy/remove.Depends on #1600 (SDK-569)
Resolves SDK-571
Test plan
npm run test -- --run src/components/UNSTABLE_TimeOff/HolidayPolicyDetail/HolidayPolicyDetail.test.tsxpasses (7 tests)tsc --noEmitpasses with no type errors