Skip to content

Commit

Permalink
Revert "CW-mobile-perfromance Remove unnecessary libraries"
Browse files Browse the repository at this point in the history
This reverts commit 51142e5.
  • Loading branch information
MeyerPV committed Aug 12, 2024
1 parent 9d245d0 commit 2be85e8
Show file tree
Hide file tree
Showing 38 changed files with 66 additions and 59 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@
"firebase": "^10.7.1",
"formik": "^2.2.1",
"google-libphonenumber": "^3.2.28",
"http-status-codes": "^2.2.0",
"i18next": "^21.9.1",
"immer": "^9.0.16",
"immutable": "^4.2.0",
"is-hotkey": "^0.2.0",
"jszip": "^3.7.1",
"lodash-es": "^4.17.21",
"lodash": "^4.17.20",
"millify": "^3.5.2",
"moment": "^2.29.1",
"node-sass": "^4.14.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useDispatch, useSelector } from "react-redux";
import { MultiValue, SingleValue } from "react-select";
import classNames from "classnames";
import { Formik } from "formik";
import { omit } from "lodash-es";
import { omit } from "lodash";
import * as Yup from "yup";
import { createDiscussion } from "@/pages/OldCommon/store/actions";
import { getCommonGovernanceCircles } from "@/pages/OldCommon/store/api";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { lowerCase, startCase } from "lodash-es";
import { lowerCase, startCase } from "lodash";
import { GovernanceActions } from "@/shared/constants";
import { AllowedActions } from "@/shared/models";
import { commonTypeText } from "@/shared/utils";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
intersectionBy,
isEmpty,
isEqual,
} from "lodash-es";
} from "lodash";
import { Button, Separator } from "@/shared/components";
import { Form, RulesArray } from "@/shared/components/Form/Formik";
import { ModalFooter, ModalHeaderContent } from "@/shared/components/Modal";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { useDispatch, useSelector } from "react-redux";
import { useDebounce, useMeasure, useScroll } from "react-use";
import classNames from "classnames";
import isHotkey from "is-hotkey";
import { debounce, delay, omit } from "lodash-es";
import { debounce, delay, omit } from "lodash";
import { v4 as uuidv4 } from "uuid";
import { selectUser } from "@/pages/Auth/store/selectors";
import { ChatService, DiscussionMessageService, FileService } from "@/services";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { findLast } from "lodash-es";
import findLast from "lodash/findLast";
import {
checkIsUserDiscussionMessage,
DiscussionMessage,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { FC, useEffect, useMemo } from "react";
import { useDispatch } from "react-redux";
import { useFormikContext } from "formik";
import { debounce } from "lodash-es";
import debounce from "lodash/debounce";
import { NewDiscussionCreationFormValues } from "@/shared/interfaces";
import { commonActions } from "@/store/states";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { FC, useEffect, useMemo } from "react";
import { useDispatch } from "react-redux";
import { useFormikContext } from "formik";
import { debounce } from "lodash-es";
import debounce from "lodash/debounce";
import { NewProposalCreationFormValues } from "@/shared/interfaces";
import { commonActions } from "@/store/states";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { FC, useMemo } from "react";
import { flattenDeep, uniq } from "lodash-es";
import { flattenDeep, uniq } from "lodash";
import { ProposalsTypes } from "@/shared/constants";
import { Circles, Governance } from "@/shared/models";
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import React, {
} from "react";
import { useSelector } from "react-redux";
import { useUpdateEffect } from "react-use";
import { debounce } from "lodash-es";
import { debounce } from "lodash";
import { selectUser } from "@/pages/Auth/store/selectors";
import { DiscussionService } from "@/services";
import { DeletePrompt, GlobalOverlay, ReportModal } from "@/shared/components";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { FC, useRef, useState } from "react";
import { useSelector } from "react-redux";
import { CancelTokenSource } from "axios";
import classNames from "classnames";
import { isError } from "lodash-es";
import { isError } from "lodash";
import { selectUser } from "@/pages/Auth/store/selectors";
import {
CommonFeedService,
Expand Down Expand Up @@ -71,11 +71,7 @@ const UnlinkStreamModal: FC<UnlinkStreamModalProps> = (props) => {
cancelTokenRef.current = null;
}
setIsUnlinking(false);
setErrorText(
isError(error)
? (error as Record<string, string>)?.message
: "Something went wrong...",
);
setErrorText(isError(error) ? error.message : "Something went wrong...");
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import React, {
} from "react";
import { useSelector } from "react-redux";
import { useUpdateEffect } from "react-use";
import { debounce } from "lodash-es";
import { debounce } from "lodash";
import { selectUser } from "@/pages/Auth/store/selectors";
import { useCommonMember, useProposalUserVote } from "@/pages/OldCommon/hooks";
import { ProposalService } from "@/services";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { debounce } from "lodash-es";
import { debounce } from "lodash";
import { StorageKey } from "@/shared/constants";

export const saveChatSize = debounce((size: number) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useCallback, useEffect, useState } from "react";
import { debounce } from "lodash-es";
import { debounce } from "lodash";
import { QueryParamKey } from "@/shared/constants";
import { ToggleState, useQueryParams, useToggle } from "@/shared/hooks";
import { addQueryParam, deleteQueryParam } from "@/shared/utils";
Expand Down
2 changes: 1 addition & 1 deletion src/pages/commonFeed/hooks/useCommonData/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { RefObject, useCallback, useRef, useState } from "react";
import { last } from "lodash-es";
import { last } from "lodash";
import {
CommonFeedService,
CommonService,
Expand Down
2 changes: 1 addition & 1 deletion src/services/Common.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isEqual } from "lodash-es";
import { isEqual } from "lodash";
import {
getCommonState,
updateCommonState,
Expand Down
2 changes: 1 addition & 1 deletion src/shared/components/Chat/ChatMessage/ChatMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import React, {
} from "react";
import { useDispatch } from "react-redux";
import classNames from "classnames";
import { isEmpty } from "lodash-es";
import { isEmpty } from "lodash";
import { Element } from "slate";
import { useLongPress } from "use-long-press";
import * as oldCommonActions from "@/pages/OldCommon/store/actions";
Expand Down
2 changes: 1 addition & 1 deletion src/shared/components/Chat/ChatMessage/DMChatMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import React, {
import { useDispatch } from "react-redux";
import { usePrevious } from "react-use";
import classNames from "classnames";
import { isEmpty, isEqual } from "lodash-es";
import { isEmpty, isEqual } from "lodash";
import { Element } from "slate";
import { useLongPress } from "use-long-press";
import { ChatService, Logger } from "@/services";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import React, {
useState,
} from "react";
import { useSelector } from "react-redux";
import { isEmpty } from "lodash-es";
import { isEmpty } from "lodash";
import { selectUser } from "@/pages/Auth/store/selectors";
import { Logger } from "@/services";
import { UserAvatar } from "@/shared/components/UserAvatar";
Expand Down
2 changes: 1 addition & 1 deletion src/shared/components/Dropdown/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
closeMenu,
} from "react-aria-menubutton";
import classNames from "classnames";
import { isEqual } from "lodash-es";
import { isEqual } from "lodash";
import { v4 as uuidv4 } from "uuid";
import { useChatContentContext } from "@/pages/common/components/CommonContent/context";
import { Loader } from "@/shared/components";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import React, {
ForwardRefRenderFunction,
} from "react";
import classNames from "classnames";
import throttle from "lodash-es/throttle";
import { Swiper, SwiperSlide } from "swiper/react";
import SwiperClass from "swiper/types/swiper-class";
import throttle from "lodash/throttle";
import DownloadIcon from "../../../icons/download.icon";
import LeftArrowIcon from "../../../icons/leftArrow.icon";
import RightArrowIcon from "../../../icons/rightArrow.icon";
import { DocInfo } from "../../../models";
import { saveZip } from "../../../utils";
import { DocInfo } from "../../../models";
import { ButtonIcon } from "../../ButtonIcon";
import { InvoiceTile } from "../../InvoiceTile";
import { getSwiperConfig } from "./helpers";
Expand Down Expand Up @@ -45,8 +45,10 @@ const AllFilesCarousel: ForwardRefRenderFunction<
initialDocIndex,
onDocClick,
} = props;
const [swiperWrapperRef, setSwiperWrapperRef] =
useState<HTMLDivElement | null>(null);
const [
swiperWrapperRef,
setSwiperWrapperRef,
] = useState<HTMLDivElement | null>(null);
const [{ isBeginning, isEnd }, setSlideState] = useState<{
isBeginning: boolean;
isEnd: boolean;
Expand All @@ -57,7 +59,7 @@ const AllFilesCarousel: ForwardRefRenderFunction<
const swiperClientWidth = swiperWrapperRef?.clientWidth || 0;
const swiperConfig = useMemo(
() => getSwiperConfig(payoutDocs.length, swiperClientWidth),
[payoutDocs.length, swiperClientWidth],
[payoutDocs.length, swiperClientWidth]
);

const handleSlideChange = useCallback(
Expand All @@ -68,17 +70,17 @@ const AllFilesCarousel: ForwardRefRenderFunction<
: {
isBeginning,
isEnd,
},
}
);
},
[],
[]
);
const handleSwiper = useCallback(
(swiper: SwiperClass) => {
swiperRef.current = swiper;
handleSlideChange(swiper);
},
[handleSlideChange],
[handleSlideChange]
);

