From d72834c8dabb92f1fc4d4338a1103b96a8bd56d8 Mon Sep 17 00:00:00 2001 From: Shubham Agrawal Date: Sun, 3 Dec 2023 18:24:47 +0530 Subject: [PATCH 1/2] renamed NewDatePicker to DatePicker --- .../CalendarPicker/ArrowIcon.js | 0 .../CalendarPicker/YearPickerModal.js | 0 .../CalendarPicker/generateMonthMatrix.js | 0 .../CalendarPicker/index.js | 0 src/components/{NewDatePicker => DatePicker}/index.js | 10 +++++----- src/pages/EditRequestCreatedPage.js | 4 ++-- src/pages/EnablePayments/AdditionalDetailsStep.js | 4 ++-- src/pages/ReimbursementAccount/CompanyStep.js | 4 ++-- src/pages/ReimbursementAccount/IdentityForm.js | 4 ++-- src/pages/iou/MoneyRequestDatePage.js | 4 ++-- .../Profile/PersonalDetails/DateOfBirthPage.js | 4 ++-- src/stories/Form.stories.js | 7 +++++++ tests/unit/CalendarPickerTest.js | 2 +- tests/unit/generateMonthMatrixTest.js | 2 +- 14 files changed, 26 insertions(+), 19 deletions(-) rename src/components/{NewDatePicker => DatePicker}/CalendarPicker/ArrowIcon.js (100%) rename src/components/{NewDatePicker => DatePicker}/CalendarPicker/YearPickerModal.js (100%) rename src/components/{NewDatePicker => DatePicker}/CalendarPicker/generateMonthMatrix.js (100%) rename src/components/{NewDatePicker => DatePicker}/CalendarPicker/index.js (100%) rename src/components/{NewDatePicker => DatePicker}/index.js (90%) diff --git a/src/components/NewDatePicker/CalendarPicker/ArrowIcon.js b/src/components/DatePicker/CalendarPicker/ArrowIcon.js similarity index 100% rename from src/components/NewDatePicker/CalendarPicker/ArrowIcon.js rename to src/components/DatePicker/CalendarPicker/ArrowIcon.js diff --git a/src/components/NewDatePicker/CalendarPicker/YearPickerModal.js b/src/components/DatePicker/CalendarPicker/YearPickerModal.js similarity index 100% rename from src/components/NewDatePicker/CalendarPicker/YearPickerModal.js rename to src/components/DatePicker/CalendarPicker/YearPickerModal.js diff --git a/src/components/NewDatePicker/CalendarPicker/generateMonthMatrix.js b/src/components/DatePicker/CalendarPicker/generateMonthMatrix.js similarity index 100% rename from src/components/NewDatePicker/CalendarPicker/generateMonthMatrix.js rename to src/components/DatePicker/CalendarPicker/generateMonthMatrix.js diff --git a/src/components/NewDatePicker/CalendarPicker/index.js b/src/components/DatePicker/CalendarPicker/index.js similarity index 100% rename from src/components/NewDatePicker/CalendarPicker/index.js rename to src/components/DatePicker/CalendarPicker/index.js diff --git a/src/components/NewDatePicker/index.js b/src/components/DatePicker/index.js similarity index 90% rename from src/components/NewDatePicker/index.js rename to src/components/DatePicker/index.js index 8403bdb2661f..10a53dc25bbb 100644 --- a/src/components/NewDatePicker/index.js +++ b/src/components/DatePicker/index.js @@ -44,7 +44,7 @@ const datePickerDefaultProps = { value: undefined, }; -function NewDatePicker({containerStyles, defaultValue, disabled, errorText, inputID, isSmallScreenWidth, label, maxDate, minDate, onInputChange, onTouched, placeholder, translate, value}) { +function DatePicker({containerStyles, defaultValue, disabled, errorText, inputID, isSmallScreenWidth, label, maxDate, minDate, onInputChange, onTouched, placeholder, translate, value}) { const styles = useThemeStyles(); const [selectedDate, setSelectedDate] = useState(value || defaultValue || undefined); @@ -99,8 +99,8 @@ function NewDatePicker({containerStyles, defaultValue, disabled, errorText, inpu ); } -NewDatePicker.propTypes = propTypes; -NewDatePicker.defaultProps = datePickerDefaultProps; -NewDatePicker.displayName = 'NewDatePicker'; +DatePicker.propTypes = propTypes; +DatePicker.defaultProps = datePickerDefaultProps; +DatePicker.displayName = 'DatePicker'; -export default withLocalize(NewDatePicker); +export default withLocalize(DatePicker); diff --git a/src/pages/EditRequestCreatedPage.js b/src/pages/EditRequestCreatedPage.js index 78a2d28a925c..06e38a857734 100644 --- a/src/pages/EditRequestCreatedPage.js +++ b/src/pages/EditRequestCreatedPage.js @@ -2,7 +2,7 @@ import PropTypes from 'prop-types'; import React from 'react'; import FormProvider from '@components/Form/FormProvider'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; -import NewDatePicker from '@components/NewDatePicker'; +import DatePicker from '@components/DatePicker'; import ScreenWrapper from '@components/ScreenWrapper'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@styles/useThemeStyles'; @@ -34,7 +34,7 @@ function EditRequestCreatedPage({defaultCreated, onSubmit}) { submitButtonText={translate('common.save')} enabledWhenOffline > - - - - - - + { it('returns the correct matrix for January 2022', () => { From 958c4312e6713e9ad76174a5f3c95e02dbf21576 Mon Sep 17 00:00:00 2001 From: Shubham Agrawal Date: Sun, 3 Dec 2023 18:43:44 +0530 Subject: [PATCH 2/2] fix lint --- src/pages/EditRequestCreatedPage.js | 2 +- src/pages/EnablePayments/AdditionalDetailsStep.js | 2 +- src/pages/ReimbursementAccount/CompanyStep.js | 2 +- src/pages/ReimbursementAccount/IdentityForm.js | 2 +- src/pages/iou/MoneyRequestDatePage.js | 2 +- src/pages/settings/Profile/PersonalDetails/DateOfBirthPage.js | 2 +- src/stories/Form.stories.js | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/pages/EditRequestCreatedPage.js b/src/pages/EditRequestCreatedPage.js index 06e38a857734..c2b05d9e6dfa 100644 --- a/src/pages/EditRequestCreatedPage.js +++ b/src/pages/EditRequestCreatedPage.js @@ -1,8 +1,8 @@ import PropTypes from 'prop-types'; import React from 'react'; +import DatePicker from '@components/DatePicker'; import FormProvider from '@components/Form/FormProvider'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; -import DatePicker from '@components/DatePicker'; import ScreenWrapper from '@components/ScreenWrapper'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@styles/useThemeStyles'; diff --git a/src/pages/EnablePayments/AdditionalDetailsStep.js b/src/pages/EnablePayments/AdditionalDetailsStep.js index 652bb0948d2e..6d01e601b901 100644 --- a/src/pages/EnablePayments/AdditionalDetailsStep.js +++ b/src/pages/EnablePayments/AdditionalDetailsStep.js @@ -5,10 +5,10 @@ import React from 'react'; import {View} from 'react-native'; import {withOnyx} from 'react-native-onyx'; import _ from 'underscore'; +import DatePicker from '@components/DatePicker'; import FormProvider from '@components/Form/FormProvider'; import InputWrapper from '@components/Form/InputWrapper'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; -import DatePicker from '@components/DatePicker'; import ScreenWrapper from '@components/ScreenWrapper'; import Text from '@components/Text'; import TextInput from '@components/TextInput'; diff --git a/src/pages/ReimbursementAccount/CompanyStep.js b/src/pages/ReimbursementAccount/CompanyStep.js index 945346c4d95a..f1d62eef89ae 100644 --- a/src/pages/ReimbursementAccount/CompanyStep.js +++ b/src/pages/ReimbursementAccount/CompanyStep.js @@ -7,10 +7,10 @@ import {View} from 'react-native'; import {withOnyx} from 'react-native-onyx'; import _ from 'underscore'; import CheckboxWithLabel from '@components/CheckboxWithLabel'; +import DatePicker from '@components/DatePicker'; import FormProvider from '@components/Form/FormProvider'; import InputWrapper from '@components/Form/InputWrapper'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; -import DatePicker from '@components/DatePicker'; import Picker from '@components/Picker'; import ScreenWrapper from '@components/ScreenWrapper'; import StatePicker from '@components/StatePicker'; diff --git a/src/pages/ReimbursementAccount/IdentityForm.js b/src/pages/ReimbursementAccount/IdentityForm.js index f73a6375e107..5f31f94a0e28 100644 --- a/src/pages/ReimbursementAccount/IdentityForm.js +++ b/src/pages/ReimbursementAccount/IdentityForm.js @@ -3,8 +3,8 @@ import PropTypes from 'prop-types'; import React from 'react'; import {View} from 'react-native'; import _ from 'underscore'; -import InputWrapper from '@components/Form/InputWrapper'; import DatePicker from '@components/DatePicker'; +import InputWrapper from '@components/Form/InputWrapper'; import TextInput from '@components/TextInput'; import useThemeStyles from '@styles/useThemeStyles'; import CONST from '@src/CONST'; diff --git a/src/pages/iou/MoneyRequestDatePage.js b/src/pages/iou/MoneyRequestDatePage.js index e5ae2a93ad30..9f80cbce9984 100644 --- a/src/pages/iou/MoneyRequestDatePage.js +++ b/src/pages/iou/MoneyRequestDatePage.js @@ -3,9 +3,9 @@ import PropTypes from 'prop-types'; import React, {useEffect} from 'react'; import {withOnyx} from 'react-native-onyx'; import _ from 'underscore'; +import DatePicker from '@components/DatePicker'; import FormProvider from '@components/Form/FormProvider'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; -import DatePicker from '@components/DatePicker'; import ScreenWrapper from '@components/ScreenWrapper'; import useLocalize from '@hooks/useLocalize'; import * as MoneyRequestUtils from '@libs/MoneyRequestUtils'; diff --git a/src/pages/settings/Profile/PersonalDetails/DateOfBirthPage.js b/src/pages/settings/Profile/PersonalDetails/DateOfBirthPage.js index 30fe6e17906b..10a6d8807afc 100644 --- a/src/pages/settings/Profile/PersonalDetails/DateOfBirthPage.js +++ b/src/pages/settings/Profile/PersonalDetails/DateOfBirthPage.js @@ -3,10 +3,10 @@ import lodashGet from 'lodash/get'; import PropTypes from 'prop-types'; import React, {useCallback} from 'react'; import {withOnyx} from 'react-native-onyx'; +import DatePicker from '@components/DatePicker'; import FormProvider from '@components/Form/FormProvider'; import FullscreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; -import DatePicker from '@components/DatePicker'; import ScreenWrapper from '@components/ScreenWrapper'; import withLocalize, {withLocalizePropTypes} from '@components/withLocalize'; import usePrivatePersonalDetails from '@hooks/usePrivatePersonalDetails'; diff --git a/src/stories/Form.stories.js b/src/stories/Form.stories.js index c192fb80b377..6473b1074f17 100644 --- a/src/stories/Form.stories.js +++ b/src/stories/Form.stories.js @@ -69,7 +69,7 @@ function Template(args) { containerStyles={[styles.mt4]} hint="No PO box" /> -