Skip to content

Commit

Permalink
Migrate to Lens v3
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoginth committed Dec 7, 2024
1 parent 783bdeb commit 07c43d0
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 24 deletions.
11 changes: 2 additions & 9 deletions apps/web/src/components/Composer/NewPost.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,13 @@ import { usePostStore } from "src/store/non-persisted/post/usePostStore";
import { useAccountStore } from "src/store/persisted/useAccountStore";
import NewPublication from "./NewPublication";

interface NewPostProps {
tags?: string[];
}

const NewPost: FC<NewPostProps> = ({ tags }) => {
const NewPost: FC = () => {
const { isReady, query } = useRouter();
const { currentAccount } = useAccountStore();
const { setPostContent, setTags } = usePostStore();
const { setPostContent } = usePostStore();
const [showComposer, setShowComposer] = useState(false);

const handleOpenModal = () => {
if (tags) {
setTags(tags);
}
setShowComposer(true);
};

Expand Down
3 changes: 1 addition & 2 deletions apps/web/src/components/Composer/NewPublication.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const NewPublication: FC<NewPublicationProps> = ({ className, post }) => {
const { setShowNewPostModal } = useGlobalModalStateStore();

// Post store
const { postContent, quotedPost, setPostContent, setQuotedPost, setTags } =
const { postContent, quotedPost, setPostContent, setQuotedPost } =
usePostStore();

// Audio store
Expand Down Expand Up @@ -133,7 +133,6 @@ const NewPublication: FC<NewPublicationProps> = ({ className, post }) => {
editor?.setMarkdown("");
setIsLoading(false);
setPostContent("");
setTags(null);
setShowPollEditor(false);
resetPollConfig();
setShowLiveVideoEditor(false);
Expand Down
9 changes: 1 addition & 8 deletions apps/web/src/components/Group/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,7 @@ const ViewGroup: NextPage = () => {
<Members address={group.address} />
) : (
<>
{currentAccount && group.isMember && (
<NewPost
tags={[
`orbcommunities${group.handle}`,
`heyclubs${group.handle}`
]}
/>
)}
{currentAccount && group.isMember && <NewPost />}
<GroupFeed handle={group.handle} />
</>
)}
Expand Down
6 changes: 1 addition & 5 deletions apps/web/src/store/non-persisted/post/usePostStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,13 @@ interface State {
quotedPost: Post | null;
setPostContent: (postContent: string) => void;
setQuotedPost: (quotedPost: Post | null) => void;
setTags: (tags: null | string[]) => void;
tags: null | string[];
}

const store = create<State>((set) => ({
postContent: "",
quotedPost: null,
setPostContent: (postContent) => set(() => ({ postContent })),
setQuotedPost: (quotedPost) => set(() => ({ quotedPost })),
setTags: (tags) => set(() => ({ tags })),
tags: null
setQuotedPost: (quotedPost) => set(() => ({ quotedPost }))
}));

export const usePostStore = createTrackedSelector(store);

0 comments on commit 07c43d0

Please sign in to comment.