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

refactor: remove logEvent calls from various components

yoginth.com e31a17d4 cd80779f

verified
-53
-2
apps/web/src/components/Post/Actions/Share/UndoRepost.tsx
··· 8 8 import { toast } from "sonner"; 9 9 import cn from "@/helpers/cn"; 10 10 import errorToast from "@/helpers/errorToast"; 11 - import logEvent from "@/helpers/logEvent"; 12 11 import useTransactionLifecycle from "@/hooks/useTransactionLifecycle"; 13 12 import { useAccountStore } from "@/store/persisted/useAccountStore"; 14 13 ··· 45 44 setIsSubmitting(false); 46 45 updateCache(); 47 46 toast.success("Undone repost"); 48 - void logEvent("Undo Repost"); 49 47 }; 50 48 51 49 const onError = useCallback((error?: unknown) => {
-2
apps/web/src/components/Post/OpenAction/CollectAction/CollectActionButton.tsx
··· 16 16 import errorToast from "@/helpers/errorToast"; 17 17 import { hono } from "@/helpers/fetcher"; 18 18 import getCollectActionData from "@/helpers/getCollectActionData"; 19 - import logEvent from "@/helpers/logEvent"; 20 19 import useTransactionLifecycle from "@/hooks/useTransactionLifecycle"; 21 20 import { useAccountStore } from "@/store/persisted/useAccountStore"; 22 21 ··· 82 81 toast.success("Collected successfully"); 83 82 84 83 void hono.collects.create({ slug: post.slug }); 85 - void logEvent("Collect"); 86 84 }; 87 85 88 86 const onError = useCallback((error: ApolloClientError) => {
-5
apps/web/src/components/Search/FeedType.tsx
··· 1 1 import { useSearchParams } from "react-router"; 2 2 import { Tabs } from "@/components/Shared/UI"; 3 - import logEvent from "@/helpers/logEvent"; 4 3 5 4 export enum SearchTabFocus { 6 5 Accounts = "ACCOUNTS", ··· 26 25 27 26 searchParams.set("type", type); 28 27 setSearchParams(searchParams); 29 - const tab = tabs.find((tabItem) => tabItem.type === type); 30 - if (tab) { 31 - void logEvent(`Search Tab: ${tab.name}`); 32 - } 33 28 }; 34 29 35 30 return (
-2
apps/web/src/components/Settings/Funds/TokenOperation.tsx
··· 3 3 import { toast } from "sonner"; 4 4 import { Button, Input, Modal } from "@/components/Shared/UI"; 5 5 import errorToast from "@/helpers/errorToast"; 6 - import logEvent from "@/helpers/logEvent"; 7 6 import useTransactionLifecycle from "@/hooks/useTransactionLifecycle"; 8 7 import useWaitForTransactionToComplete from "@/hooks/useWaitForTransactionToComplete"; 9 8 ··· 40 39 setIsSubmitting(false); 41 40 refetch(); 42 41 toast.success(successMessage); 43 - void logEvent(title); 44 42 }; 45 43 46 44 const onError = useCallback((error: ApolloClientError) => {
-2
apps/web/src/components/Settings/Manager/AccountManager/AddAccountManager.tsx
··· 9 9 import SearchAccounts from "@/components/Shared/Account/SearchAccounts"; 10 10 import { Button } from "@/components/Shared/UI"; 11 11 import errorToast from "@/helpers/errorToast"; 12 - import logEvent from "@/helpers/logEvent"; 13 12 import useTransactionLifecycle from "@/hooks/useTransactionLifecycle"; 14 13 import useWaitForTransactionToComplete from "@/hooks/useWaitForTransactionToComplete"; 15 14 import { useAccountStore } from "@/store/persisted/useAccountStore"; ··· 33 32 const toastId = toast.loading("Adding manager..."); 34 33 await waitForTransactionToComplete(hash); 35 34 toast.success("Manager added successfully", { id: toastId }); 36 - void logEvent("Add Account Manager"); 37 35 location.reload(); 38 36 }; 39 37
-9
apps/web/src/components/Settings/Manager/AccountManager/Management/List.tsx
··· 15 15 import Loader from "@/components/Shared/Loader"; 16 16 import { Button, EmptyState, ErrorMessage } from "@/components/Shared/UI"; 17 17 import errorToast from "@/helpers/errorToast"; 18 - import logEvent from "@/helpers/logEvent"; 19 18 import useLoadMoreOnIntersect from "@/hooks/useLoadMoreOnIntersect"; 20 19 21 20 interface ListProps { ··· 111 110 const handleToggleManagement = async (account: string) => { 112 111 setUpdatingAccount(account); 113 112 114 - let eventName: string | null = null; 115 - 116 113 try { 117 114 if (managed) { 118 115 await hideManagedAccount({ variables: { request: { account } } }); 119 116 toast.success("Account is now un-managed"); 120 - eventName = "Unmanage Account"; 121 117 } else { 122 118 await unhideManagedAccount({ variables: { request: { account } } }); 123 119 toast.success("Account is now managed"); 124 - eventName = "Manage Account"; 125 120 } 126 121 setTimeout(() => refetch(), 500); 127 122 } catch (error) { 128 123 errorToast(error); 129 124 } finally { 130 125 setUpdatingAccount(null); 131 - } 132 - 133 - if (eventName) { 134 - void logEvent(eventName); 135 126 } 136 127 }; 137 128
-2
apps/web/src/components/Settings/Manager/AccountManager/Managers/List.tsx
··· 16 16 import Loader from "@/components/Shared/Loader"; 17 17 import { Button, EmptyState, ErrorMessage } from "@/components/Shared/UI"; 18 18 import errorToast from "@/helpers/errorToast"; 19 - import logEvent from "@/helpers/logEvent"; 20 19 import useLoadMoreOnIntersect from "@/hooks/useLoadMoreOnIntersect"; 21 20 import useTransactionLifecycle from "@/hooks/useTransactionLifecycle"; 22 21 import { useAccountStore } from "@/store/persisted/useAccountStore"; ··· 41 40 setRemovingManager(null); 42 41 updateCache(); 43 42 toast.success("Manager removed successfully"); 44 - void logEvent("Remove Account Manager"); 45 43 }; 46 44 47 45 const onError = useCallback((error: ApolloClientError) => {
-5
apps/web/src/components/Settings/Manager/AccountManager/index.tsx
··· 2 2 import Managed from "@/components/Settings/Manager/AccountManager/Management/Managed"; 3 3 import Unmanaged from "@/components/Settings/Manager/AccountManager/Management/Unmanaged"; 4 4 import { Button, Modal, Tabs } from "@/components/Shared/UI"; 5 - import logEvent from "@/helpers/logEvent"; 6 5 import AddAccountManager from "./AddAccountManager"; 7 6 import Managers from "./Managers"; 8 7 ··· 31 30 setActive={(tabType) => { 32 31 const nextType = tabType as Type; 33 32 setType(nextType); 34 - const tab = tabs.find((tabItem) => tabItem.type === nextType); 35 - if (tab) { 36 - void logEvent(`Account Manager Tab: ${tab.name}`); 37 - } 38 33 }} 39 34 tabs={tabs} 40 35 />
-2
apps/web/src/components/Settings/Manager/Signless.tsx
··· 4 4 import { toast } from "sonner"; 5 5 import { Button, H6 } from "@/components/Shared/UI"; 6 6 import errorToast from "@/helpers/errorToast"; 7 - import logEvent from "@/helpers/logEvent"; 8 7 import useTransactionLifecycle from "@/hooks/useTransactionLifecycle"; 9 8 10 9 const Signless = () => { ··· 14 13 const onCompleted = () => { 15 14 setIsSubmitting(false); 16 15 toast.success("Signless enabled"); 17 - void logEvent("Enable Signless"); 18 16 }; 19 17 20 18 const onError = useCallback((error: ApolloClientError) => {
-2
apps/web/src/components/Settings/Personalize/Form.tsx
··· 28 28 } from "@/components/Shared/UI"; 29 29 import errorToast from "@/helpers/errorToast"; 30 30 import getAccountAttribute from "@/helpers/getAccountAttribute"; 31 - import logEvent from "@/helpers/logEvent"; 32 31 import uploadMetadata from "@/helpers/uploadMetadata"; 33 32 import useTransactionLifecycle from "@/hooks/useTransactionLifecycle"; 34 33 import useWaitForTransactionToComplete from "@/hooks/useWaitForTransactionToComplete"; ··· 73 72 setCurrentAccount(accountData?.data?.me.loggedInAs.account); 74 73 setIsSubmitting(false); 75 74 toast.success("Account updated"); 76 - void logEvent("Update Account Settings"); 77 75 }; 78 76 79 77 const onError = useCallback((error: ApolloClientError) => {
-2
apps/web/src/components/Settings/Sessions/List.tsx
··· 13 13 import Loader from "@/components/Shared/Loader"; 14 14 import { Button, EmptyState, ErrorMessage } from "@/components/Shared/UI"; 15 15 import errorToast from "@/helpers/errorToast"; 16 - import logEvent from "@/helpers/logEvent"; 17 16 import useLoadMoreOnIntersect from "@/hooks/useLoadMoreOnIntersect"; 18 17 import { useAccountStore } from "@/store/persisted/useAccountStore"; 19 18 ··· 34 33 setRevoking(false); 35 34 setRevokeingSessionId(null); 36 35 toast.success("Session revoked"); 37 - void logEvent("Revoke Session"); 38 36 }; 39 37 40 38 const [revokeAuthentication] = useRevokeAuthenticationMutation({
-2
apps/web/src/components/Settings/Username/LinkUsername.tsx
··· 11 11 import Slug from "@/components/Shared/Slug"; 12 12 import { Button, EmptyState, H6 } from "@/components/Shared/UI"; 13 13 import errorToast from "@/helpers/errorToast"; 14 - import logEvent from "@/helpers/logEvent"; 15 14 import useTransactionLifecycle from "@/hooks/useTransactionLifecycle"; 16 15 import { useAccountStore } from "@/store/persisted/useAccountStore"; 17 16 ··· 23 22 const onCompleted = () => { 24 23 setLinkingUsername(null); 25 24 toast.success("Linked"); 26 - void logEvent("Link Username"); 27 25 }; 28 26 29 27 const onError = useCallback((error: ApolloClientError) => {
-2
apps/web/src/components/Settings/Username/UnlinkUsername.tsx
··· 5 5 import { toast } from "sonner"; 6 6 import { Button, H6 } from "@/components/Shared/UI"; 7 7 import errorToast from "@/helpers/errorToast"; 8 - import logEvent from "@/helpers/logEvent"; 9 8 import useTransactionLifecycle from "@/hooks/useTransactionLifecycle"; 10 9 import { useAccountStore } from "@/store/persisted/useAccountStore"; 11 10 ··· 17 16 const onCompleted = () => { 18 17 setUnlinking(false); 19 18 toast.success("Unlinked"); 20 - void logEvent("Unlink Username"); 21 19 }; 22 20 23 21 const onError = useCallback((error: ApolloClientError) => {
-2
apps/web/src/components/Shared/Account/Follow.tsx
··· 4 4 import { useCallback, useState } from "react"; 5 5 import { Button } from "@/components/Shared/UI"; 6 6 import errorToast from "@/helpers/errorToast"; 7 - import logEvent from "@/helpers/logEvent"; 8 7 import useTransactionLifecycle from "@/hooks/useTransactionLifecycle"; 9 8 import { useAuthModalStore } from "@/store/non-persisted/modal/useAuthModalStore"; 10 9 import { useAccountStore } from "@/store/persisted/useAccountStore"; ··· 45 44 updateCache(); 46 45 setIsSubmitting(false); 47 46 onFollow?.(); 48 - void logEvent("Follow"); 49 47 }; 50 48 51 49 const onError = useCallback((error: ApolloClientError) => {
-2
apps/web/src/components/Shared/Account/TopUp/Transfer.tsx
··· 16 16 import Skeleton from "@/components/Shared/Skeleton"; 17 17 import { Button, Card, Input, Spinner } from "@/components/Shared/UI"; 18 18 import errorToast from "@/helpers/errorToast"; 19 - import logEvent from "@/helpers/logEvent"; 20 19 import usePreventScrollOnNumberInput from "@/hooks/usePreventScrollOnNumberInput"; 21 20 import useTransactionLifecycle from "@/hooks/useTransactionLifecycle"; 22 21 import { ··· 61 60 setTxHash(null); 62 61 setShowFundModal({ showFundModal: false }); 63 62 toast.success("Transferred successfully"); 64 - void logEvent("Transfer Funds"); 65 63 }; 66 64 67 65 const onError = useCallback((error: ApolloClientError) => {
-2
apps/web/src/components/Shared/Account/Unfollow.tsx
··· 4 4 import { useCallback, useState } from "react"; 5 5 import { Button } from "@/components/Shared/UI"; 6 6 import errorToast from "@/helpers/errorToast"; 7 - import logEvent from "@/helpers/logEvent"; 8 7 import useTransactionLifecycle from "@/hooks/useTransactionLifecycle"; 9 8 import { useAuthModalStore } from "@/store/non-persisted/modal/useAuthModalStore"; 10 9 import { useAccountStore } from "@/store/persisted/useAccountStore"; ··· 42 41 const onCompleted = () => { 43 42 updateCache(); 44 43 setIsSubmitting(false); 45 - void logEvent("Unfollow"); 46 44 }; 47 45 48 46 const onError = useCallback((error: ApolloClientError) => {
-3
apps/web/src/components/Shared/Alert/BlockOrUnblockAccount.tsx
··· 7 7 import { toast } from "sonner"; 8 8 import { Alert } from "@/components/Shared/UI"; 9 9 import errorToast from "@/helpers/errorToast"; 10 - import logEvent from "@/helpers/logEvent"; 11 10 import useTransactionLifecycle from "@/hooks/useTransactionLifecycle"; 12 11 import { useBlockAlertStore } from "@/store/non-persisted/alert/useBlockAlertStore"; 13 12 import { useAccountStore } from "@/store/persisted/useAccountStore"; ··· 40 39 }; 41 40 42 41 const onCompleted = () => { 43 - const eventName = hasBlocked ? "Unblock Account" : "Block Account"; 44 42 updateCache(); 45 43 setIsSubmitting(false); 46 44 setHasBlocked(!hasBlocked); ··· 48 46 toast.success( 49 47 hasBlocked ? "Unblocked successfully" : "Blocked successfully" 50 48 ); 51 - void logEvent(eventName); 52 49 }; 53 50 54 51 const onError = useCallback((error: ApolloClientError) => {
-3
apps/web/src/components/Shared/Alert/MuteOrUnmuteAccount.tsx
··· 7 7 import { toast } from "sonner"; 8 8 import { Alert } from "@/components/Shared/UI"; 9 9 import errorToast from "@/helpers/errorToast"; 10 - import logEvent from "@/helpers/logEvent"; 11 10 import { useMuteAlertStore } from "@/store/non-persisted/alert/useMuteAlertStore"; 12 11 import { useAccountStore } from "@/store/persisted/useAccountStore"; 13 12 ··· 37 36 }; 38 37 39 38 const onCompleted = () => { 40 - const eventName = hasMuted ? "Unmute Account" : "Mute Account"; 41 39 updateCache(); 42 40 setIsSubmitting(false); 43 41 setHasMuted(!hasMuted); 44 42 setShowMuteOrUnmuteAlert(false); 45 43 toast.success(hasMuted ? "Unmuted successfully" : "Muted successfully"); 46 - void logEvent(eventName); 47 44 }; 48 45 49 46 const onError = useCallback((error: ApolloClientError) => {
-2
apps/web/src/components/Shared/TipMenu.tsx
··· 18 18 import { Button, Input, Spinner } from "@/components/Shared/UI"; 19 19 import cn from "@/helpers/cn"; 20 20 import errorToast from "@/helpers/errorToast"; 21 - import logEvent from "@/helpers/logEvent"; 22 21 import usePreventScrollOnNumberInput from "@/hooks/usePreventScrollOnNumberInput"; 23 22 import useTransactionLifecycle from "@/hooks/useTransactionLifecycle"; 24 23 import { useAccountStore } from "@/store/persisted/useAccountStore"; ··· 77 76 closePopover(); 78 77 updateCache(); 79 78 toast.success(`Tipped ${amount} ${NATIVE_TOKEN_SYMBOL}`); 80 - void logEvent("Tip"); 81 79 }; 82 80 83 81 const onError = useCallback((error: ApolloClientError) => {