Skip to content

feat: HolidayPolicyDetail presentational component (stateless UI)#1600

Merged
krisxcrash merged 7 commits intomainfrom
feat/sdk-569-holiday-policy-detail-presentation
Apr 30, 2026
Merged

feat: HolidayPolicyDetail presentational component (stateless UI)#1600
krisxcrash merged 7 commits intomainfrom
feat/sdk-569-holiday-policy-detail-presentation

Conversation

@krisxcrash
Copy link
Copy Markdown
Contributor

@krisxcrash krisxcrash commented Apr 23, 2026

Summary

  • Introduces a reusable PolicyDetailLayout in shared/PolicyDetailLayout/ that composes DetailViewLayout, a built-in employees tab (EmployeeTable + HamburgerMenu), a destructive remove-employee Dialog, and a dismissible success Alert. Accepts a firstTab render prop for domain-specific content.
  • Adds HolidayPolicyDetailPresentation in HolidayPolicyDetail/ which composes PolicyDetailLayout with a read-only Holidays tab showing federal holidays via DataView (Holiday, Observed date, Next observation columns).
  • Adds new i18n namespace Company.TimeOff.PolicyDetail for shared policy detail strings and extends Company.TimeOff.HolidayPolicy with holiday detail-specific keys.
  • Includes Storybook stories for both PolicyDetailLayout (generic shell) and HolidayPolicyDetailPresentation (holidays tab, employees tab, success alert, remove dialog, empty employees).
  • PolicyDetailLayout is designed for reuse by future PTO/Sick policy detail views (same tab structure, different first tab content).

Resolves SDK-569

Test plan

  • Verify PolicyDetailLayout stories render in Storybook (TimeOff/PolicyDetailLayout)
  • Verify HolidayPolicyDetail stories render in Storybook (TimeOff/HolidayPolicyDetail)
  • Confirm Holidays tab shows the 11 federal holidays with correct column data
  • Confirm Employees tab shows employee list with search and hamburger menu
  • Confirm remove dialog opens/closes correctly in the RemoveDialogOpen story
  • Confirm success alert displays and is dismissible in the WithSuccessAlert story
  • Verify empty employees state renders correctly
  • Confirm tsc --noEmit passes with no type errors

Comment on lines +9 to +20
function countGridChildren(children: ReactNode): number {
let count = 0
Children.forEach(children, child => {
if (isValidElement(child) && child.type === Fragment) {
const fragmentProps = child.props as { children?: ReactNode }
count += countGridChildren(fragmentProps.children)
} else if (child != null && typeof child !== 'boolean') {
count++
}
})
return count
}
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.

is there a reason we needed to do this for actions layout? it impacts a lot of surface area so we might be better served working around this one rather than making a change here. lmk what the use case is and we may have a workaround

Comment on lines +10 to +15
function unwrapFragment(node: ReactNode): ReactNode {
if (isValidElement(node) && node.type === Fragment) {
return (node.props as { children?: ReactNode }).children
}
return node
}
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.

do we still need this?

…icyDetailLayout

Introduce a reusable PolicyDetailLayout shell (DetailViewLayout + employees tab +
remove dialog + success alert) and a HolidayPolicyDetailPresentation that composes it
with a read-only holidays DataView tab. Includes Storybook stories and i18n keys.

The PolicyDetailLayout is designed for reuse by future PTO/Sick detail views.

SDK-569
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.
@krisxcrash krisxcrash force-pushed the feat/sdk-569-holiday-policy-detail-presentation branch from 79a8ca5 to d8f1e93 Compare April 30, 2026 22:18
@krisxcrash krisxcrash merged commit 30dffa3 into main Apr 30, 2026
19 checks passed
@krisxcrash krisxcrash deleted the feat/sdk-569-holiday-policy-detail-presentation branch April 30, 2026 23:14
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