Skip to content

Commit

Permalink
refactor: enable action buttons when shift options are changed
Browse files Browse the repository at this point in the history
  • Loading branch information
hamed-musallam committed Sep 25, 2024
1 parent dda573a commit dc3bce8
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ interface ShiftOptionsPanelProps {
export default function ShiftOptionsPanel(props: ShiftOptionsPanelProps) {
const { filter } = props;
const dispatch = useDispatch();
const { handleSubmit, control } = useForm({ defaultValues: filter.value });
const {
handleSubmit,
control,
formState: { isDirty },
} = useForm({ defaultValues: filter.value });

function handleCancelFilter() {
dispatch({
Expand Down Expand Up @@ -68,6 +72,8 @@ export default function ShiftOptionsPanel(props: ShiftOptionsPanelProps) {
<FilterActionButtons
onConfirm={() => handleSubmit(handleApplyFilter)()}
onCancel={handleCancelFilter}
disabledConfirm={!isDirty}
disabledCancel={!isDirty}
/>
</HeaderContainer>
</StickyHeader>
Expand Down

0 comments on commit dc3bce8

Please sign in to comment.