const handleLeftClick = () => {
Expand Down Expand Up @@ -129,14 +131,14 @@ const AllFilesCarousel: ForwardRefRenderFunction<
swiperRef.current?.slideTo(index);
},
}),
[],
[]
);

const contentWrapperClassName = classNames(
"all-files-carousel-wrapper__content-wrapper",
{
"all-files-carousel-wrapper__content-wrapper--without-actions": false,
},
}
);

return (
Expand All @@ -157,8 +159,7 @@ const AllFilesCarousel: ForwardRefRenderFunction<
<div className={contentWrapperClassName}>
<ButtonIcon
className={classNames("all-files-carousel-wrapper__button-icon", {
"all-files-carousel-wrapper__button-icon--hidden":
!swiperConfig.scrollable,
"all-files-carousel-wrapper__button-icon--hidden": !swiperConfig.scrollable,
})}
onClick={handleLeftClick}
disabled={!swiperConfig.scrollable || isBeginning}
Expand All @@ -183,14 +184,13 @@ const AllFilesCarousel: ForwardRefRenderFunction<
"all-files-carousel-wrapper__invoice-tile",
{
"all-files-carousel-wrapper__invoice-tile--active": isActive,
},
}
);
const imageClassName = classNames(
"all-files-carousel-wrapper__invoice-tile-image",
{
"all-files-carousel-wrapper__invoice-tile-image--active":
isActive,
},
"all-files-carousel-wrapper__invoice-tile-image--active": isActive,
}
);

