From 5fb1bee0f7a4c1bc0eb128b38936c51539e91d84 Mon Sep 17 00:00:00 2001 From: SanttuA Date: Fri, 8 Sep 2023 13:26:29 +0300 Subject: [PATCH] Changed react bootstrap and lodash imports (#264) Changes: - instead of importing whole lodash or react-bootstrap for some cases, import only what is needed from each package --- app/pages/home/HomePage.js | 4 +++- app/pages/manage-reservations/ManageReservationsPage.js | 4 +++- .../dropdown-action/ManageReservationsDropdown.js | 3 ++- .../filters/ManageReservationsFilters.js | 9 +++++---- app/pages/manage-reservations/filters/filterUtils.js | 3 ++- app/pages/manage-reservations/inputs/SelectField.js | 3 ++- app/pages/manage-reservations/inputs/ToggleField.js | 2 +- .../manage-reservations/list/ManageReservationsList.js | 2 +- app/pages/manage-reservations/list/ReservationDataRow.js | 2 +- .../manage-reservations/manageReservationsPageUtils.js | 2 +- .../reservation-details/ReservationDetails.js | 2 +- .../reservation-information/ReservationSubmitButton.js | 2 +- .../reservation-products/ReservationProducts.js | 8 ++++---- .../reservation-products/extra-products/ExtraProducts.js | 2 +- .../reservation-products/extra-products/QuantityInput.js | 2 +- .../mandatory-products/MandatoryProducts.js | 4 +++- .../product-time-slots/ProductTimeSlotPrices.js | 2 +- app/pages/resource/ResourcePage.js | 2 +- .../reservation-list/reservationListSelector.js | 4 +++- app/resource-outlook-linker/reducer.js | 6 ++---- app/shared/form-fields/TermsField.js | 2 +- .../modals/reservation-info/ReservationEditForm.js | 2 +- .../modals/reservation-info/ReservationOrderInfo.js | 2 +- app/shared/modals/reservation-payment/PaymentButton.js | 2 +- .../modals/reservation-payment/PaymentModalContainer.js | 3 ++- app/shared/pagination/NumberedPageButtons.js | 2 +- app/shared/quality-tools-form/QualityToolsForm.js | 2 +- app/shared/service-announcement/ServiceAnnouncement.js | 3 ++- app/shared/tooltip/TooltipOverlay.js | 3 ++- app/shared/top-navbar/mobile/MobileNavbar.js | 3 ++- app/utils/languageUtils.js | 3 ++- 31 files changed, 55 insertions(+), 40 deletions(-) diff --git a/app/pages/home/HomePage.js b/app/pages/home/HomePage.js index f20e513fa..963e5ddcc 100644 --- a/app/pages/home/HomePage.js +++ b/app/pages/home/HomePage.js @@ -1,6 +1,8 @@ import PropTypes from 'prop-types'; import React, { Component } from 'react'; -import { Button, Col, Row } from 'react-bootstrap'; +import Button from 'react-bootstrap/lib/Button'; +import Col from 'react-bootstrap/lib/Col'; +import Row from 'react-bootstrap/lib/Row'; import Loader from 'react-loader'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; diff --git a/app/pages/manage-reservations/ManageReservationsPage.js b/app/pages/manage-reservations/ManageReservationsPage.js index bffedb78f..d1f7b57f3 100644 --- a/app/pages/manage-reservations/ManageReservationsPage.js +++ b/app/pages/manage-reservations/ManageReservationsPage.js @@ -2,7 +2,9 @@ import React from 'react'; import PropTypes from 'prop-types'; import Loader from 'react-loader'; -import { Col, Grid, Row } from 'react-bootstrap'; +import Col from 'react-bootstrap/lib/Col'; +import Grid from 'react-bootstrap/lib/Grid'; +import Row from 'react-bootstrap/lib/Row'; import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; import { withRouter } from 'react-router'; diff --git a/app/pages/manage-reservations/dropdown-action/ManageReservationsDropdown.js b/app/pages/manage-reservations/dropdown-action/ManageReservationsDropdown.js index 644c83383..87c0b5385 100644 --- a/app/pages/manage-reservations/dropdown-action/ManageReservationsDropdown.js +++ b/app/pages/manage-reservations/dropdown-action/ManageReservationsDropdown.js @@ -1,7 +1,8 @@ import React from 'react'; -import { DropdownButton, MenuItem } from 'react-bootstrap'; +import DropdownButton from 'react-bootstrap/lib/DropdownButton'; +import MenuItem from 'react-bootstrap/lib/MenuItem'; import PropTypes from 'prop-types'; import constants from 'constants/AppConstants'; diff --git a/app/pages/manage-reservations/filters/ManageReservationsFilters.js b/app/pages/manage-reservations/filters/ManageReservationsFilters.js index 9eea67bce..8fea60196 100644 --- a/app/pages/manage-reservations/filters/ManageReservationsFilters.js +++ b/app/pages/manage-reservations/filters/ManageReservationsFilters.js @@ -1,9 +1,10 @@ -import { get } from 'lodash'; +import get from 'lodash/get'; import React from 'react'; -import { - Button, Col, Grid, Row -} from 'react-bootstrap'; +import Button from 'react-bootstrap/lib/Button'; +import Col from 'react-bootstrap/lib/Col'; +import Grid from 'react-bootstrap/lib/Grid'; +import Row from 'react-bootstrap/lib/Row'; import PropTypes from 'prop-types'; import { injectIntl, intlShape } from 'react-intl'; import moment from 'moment'; diff --git a/app/pages/manage-reservations/filters/filterUtils.js b/app/pages/manage-reservations/filters/filterUtils.js index 8e9f93d66..7d1f29480 100644 --- a/app/pages/manage-reservations/filters/filterUtils.js +++ b/app/pages/manage-reservations/filters/filterUtils.js @@ -1,5 +1,6 @@ -import { isEmpty, omit } from 'lodash'; +import isEmpty from 'lodash/isEmpty'; +import omit from 'lodash/omit'; import moment from 'moment'; import constants from 'constants/AppConstants'; diff --git a/app/pages/manage-reservations/inputs/SelectField.js b/app/pages/manage-reservations/inputs/SelectField.js index 229864d9c..4d12ecbab 100644 --- a/app/pages/manage-reservations/inputs/SelectField.js +++ b/app/pages/manage-reservations/inputs/SelectField.js @@ -1,6 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { ControlLabel, FormGroup } from 'react-bootstrap'; +import ControlLabel from 'react-bootstrap/lib/ControlLabel'; +import FormGroup from 'react-bootstrap/lib/FormGroup'; import Select from 'react-select'; import injectT from '../../../i18n/injectT'; diff --git a/app/pages/manage-reservations/inputs/ToggleField.js b/app/pages/manage-reservations/inputs/ToggleField.js index 23aa118b9..95f46d839 100644 --- a/app/pages/manage-reservations/inputs/ToggleField.js +++ b/app/pages/manage-reservations/inputs/ToggleField.js @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { ControlLabel } from 'react-bootstrap'; +import ControlLabel from 'react-bootstrap/lib/ControlLabel'; import Toggle from 'react-toggle'; function ToggleField({ diff --git a/app/pages/manage-reservations/list/ManageReservationsList.js b/app/pages/manage-reservations/list/ManageReservationsList.js index 02d528dbe..147188026 100644 --- a/app/pages/manage-reservations/list/ManageReservationsList.js +++ b/app/pages/manage-reservations/list/ManageReservationsList.js @@ -1,5 +1,5 @@ import React from 'react'; -import { Table } from 'react-bootstrap'; +import Table from 'react-bootstrap/lib/Table'; import PropTypes from 'prop-types'; import injectT from '../../../i18n/injectT'; diff --git a/app/pages/manage-reservations/list/ReservationDataRow.js b/app/pages/manage-reservations/list/ReservationDataRow.js index 9eca1be8d..478c34ffd 100644 --- a/app/pages/manage-reservations/list/ReservationDataRow.js +++ b/app/pages/manage-reservations/list/ReservationDataRow.js @@ -1,4 +1,4 @@ -import { get } from 'lodash'; +import get from 'lodash/get'; import React from 'react'; import PropTypes from 'prop-types'; diff --git a/app/pages/manage-reservations/manageReservationsPageUtils.js b/app/pages/manage-reservations/manageReservationsPageUtils.js index 903d34766..9188e01d6 100644 --- a/app/pages/manage-reservations/manageReservationsPageUtils.js +++ b/app/pages/manage-reservations/manageReservationsPageUtils.js @@ -1,4 +1,4 @@ -import { isEmpty } from 'lodash'; +import isEmpty from 'lodash/isEmpty'; import constants from 'constants/AppConstants'; import { canUserModifyReservation } from 'utils/reservationUtils'; diff --git a/app/pages/reservation/reservation-details/ReservationDetails.js b/app/pages/reservation/reservation-details/ReservationDetails.js index e2b34c5ad..3cc74a36f 100644 --- a/app/pages/reservation/reservation-details/ReservationDetails.js +++ b/app/pages/reservation/reservation-details/ReservationDetails.js @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { Well } from 'react-bootstrap'; +import Well from 'react-bootstrap/lib/Well'; import moment from 'moment'; import injectT from '../../../i18n/injectT'; diff --git a/app/pages/reservation/reservation-information/ReservationSubmitButton.js b/app/pages/reservation/reservation-information/ReservationSubmitButton.js index 623239c35..8e1d64a53 100644 --- a/app/pages/reservation/reservation-information/ReservationSubmitButton.js +++ b/app/pages/reservation/reservation-information/ReservationSubmitButton.js @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { Button } from 'react-bootstrap'; +import Button from 'react-bootstrap/lib/Button'; import injectT from '../../../i18n/injectT'; diff --git a/app/pages/reservation/reservation-products/ReservationProducts.js b/app/pages/reservation/reservation-products/ReservationProducts.js index ad82baff3..dcb5e925b 100644 --- a/app/pages/reservation/reservation-products/ReservationProducts.js +++ b/app/pages/reservation/reservation-products/ReservationProducts.js @@ -1,9 +1,9 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { - Button, Col, Row -} from 'react-bootstrap'; -import { isEmpty } from 'lodash'; +import Button from 'react-bootstrap/lib/Button'; +import Col from 'react-bootstrap/lib/Col'; +import Row from 'react-bootstrap/lib/Row'; +import isEmpty from 'lodash/isEmpty'; import Loader from 'react-loader'; import injectT from '../../../i18n/injectT'; diff --git a/app/pages/reservation/reservation-products/extra-products/ExtraProducts.js b/app/pages/reservation/reservation-products/extra-products/ExtraProducts.js index 367dbc6cc..7886427d5 100644 --- a/app/pages/reservation/reservation-products/extra-products/ExtraProducts.js +++ b/app/pages/reservation/reservation-products/extra-products/ExtraProducts.js @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { Table } from 'react-bootstrap'; +import Table from 'react-bootstrap/lib/Table'; import injectT from '../../../../i18n/injectT'; import { PRODUCT_TYPES } from '../ReservationProductsUtils'; diff --git a/app/pages/reservation/reservation-products/extra-products/QuantityInput.js b/app/pages/reservation/reservation-products/extra-products/QuantityInput.js index 45861530c..88b24b8b6 100644 --- a/app/pages/reservation/reservation-products/extra-products/QuantityInput.js +++ b/app/pages/reservation/reservation-products/extra-products/QuantityInput.js @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { Glyphicon } from 'react-bootstrap'; +import Glyphicon from 'react-bootstrap/lib/Glyphicon'; import injectT from '../../../../i18n/injectT'; diff --git a/app/pages/reservation/reservation-products/mandatory-products/MandatoryProducts.js b/app/pages/reservation/reservation-products/mandatory-products/MandatoryProducts.js index 0e3182a33..399107e06 100644 --- a/app/pages/reservation/reservation-products/mandatory-products/MandatoryProducts.js +++ b/app/pages/reservation/reservation-products/mandatory-products/MandatoryProducts.js @@ -1,6 +1,8 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { Checkbox, Table, Well } from 'react-bootstrap'; +import Checkbox from 'react-bootstrap/lib/Checkbox'; +import Table from 'react-bootstrap/lib/Table'; +import Well from 'react-bootstrap/lib/Well'; import injectT from '../../../../i18n/injectT'; import MandatoryProductTableRow from './MandatoryProductTableRow'; diff --git a/app/pages/reservation/reservation-products/product-time-slots/ProductTimeSlotPrices.js b/app/pages/reservation/reservation-products/product-time-slots/ProductTimeSlotPrices.js index a49a7c70c..0325a6c9e 100644 --- a/app/pages/reservation/reservation-products/product-time-slots/ProductTimeSlotPrices.js +++ b/app/pages/reservation/reservation-products/product-time-slots/ProductTimeSlotPrices.js @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { Panel } from 'react-bootstrap'; +import Panel from 'react-bootstrap/lib/Panel'; import { getPrettifiedPeriodUnits } from 'utils/timeUtils'; import { getTimeSlotMinMaxPrices, PRODUCT_PRICE_TYPES } from '../ReservationProductsUtils'; diff --git a/app/pages/resource/ResourcePage.js b/app/pages/resource/ResourcePage.js index b08874792..de8ce0226 100644 --- a/app/pages/resource/ResourcePage.js +++ b/app/pages/resource/ResourcePage.js @@ -12,7 +12,7 @@ import Col from 'react-bootstrap/lib/Col'; import Panel from 'react-bootstrap/lib/Panel'; import Lightbox from 'lightbox-react'; import 'lightbox-react/style.css'; -import { Button } from 'react-bootstrap'; +import Button from 'react-bootstrap/lib/Button'; import { addNotification } from 'actions/notificationsActions'; import { fetchResource } from 'actions/resourceActions'; diff --git a/app/pages/user-reservations/reservation-list/reservationListSelector.js b/app/pages/user-reservations/reservation-list/reservationListSelector.js index ebd6f068c..df3ab4ebf 100644 --- a/app/pages/user-reservations/reservation-list/reservationListSelector.js +++ b/app/pages/user-reservations/reservation-list/reservationListSelector.js @@ -1,5 +1,7 @@ -import { filter, orderBy, values } from 'lodash'; +import filter from 'lodash/filter'; +import orderBy from 'lodash/orderBy'; +import values from 'lodash/values'; import { createSelector, createStructuredSelector } from 'reselect'; import ActionTypes from 'constants/ActionTypes'; diff --git a/app/resource-outlook-linker/reducer.js b/app/resource-outlook-linker/reducer.js index cc09fc10a..c6d58765a 100644 --- a/app/resource-outlook-linker/reducer.js +++ b/app/resource-outlook-linker/reducer.js @@ -1,8 +1,6 @@ import Immutable from 'seamless-immutable'; -import { - omit, - reduce, -} from 'lodash'; +import omit from 'lodash/omit'; +import reduce from 'lodash/reduce'; import { actionTypes diff --git a/app/shared/form-fields/TermsField.js b/app/shared/form-fields/TermsField.js index 733ba7e5e..f5ba048c1 100644 --- a/app/shared/form-fields/TermsField.js +++ b/app/shared/form-fields/TermsField.js @@ -4,7 +4,7 @@ import Col from 'react-bootstrap/lib/Col'; import RBCheckbox from 'react-bootstrap/lib/Checkbox'; import FormGroup from 'react-bootstrap/lib/FormGroup'; import HelpBlock from 'react-bootstrap/lib/HelpBlock'; -import { Button } from 'react-bootstrap'; +import Button from 'react-bootstrap/lib/Button'; function TermsField({ input, label, labelLink, meta, onClick, isRequired diff --git a/app/shared/modals/reservation-info/ReservationEditForm.js b/app/shared/modals/reservation-info/ReservationEditForm.js index 14daf4acb..c73608e17 100644 --- a/app/shared/modals/reservation-info/ReservationEditForm.js +++ b/app/shared/modals/reservation-info/ReservationEditForm.js @@ -11,7 +11,7 @@ import FormControl from 'react-bootstrap/lib/FormControl'; import FormGroup from 'react-bootstrap/lib/FormGroup'; import Well from 'react-bootstrap/lib/Well'; import { Field, Fields, reduxForm } from 'redux-form'; -import { Row } from 'react-bootstrap'; +import Row from 'react-bootstrap/lib/Row'; import FormTypes from 'constants/FormTypes'; import ReduxFormField from 'shared/form-fields/ReduxFormField'; diff --git a/app/shared/modals/reservation-info/ReservationOrderInfo.js b/app/shared/modals/reservation-info/ReservationOrderInfo.js index c93ce0270..395648595 100644 --- a/app/shared/modals/reservation-info/ReservationOrderInfo.js +++ b/app/shared/modals/reservation-info/ReservationOrderInfo.js @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { Well } from 'react-bootstrap'; +import Well from 'react-bootstrap/lib/Well'; import { decamelizeKeys } from 'humps'; import injectT from '../../../i18n/injectT'; diff --git a/app/shared/modals/reservation-payment/PaymentButton.js b/app/shared/modals/reservation-payment/PaymentButton.js index b09712319..3b9109d6f 100644 --- a/app/shared/modals/reservation-payment/PaymentButton.js +++ b/app/shared/modals/reservation-payment/PaymentButton.js @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { Button } from 'react-bootstrap'; +import Button from 'react-bootstrap/lib/Button'; import constants from '../../../constants/AppConstants'; import injectT from '../../../i18n/injectT'; diff --git a/app/shared/modals/reservation-payment/PaymentModalContainer.js b/app/shared/modals/reservation-payment/PaymentModalContainer.js index b238bc8e1..b835723ec 100644 --- a/app/shared/modals/reservation-payment/PaymentModalContainer.js +++ b/app/shared/modals/reservation-payment/PaymentModalContainer.js @@ -2,7 +2,8 @@ import React, { useEffect, useState } from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; -import { Button, Modal } from 'react-bootstrap'; +import Button from 'react-bootstrap/lib/Button'; +import Modal from 'react-bootstrap/lib/Modal'; import classNames from 'classnames'; import constants from '../../../constants/AppConstants'; diff --git a/app/shared/pagination/NumberedPageButtons.js b/app/shared/pagination/NumberedPageButtons.js index 227aa01c5..b72fc1042 100644 --- a/app/shared/pagination/NumberedPageButtons.js +++ b/app/shared/pagination/NumberedPageButtons.js @@ -1,6 +1,6 @@ import React from 'react'; -import { Button } from 'react-bootstrap'; +import Button from 'react-bootstrap/lib/Button'; import PropTypes from 'prop-types'; import classNames from 'classnames'; diff --git a/app/shared/quality-tools-form/QualityToolsForm.js b/app/shared/quality-tools-form/QualityToolsForm.js index 464dfe1d6..b2a46836f 100644 --- a/app/shared/quality-tools-form/QualityToolsForm.js +++ b/app/shared/quality-tools-form/QualityToolsForm.js @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { Button } from 'react-bootstrap'; +import Button from 'react-bootstrap/lib/Button'; import injectT from '../../i18n/injectT'; import StarInput from './StarInput'; diff --git a/app/shared/service-announcement/ServiceAnnouncement.js b/app/shared/service-announcement/ServiceAnnouncement.js index 35d375cac..2c1e4d27a 100644 --- a/app/shared/service-announcement/ServiceAnnouncement.js +++ b/app/shared/service-announcement/ServiceAnnouncement.js @@ -1,5 +1,6 @@ import React from 'react'; -import { Alert, Button } from 'react-bootstrap'; +import Alert from 'react-bootstrap/lib/Alert'; +import Button from 'react-bootstrap/lib/Button'; import PropTypes from 'prop-types'; import { injectT } from 'i18n'; diff --git a/app/shared/tooltip/TooltipOverlay.js b/app/shared/tooltip/TooltipOverlay.js index ec433d58e..4ddf76d71 100644 --- a/app/shared/tooltip/TooltipOverlay.js +++ b/app/shared/tooltip/TooltipOverlay.js @@ -1,5 +1,6 @@ import React from 'react'; -import { OverlayTrigger, Tooltip as BTTooltip } from 'react-bootstrap'; +import OverlayTrigger from 'react-bootstrap/lib/OverlayTrigger'; +import BTTooltip from 'react-bootstrap/lib/Tooltip'; import PropTypes from 'prop-types'; function TooltipOverlay({ diff --git a/app/shared/top-navbar/mobile/MobileNavbar.js b/app/shared/top-navbar/mobile/MobileNavbar.js index 32557d4bd..084121bce 100644 --- a/app/shared/top-navbar/mobile/MobileNavbar.js +++ b/app/shared/top-navbar/mobile/MobileNavbar.js @@ -1,7 +1,8 @@ import PropTypes from 'prop-types'; import React from 'react'; import classNames from 'classnames'; -import { Col, Row } from 'react-bootstrap'; +import Col from 'react-bootstrap/lib/Col'; +import Row from 'react-bootstrap/lib/Row'; import FontChanger from 'shared/top-navbar/accessibility/TopNavbarFontContainer'; import ContrastChanger from 'shared/top-navbar/accessibility/TopNavbarContrastContainer'; diff --git a/app/utils/languageUtils.js b/app/utils/languageUtils.js index 65a710cd1..676ab03c3 100644 --- a/app/utils/languageUtils.js +++ b/app/utils/languageUtils.js @@ -1,4 +1,5 @@ -import { get, values } from 'lodash'; +import get from 'lodash/get'; +import values from 'lodash/values'; import constants from 'constants/AppConstants';