From 1b50e17e59d7f68b765b0e4db87a5223e8c4ccc6 Mon Sep 17 00:00:00 2001 From: Yoginth Date: Wed, 13 Nov 2024 18:14:09 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=8D=20Rename=20publication=20to=20post?= =?UTF-8?q?=20for=20v3=20preparation:=20v6=20(#pre-lens-v3)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: Renamed "publication" to "post" across various components and stores. Highlights: • Updated imports and usage from `usePublicationStore` to `usePostStore`. • Created new stores like `usePostAttributesStore` and `usePostAudioStore`. • Added `usePostMetadata` hook to handle post metadata operations. Read more: https://pierre.co/hey/hey/pre-lens-v3 --- .../Actions/CollectSettings/CollectForm.tsx | 4 +-- .../Actions/CollectSettings/index.tsx | 4 +-- .../LivestreamSettings/LivestreamEditor.tsx | 4 +-- .../Actions/LivestreamSettings/index.tsx | 4 +-- .../Actions/PollSettings/PollEditor.tsx | 4 +-- .../Composer/Actions/PollSettings/index.tsx | 4 +-- .../src/components/Composer/Editor/Editor.tsx | 6 ++-- .../src/components/Composer/LicensePicker.tsx | 4 +-- .../src/components/Composer/LinkPreviews.tsx | 8 ++--- apps/web/src/components/Composer/NewPost.tsx | 4 +-- .../components/Composer/NewPublication.tsx | 34 +++++++++---------- .../Publication/Actions/Share/Quote.tsx | 4 +-- .../src/components/Publication/PostHeader.tsx | 4 +-- .../web/src/components/Shared/Audio/index.tsx | 4 +-- .../src/hooks/prosekit/useContentChange.ts | 5 ++- apps/web/src/hooks/useCreatePoll.tsx | 4 +-- apps/web/src/hooks/useCreatePublication.tsx | 4 +-- ...licationMetadata.ts => usePostMetadata.ts} | 28 +++++++-------- ...utesStore.ts => usePostAttributesStore.ts} | 2 +- ...tionAudioStore.ts => usePostAudioStore.ts} | 2 +- ...LicenseStore.ts => usePostLicenseStore.ts} | 2 +- ...cationLiveStore.ts => usePostLiveStore.ts} | 2 +- ...cationPollStore.ts => usePostPollStore.ts} | 2 +- ...usePublicationStore.ts => usePostStore.ts} | 2 +- 24 files changed, 72 insertions(+), 73 deletions(-) rename apps/web/src/hooks/{usePublicationMetadata.ts => usePostMetadata.ts} (79%) rename apps/web/src/store/non-persisted/publication/{usePublicationAttributesStore.ts => usePostAttributesStore.ts} (94%) rename apps/web/src/store/non-persisted/publication/{usePublicationAudioStore.ts => usePostAudioStore.ts} (89%) rename apps/web/src/store/non-persisted/publication/{usePublicationLicenseStore.ts => usePostLicenseStore.ts} (84%) rename apps/web/src/store/non-persisted/publication/{usePublicationLiveStore.ts => usePostLiveStore.ts} (92%) rename apps/web/src/store/non-persisted/publication/{usePublicationPollStore.ts => usePostPollStore.ts} (91%) rename apps/web/src/store/non-persisted/publication/{usePublicationStore.ts => usePostStore.ts} (91%) diff --git a/apps/web/src/components/Composer/Actions/CollectSettings/CollectForm.tsx b/apps/web/src/components/Composer/Actions/CollectSettings/CollectForm.tsx index 0f80079478c7..8809ac1fb132 100644 --- a/apps/web/src/components/Composer/Actions/CollectSettings/CollectForm.tsx +++ b/apps/web/src/components/Composer/Actions/CollectSettings/CollectForm.tsx @@ -5,7 +5,7 @@ import type { CollectModuleType } from "@hey/types/hey"; import { Button } from "@hey/ui"; import type { Dispatch, FC, SetStateAction } from "react"; import { useCollectModuleStore } from "src/store/non-persisted/publication/useCollectModuleStore"; -import { usePublicationLicenseStore } from "src/store/non-persisted/publication/usePublicationLicenseStore"; +import { usePostLicenseStore } from "src/store/non-persisted/publication/usePostLicenseStore"; import { isAddress } from "viem"; import AmountConfig from "./AmountConfig"; import CollectLimitConfig from "./CollectLimitConfig"; @@ -22,7 +22,7 @@ const CollectForm: FC = ({ setShowModal }) => { const { collectModule, reset, setCollectModule } = useCollectModuleStore( (state) => state ); - const { setLicense } = usePublicationLicenseStore(); + const { setLicense } = usePostLicenseStore(); const { SimpleCollectOpenActionModule } = CollectOpenActionModuleType; const recipients = collectModule.recipients || []; diff --git a/apps/web/src/components/Composer/Actions/CollectSettings/index.tsx b/apps/web/src/components/Composer/Actions/CollectSettings/index.tsx index 436bc79343ec..44b79e2ac406 100644 --- a/apps/web/src/components/Composer/Actions/CollectSettings/index.tsx +++ b/apps/web/src/components/Composer/Actions/CollectSettings/index.tsx @@ -3,12 +3,12 @@ import { Modal, Tooltip } from "@hey/ui"; import type { FC } from "react"; import { useState } from "react"; import { useCollectModuleStore } from "src/store/non-persisted/publication/useCollectModuleStore"; -import { usePublicationLicenseStore } from "src/store/non-persisted/publication/usePublicationLicenseStore"; +import { usePostLicenseStore } from "src/store/non-persisted/publication/usePostLicenseStore"; import CollectForm from "./CollectForm"; const CollectSettings: FC = () => { const { reset } = useCollectModuleStore((state) => state); - const { setLicense } = usePublicationLicenseStore(); + const { setLicense } = usePostLicenseStore(); const [showModal, setShowModal] = useState(false); return ( diff --git a/apps/web/src/components/Composer/Actions/LivestreamSettings/LivestreamEditor.tsx b/apps/web/src/components/Composer/Actions/LivestreamSettings/LivestreamEditor.tsx index ade7cd4faf5c..5b656a132f58 100644 --- a/apps/web/src/components/Composer/Actions/LivestreamSettings/LivestreamEditor.tsx +++ b/apps/web/src/components/Composer/Actions/LivestreamSettings/LivestreamEditor.tsx @@ -14,7 +14,7 @@ import axios from "axios"; import type { FC, ReactNode } from "react"; import { useState } from "react"; import toast from "react-hot-toast"; -import { usePublicationLiveStore } from "src/store/non-persisted/publication/usePublicationLiveStore"; +import { usePostLiveStore } from "src/store/non-persisted/publication/usePostLiveStore"; interface WrapperProps { children: ReactNode; @@ -34,7 +34,7 @@ const LivestreamEditor: FC = () => { resetLiveVideoConfig, setLiveVideoConfig, setShowLiveVideoEditor - } = usePublicationLiveStore(); + } = usePostLiveStore(); const [screen, setScreen] = useState<"create" | "record">("create"); const [creating, setCreating] = useState(false); diff --git a/apps/web/src/components/Composer/Actions/LivestreamSettings/index.tsx b/apps/web/src/components/Composer/Actions/LivestreamSettings/index.tsx index 9e768238ae8e..24c4974f378d 100644 --- a/apps/web/src/components/Composer/Actions/LivestreamSettings/index.tsx +++ b/apps/web/src/components/Composer/Actions/LivestreamSettings/index.tsx @@ -3,11 +3,11 @@ import { Tooltip } from "@hey/ui"; import cn from "@hey/ui/cn"; import type { FC } from "react"; import { usePostAttachmentStore } from "src/store/non-persisted/publication/usePostAttachmentStore"; -import { usePublicationLiveStore } from "src/store/non-persisted/publication/usePublicationLiveStore"; +import { usePostLiveStore } from "src/store/non-persisted/publication/usePostLiveStore"; const LivestreamSettings: FC = () => { const { resetLiveVideoConfig, setShowLiveVideoEditor, showLiveVideoEditor } = - usePublicationLiveStore(); + usePostLiveStore(); const { attachments } = usePostAttachmentStore((state) => state); const disable = attachments.length > 0; diff --git a/apps/web/src/components/Composer/Actions/PollSettings/PollEditor.tsx b/apps/web/src/components/Composer/Actions/PollSettings/PollEditor.tsx index 48dcdb642e92..c0479efe6cf9 100644 --- a/apps/web/src/components/Composer/Actions/PollSettings/PollEditor.tsx +++ b/apps/web/src/components/Composer/Actions/PollSettings/PollEditor.tsx @@ -4,11 +4,11 @@ import { Button, Card, Input, Modal, Tooltip } from "@hey/ui"; import plur from "plur"; import type { FC } from "react"; import { useState } from "react"; -import { usePublicationPollStore } from "src/store/non-persisted/publication/usePublicationPollStore"; +import { usePostPollStore } from "src/store/non-persisted/publication/usePostPollStore"; const PollEditor: FC = () => { const { pollConfig, resetPollConfig, setPollConfig, setShowPollEditor } = - usePublicationPollStore(); + usePostPollStore(); const [showPollLengthModal, setShowPollLengthModal] = useState(false); return ( diff --git a/apps/web/src/components/Composer/Actions/PollSettings/index.tsx b/apps/web/src/components/Composer/Actions/PollSettings/index.tsx index 3eb6b57e762f..ccfb553ca5b1 100644 --- a/apps/web/src/components/Composer/Actions/PollSettings/index.tsx +++ b/apps/web/src/components/Composer/Actions/PollSettings/index.tsx @@ -1,11 +1,11 @@ import { Bars3BottomLeftIcon } from "@heroicons/react/24/solid"; import { Tooltip } from "@hey/ui"; import type { FC } from "react"; -import { usePublicationPollStore } from "src/store/non-persisted/publication/usePublicationPollStore"; +import { usePostPollStore } from "src/store/non-persisted/publication/usePostPollStore"; const PollSettings: FC = () => { const { resetPollConfig, setShowPollEditor, showPollEditor } = - usePublicationPollStore(); + usePostPollStore(); return ( diff --git a/apps/web/src/components/Composer/Editor/Editor.tsx b/apps/web/src/components/Composer/Editor/Editor.tsx index 4e745c28aca3..1dc7b97e3c7c 100644 --- a/apps/web/src/components/Composer/Editor/Editor.tsx +++ b/apps/web/src/components/Composer/Editor/Editor.tsx @@ -3,15 +3,15 @@ import { htmlFromMarkdown } from "@helpers/prosekit/markdown"; import getAvatar from "@hey/helpers/getAvatar"; import { Image } from "@hey/ui"; import dynamic from "next/dynamic"; -import type { FC } from "react"; import "prosekit/basic/style.css"; import { createEditor } from "prosekit/core"; import { ProseKit } from "prosekit/react"; +import type { FC } from "react"; import { useMemo, useRef } from "react"; import useContentChange from "src/hooks/prosekit/useContentChange"; import useFocus from "src/hooks/prosekit/useFocus"; import { usePaste } from "src/hooks/prosekit/usePaste"; -import { usePublicationStore } from "src/store/non-persisted/publication/usePublicationStore"; +import { usePostStore } from "src/store/non-persisted/publication/usePostStore"; import { useProfileStore } from "src/store/persisted/useProfileStore"; import { useEditorHandle } from "./EditorHandle"; @@ -20,7 +20,7 @@ const EditorMenus = dynamic(() => import("./EditorMenus"), { ssr: false }); const Editor: FC = () => { const { currentProfile } = useProfileStore(); - const { publicationContent } = usePublicationStore(); + const { publicationContent } = usePostStore(); const defaultMarkdownRef = useRef(publicationContent); const defaultContent = useMemo(() => { diff --git a/apps/web/src/components/Composer/LicensePicker.tsx b/apps/web/src/components/Composer/LicensePicker.tsx index ad48b198a84c..5801e13b1430 100644 --- a/apps/web/src/components/Composer/LicensePicker.tsx +++ b/apps/web/src/components/Composer/LicensePicker.tsx @@ -3,10 +3,10 @@ import { Select, Tooltip } from "@hey/ui"; import { MetadataLicenseType } from "@lens-protocol/metadata"; import Link from "next/link"; import type { FC } from "react"; -import { usePublicationLicenseStore } from "src/store/non-persisted/publication/usePublicationLicenseStore"; +import { usePostLicenseStore } from "src/store/non-persisted/publication/usePostLicenseStore"; const LicensePicker: FC = () => { - const { license, setLicense } = usePublicationLicenseStore(); + const { license, setLicense } = usePostLicenseStore(); const otherOptions = Object.values(MetadataLicenseType) .filter((type) => getAssetLicense(type)) diff --git a/apps/web/src/components/Composer/LinkPreviews.tsx b/apps/web/src/components/Composer/LinkPreviews.tsx index 14b7bc281064..8a683d019968 100644 --- a/apps/web/src/components/Composer/LinkPreviews.tsx +++ b/apps/web/src/components/Composer/LinkPreviews.tsx @@ -6,14 +6,14 @@ import { MetadataAttributeType } from "@lens-protocol/metadata"; import type { FC } from "react"; import { useEffect, useState } from "react"; import { usePostAttachmentStore } from "src/store/non-persisted/publication/usePostAttachmentStore"; -import { usePublicationAttributesStore } from "src/store/non-persisted/publication/usePublicationAttributesStore"; -import { usePublicationStore } from "src/store/non-persisted/publication/usePublicationStore"; +import { usePostAttributesStore } from "src/store/non-persisted/publication/usePostAttributesStore"; +import { usePostStore } from "src/store/non-persisted/publication/usePostStore"; const LinkPreviews: FC = () => { - const { publicationContent, quotedPost } = usePublicationStore(); + const { publicationContent, quotedPost } = usePostStore(); const { attachments } = usePostAttachmentStore((state) => state); const { addAttribute, getAttribute, removeAttribute } = - usePublicationAttributesStore(); + usePostAttributesStore(); const [showRemove, setShowRemove] = useState(false); const urls = getURLs(publicationContent); diff --git a/apps/web/src/components/Composer/NewPost.tsx b/apps/web/src/components/Composer/NewPost.tsx index 51cee3eb62df..cb24cdefc2ff 100644 --- a/apps/web/src/components/Composer/NewPost.tsx +++ b/apps/web/src/components/Composer/NewPost.tsx @@ -4,7 +4,7 @@ import { Card, Image } from "@hey/ui"; import { useRouter } from "next/router"; import type { FC } from "react"; import { useEffect, useState } from "react"; -import { usePublicationStore } from "src/store/non-persisted/publication/usePublicationStore"; +import { usePostStore } from "src/store/non-persisted/publication/usePostStore"; import { useProfileStore } from "src/store/persisted/useProfileStore"; import NewPublication from "./NewPublication"; @@ -15,7 +15,7 @@ interface NewPostProps { const NewPost: FC = ({ tags }) => { const { isReady, query } = useRouter(); const { currentProfile } = useProfileStore(); - const { setPublicationContent, setTags } = usePublicationStore(); + const { setPublicationContent, setTags } = usePostStore(); const [showComposer, setShowComposer] = useState(false); const handleOpenModal = () => { diff --git a/apps/web/src/components/Composer/NewPublication.tsx b/apps/web/src/components/Composer/NewPublication.tsx index 68369cff95ba..70e7dedd346e 100644 --- a/apps/web/src/components/Composer/NewPublication.tsx +++ b/apps/web/src/components/Composer/NewPublication.tsx @@ -34,22 +34,22 @@ import { useEffect, useState } from "react"; import toast from "react-hot-toast"; import useCreatePoll from "src/hooks/useCreatePoll"; import useCreatePublication from "src/hooks/useCreatePublication"; -import usePublicationMetadata from "src/hooks/usePublicationMetadata"; +import usePostMetadata from "src/hooks/usePostMetadata"; import { useCollectModuleStore } from "src/store/non-persisted/publication/useCollectModuleStore"; import { usePostAttachmentStore } from "src/store/non-persisted/publication/usePostAttachmentStore"; +import { usePostAttributesStore } from "src/store/non-persisted/publication/usePostAttributesStore"; +import { + DEFAULT_AUDIO_PUBLICATION, + usePostAudioStore +} from "src/store/non-persisted/publication/usePostAudioStore"; +import { usePostLicenseStore } from "src/store/non-persisted/publication/usePostLicenseStore"; +import { usePostLiveStore } from "src/store/non-persisted/publication/usePostLiveStore"; +import { usePostPollStore } from "src/store/non-persisted/publication/usePostPollStore"; +import { usePostStore } from "src/store/non-persisted/publication/usePostStore"; import { DEFAULT_VIDEO_THUMBNAIL, usePostVideoStore } from "src/store/non-persisted/publication/usePostVideoStore"; -import { usePublicationAttributesStore } from "src/store/non-persisted/publication/usePublicationAttributesStore"; -import { - DEFAULT_AUDIO_PUBLICATION, - usePublicationAudioStore -} from "src/store/non-persisted/publication/usePublicationAudioStore"; -import { usePublicationLicenseStore } from "src/store/non-persisted/publication/usePublicationLicenseStore"; -import { usePublicationLiveStore } from "src/store/non-persisted/publication/usePublicationLiveStore"; -import { usePublicationPollStore } from "src/store/non-persisted/publication/usePublicationPollStore"; -import { usePublicationStore } from "src/store/non-persisted/publication/usePublicationStore"; import { useGlobalModalStateStore } from "src/store/non-persisted/useGlobalModalStateStore"; import { useNonceStore } from "src/store/non-persisted/useNonceStore"; import { useProfileStatus } from "src/store/non-persisted/useProfileStatus"; @@ -111,17 +111,17 @@ const NewPublication: FC = ({ className, post }) => { setPublicationContent, setQuotedPost, setTags - } = usePublicationStore(); + } = usePostStore(); // Audio store - const { audioPublication, setAudioPublication } = usePublicationAudioStore(); + const { audioPublication, setAudioPublication } = usePostAudioStore(); // Video store const { setVideoThumbnail, videoThumbnail } = usePostVideoStore(); // Live video store const { resetLiveVideoConfig, setShowLiveVideoEditor, showLiveVideoEditor } = - usePublicationLiveStore(); + usePostLiveStore(); // Attachment store const { addAttachments, attachments, isUploading, setAttachments } = @@ -129,10 +129,10 @@ const NewPublication: FC = ({ className, post }) => { // Poll store const { pollConfig, resetPollConfig, setShowPollEditor, showPollEditor } = - usePublicationPollStore(); + usePostPollStore(); // License store - const { setLicense } = usePublicationLicenseStore(); + const { setLicense } = usePostLicenseStore(); // Collect module store const { collectModule, reset: resetCollectSettings } = useCollectModuleStore( @@ -144,7 +144,7 @@ const NewPublication: FC = ({ className, post }) => { useReferenceModuleStore(); // Attributes store - const { reset: resetAttributes } = usePublicationAttributesStore(); + const { reset: resetAttributes } = usePostAttributesStore(); // States const [isLoading, setIsLoading] = useState(false); @@ -154,7 +154,7 @@ const NewPublication: FC = ({ className, post }) => { const editor = useEditorContext(); const createPoll = useCreatePoll(); - const getMetadata = usePublicationMetadata(); + const getMetadata = usePostMetadata(); const { canUseLensManager } = checkDispatcherPermissions(currentProfile); diff --git a/apps/web/src/components/Publication/Actions/Share/Quote.tsx b/apps/web/src/components/Publication/Actions/Share/Quote.tsx index 1de041073cd7..94a85c557efe 100644 --- a/apps/web/src/components/Publication/Actions/Share/Quote.tsx +++ b/apps/web/src/components/Publication/Actions/Share/Quote.tsx @@ -6,7 +6,7 @@ import { TriStateValue } from "@hey/lens"; import cn from "@hey/ui/cn"; import type { FC } from "react"; import toast from "react-hot-toast"; -import { usePublicationStore } from "src/store/non-persisted/publication/usePublicationStore"; +import { usePostStore } from "src/store/non-persisted/publication/usePostStore"; import { useGlobalModalStateStore } from "src/store/non-persisted/useGlobalModalStateStore"; import { useProfileStatus } from "src/store/non-persisted/useProfileStatus"; import { useProfileStore } from "src/store/persisted/useProfileStore"; @@ -18,7 +18,7 @@ interface QuoteProps { const Quote: FC = ({ post }) => { const { currentProfile } = useProfileStore(); const { setShowAuthModal, setShowNewPostModal } = useGlobalModalStateStore(); - const { setQuotedPost } = usePublicationStore(); + const { setQuotedPost } = usePostStore(); const { isSuspended } = useProfileStatus(); const publicationType = post.__typename; diff --git a/apps/web/src/components/Publication/PostHeader.tsx b/apps/web/src/components/Publication/PostHeader.tsx index d7f7b203d547..6432d7641053 100644 --- a/apps/web/src/components/Publication/PostHeader.tsx +++ b/apps/web/src/components/Publication/PostHeader.tsx @@ -4,7 +4,7 @@ import { isRepost } from "@hey/helpers/postHelpers"; import stopEventPropagation from "@hey/helpers/stopEventPropagation"; import type { AnyPublication, FeedItem } from "@hey/lens"; import type { FC } from "react"; -import { usePublicationStore } from "src/store/non-persisted/publication/usePublicationStore"; +import { usePostStore } from "src/store/non-persisted/publication/usePostStore"; import PostMenu from "./Actions/Menu"; interface PostHeaderProps { @@ -20,7 +20,7 @@ const PostHeader: FC = ({ post, quoted = false }) => { - const { setQuotedPost } = usePublicationStore(); + const { setQuotedPost } = usePostStore(); const targetPost = isRepost(post) ? post?.mirrorOn : post; const rootPublication = feedItem ? feedItem?.root : targetPost; diff --git a/apps/web/src/components/Shared/Audio/index.tsx b/apps/web/src/components/Shared/Audio/index.tsx index 818bccdfe3a4..c0363ab71849 100644 --- a/apps/web/src/components/Shared/Audio/index.tsx +++ b/apps/web/src/components/Shared/Audio/index.tsx @@ -7,7 +7,7 @@ import type { AnyPublication, Profile } from "@hey/lens"; import type { APITypes } from "plyr-react"; import type { ChangeEvent, FC } from "react"; import { useRef, useState } from "react"; -import { usePublicationAudioStore } from "src/store/non-persisted/publication/usePublicationAudioStore"; +import { usePostAudioStore } from "src/store/non-persisted/publication/usePostAudioStore"; import { object, string } from "zod"; import CoverImage from "./CoverImage"; import Player from "./Player"; @@ -37,7 +37,7 @@ const Audio: FC = ({ src, title }) => { - const { audioPublication, setAudioPublication } = usePublicationAudioStore(); + const { audioPublication, setAudioPublication } = usePostAudioStore(); const [newPreviewUri, setNewPreviewUri] = useState(null); const [playing, setPlaying] = useState(false); const playerRef = useRef(null); diff --git a/apps/web/src/hooks/prosekit/useContentChange.ts b/apps/web/src/hooks/prosekit/useContentChange.ts index ec0a49c9b133..76db1daec207 100644 --- a/apps/web/src/hooks/prosekit/useContentChange.ts +++ b/apps/web/src/hooks/prosekit/useContentChange.ts @@ -4,14 +4,13 @@ import type { Editor } from "prosekit/core"; import { useDocChange } from "prosekit/react"; import { useCallback, useState } from "react"; import useDebouncedCallback from "src/hooks/prosekit/useDebouncedCallback"; -import { usePublicationStore } from "src/store/non-persisted/publication/usePublicationStore"; +import { usePostStore } from "src/store/non-persisted/publication/usePostStore"; const DEBOUNCE_CHARS_THRESHOLD = 3000; const DEBOUNCE_DELAY = 500; const useContentChange = (editor: Editor) => { - const { setPublicationContent } = usePublicationStore(); - + const { setPublicationContent } = usePostStore(); const [largeDocument, setLargeDocument] = useState(false); const setContent = useCallback(() => { diff --git a/apps/web/src/hooks/useCreatePoll.tsx b/apps/web/src/hooks/useCreatePoll.tsx index 1db0c16b712a..0a94ec36738d 100644 --- a/apps/web/src/hooks/useCreatePoll.tsx +++ b/apps/web/src/hooks/useCreatePoll.tsx @@ -1,12 +1,12 @@ import { getAuthApiHeaders } from "@helpers/getAuthApiHeaders"; import { HEY_API_URL } from "@hey/data/constants"; import axios from "axios"; -import { usePublicationPollStore } from "src/store/non-persisted/publication/usePublicationPollStore"; +import { usePostPollStore } from "src/store/non-persisted/publication/usePostPollStore"; type CreatePollResponse = string; const useCreatePoll = () => { - const { pollConfig } = usePublicationPollStore(); + const { pollConfig } = usePostPollStore(); // TODO: use useCallback const createPoll = async (): Promise => { diff --git a/apps/web/src/hooks/useCreatePublication.tsx b/apps/web/src/hooks/useCreatePublication.tsx index df8c122c6f95..2108edc958cc 100644 --- a/apps/web/src/hooks/useCreatePublication.tsx +++ b/apps/web/src/hooks/useCreatePublication.tsx @@ -34,7 +34,7 @@ import { import { OptmisticPublicationType } from "@hey/types/enums"; import type { OptimisticTransaction } from "@hey/types/misc"; import { useRouter } from "next/router"; -import { usePublicationStore } from "src/store/non-persisted/publication/usePublicationStore"; +import { usePostStore } from "src/store/non-persisted/publication/usePostStore"; import { useNonceStore } from "src/store/non-persisted/useNonceStore"; import { useProfileStore } from "src/store/persisted/useProfileStore"; import { useTransactionStore } from "src/store/persisted/useTransactionStore"; @@ -62,7 +62,7 @@ const useCreatePublication = ({ incrementLensHubOnchainSigNonce, lensHubOnchainSigNonce } = useNonceStore(); - const { publicationContent } = usePublicationStore(); + const { publicationContent } = usePostStore(); const { addTransaction } = useTransactionStore(); const handleWrongNetwork = useHandleWrongNetwork(); const { canBroadcast } = checkDispatcherPermissions(currentProfile); diff --git a/apps/web/src/hooks/usePublicationMetadata.ts b/apps/web/src/hooks/usePostMetadata.ts similarity index 79% rename from apps/web/src/hooks/usePublicationMetadata.ts rename to apps/web/src/hooks/usePostMetadata.ts index 6756d015db6f..eeb53f0fe729 100644 --- a/apps/web/src/hooks/usePublicationMetadata.ts +++ b/apps/web/src/hooks/usePostMetadata.ts @@ -9,29 +9,29 @@ import { } from "@lens-protocol/metadata"; import { useCallback } from "react"; import { usePostAttachmentStore } from "src/store/non-persisted/publication/usePostAttachmentStore"; +import { usePostAttributesStore } from "src/store/non-persisted/publication/usePostAttributesStore"; +import { usePostLicenseStore } from "src/store/non-persisted/publication/usePostLicenseStore"; +import { usePostLiveStore } from "src/store/non-persisted/publication/usePostLiveStore"; +import { usePostStore } from "src/store/non-persisted/publication/usePostStore"; import { usePostVideoStore } from "src/store/non-persisted/publication/usePostVideoStore"; -import { usePublicationAttributesStore } from "src/store/non-persisted/publication/usePublicationAttributesStore"; -import { usePublicationAudioStore } from "src/store/non-persisted/publication/usePublicationAudioStore"; -import { usePublicationLicenseStore } from "src/store/non-persisted/publication/usePublicationLicenseStore"; -import { usePublicationLiveStore } from "src/store/non-persisted/publication/usePublicationLiveStore"; -import { usePublicationStore } from "src/store/non-persisted/publication/usePublicationStore"; import { v4 as uuid } from "uuid"; +import { usePostAudioStore } from "../store/non-persisted/publication/usePostAudioStore"; -interface UsePublicationMetadataProps { +interface UsePostMetadataProps { baseMetadata: any; } -const usePublicationMetadata = () => { - const { tags } = usePublicationStore(); +const usePostMetadata = () => { + const { tags } = usePostStore(); const { videoDurationInSeconds, videoThumbnail } = usePostVideoStore(); - const { audioPublication } = usePublicationAudioStore(); - const { license } = usePublicationLicenseStore(); + const { audioPublication } = usePostAudioStore(); + const { license } = usePostLicenseStore(); const { attachments } = usePostAttachmentStore((state) => state); - const { liveVideoConfig, showLiveVideoEditor } = usePublicationLiveStore(); - const { attributes } = usePublicationAttributesStore(); + const { liveVideoConfig, showLiveVideoEditor } = usePostLiveStore(); + const { attributes } = usePostAttributesStore(); const getMetadata = useCallback( - ({ baseMetadata }: UsePublicationMetadataProps) => { + ({ baseMetadata }: UsePostMetadataProps) => { const hasAttachments = attachments.length; const isImage = attachments[0]?.type === "Image"; const isAudio = attachments[0]?.type === "Audio"; @@ -136,4 +136,4 @@ const usePublicationMetadata = () => { return getMetadata; }; -export default usePublicationMetadata; +export default usePostMetadata; diff --git a/apps/web/src/store/non-persisted/publication/usePublicationAttributesStore.ts b/apps/web/src/store/non-persisted/publication/usePostAttributesStore.ts similarity index 94% rename from apps/web/src/store/non-persisted/publication/usePublicationAttributesStore.ts rename to apps/web/src/store/non-persisted/publication/usePostAttributesStore.ts index 4e64d0f5cfb0..79220a42a34a 100644 --- a/apps/web/src/store/non-persisted/publication/usePublicationAttributesStore.ts +++ b/apps/web/src/store/non-persisted/publication/usePostAttributesStore.ts @@ -34,4 +34,4 @@ const store = create((set, get) => ({ })) })); -export const usePublicationAttributesStore = createTrackedSelector(store); +export const usePostAttributesStore = createTrackedSelector(store); diff --git a/apps/web/src/store/non-persisted/publication/usePublicationAudioStore.ts b/apps/web/src/store/non-persisted/publication/usePostAudioStore.ts similarity index 89% rename from apps/web/src/store/non-persisted/publication/usePublicationAudioStore.ts rename to apps/web/src/store/non-persisted/publication/usePostAudioStore.ts index 8445f11bd4da..e4b2a45b9798 100644 --- a/apps/web/src/store/non-persisted/publication/usePublicationAudioStore.ts +++ b/apps/web/src/store/non-persisted/publication/usePostAudioStore.ts @@ -25,4 +25,4 @@ const store = create((set) => ({ setAudioPublication: (audioPublication) => set(() => ({ audioPublication })) })); -export const usePublicationAudioStore = createTrackedSelector(store); +export const usePostAudioStore = createTrackedSelector(store); diff --git a/apps/web/src/store/non-persisted/publication/usePublicationLicenseStore.ts b/apps/web/src/store/non-persisted/publication/usePostLicenseStore.ts similarity index 84% rename from apps/web/src/store/non-persisted/publication/usePublicationLicenseStore.ts rename to apps/web/src/store/non-persisted/publication/usePostLicenseStore.ts index 4d5e2362ec69..d2120d31de1b 100644 --- a/apps/web/src/store/non-persisted/publication/usePublicationLicenseStore.ts +++ b/apps/web/src/store/non-persisted/publication/usePostLicenseStore.ts @@ -12,4 +12,4 @@ const store = create((set) => ({ setLicense: (license) => set(() => ({ license })) })); -export const usePublicationLicenseStore = createTrackedSelector(store); +export const usePostLicenseStore = createTrackedSelector(store); diff --git a/apps/web/src/store/non-persisted/publication/usePublicationLiveStore.ts b/apps/web/src/store/non-persisted/publication/usePostLiveStore.ts similarity index 92% rename from apps/web/src/store/non-persisted/publication/usePublicationLiveStore.ts rename to apps/web/src/store/non-persisted/publication/usePostLiveStore.ts index 2f1293957719..3276423de586 100644 --- a/apps/web/src/store/non-persisted/publication/usePublicationLiveStore.ts +++ b/apps/web/src/store/non-persisted/publication/usePostLiveStore.ts @@ -27,4 +27,4 @@ const store = create((set) => ({ showLiveVideoEditor: false })); -export const usePublicationLiveStore = createTrackedSelector(store); +export const usePostLiveStore = createTrackedSelector(store); diff --git a/apps/web/src/store/non-persisted/publication/usePublicationPollStore.ts b/apps/web/src/store/non-persisted/publication/usePostPollStore.ts similarity index 91% rename from apps/web/src/store/non-persisted/publication/usePublicationPollStore.ts rename to apps/web/src/store/non-persisted/publication/usePostPollStore.ts index 7c0c1f63a3fc..a137c0d00da1 100644 --- a/apps/web/src/store/non-persisted/publication/usePublicationPollStore.ts +++ b/apps/web/src/store/non-persisted/publication/usePostPollStore.ts @@ -21,4 +21,4 @@ const store = create((set) => ({ showPollEditor: false })); -export const usePublicationPollStore = createTrackedSelector(store); +export const usePostPollStore = createTrackedSelector(store); diff --git a/apps/web/src/store/non-persisted/publication/usePublicationStore.ts b/apps/web/src/store/non-persisted/publication/usePostStore.ts similarity index 91% rename from apps/web/src/store/non-persisted/publication/usePublicationStore.ts rename to apps/web/src/store/non-persisted/publication/usePostStore.ts index 08e5a48d8035..20cf87165172 100644 --- a/apps/web/src/store/non-persisted/publication/usePublicationStore.ts +++ b/apps/web/src/store/non-persisted/publication/usePostStore.ts @@ -21,4 +21,4 @@ const store = create((set) => ({ tags: null })); -export const usePublicationStore = createTrackedSelector(store); +export const usePostStore = createTrackedSelector(store);