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

refactor: remove 'as const' assertions from multiple files for consistency and clarity

yoginth.com 57485618 03e3c502

verified
+47 -58
+1 -1
apps/web/src/components/Notification/List.tsx
··· 32 32 ReactionNotification, 33 33 RepostNotification, 34 34 TokenDistributedNotification 35 - } as const; 35 + }; 36 36 37 37 interface ListProps { 38 38 feedType: string;
+38 -49
apps/web/src/components/Post/PostAccount.tsx
··· 1 + import { ChevronRightIcon } from "@heroicons/react/24/outline"; 1 2 import { CheckBadgeIcon } from "@heroicons/react/24/solid"; 2 3 import { TRANSFORMS } from "@hey/data/constants"; 3 4 import getAccount from "@hey/helpers/getAccount"; ··· 7 8 AnyPostFragment, 8 9 PostGroupInfoFragment 9 10 } from "@hey/indexer"; 10 - import type { ReactNode } from "react"; 11 11 import { memo } from "react"; 12 12 import { Link } from "react-router"; 13 13 import AccountLink from "@/components/Shared/Account/AccountLink"; 14 14 import AccountPreview from "@/components/Shared/Account/AccountPreview"; 15 15 import PostLink from "@/components/Shared/Post/PostLink"; 16 - import Slug from "@/components/Shared/Slug"; 17 16 import { Image } from "@/components/Shared/UI"; 18 17 import formatRelativeOrAbsolute from "@/helpers/datetime/formatRelativeOrAbsolute"; 19 18 ··· 25 24 } 26 25 27 26 const PostAccount = ({ account, group, post, timestamp }: PostAccountProps) => { 28 - const CustomLink = ({ children }: { children: ReactNode }) => ( 29 - <AccountLink 30 - account={account} 31 - className="outline-hidden hover:underline focus:underline" 32 - > 33 - <AccountPreview 34 - address={account.address} 35 - showUserPreview 36 - username={account.username?.localName} 37 - > 38 - {children} 39 - </AccountPreview> 40 - </AccountLink> 41 - ); 42 - 43 27 return ( 44 28 <div className="flex flex-col"> 45 29 <div className="flex flex-wrap items-center gap-x-1"> 46 - <CustomLink> 47 - <span className="flex items-center gap-x-1 font-semibold"> 48 - {getAccount(account).name} 49 - {account.hasSubscribed && ( 50 - <CheckBadgeIcon className="size-4 text-brand-500" /> 51 - )} 52 - </span> 53 - </CustomLink> 54 - <CustomLink> 55 - <Slug 56 - className="text-sm" 57 - slug={getAccount(account).usernameWithPrefix} 58 - /> 59 - </CustomLink> 30 + <AccountLink 31 + account={account} 32 + className="outline-hidden hover:underline focus:underline" 33 + > 34 + <AccountPreview 35 + address={account.address} 36 + showUserPreview 37 + username={account.username?.localName} 38 + > 39 + <span className="flex items-center gap-x-1 font-semibold"> 40 + {account.preferNameInFeed 41 + ? getAccount(account).name 42 + : getAccount(account).usernameWithPrefix} 43 + {account.hasSubscribed && ( 44 + <CheckBadgeIcon className="size-4 text-brand-500" /> 45 + )} 46 + </span> 47 + </AccountPreview> 48 + </AccountLink> 49 + {group?.metadata ? ( 50 + <> 51 + <ChevronRightIcon className="size-4 text-gray-500" /> 52 + <Link 53 + className="flex items-center gap-x-1 hover:underline focus:underline" 54 + to={`/g/${group.address}`} 55 + > 56 + <Image 57 + alt={group.metadata.name} 58 + className="size-4 rounded-sm" 59 + src={getAvatar(group, TRANSFORMS.AVATAR_TINY)} 60 + /> 61 + <span className="truncate text-sm">{group.metadata.name}</span> 62 + </Link> 63 + </> 64 + ) : null} 60 65 {timestamp ? ( 61 - <span className="text-gray-500 dark:text-gray-200"> 62 - <span className="mr-1">·</span> 63 - <PostLink className="text-xs hover:underline" post={post}> 66 + <span className="ml-1 text-gray-500 dark:text-gray-200"> 67 + <PostLink className="text-sm hover:underline" post={post}> 64 68 {formatRelativeOrAbsolute(timestamp)} 65 69 </PostLink> 66 70 </span> 67 71 ) : null} 68 72 </div> 69 - {group?.metadata ? ( 70 - <Link 71 - className="mt-0.5 mb-2 flex w-fit max-w-sm items-center gap-x-1 text-xs hover:underline focus:underline" 72 - to={`/g/${group.address}`} 73 - > 74 - <Image 75 - alt={group.metadata.name} 76 - className="size-4 rounded-sm" 77 - src={getAvatar(group, TRANSFORMS.AVATAR_TINY)} 78 - /> 79 - <span className="truncate text-gray-500 dark:text-gray-200"> 80 - {group.metadata.name} 81 - </span> 82 - </Link> 83 - ) : null} 84 73 </div> 85 74 ); 86 75 };
+1 -1
apps/web/src/helpers/getWalletDetails.ts
··· 18 18 logo: `${STATIC_IMAGES_URL}/wallets/walletconnect.svg`, 19 19 name: "Wallet Connect" 20 20 } 21 - } as const; 21 + }; 22 22 23 23 type WalletId = keyof typeof WALLETS; 24 24
+1 -1
apps/web/src/helpers/shortcuts.ts
··· 11 11 GoToSearch: { key: "g+s", name: "Go to Search" }, 12 12 GoToSettings: { key: "g+t", name: "Go to Settings" }, 13 13 ThisModal: { key: "?", name: "Shortcut help" } 14 - } as const; 14 + }; 15 15 16 16 export type ShortcutName = keyof typeof KeyboardShortcuts; 17 17 export default KeyboardShortcuts;
+2 -2
packages/data/constants.ts
··· 56 56 AVATAR_TINY: "tr:w-50,h-50", 57 57 COVER: "tr:w-1350,h-350", 58 58 EXPANDED_AVATAR: "tr:w-1000,h-1000" 59 - } as const; 59 + }; 60 60 61 61 export const BANNER_IDS = { 62 62 BETA: "77727211532641772361026076963509019960782537128878733125792525478249531516748", 63 63 PRO: "91121314879992189064880690246403275227925211745526529128205988492742121673395" 64 - } as const; 64 + }; 65 65 66 66 export const PERMISSIONS = { 67 67 BETA: "0x287b09fAa3AfC548F1b28DEa36C30c1edc574C06",
+1 -1
packages/data/errors.ts
··· 1 1 export const ERRORS = { 2 2 SignWallet: "Please sign in your wallet.", 3 3 SomethingWentWrong: "Something went wrong!" 4 - } as const; 4 + };
+1 -1
packages/data/lens-endpoints.ts
··· 2 2 Mainnet: "https://api.lens.xyz/graphql", 3 3 Staging: "https://api.staging.lens.xyz/graphql", 4 4 Testnet: "https://api.testnet.lens.xyz/graphql" 5 - } as const; 5 + };
+1 -1
packages/data/utils/getEnvConfig.ts
··· 18 18 defaultCollectToken: TESTNET_CONTRACTS.defaultToken, 19 19 lensApiEndpoint: LENS_ENDPOINT.Testnet 20 20 } 21 - } as const; 21 + }; 22 22 23 23 type Config = (typeof config)[keyof typeof config]; 24 24
+1 -1
packages/helpers/getAccount.ts
··· 47 47 const usernameValue = username?.value; 48 48 const localName = username?.localName; 49 49 50 - const usernamePrefix = username ? "@" : "#"; 50 + const usernamePrefix = username ? "" : "#"; 51 51 const usernameValueOrAddress = 52 52 (usernameValue?.includes(LENS_NAMESPACE) ? localName : usernameValue) || 53 53 formatAddress(address);