Skip to content

feat: HolidayPolicyDetail functional component (data + wire-up)#1601

Open
krisxcrash wants to merge 5 commits intofeat/sdk-569-holiday-policy-detail-presentationfrom
feat/sdk-571-holiday-policy-detail-container
Open

feat: HolidayPolicyDetail functional component (data + wire-up)#1601
krisxcrash wants to merge 5 commits intofeat/sdk-569-holiday-policy-detail-presentationfrom
feat/sdk-571-holiday-policy-detail-container

Conversation

@krisxcrash
Copy link
Copy Markdown
Contributor

Summary

  • Adds HolidayPolicyDetail.tsx container that fetches holiday pay policy and employee data via useHolidayPayPoliciesGetSuspense and useEmployeesListSuspense, joins them to build the employee table, and wires up the remove-employee flow via useHolidayPayPoliciesRemoveEmployeesMutation.
  • ViewHolidaySchedule and ViewHolidayEmployees stubs now delegate to HolidayPolicyDetail with defaultTab="holidays" and defaultTab="employees" respectively, maintaining the same public interface.
  • Container manages local state for tab selection, employee search, remove dialog, and success alerts. Back navigation fires TIME_OFF_BACK_TO_LIST.
  • Endpoint inventory auto-updated to include PUT /v1/companies/:companyUuid/holiday_pay_policy/remove.
  • Unit tests cover: holidays tab rendering, employees tab rendering, employee search filtering, back navigation, remove employee flow (dialog + API call + cancel).

Depends on #1600 (SDK-569)
Resolves SDK-571

Test plan

  • npm run test -- --run src/components/UNSTABLE_TimeOff/HolidayPolicyDetail/HolidayPolicyDetail.test.tsx passes (7 tests)
  • tsc --noEmit passes with no type errors
  • Verify ViewHolidaySchedule renders HolidayPolicyDetail with holidays tab
  • Verify ViewHolidayEmployees renders HolidayPolicyDetail with employees tab
  • Verify back button fires TIME_OFF_BACK_TO_LIST event
  • Verify employee search filters the employee list
  • Verify remove employee opens dialog, calls API on confirm, shows success alert
  • Verify cancel on remove dialog closes it without API call

…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.
Copy link
Copy Markdown
Member

@serikjensen serikjensen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 })
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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}>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants