From 69e0bd741ff7de9647ba5ecdfdbb757e42d335f1 Mon Sep 17 00:00:00 2001 From: lethemanh Date: Mon, 20 Apr 2026 10:28:24 +0700 Subject: [PATCH] #765 disable auto zoom in on ios --- .../Calendar/MobileTempSearchInput.tsx | 2 +- src/components/Event/AddDescButton.tsx | 3 +- src/components/Event/EventFormFields.tsx | 15 ++++++---- src/components/Event/EventRepeat.tsx | 28 ++++++++----------- .../DateTimeFields/TouchDatePickerField.tsx | 6 ++-- .../DateTimeFields/TouchTimePickerField.tsx | 2 +- .../DateTimeFields/dateTimePickerSlotProps.ts | 20 +++++++------ .../Timezone/SmallTimeZoneSelector.tsx | 4 +-- src/declarations.ts | 7 +++++ 9 files changed, 49 insertions(+), 38 deletions(-) diff --git a/src/components/Calendar/MobileTempSearchInput.tsx b/src/components/Calendar/MobileTempSearchInput.tsx index 1fbde28..e53a047 100644 --- a/src/components/Calendar/MobileTempSearchInput.tsx +++ b/src/components/Calendar/MobileTempSearchInput.tsx @@ -36,7 +36,7 @@ export const MobileTempSearchInput: React.FC = ({ setDescription(e.target.value)} - size="small" + size={isMobile ? 'medium' : 'small'} margin="dense" multiline minRows={2} diff --git a/src/components/Event/EventFormFields.tsx b/src/components/Event/EventFormFields.tsx index 82de0a5..19cdff2 100644 --- a/src/components/Event/EventFormFields.tsx +++ b/src/components/Event/EventFormFields.tsx @@ -177,8 +177,8 @@ export default function EventFormFields({ setSelectedResources }: EventFormFieldsProps): JSX.Element { const { t } = useI18n() - const { isTooSmall: isMobile } = useScreenSizeDetection() + const [timezoneDrawerOpen, setTimezoneDrawerOpen] = React.useState(false) // Internal state for 4 separate fields @@ -514,7 +514,7 @@ export default function EventFormFields({ onChange={e => { setTitle(e.target.value) }} - size="small" + size={isMobile ? 'medium' : 'small'} margin="dense" inputRef={titleInputRef} /> @@ -694,7 +694,9 @@ export default function EventFormFields({ timezone={timezone} end={end} placeholder={t('event.form.addGuestsPlaceholder')} - inputSlot={params => } + inputSlot={params => ( + + )} /> @@ -815,7 +817,6 @@ export default function EventFormFields({ showMore={showMore} description={description} setDescription={setDescription} - isMobile={isMobile} /> setLocation(e.target.value)} - size="small" + size={isMobile ? 'medium' : 'small'} margin="dense" /> )} @@ -922,7 +923,9 @@ export default function EventFormFields({ } + inputSlot={params => ( + + )} onChange={(_event: React.SyntheticEvent, value: Resource[]) => { handleResourceChange(value) }} diff --git a/src/components/Event/EventRepeat.tsx b/src/components/Event/EventRepeat.tsx index d22a7c2..92ca9bf 100644 --- a/src/components/Event/EventRepeat.tsx +++ b/src/components/Event/EventRepeat.tsx @@ -24,6 +24,7 @@ import { useI18n } from 'twake-i18n' import { ReadOnlyDateField } from './components/ReadOnlyPickerField' import { LONG_DATE_FORMAT } from './utils/dateTimeFormatters' import { FC_DAYS, WeekDaySelector } from './WeekDaySelector' +import { useScreenSizeDetection } from '@/useScreenSizeDetection' const numericSlotProps = { htmlInput: { @@ -36,18 +37,9 @@ export const RepeatEvent: React.FC<{ eventStart: Date setRepetition: (repetition: RepetitionObject) => void isOwn?: boolean -}> = ({ - repetition, - eventStart, - setRepetition, - isOwn = true -}: { - repetition: RepetitionObject - eventStart: Date - setRepetition: (repetition: RepetitionObject) => void - isOwn?: boolean -}) => { +}> = ({ repetition, eventStart, setRepetition, isOwn = true }) => { const { t } = useI18n() + const { isTooSmall: isMobile } = useScreenSizeDetection() const days = ['MO', 'TU', 'WE', 'TH', 'FR', 'SA', 'SU'] const day = new Date(eventStart) const dateCalendarLayoutSx = { @@ -85,8 +77,8 @@ export const RepeatEvent: React.FC<{ interval: Number(e.target.value) }) } - size="small" - sx={{ width: 80 }} + size={isMobile ? 'medium' : 'small'} + style={{ width: 80 }} slotProps={{ htmlInput: { ...numericSlotProps.htmlInput, @@ -223,8 +215,12 @@ export const RepeatEvent: React.FC<{ { const value = Number(e.target.value) diff --git a/src/components/Event/components/DateTimeFields/TouchDatePickerField.tsx b/src/components/Event/components/DateTimeFields/TouchDatePickerField.tsx index 56b73b0..d32d7ed 100644 --- a/src/components/Event/components/DateTimeFields/TouchDatePickerField.tsx +++ b/src/components/Event/components/DateTimeFields/TouchDatePickerField.tsx @@ -104,7 +104,7 @@ const DatePickerDialogContent: React.FC = ({ = ({ slots={{ field: ReadOnlyDateField }} slotProps={{ openPickerButton: { sx: { display: 'none' } }, - ...getDateSlotProps(testId, hasError, label), - field: getDateFieldSlotProps(testId, hasError, label), + ...getDateSlotProps(testId, hasError, label, true), + field: getDateFieldSlotProps(testId, hasError, label, true), layout: { sx: dateCalendarLayoutSx } }} /> diff --git a/src/components/Event/components/DateTimeFields/TouchTimePickerField.tsx b/src/components/Event/components/DateTimeFields/TouchTimePickerField.tsx index 5db81e2..7cc1bc6 100644 --- a/src/components/Event/components/DateTimeFields/TouchTimePickerField.tsx +++ b/src/components/Event/components/DateTimeFields/TouchTimePickerField.tsx @@ -113,7 +113,7 @@ export const TouchTimePickerField: React.FC = ({ slotProps={{ openPickerButton: { sx: { display: 'none' } }, field: { - ...getTimeFieldSlotProps(testId, hasError, label), + ...getTimeFieldSlotProps(testId, hasError, label, true), onFocus: e => e.target.blur() } }} diff --git a/src/components/Event/components/DateTimeFields/dateTimePickerSlotProps.ts b/src/components/Event/components/DateTimeFields/dateTimePickerSlotProps.ts index 5b129dd..eba7403 100644 --- a/src/components/Event/components/DateTimeFields/dateTimePickerSlotProps.ts +++ b/src/components/Event/components/DateTimeFields/dateTimePickerSlotProps.ts @@ -28,7 +28,8 @@ export const timePickerPopperSx = { const baseFieldProps = ( testId: string, hasError = false, - label?: string + label?: string, + isMobile?: boolean ): Pick< TextFieldProps, | 'size' @@ -39,7 +40,7 @@ const baseFieldProps = ( | 'sx' | 'inputProps' > => ({ - size: 'small' as const, + size: isMobile ? ('medium' as const) : ('small' as const), margin: 'dense' as const, fullWidth: true, InputLabelProps: { shrink: true }, @@ -54,17 +55,19 @@ const baseFieldProps = ( export const getDateSlotProps = ( testId: string, hasError = false, - label?: string + label?: string, + isMobile?: boolean ): Partial> => ({ textField: { - ...baseFieldProps(testId, hasError, label) + ...baseFieldProps(testId, hasError, label, isMobile) } }) export const getDateFieldSlotProps = ( testId: string, hasError = false, - label?: string + label?: string, + isMobile?: boolean ): Partial & Pick< TextFieldProps, @@ -75,12 +78,13 @@ export const getDateFieldSlotProps = ( | 'error' | 'sx' | 'inputProps' - > => baseFieldProps(testId, hasError, label) + > => baseFieldProps(testId, hasError, label, isMobile) export const getTimeFieldSlotProps = ( testId: string, hasError = false, - label?: string + label?: string, + isMobile?: boolean ): Partial & Pick< TextFieldProps, @@ -91,4 +95,4 @@ export const getTimeFieldSlotProps = ( | 'error' | 'sx' | 'inputProps' - > => baseFieldProps(testId, hasError, label) + > => baseFieldProps(testId, hasError, label, isMobile) diff --git a/src/components/Timezone/SmallTimeZoneSelector.tsx b/src/components/Timezone/SmallTimeZoneSelector.tsx index 2375ac1..76299cf 100644 --- a/src/components/Timezone/SmallTimeZoneSelector.tsx +++ b/src/components/Timezone/SmallTimeZoneSelector.tsx @@ -128,6 +128,7 @@ export const SmallTimezoneSelector: React.FC< diff --git a/src/declarations.ts b/src/declarations.ts index b47387c..bd0b211 100644 --- a/src/declarations.ts +++ b/src/declarations.ts @@ -41,3 +41,10 @@ declare module '@linagora/twake-mui' { export const radius: Record } + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +declare const process: { + env: { + [key: string]: string | undefined + } +}