Merge pull request #775 from lethemanh/765-disable-auto-zoom-in-on-ios

#765 disable auto zoom in on ios
This commit is contained in:
lethemanh
2026-04-20 14:32:51 +07:00
committed by GitHub
9 changed files with 49 additions and 38 deletions
@@ -36,7 +36,7 @@ export const MobileTempSearchInput: React.FC<MobileTempSearchInputProps> = ({
<TextField <TextField
{...params} {...params}
autoFocus autoFocus
size="small" size="medium"
sx={{ sx={{
'& .MuiOutlinedInput-notchedOutline': { '& .MuiOutlinedInput-notchedOutline': {
border: 'none' border: 'none'
+2 -1
View File
@@ -5,6 +5,7 @@ import React from 'react'
import { useI18n } from 'twake-i18n' import { useI18n } from 'twake-i18n'
import { FieldWithLabel } from './components/FieldWithLabel' import { FieldWithLabel } from './components/FieldWithLabel'
import { SectionPreviewRow } from './components/SectionPreviewRow' import { SectionPreviewRow } from './components/SectionPreviewRow'
import { useScreenSizeDetection } from '@/useScreenSizeDetection'
export function AddDescButton({ export function AddDescButton({
showDescription, showDescription,
@@ -43,7 +44,7 @@ export function AddDescButton({
placeholder={t('event.form.descriptionPlaceholder')} placeholder={t('event.form.descriptionPlaceholder')}
value={description} value={description}
onChange={e => setDescription(e.target.value)} onChange={e => setDescription(e.target.value)}
size="small" size={isMobile ? 'medium' : 'small'}
margin="dense" margin="dense"
multiline multiline
minRows={2} minRows={2}
+9 -6
View File
@@ -177,8 +177,8 @@ export default function EventFormFields({
setSelectedResources setSelectedResources
}: EventFormFieldsProps): JSX.Element { }: EventFormFieldsProps): JSX.Element {
const { t } = useI18n() const { t } = useI18n()
const { isTooSmall: isMobile } = useScreenSizeDetection() const { isTooSmall: isMobile } = useScreenSizeDetection()
const [timezoneDrawerOpen, setTimezoneDrawerOpen] = React.useState(false) const [timezoneDrawerOpen, setTimezoneDrawerOpen] = React.useState(false)
// Internal state for 4 separate fields // Internal state for 4 separate fields
@@ -514,7 +514,7 @@ export default function EventFormFields({
onChange={e => { onChange={e => {
setTitle(e.target.value) setTitle(e.target.value)
}} }}
size="small" size={isMobile ? 'medium' : 'small'}
margin="dense" margin="dense"
inputRef={titleInputRef} inputRef={titleInputRef}
/> />
@@ -694,7 +694,9 @@ export default function EventFormFields({
timezone={timezone} timezone={timezone}
end={end} end={end}
placeholder={t('event.form.addGuestsPlaceholder')} placeholder={t('event.form.addGuestsPlaceholder')}
inputSlot={params => <TextField {...params} size="small" />} inputSlot={params => (
<TextField {...params} size={isMobile ? 'medium' : 'small'} />
)}
/> />
</FieldWithLabel> </FieldWithLabel>
@@ -815,7 +817,6 @@ export default function EventFormFields({
showMore={showMore} showMore={showMore}
description={description} description={description}
setDescription={setDescription} setDescription={setDescription}
isMobile={isMobile}
/> />
<FieldWithLabel <FieldWithLabel
@@ -841,7 +842,7 @@ export default function EventFormFields({
placeholder={t('event.form.locationPlaceholder')} placeholder={t('event.form.locationPlaceholder')}
value={location} value={location}
onChange={e => setLocation(e.target.value)} onChange={e => setLocation(e.target.value)}
size="small" size={isMobile ? 'medium' : 'small'}
margin="dense" margin="dense"
/> />
)} )}
@@ -922,7 +923,9 @@ export default function EventFormFields({
<ResourceSearch <ResourceSearch
objectTypes={['resource']} objectTypes={['resource']}
selectedResources={selectedResources} selectedResources={selectedResources}
inputSlot={params => <TextField {...params} size="small" />} inputSlot={params => (
<TextField {...params} size={isMobile ? 'medium' : 'small'} />
)}
onChange={(_event: React.SyntheticEvent, value: Resource[]) => { onChange={(_event: React.SyntheticEvent, value: Resource[]) => {
handleResourceChange(value) handleResourceChange(value)
}} }}
+12 -16
View File
@@ -24,6 +24,7 @@ import { useI18n } from 'twake-i18n'
import { ReadOnlyDateField } from './components/ReadOnlyPickerField' import { ReadOnlyDateField } from './components/ReadOnlyPickerField'
import { LONG_DATE_FORMAT } from './utils/dateTimeFormatters' import { LONG_DATE_FORMAT } from './utils/dateTimeFormatters'
import { FC_DAYS, WeekDaySelector } from './WeekDaySelector' import { FC_DAYS, WeekDaySelector } from './WeekDaySelector'
import { useScreenSizeDetection } from '@/useScreenSizeDetection'
const numericSlotProps = { const numericSlotProps = {
htmlInput: { htmlInput: {
@@ -36,18 +37,9 @@ export const RepeatEvent: React.FC<{
eventStart: Date eventStart: Date
setRepetition: (repetition: RepetitionObject) => void setRepetition: (repetition: RepetitionObject) => void
isOwn?: boolean isOwn?: boolean
}> = ({ }> = ({ repetition, eventStart, setRepetition, isOwn = true }) => {
repetition,
eventStart,
setRepetition,
isOwn = true
}: {
repetition: RepetitionObject
eventStart: Date
setRepetition: (repetition: RepetitionObject) => void
isOwn?: boolean
}) => {
const { t } = useI18n() const { t } = useI18n()
const { isTooSmall: isMobile } = useScreenSizeDetection()
const days = ['MO', 'TU', 'WE', 'TH', 'FR', 'SA', 'SU'] const days = ['MO', 'TU', 'WE', 'TH', 'FR', 'SA', 'SU']
const day = new Date(eventStart) const day = new Date(eventStart)
const dateCalendarLayoutSx = { const dateCalendarLayoutSx = {
@@ -85,8 +77,8 @@ export const RepeatEvent: React.FC<{
interval: Number(e.target.value) interval: Number(e.target.value)
}) })
} }
size="small" size={isMobile ? 'medium' : 'small'}
sx={{ width: 80 }} style={{ width: 80 }}
slotProps={{ slotProps={{
htmlInput: { htmlInput: {
...numericSlotProps.htmlInput, ...numericSlotProps.htmlInput,
@@ -223,8 +215,12 @@ export const RepeatEvent: React.FC<{
<Box <Box
sx={{ sx={{
width: 220, width: 220,
'& .MuiInputBase-root': { fontSize: 14 }, '& .MuiInputBase-root': {
'& .MuiInputBase-input': { fontSize: 14 } fontSize: isMobile ? 16 : 14
},
'& .MuiInputBase-input': {
fontSize: isMobile ? 16 : 14
}
}} }}
> >
<DatePicker <DatePicker
@@ -278,7 +274,7 @@ export const RepeatEvent: React.FC<{
</Typography> </Typography>
<TextField <TextField
type="number" type="number"
size="small" size={isMobile ? 'medium' : 'small'}
value={repetition.occurrences || 1} value={repetition.occurrences || 1}
onChange={e => { onChange={e => {
const value = Number(e.target.value) const value = Number(e.target.value)
@@ -104,7 +104,7 @@ const DatePickerDialogContent: React.FC<DatePickerDialogProps> = ({
<DateField <DateField
fullWidth fullWidth
inputMode="numeric" inputMode="numeric"
size="small" size="medium"
value={internalValue} value={internalValue}
onChange={handleInternalChange} onChange={handleInternalChange}
autoFocus autoFocus
@@ -171,8 +171,8 @@ export const TouchDatePickerField: React.FC<DatePickerFieldProps> = ({
slots={{ field: ReadOnlyDateField }} slots={{ field: ReadOnlyDateField }}
slotProps={{ slotProps={{
openPickerButton: { sx: { display: 'none' } }, openPickerButton: { sx: { display: 'none' } },
...getDateSlotProps(testId, hasError, label), ...getDateSlotProps(testId, hasError, label, true),
field: getDateFieldSlotProps(testId, hasError, label), field: getDateFieldSlotProps(testId, hasError, label, true),
layout: { sx: dateCalendarLayoutSx } layout: { sx: dateCalendarLayoutSx }
}} }}
/> />
@@ -113,7 +113,7 @@ export const TouchTimePickerField: React.FC<TimePickerFieldProps> = ({
slotProps={{ slotProps={{
openPickerButton: { sx: { display: 'none' } }, openPickerButton: { sx: { display: 'none' } },
field: { field: {
...getTimeFieldSlotProps(testId, hasError, label), ...getTimeFieldSlotProps(testId, hasError, label, true),
onFocus: e => e.target.blur() onFocus: e => e.target.blur()
} }
}} }}
@@ -28,7 +28,8 @@ export const timePickerPopperSx = {
const baseFieldProps = ( const baseFieldProps = (
testId: string, testId: string,
hasError = false, hasError = false,
label?: string label?: string,
isMobile?: boolean
): Pick< ): Pick<
TextFieldProps, TextFieldProps,
| 'size' | 'size'
@@ -39,7 +40,7 @@ const baseFieldProps = (
| 'sx' | 'sx'
| 'inputProps' | 'inputProps'
> => ({ > => ({
size: 'small' as const, size: isMobile ? ('medium' as const) : ('small' as const),
margin: 'dense' as const, margin: 'dense' as const,
fullWidth: true, fullWidth: true,
InputLabelProps: { shrink: true }, InputLabelProps: { shrink: true },
@@ -54,17 +55,19 @@ const baseFieldProps = (
export const getDateSlotProps = ( export const getDateSlotProps = (
testId: string, testId: string,
hasError = false, hasError = false,
label?: string label?: string,
isMobile?: boolean
): Partial<DatePickerSlotProps<true>> => ({ ): Partial<DatePickerSlotProps<true>> => ({
textField: { textField: {
...baseFieldProps(testId, hasError, label) ...baseFieldProps(testId, hasError, label, isMobile)
} }
}) })
export const getDateFieldSlotProps = ( export const getDateFieldSlotProps = (
testId: string, testId: string,
hasError = false, hasError = false,
label?: string label?: string,
isMobile?: boolean
): Partial<DatePickerFieldProps> & ): Partial<DatePickerFieldProps> &
Pick< Pick<
TextFieldProps, TextFieldProps,
@@ -75,12 +78,13 @@ export const getDateFieldSlotProps = (
| 'error' | 'error'
| 'sx' | 'sx'
| 'inputProps' | 'inputProps'
> => baseFieldProps(testId, hasError, label) > => baseFieldProps(testId, hasError, label, isMobile)
export const getTimeFieldSlotProps = ( export const getTimeFieldSlotProps = (
testId: string, testId: string,
hasError = false, hasError = false,
label?: string label?: string,
isMobile?: boolean
): Partial<TimePickerFieldProps> & ): Partial<TimePickerFieldProps> &
Pick< Pick<
TextFieldProps, TextFieldProps,
@@ -91,4 +95,4 @@ export const getTimeFieldSlotProps = (
| 'error' | 'error'
| 'sx' | 'sx'
| 'inputProps' | 'inputProps'
> => baseFieldProps(testId, hasError, label) > => baseFieldProps(testId, hasError, label, isMobile)
@@ -128,6 +128,7 @@ export const SmallTimezoneSelector: React.FC<
<TextField <TextField
inputRef={inputRef} inputRef={inputRef}
fullWidth fullWidth
size="medium"
variant="standard" variant="standard"
placeholder={t('calendar.searchTimezone')} placeholder={t('calendar.searchTimezone')}
value={searchQuery} value={searchQuery}
@@ -152,8 +153,7 @@ export const SmallTimezoneSelector: React.FC<
}} }}
sx={{ sx={{
'& .MuiInputBase-root': { '& .MuiInputBase-root': {
padding: '8px 0', padding: '8px 0'
fontSize: '16px'
} }
}} }}
/> />
+7
View File
@@ -41,3 +41,10 @@ declare module '@linagora/twake-mui' {
export const radius: Record<string, string | number> export const radius: Record<string, string | number>
} }
// eslint-disable-next-line @typescript-eslint/no-unused-vars
declare const process: {
env: {
[key: string]: string | undefined
}
}