-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Fix date filter is cut off #88704
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Fix date filter is cut off #88704
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,11 +22,13 @@ import type {Policy, PolicyReportField} from '@src/types/onyx'; | |
| import type {PolicyReportFieldType} from '@src/types/onyx/Policy'; | ||
| import BasePopup from './BasePopup'; | ||
| import DateSelectPopup from './DateSelectPopup'; | ||
| import type {PopoverComponentProps} from './DropdownButton'; | ||
| import SingleSelectPopup from './SingleSelectPopup'; | ||
| import TextInputPopup from './TextInputPopup'; | ||
|
|
||
| type ReportFieldPopupProps = { | ||
| closeOverlay: () => void; | ||
| setPopoverWidth: PopoverComponentProps['setPopoverWidth']; | ||
| updateFilterForm: (value: Partial<SearchAdvancedFiltersForm>) => void; | ||
| }; | ||
|
|
||
|
|
@@ -40,6 +42,7 @@ type ReportFieldSubPopupProps = { | |
| type ReportFieldDatePopupProps = { | ||
| field: PolicyReportField; | ||
| value: SearchDateValues; | ||
| setPopoverWidth: PopoverComponentProps['setPopoverWidth']; | ||
| onBackButtonPress: () => void; | ||
| onChange: (newValue: SearchDateValues) => void; | ||
| }; | ||
|
|
@@ -67,14 +70,12 @@ function ReportFieldListPopup({value, field, onBackButtonPress, onChange}: Repor | |
| ); | ||
| } | ||
|
|
||
| function ReportFieldDatePopup({value, field, onBackButtonPress, onChange}: ReportFieldDatePopupProps) { | ||
| function ReportFieldDatePopup({value, field, setPopoverWidth, onBackButtonPress, onChange}: ReportFieldDatePopupProps) { | ||
| const styles = useThemeStyles(); | ||
| const {windowHeight} = useWindowDimensions(); | ||
| const isInLandscapeMode = useIsInLandscapeMode(); | ||
| const filterKey = `${CONST.SEARCH.REPORT_FIELD.DEFAULT_PREFIX}${getFieldNameAsKey(field.name)}` as const; | ||
|
|
||
| return ( | ||
| <View style={[styles.pv4, styles.gap2, styles.getPopoverMaxHeight(windowHeight, isInLandscapeMode)]}> | ||
| <View style={[styles.pv4, styles.gap2]}> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please also add test case for this
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
| <HeaderWithBackButton | ||
| shouldDisplayHelpButton={false} | ||
| style={[styles.h10]} | ||
|
|
@@ -86,6 +87,7 @@ function ReportFieldDatePopup({value, field, onBackButtonPress, onChange}: Repor | |
| value={value} | ||
| onChange={onChange} | ||
| closeOverlay={onBackButtonPress} | ||
| setPopoverWidth={setPopoverWidth} | ||
| presets={getDatePresets(filterKey, true)} | ||
| /> | ||
| </View> | ||
|
|
@@ -105,7 +107,7 @@ function ReportFieldTextPopup({field, value, onBackButtonPress, onChange}: Repor | |
| ); | ||
| } | ||
|
|
||
| function ReportFieldPopup({closeOverlay, updateFilterForm}: ReportFieldPopupProps) { | ||
| function ReportFieldPopup({closeOverlay, setPopoverWidth, updateFilterForm}: ReportFieldPopupProps) { | ||
| const {translate, localeCompare} = useLocalize(); | ||
| const {windowHeight} = useWindowDimensions(); | ||
| const isInLandscapeMode = useIsInLandscapeMode(); | ||
|
|
@@ -139,6 +141,7 @@ function ReportFieldPopup({closeOverlay, updateFilterForm}: ReportFieldPopupProp | |
| if (selectedField) { | ||
| const goBack = () => { | ||
| setSelectedField(null); | ||
| setPopoverWidth?.(undefined); | ||
| }; | ||
|
|
||
| // We only support list, date, & text for report fields, no other types | ||
|
|
@@ -156,6 +159,7 @@ function ReportFieldPopup({closeOverlay, updateFilterForm}: ReportFieldPopupProp | |
| field={selectedField} | ||
| value={filterValue as SearchDateValues} | ||
| onBackButtonPress={goBack} | ||
| setPopoverWidth={setPopoverWidth} | ||
| onChange={(newValue) => | ||
| setValues((prevValues) => ({ | ||
| ...prevValues, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,10 +2,7 @@ import React from 'react'; | |
| import DateSelectPopup from '@components/Search/FilterDropdowns/DateSelectPopup'; | ||
| import type {PopoverComponentProps} from '@components/Search/FilterDropdowns/DropdownButton'; | ||
| import type {SearchDateFilterKeys} from '@components/Search/types'; | ||
| import useIsInLandscapeMode from '@hooks/useIsInLandscapeMode'; | ||
| import useLocalize from '@hooks/useLocalize'; | ||
| import useThemeStyles from '@hooks/useThemeStyles'; | ||
| import useWindowDimensions from '@hooks/useWindowDimensions'; | ||
| import type {SearchDateValues} from '@libs/SearchQueryUtils'; | ||
| import {getDatePresets} from '@libs/SearchUIUtils'; | ||
| import CONST from '@src/CONST'; | ||
|
|
@@ -21,9 +18,6 @@ type DatePickerFilterPopupProps = PopoverComponentProps & { | |
|
|
||
| function DatePickerFilterPopup({closeOverlay, setPopoverWidth, filterKey, value, translationKey, updateFilterForm}: DatePickerFilterPopupProps) { | ||
| const {translate} = useLocalize(); | ||
| const styles = useThemeStyles(); | ||
| const {windowHeight} = useWindowDimensions(); | ||
| const isInLandscapeMode = useIsInLandscapeMode(); | ||
| const onChange = (selectedDates: SearchDateValues) => { | ||
| const dateFormValues: Record<string, string | undefined> = {}; | ||
| dateFormValues[`${filterKey}On`] = selectedDates[CONST.SEARCH.DATE_MODIFIERS.ON]; | ||
|
|
@@ -40,7 +34,6 @@ function DatePickerFilterPopup({closeOverlay, setPopoverWidth, filterKey, value, | |
| closeOverlay={closeOverlay} | ||
| setPopoverWidth={setPopoverWidth} | ||
| presets={getDatePresets(filterKey, true)} | ||
| style={[styles.getPopoverMaxHeight(windowHeight, isInLandscapeMode)]} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added back the max height style that was removed in https://github.com/Expensify/App/pull/88191/changes#diff-83cb90c4b04d8b728f53bc1ee7a2400a965b1148a1f4645cec08033cee26d83f, but instead of only applying it when date range modifier is selected, we now apply it to all cases, and also change the View to ScrollView in large screen to make it scrollable. Note: DateSelectPopup is also used for date-type report field and the max height doesn't work fine
But I think it's fine, no real user will resize their window to be that small. In #88428, the report field date will follow the same max-height as the report field list and other popups. |
||
| /> | ||
|
bernhardoj marked this conversation as resolved.
|
||
| ); | ||
| } | ||
|
|
||


Uh oh!
There was an error while loading. Please reload this page.