return (
Expand All @@ -212,8 +212,7 @@ const AllFilesCarousel: ForwardRefRenderFunction<
</div>
<ButtonIcon
className={classNames("all-files-carousel-wrapper__button-icon", {
"all-files-carousel-wrapper__button-icon--hidden":
!swiperConfig.scrollable,
"all-files-carousel-wrapper__button-icon--hidden": !swiperConfig.scrollable,
})}
onClick={handleRightClick}
disabled={!swiperConfig.scrollable || isEnd}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { FC, useMemo, useRef } from "react";
import classNames from "classnames";
import { FieldArray, useFormikContext } from "formik";
import { min, max, uniqBy } from "lodash-es";
import { min, max, uniqBy } from "lodash";
import { Option } from "@/shared/components/Dropdown/Dropdown";
import { Dropdown } from "@/shared/components/Form/Formik";
import { Modal } from "@/shared/components/Modal";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useCallback, FC } from "react";
import classNames from "classnames";
import { upperFirst } from "lodash-es";
import { upperFirst } from "lodash";
import { useRadioButtonGroupContext } from "../context";
import "./index.scss";

Expand Down
2 changes: 1 addition & 1 deletion src/shared/hooks/useCases/useCommonPinnedFeedItems.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useEffect } from "react";
import { useDispatch, useSelector } from "react-redux";
import { usePreviousDistinct } from "react-use";
import { difference } from "lodash-es";
import difference from "lodash/difference";
import { CommonFeedService } from "@/services";
import {
commonActions,
Expand Down
2 changes: 1 addition & 1 deletion src/shared/hooks/useCases/useFullCommonData/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useCallback, useState } from "react";
import { last } from "lodash-es";
import { last } from "lodash";
import { CommonService, GovernanceService } from "@/services";
import { useSupportersData } from "@/shared/hooks/useCases";
import { Common } from "@/shared/models";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { truncate } from "lodash-es";
import { truncate } from "lodash";

