diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f2effc53..9a1b414f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Prevent unncessary import of mongoose package by frontend #466 - Switching eth wallet should result in logging out the user #469 - Logging out of MetaMask causes EthAccount in navigation to disappear #470 +- Changed lodash imports to single method import #486 ## [0.8.0] - 2022-06-06 diff --git a/packages/api/src/period/controllers/assignment.ts b/packages/api/src/period/controllers/assignment.ts index 0d990609a..05b0ee0ff 100644 --- a/packages/api/src/period/controllers/assignment.ts +++ b/packages/api/src/period/controllers/assignment.ts @@ -14,7 +14,11 @@ import { EventLogTypeKey } from '@eventlog/types'; import { logEvent } from '@eventlog/utils'; import { firstFit, PackingOutput } from 'bin-packer'; import logger from 'jet-logger'; -import { flatten, intersection, range, sum, zip } from 'lodash'; +import flatten from 'lodash/flatten'; +import intersection from 'lodash/intersection'; +import range from 'lodash/range'; +import sum from 'lodash/sum'; +import zip from 'lodash/zip'; import { StatusCodes } from 'http-status-codes'; import { Request } from 'express'; import greedyPartitioning from 'greedy-number-partitioning'; diff --git a/packages/api/src/period/utils.ts b/packages/api/src/period/utils.ts index eed9a67ce..3e2a5b315 100644 --- a/packages/api/src/period/utils.ts +++ b/packages/api/src/period/utils.ts @@ -4,7 +4,7 @@ import { calculateReceiverCompositeScore } from '@praise/utils/score'; import { periodsettingListTransformer } from '@periodsettings/transformers'; import { PeriodSettingsModel } from '@periodsettings/entities'; import { settingValue } from '@shared/settings'; -import { some } from 'lodash'; +import some from 'lodash/some'; import { PeriodModel } from './entities'; import { periodDetailsReceiverListTransformer, diff --git a/packages/api/src/praise/utils/score.ts b/packages/api/src/praise/utils/score.ts index 119c4c6cd..f9efe71a1 100644 --- a/packages/api/src/praise/utils/score.ts +++ b/packages/api/src/praise/utils/score.ts @@ -2,7 +2,7 @@ import { BadRequestError } from '@error/errors'; import { settingValue } from '@shared/settings'; import { PeriodDetailsReceiver } from '@period/types'; import { Types } from 'mongoose'; -import { sum } from 'lodash'; +import sum from 'lodash/sum'; import { PraiseModel } from '../entities'; import { Quantification } from '../types'; import { getPraisePeriod, isQuantificationCompleted } from './core'; diff --git a/packages/api/src/tests/score.spec.ts b/packages/api/src/tests/score.spec.ts index 2b15eb333..8af69043e 100644 --- a/packages/api/src/tests/score.spec.ts +++ b/packages/api/src/tests/score.spec.ts @@ -15,7 +15,7 @@ import { PeriodModel } from '@period/entities'; import { PeriodDetailsReceiver } from '@period/types'; import { PraiseModel } from '@praise/entities'; import { settingValue } from '@shared/settings'; -import { sum } from 'lodash'; +import sum from 'lodash/sum'; import { getPeriodDateRangeQuery } from '@period/utils'; import faker from 'faker'; import { add } from 'date-fns'; diff --git a/packages/frontend/src/components/eventlog/EventLog.tsx b/packages/frontend/src/components/eventlog/EventLog.tsx index 6cfd47874..e292ca76b 100644 --- a/packages/frontend/src/components/eventlog/EventLog.tsx +++ b/packages/frontend/src/components/eventlog/EventLog.tsx @@ -31,8 +31,6 @@ interface Params { const EventLog = ({ eventlog, className = '' }: Params): JSX.Element | null => { const user = useRecoilValue(SingleUser(eventlog.user)); - console.log(eventlog); - return (
diff --git a/packages/frontend/src/components/form/DayInput.tsx b/packages/frontend/src/components/form/DayInput.tsx index 854b999a1..d4cfd4b94 100644 --- a/packages/frontend/src/components/form/DayInput.tsx +++ b/packages/frontend/src/components/form/DayInput.tsx @@ -32,7 +32,6 @@ const DayInput = ({ const [pickerVisible, setPickerVisible] = useState(false); const handleDayClick = (day: Date): void => { - console.log('day clicked is', day); onChange(formatIsoDateUTC(day.toISOString(), DATE_FORMAT)); setPickerVisible(false); }; diff --git a/packages/frontend/src/components/form/MultiselectInput.tsx b/packages/frontend/src/components/form/MultiselectInput.tsx index c4d1e636c..f74ba64dc 100644 --- a/packages/frontend/src/components/form/MultiselectInput.tsx +++ b/packages/frontend/src/components/form/MultiselectInput.tsx @@ -22,7 +22,7 @@ const MultiselectInput = ({ noSelectedMessage, }: MultiselectInputProps): JSX.Element => { return ( -
+
{(): JSX.Element => ( diff --git a/packages/frontend/src/components/form/SelectInput.tsx b/packages/frontend/src/components/form/SelectInput.tsx index 483cf120d..24d095ae9 100644 --- a/packages/frontend/src/components/form/SelectInput.tsx +++ b/packages/frontend/src/components/form/SelectInput.tsx @@ -23,7 +23,7 @@ const SelectInput = ({ icon, }: SelectInputProps): JSX.Element => { return ( -
+
{selected.label} diff --git a/packages/frontend/src/components/settings/SettingsForm.tsx b/packages/frontend/src/components/settings/SettingsForm.tsx index 62b5beb7f..dbae009f7 100644 --- a/packages/frontend/src/components/settings/SettingsForm.tsx +++ b/packages/frontend/src/components/settings/SettingsForm.tsx @@ -11,7 +11,7 @@ import { } from '@/model/settings'; import { Form } from 'react-final-form'; import { useRecoilValue } from 'recoil'; -import { find } from 'lodash'; +import find from 'lodash/find'; import SubmitButton from '../form/SubmitButton'; import { PeriodSettingDto } from 'api/src/periodsettings/types'; import { SettingDto } from 'api/dist/settings/types'; diff --git a/packages/frontend/src/index.tsx b/packages/frontend/src/index.tsx index 5da5f26e2..ea3512ac9 100644 --- a/packages/frontend/src/index.tsx +++ b/packages/frontend/src/index.tsx @@ -16,7 +16,7 @@ import { Theme as RainbowTheme, darkTheme, } from '@rainbow-me/rainbowkit'; -import { merge } from 'lodash'; +import merge from 'lodash/merge'; import { configureChains, createClient, WagmiConfig, chain } from 'wagmi'; import { publicProvider } from 'wagmi/providers/public'; import Routes from './navigation/Routes'; diff --git a/packages/frontend/src/model/periodsettings.ts b/packages/frontend/src/model/periodsettings.ts index 171f5467d..1df78a403 100644 --- a/packages/frontend/src/model/periodsettings.ts +++ b/packages/frontend/src/model/periodsettings.ts @@ -8,7 +8,7 @@ import { useRecoilCallback, useRecoilValue, } from 'recoil'; -import { find } from 'lodash'; +import find from 'lodash/find'; import { ApiAuthGet, useAuthApiQuery, isResponseOk } from './api'; import { Setting, useSetSettingReturn } from './settings'; import { PeriodSettingDto } from 'api/src/periodsettings/types'; diff --git a/packages/frontend/src/navigation/AuthenticatedRoutes.tsx b/packages/frontend/src/navigation/AuthenticatedRoutes.tsx index 3ff71b41b..9456cbb4e 100644 --- a/packages/frontend/src/navigation/AuthenticatedRoutes.tsx +++ b/packages/frontend/src/navigation/AuthenticatedRoutes.tsx @@ -3,7 +3,7 @@ import StartPage from '@/pages/Start/StartPage'; import { ROLE_ADMIN, ROLE_QUANTIFIER } from '@/model/auth'; import React from 'react'; import { Redirect, Route, Switch } from 'react-router-dom'; -import { difference } from 'lodash'; +import difference from 'lodash/difference'; const MyPraisePage = React.lazy(() => import('@/pages/MyPraise/MyPraisePage')); const UserDetailsPage = React.lazy( diff --git a/packages/frontend/src/pages/Activate/ActivatePage.tsx b/packages/frontend/src/pages/Activate/ActivatePage.tsx index 847f665a5..8d0f0af2e 100644 --- a/packages/frontend/src/pages/Activate/ActivatePage.tsx +++ b/packages/frontend/src/pages/Activate/ActivatePage.tsx @@ -7,7 +7,8 @@ import { useState, useEffect } from 'react'; import { toast } from 'react-hot-toast'; import { useHistory, useLocation } from 'react-router-dom'; import { useRecoilValue } from 'recoil'; -import { upperFirst, lowerCase } from 'lodash'; +import upperFirst from 'lodash/upperFirst'; +import lowerCase from 'lodash/lowerCase'; import { useAccount } from 'wagmi'; import { requestApiActivate } from '@/utils/auth'; import SignMessageLayout from '../../layouts/SignMessageLayout'; diff --git a/packages/frontend/src/pages/EventLogs/EventLogsPage.tsx b/packages/frontend/src/pages/EventLogs/EventLogsPage.tsx index faef1af07..a3757045d 100644 --- a/packages/frontend/src/pages/EventLogs/EventLogsPage.tsx +++ b/packages/frontend/src/pages/EventLogs/EventLogsPage.tsx @@ -96,7 +96,7 @@ const EventLogsPage = (): JSX.Element => {
{/* Filter */} -
+
{ setSelectedFilters(e); @@ -109,7 +109,7 @@ const EventLogsPage = (): JSX.Element => {
{/* Search */} -
+
{ setSearchValue(e); @@ -120,7 +120,7 @@ const EventLogsPage = (): JSX.Element => {
{/* Sort */} -
+
{ setSelectedSort(e); diff --git a/packages/frontend/src/pages/EventLogs/components/EventLogsList.tsx b/packages/frontend/src/pages/EventLogs/components/EventLogsList.tsx index 4622d4dc1..c22cb0e86 100644 --- a/packages/frontend/src/pages/EventLogs/components/EventLogsList.tsx +++ b/packages/frontend/src/pages/EventLogs/components/EventLogsList.tsx @@ -34,8 +34,8 @@ const EventLogsTable = ({ ))}
{(data.hasNextPage || data.hasPrevPage) && ( -
-
+
+
{data.hasPrevPage && ( Previous )}
-
+
{data.hasNextPage && ( )} diff --git a/packages/frontend/src/pages/Periods/Details/components/QuantifierTable.tsx b/packages/frontend/src/pages/Periods/Details/components/QuantifierTable.tsx index 92481678c..e9010acc1 100644 --- a/packages/frontend/src/pages/Periods/Details/components/QuantifierTable.tsx +++ b/packages/frontend/src/pages/Periods/Details/components/QuantifierTable.tsx @@ -6,7 +6,7 @@ import React from 'react'; import { useParams } from 'react-router-dom'; import { TableOptions, useTable } from 'react-table'; import { useRecoilValue } from 'recoil'; -import { sortBy } from 'lodash'; +import sortBy from 'lodash/sortBy'; import { classNames } from '@/utils/index'; import { UserAvatarAndName } from '@/components/user/UserAvatarAndName'; diff --git a/packages/frontend/src/pages/Periods/Details/components/ReceiverTable.tsx b/packages/frontend/src/pages/Periods/Details/components/ReceiverTable.tsx index e0c01a7a8..2868e81df 100644 --- a/packages/frontend/src/pages/Periods/Details/components/ReceiverTable.tsx +++ b/packages/frontend/src/pages/Periods/Details/components/ReceiverTable.tsx @@ -6,7 +6,7 @@ import React from 'react'; import { useHistory, useParams } from 'react-router-dom'; import { TableOptions, useSortBy, useTable } from 'react-table'; import { useRecoilValue } from 'recoil'; -import { sortBy } from 'lodash'; +import sortBy from 'lodash/sortBy'; import { classNames } from '@/utils/index'; import { UserAvatarAndName } from '@/components/user/UserAvatarAndName'; diff --git a/packages/frontend/src/pages/QuantifyPeriodReceiver/components/QuantifyTable.tsx b/packages/frontend/src/pages/QuantifyPeriodReceiver/components/QuantifyTable.tsx index 7dcc91c9e..9cd49296b 100644 --- a/packages/frontend/src/pages/QuantifyPeriodReceiver/components/QuantifyTable.tsx +++ b/packages/frontend/src/pages/QuantifyPeriodReceiver/components/QuantifyTable.tsx @@ -4,7 +4,8 @@ import { useQuantifyPraise } from '@/model/praise'; import { usePeriodSettingValueRealized } from '@/model/periodsettings'; import getWeek from 'date-fns/getWeek'; import parseISO from 'date-fns/parseISO'; -import { groupBy, sortBy } from 'lodash'; +import groupBy from 'lodash/groupBy'; +import sortBy from 'lodash/sortBy'; import React from 'react'; import { useRecoilValue } from 'recoil'; import { QuantifyBackNextLink } from './BackNextLink';