@@ -68,6 +68,9 @@ export type CustomClassNames = {
68
68
subtitlesClassName ?: string ;
69
69
scheduleClassNames ?: scheduleClassNames ;
70
70
overridesModalClassNames ?: string ;
71
+ dateOverrideClassNames ?: {
72
+ container ?: string ;
73
+ } ;
71
74
hiddenSwitchClassname ?: {
72
75
container ?: string ;
73
76
thumb ?: string ;
@@ -180,13 +183,17 @@ const DateOverride = ({
180
183
travelSchedules,
181
184
weekStart,
182
185
overridesModalClassNames,
186
+ classNames,
183
187
handleSubmit,
184
188
} : {
185
189
workingHours : WorkingHours [ ] ;
186
190
userTimeFormat : number | null ;
187
191
travelSchedules ?: RouterOutputs [ "viewer" ] [ "travelSchedules" ] [ "get" ] ;
188
192
weekStart : 0 | 1 | 2 | 3 | 4 | 5 | 6 ;
189
193
overridesModalClassNames ?: string ;
194
+ classNames ?: {
195
+ container ?: string ;
196
+ } ;
190
197
handleSubmit : ( data : AvailabilityFormValues ) => Promise < void > ;
191
198
} ) => {
192
199
const { append, replace, fields } = useFieldArray < AvailabilityFormValues , "dateOverrides" > ( {
@@ -202,7 +209,7 @@ const DateOverride = ({
202
209
} ;
203
210
204
211
return (
205
- < div className = "p-6" >
212
+ < div className = { cn ( "p-6" , classNames ?. container ) } >
206
213
< h3 className = "text-emphasis font-medium leading-6" >
207
214
{ t ( "date_overrides" ) } { " " }
208
215
< Tooltip content = { t ( "date_overrides_info" ) } >
@@ -318,24 +325,27 @@ export const AvailabilitySettings = forwardRef<AvailabilitySettingsFormRef, Avai
318
325
319
326
const callbacksRef = useRef < { onSuccess ?: ( ) => void ; onError ?: ( error : Error ) => void } > ( { } ) ;
320
327
321
- const handleFormSubmit = useCallback ( ( customCallbacks ?: { onSuccess ?: ( ) => void ; onError ?: ( error : Error ) => void } ) => {
322
- if ( customCallbacks ) {
323
- callbacksRef . current = customCallbacks ;
324
- }
328
+ const handleFormSubmit = useCallback (
329
+ ( customCallbacks ?: { onSuccess ?: ( ) => void ; onError ?: ( error : Error ) => void } ) => {
330
+ if ( customCallbacks ) {
331
+ callbacksRef . current = customCallbacks ;
332
+ }
325
333
326
- if ( saveButtonRef . current ) {
327
- saveButtonRef . current . click ( ) ;
328
- } else {
329
- form . handleSubmit ( async ( data ) => {
330
- try {
331
- await handleSubmit ( data ) ;
332
- callbacksRef . current ?. onSuccess ?.( ) ;
333
- } catch ( error ) {
334
- callbacksRef . current ?. onError ?.( error as Error ) ;
335
- }
336
- } ) ( ) ;
337
- }
338
- } , [ form , handleSubmit ] ) ;
334
+ if ( saveButtonRef . current ) {
335
+ saveButtonRef . current . click ( ) ;
336
+ } else {
337
+ form . handleSubmit ( async ( data ) => {
338
+ try {
339
+ await handleSubmit ( data ) ;
340
+ callbacksRef . current ?. onSuccess ?.( ) ;
341
+ } catch ( error ) {
342
+ callbacksRef . current ?. onError ?.( error as Error ) ;
343
+ }
344
+ } ) ( ) ;
345
+ }
346
+ } ,
347
+ [ form , handleSubmit ]
348
+ ) ;
339
349
340
350
const validateForm = useCallback ( async ( ) => {
341
351
const isValid = await form . trigger ( ) ;
@@ -661,6 +671,7 @@ export const AvailabilitySettings = forwardRef<AvailabilitySettingsFormRef, Avai
661
671
) as 0 | 1 | 2 | 3 | 4 | 5 | 6
662
672
}
663
673
overridesModalClassNames = { customClassNames ?. overridesModalClassNames }
674
+ classNames = { customClassNames ?. dateOverrideClassNames }
664
675
/>
665
676
) }
666
677
</ div >
0 commit comments