const OMISSION = "...";
const MOBILE_MAXIMUM_ITEM_LENGTH = 10 + OMISSION.length;
Expand Down
2 changes: 1 addition & 1 deletion src/shared/ui-kit/TextEditor/BaseTextEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import React, {
} from "react";
import { useDebounce } from "react-use";
import classNames from "classnames";
import { isEqual } from "lodash-es";
import { isEqual } from "lodash";
import {
createEditor,
Transforms,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { FC, useEffect, useMemo, useRef, useState } from "react";
import { uniq } from "lodash-es";
import { uniq } from "lodash";
import { UserAvatar } from "@/shared/components";
import { AI_PRO_USER, AI_USER, FeatureFlags } from "@/shared/constants";
import { KeyboardKeys } from "@/shared/constants/keyboardKeys";
Expand Down
2 changes: 1 addition & 1 deletion src/shared/utils/circles.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { uniqBy } from "lodash-es";
import uniqBy from "lodash/uniqBy";
import { Circle, CommonFeedType } from "../models";

export const getFilteredByIdCircles = (
Expand Down
2 changes: 1 addition & 1 deletion src/shared/utils/convertDatesToFirestoreTimestamps.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { get, set } from "lodash-es";
import { get, set } from "lodash";
import { SynchronizedDate } from "@/shared/interfaces";
import { Timestamp } from "@/shared/models";
import { checkIsSynchronizedDate } from "@/shared/utils";
Expand Down
2 changes: 1 addition & 1 deletion src/shared/utils/proposals.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { lowerCase, startCase } from "lodash-es";
import { lowerCase, startCase } from "lodash";
import { ProposalsTypes } from "@/shared/constants";
import { CommonMember, Governance } from "@/shared/models";
import { generateCirclesDataForCommonMember } from "./generateCircleDataForCommonMember";
Expand Down
2 changes: 1 addition & 1 deletion src/shared/utils/shared.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { words } from "lodash-es";
import { words } from "lodash";
import millify from "millify";
import moment from "moment";
import { store } from "@/shared/appConfig";
Expand Down
2 changes: 1 addition & 1 deletion src/store/states/cache/reducer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import produce from "immer";
import { unionBy, cloneDeep } from "lodash-es";
import { unionBy, cloneDeep } from "lodash";
import { ActionType, createReducer } from "typesafe-actions";
import {
getChatChannelUserStatusKey,
Expand Down
2 changes: 1 addition & 1 deletion src/store/states/common/reducer.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import produce from "immer";
import { WritableDraft } from "immer/dist/types/types-external";
import { differenceBy } from "lodash-es";
import { differenceBy } from "lodash";
import { ActionType, createReducer } from "typesafe-actions";
import { InboxItemType } from "@/shared/constants";
import {
Expand Down
2 changes: 1 addition & 1 deletion src/store/states/common/saga/getFeedItems.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { uniqBy } from "lodash-es";
import { uniqBy } from "lodash";
import { call, put, select } from "redux-saga/effects";
import { selectUser } from "@/pages/Auth/store/selectors";
import { CommonFeedService } from "@/services";
Expand Down
Loading

0 comments on commit 2be85e8

Please sign in to comment.