Hey is a decentralized and permissionless social media app built with Lens Protocol 🌿

refactor: move from common helpers to respective apps

Yoginth 9c23f7ee 335d11ef

+15 -18
+1 -1
apps/web/src/components/Composer/ChooseThumbnail.tsx
··· 1 1 import ThumbnailsShimmer from "@/components/Shared/Shimmer/ThumbnailsShimmer"; 2 2 import { Spinner } from "@/components/Shared/UI"; 3 3 import { generateVideoThumbnails } from "@/helpers/generateVideoThumbnails"; 4 + import getFileFromDataURL from "@/helpers/getFileFromDataURL"; 4 5 import { uploadFileToIPFS } from "@/helpers/uploadToIPFS"; 5 6 import { usePostAttachmentStore } from "@/store/non-persisted/post/usePostAttachmentStore"; 6 7 import { usePostVideoStore } from "@/store/non-persisted/post/usePostVideoStore"; 7 8 import { CheckCircleIcon, PhotoIcon } from "@heroicons/react/24/outline"; 8 - import getFileFromDataURL from "@hey/helpers/getFileFromDataURL"; 9 9 import type { ChangeEvent } from "react"; 10 10 import { useEffect, useState } from "react"; 11 11 import { toast } from "sonner";
+1 -1
apps/web/src/components/Post/OpenAction/CollectAction/CollectActionBody.tsx
··· 11 11 WarningMessage 12 12 } from "@/components/Shared/UI"; 13 13 import { CHAIN } from "@/constants"; 14 - import formatAddress from "@/helpers/formatAddress"; 15 14 import getTokenImage from "@/helpers/getTokenImage"; 16 15 import { 17 16 CheckCircleIcon, ··· 23 22 } from "@heroicons/react/24/outline"; 24 23 import { tokens } from "@hey/data/tokens"; 25 24 import formatDate from "@hey/helpers/datetime/formatDate"; 25 + import formatAddress from "@hey/helpers/formatAddress"; 26 26 import getAccount from "@hey/helpers/getAccount"; 27 27 import humanize from "@hey/helpers/humanize"; 28 28 import nFormatter from "@hey/helpers/nFormatter";
+1 -1
apps/web/src/components/Post/OpenAction/CollectAction/Splits.tsx
··· 2 2 import Slug from "@/components/Shared/Slug"; 3 3 import { Image } from "@/components/Shared/UI"; 4 4 import { CHAIN } from "@/constants"; 5 - import formatAddress from "@/helpers/formatAddress"; 5 + import formatAddress from "@hey/helpers/formatAddress"; 6 6 import getAccount from "@hey/helpers/getAccount"; 7 7 import getAvatar from "@hey/helpers/getAvatar"; 8 8 import { type RecipientPercent, useAccountsBulkQuery } from "@hey/indexer";
+1 -1
apps/web/src/components/Shared/Account/WalletAccount.tsx
··· 1 1 import { Image } from "@/components/Shared/UI"; 2 2 import { CHAIN } from "@/constants"; 3 - import formatAddress from "@/helpers/formatAddress"; 4 3 import { ArrowTopRightOnSquareIcon } from "@heroicons/react/24/outline"; 5 4 import { DEFAULT_AVATAR } from "@hey/data/constants"; 5 + import formatAddress from "@hey/helpers/formatAddress"; 6 6 import { Link } from "react-router"; 7 7 import type { Address } from "viem"; 8 8 import { useEnsName } from "wagmi";
+1 -1
apps/web/src/components/Staff/Account/Tool/AccountOverview.tsx
··· 1 1 import MetaDetails from "@/components/Shared/MetaDetails"; 2 2 import { H5 } from "@/components/Shared/UI"; 3 - import formatAddress from "@/helpers/formatAddress"; 4 3 import { BanknotesIcon, HashtagIcon } from "@heroicons/react/24/outline"; 5 4 import { ShieldCheckIcon } from "@heroicons/react/24/solid"; 5 + import formatAddress from "@hey/helpers/formatAddress"; 6 6 import type { AccountFragment } from "@hey/indexer"; 7 7 8 8 interface AccountOverviewProps {
apps/web/src/helpers/formatAddress.ts packages/helpers/formatAddress.ts
+10 -2
packages/helpers/getAccount.ts
··· 1 1 import { LENS_NAMESPACE } from "@hey/data/constants"; 2 + import { Regex } from "@hey/data/regex"; 2 3 import type { AccountFragment } from "@hey/indexer"; 3 - import formatAddress from "../../apps/web/src/helpers/formatAddress"; 4 + import formatAddress from "./formatAddress"; 4 5 import isAccountDeleted from "./isAccountDeleted"; 5 - import sanitizeDisplayName from "./sanitizeDisplayName"; 6 + 7 + const sanitizeDisplayName = (name?: null | string): null | string => { 8 + if (!name) { 9 + return null; 10 + } 11 + 12 + return name.replace(Regex.accountNameFilter, " ").trim().replace(/\s+/g, " "); 13 + }; 6 14 7 15 const getAccount = ( 8 16 account?: AccountFragment
packages/helpers/getFileFromDataURL.ts apps/web/src/helpers/getFileFromDataURL.ts
-11
packages/helpers/sanitizeDisplayName.ts
··· 1 - import { Regex } from "@hey/data/regex"; 2 - 3 - const sanitizeDisplayName = (name?: null | string): null | string => { 4 - if (!name) { 5 - return null; 6 - } 7 - 8 - return name.replace(Regex.accountNameFilter, " ").trim().replace(/\s+/g, " "); 9 - }; 10 - 11 - export default sanitizeDisplayName;