Skip to content

Commit

Permalink
🔍 Rename publication to post for v3 preparation: v8 (#pre-lens-v3)
Browse files Browse the repository at this point in the history
Summary: Renamed `publication` to `post` and added new components for post handling.

Highlights:

• Introduced `PostProfile`, `PostStats`, and `QueuedPost` components for managing post details, statistics, and queued posts.
• Added `QuotedPost`, `Quotes`, and `RelevantPeople` components to handle quoted posts and display relevant profiles.
• Implemented `useCreatePost` hook for creating posts with support for on-chain and Momoka transactions.

Read more: https://pierre.co/hey/hey/pre-lens-v3
  • Loading branch information
Yoginth authored and Pierre committed Nov 13, 2024
1 parent 169301a commit 2d64d44
Show file tree
Hide file tree
Showing 85 changed files with 55 additions and 55 deletions.
2 changes: 1 addition & 1 deletion apps/web/src/components/Bookmarks/BookmarksFeed.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import SinglePost from "@components/Publication/SinglePost";
import SinglePost from "@components/Post/SinglePost";
import PostsShimmer from "@components/Shared/Shimmer/PostsShimmer";
import { BookmarkIcon } from "@heroicons/react/24/outline";
import type {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/Club/ClubFeed.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import SinglePost from "@components/Publication/SinglePost";
import SinglePost from "@components/Post/SinglePost";
import PostsShimmer from "@components/Shared/Shimmer/PostsShimmer";
import { ChatBubbleBottomCenterIcon } from "@heroicons/react/24/outline";
import type { AnyPublication, PublicationsRequest } from "@hey/lens";
Expand Down
6 changes: 3 additions & 3 deletions apps/web/src/components/Comment/CommentFeed.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useHiddenCommentFeedStore } from "@components/Publication";
import QueuedPost from "@components/Publication/QueuedPost";
import SinglePost from "@components/Publication/SinglePost";
import { useHiddenCommentFeedStore } from "@components/Post";
import QueuedPost from "@components/Post/QueuedPost";
import SinglePost from "@components/Post/SinglePost";
import PostsShimmer from "@components/Shared/Shimmer/PostsShimmer";
import { ChatBubbleLeftIcon } from "@heroicons/react/24/outline";
import type { Comment, PublicationsRequest } from "@hey/lens";
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/components/Comment/NoneRelevantFeed.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useHiddenCommentFeedStore } from "@components/Publication";
import SinglePost from "@components/Publication/SinglePost";
import { useHiddenCommentFeedStore } from "@components/Post";
import SinglePost from "@components/Post/SinglePost";
import { ChevronDownIcon, ChevronUpIcon } from "@heroicons/react/24/outline";
import getAvatar from "@hey/helpers/getAvatar";
import type { Comment, PublicationsRequest } from "@hey/lens";
Expand Down
6 changes: 3 additions & 3 deletions apps/web/src/components/Composer/NewPublication.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import NewAttachments from "@components/Composer/NewAttachments";
import QuotedPost from "@components/Publication/QuotedPost";
import QuotedPost from "@components/Post/QuotedPost";
import { AudioPublicationSchema } from "@components/Shared/Audio";
import Wrapper from "@components/Shared/Embed/Wrapper";
import errorToast from "@helpers/errorToast";
Expand Down Expand Up @@ -33,7 +33,7 @@ import type { FC } from "react";
import { useEffect, useState } from "react";
import toast from "react-hot-toast";
import useCreatePoll from "src/hooks/useCreatePoll";
import useCreatePublication from "src/hooks/useCreatePublication";
import useCreatePost from "src/hooks/useCreatePost";
import usePostMetadata from "src/hooks/usePostMetadata";
import { useCollectModuleStore } from "src/store/non-persisted/post/useCollectModuleStore";
import { usePostAttachmentStore } from "src/store/non-persisted/post/usePostAttachmentStore";
Expand Down Expand Up @@ -246,7 +246,7 @@ const NewPublication: FC<NewPublicationProps> = ({ className, post }) => {
createQuoteOnChain,
createQuoteOnMomka,
error
} = useCreatePublication({
} = useCreatePost({
commentOn: post,
onCompleted,
onError,
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/Explore/ExploreFeed.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import SinglePost from "@components/Publication/SinglePost";
import SinglePost from "@components/Post/SinglePost";
import PostsShimmer from "@components/Shared/Shimmer/PostsShimmer";
import { ChatBubbleBottomCenterIcon } from "@heroicons/react/24/outline";
import type {
Expand Down
6 changes: 3 additions & 3 deletions apps/web/src/components/Explore/ImageFeed.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import SingleImagePost from "@components/Publication/SingleImagePost";
import ImagePublicationsShimmer from "@components/Shared/Shimmer/ImagePublicationsShimmer";
import SingleImagePost from "@components/Post/SingleImagePost";
import ImagePostsShimmer from "@components/Shared/Shimmer/ImagePostsShimmer";
import { ChatBubbleBottomCenterIcon } from "@heroicons/react/24/outline";
import {
type AnyPublication,
Expand Down Expand Up @@ -48,7 +48,7 @@ const ImageFeed: FC<ImageFeedProps> = ({
const posts = data?.explorePublications?.items;

if (loading) {
return <ImagePublicationsShimmer />;
return <ImagePostsShimmer />;
}

if (posts?.length === 0) {
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/components/Home/ForYou.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import QueuedPost from "@components/Publication/QueuedPost";
import SinglePost from "@components/Publication/SinglePost";
import QueuedPost from "@components/Post/QueuedPost";
import SinglePost from "@components/Post/SinglePost";
import PostsShimmer from "@components/Shared/Shimmer/PostsShimmer";
import { LightBulbIcon } from "@heroicons/react/24/outline";
import type { AnyPublication, PublicationForYouRequest } from "@hey/lens";
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/Home/PaidActions/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import SinglePost from "@components/Publication/SinglePost";
import SinglePost from "@components/Post/SinglePost";
import PaidActionsShimmer from "@components/Shared/Shimmer/PaidActionsShimmer";
import { CurrencyDollarIcon } from "@heroicons/react/24/outline";
import type { AnyPublication, LatestActed, PaginatedRequest } from "@hey/lens";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import CollectAction from "@components/Publication/OpenAction/CollectModule/CollectAction";
import CollectAction from "@components/Post/OpenAction/CollectModule/CollectAction";
import Loader from "@components/Shared/Loader";
import { signatureFont } from "@helpers/fonts";
import {
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/components/Home/Timeline/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import QueuedPost from "@components/Publication/QueuedPost";
import SinglePost from "@components/Publication/SinglePost";
import QueuedPost from "@components/Post/QueuedPost";
import SinglePost from "@components/Post/SinglePost";
import PostsShimmer from "@components/Shared/Shimmer/PostsShimmer";
import { UserGroupIcon } from "@heroicons/react/24/outline";
import { HEY_CURATED_ID } from "@hey/data/constants";
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/List/ListFeed.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import SinglePost from "@components/Publication/SinglePost";
import SinglePost from "@components/Post/SinglePost";
import PinUnpinButton from "@components/Shared/List/PinUnpinButton";
import PostsShimmer from "@components/Shared/Shimmer/PostsShimmer";
import SingleList from "@components/Shared/SingleList";
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/components/Mod/LatestFeed.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import HigherActions from "@components/Publication/Actions/HigherActions";
import SinglePost from "@components/Publication/SinglePost";
import HigherActions from "@components/Post/Actions/HigherActions";
import SinglePost from "@components/Post/SinglePost";
import PostsShimmer from "@components/Shared/Shimmer/PostsShimmer";
import { ChatBubbleBottomCenterIcon } from "@heroicons/react/24/outline";
import { IS_MAINNET } from "@hey/data/constants";
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/Mod/ReportsFeed/ReportDetails.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Reports from "@components/Mod/ReportsFeed/Reports";
import StaffActions from "@components/Publication/Actions/HigherActions/StaffActions";
import StaffActions from "@components/Post/Actions/HigherActions/StaffActions";
import SmallSingleProfile from "@components/Shared/SmallSingleProfile";
import { EyeIcon, HandRaisedIcon } from "@heroicons/react/24/outline";
import formatDate from "@hey/helpers/datetime/formatDate";
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/Mod/ReportsFeed/Reports.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import SinglePost from "@components/Publication/SinglePost";
import SinglePost from "@components/Post/SinglePost";
import Loader from "@components/Shared/Loader";
import { FlagIcon } from "@heroicons/react/24/outline";
import type { AnyPublication, ModReport, ModReportsRequest } from "@hey/lens";
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/Mod/ReportsFeed/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import SinglePost from "@components/Publication/SinglePost";
import SinglePost from "@components/Post/SinglePost";
import PostsShimmer from "@components/Shared/Shimmer/PostsShimmer";
import { FlagIcon } from "@heroicons/react/24/outline";
import type { AnyPublication, ModReport, ModReportsRequest } from "@hey/lens";
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/components/Mod/SearchFeed.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import HigherActions from "@components/Publication/Actions/HigherActions";
import SinglePost from "@components/Publication/SinglePost";
import HigherActions from "@components/Post/Actions/HigherActions";
import SinglePost from "@components/Post/SinglePost";
import PostsShimmer from "@components/Shared/Shimmer/PostsShimmer";
import { Leafwatch } from "@helpers/leafwatch";
import { ChatBubbleBottomCenterIcon } from "@heroicons/react/24/outline";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ApolloCache } from "@apollo/client";
import { useHiddenCommentFeedStore } from "@components/Publication";
import { useHiddenCommentFeedStore } from "@components/Post";
import { MenuItem } from "@headlessui/react";
import errorToast from "@helpers/errorToast";
import { Leafwatch } from "@helpers/leafwatch";
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import PublicationProfile from "@components/Publication/PublicationProfile";
import { XMarkIcon } from "@heroicons/react/24/outline";
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 { usePostStore } from "src/store/non-persisted/post/usePostStore";
import PostMenu from "./Actions/Menu";
import PostProfile from "./PostProfile";

interface PostHeaderProps {
feedItem?: FeedItem;
Expand All @@ -32,7 +32,7 @@ const PostHeader: FC<PostHeaderProps> = ({
className="flex w-full items-start justify-between"
onClick={stopEventPropagation}
>
<PublicationProfile
<PostProfile
profile={profile}
postId={targetPost.id}
source={targetPost.publishedOn?.id}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Source from "@components/Publication/Source";
import Source from "@components/Post/Source";
import Misuse from "@components/Shared/Profile/Icons/Misuse";
import Verified from "@components/Shared/Profile/Icons/Verified";
import formatRelativeOrAbsolute from "@hey/helpers/datetime/formatRelativeOrAbsolute";
Expand All @@ -11,15 +11,15 @@ import ProfilePreview from "../Shared/ProfilePreview";
import Slug from "../Shared/Slug";
import ClubHandle from "./ClubHandle";

interface FeedUserProfileProps {
interface PostProfileProps {
profile: Profile;
postId: string;
source?: string;
tags: string[];
timestamp: Date;
}

const PublicationProfile: FC<FeedUserProfileProps> = ({
const PostProfile: FC<PostProfileProps> = ({
profile,
postId,
source,
Expand Down Expand Up @@ -65,4 +65,4 @@ const PublicationProfile: FC<FeedUserProfileProps> = ({
);
};

export default memo(PublicationProfile);
export default memo(PostProfile);
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const store = create<HiddenCommentFeedState>((set) => ({

export const useHiddenCommentFeedStore = createTrackedSelector(store);

const ViewPublication: NextPage = () => {
const ViewPost: NextPage = () => {
const {
isReady,
pathname,
Expand Down Expand Up @@ -158,4 +158,4 @@ const ViewPublication: NextPage = () => {
);
};

export default ViewPublication;
export default ViewPost;
2 changes: 1 addition & 1 deletion apps/web/src/components/Profile/ProfileFeed.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import SinglePost from "@components/Publication/SinglePost";
import SinglePost from "@components/Post/SinglePost";
import PostsShimmer from "@components/Shared/Shimmer/PostsShimmer";
import { ChatBubbleBottomCenterIcon } from "@heroicons/react/24/outline";
import { ProfileFeedType } from "@hey/data/enums";
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/Search/Publications.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import SinglePost from "@components/Publication/SinglePost";
import SinglePost from "@components/Post/SinglePost";
import PostsShimmer from "@components/Shared/Shimmer/PostsShimmer";
import { ChatBubbleBottomCenterIcon } from "@heroicons/react/24/outline";
import type { AnyPublication, PublicationSearchRequest } from "@hey/lens";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { toast } from "react-hot-toast";
import { useGlobalAlertStateStore } from "src/store/non-persisted/useGlobalAlertStateStore";
import { useProfileStatus } from "src/store/non-persisted/useProfileStatus";

const DeletePublication: FC = () => {
const DeletePost: FC = () => {
const { deletingPost, setShowPostDeleteAlert, showPostDeleteAlert } =
useGlobalAlertStateStore();
const { isSuspended } = useProfileStatus();
Expand Down Expand Up @@ -55,4 +55,4 @@ const DeletePublication: FC = () => {
);
};

export default DeletePublication;
export default DeletePost;
2 changes: 1 addition & 1 deletion apps/web/src/components/Shared/Embed/Quote.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import QuotedPost from "@components/Publication/QuotedPost";
import QuotedPost from "@components/Post/QuotedPost";
import type { PrimaryPublication } from "@hey/lens";
import type { FC } from "react";
import Wrapper from "./Wrapper";
Expand Down
6 changes: 3 additions & 3 deletions apps/web/src/components/Shared/GlobalAlerts.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import GardenerActions from "@components/Publication/Actions/HigherActions/GardenerActions";
import GardenerActions from "@components/Post/Actions/HigherActions/GardenerActions";
import { Alert } from "@hey/ui";
import type { FC } from "react";
import { useGlobalAlertStateStore } from "src/store/non-persisted/useGlobalAlertStateStore";
import BlockOrUnBlockProfile from "./Alert/BlockOrUnBlockProfile";
import DeletePublication from "./Alert/DeletePublication";
import DeletePost from "./Alert/DeletePost";

const GlobalAlerts: FC = () => {
const {
Expand All @@ -19,7 +19,7 @@ const GlobalAlerts: FC = () => {

return (
<>
<DeletePublication />
<DeletePost />
{modingPost && (
<Alert
description="Perform mod actions on this publication."
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { FC } from "react";

const ImagePublicationsShimmer: FC = () => {
const ImagePostsShimmer: FC = () => {
return (
<div className="grid grid-cols-3 gap-4">
{Array.from({ length: 6 }).map((_, index) => (
Expand All @@ -10,4 +10,4 @@ const ImagePublicationsShimmer: FC = () => {
);
};

export default ImagePublicationsShimmer;
export default ImagePostsShimmer;
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,19 @@ import { useTransactionStore } from "src/store/persisted/useTransactionStore";
import { useSignTypedData, useWriteContract } from "wagmi";
import useHandleWrongNetwork from "./useHandleWrongNetwork";

interface CreatePublicationProps {
interface CreatePostProps {
commentOn?: AnyPublication;
onCompleted: (status?: any) => void;
onError: (error: any) => void;
quoteOn?: AnyPublication;
}

const useCreatePublication = ({
const useCreatePost = ({
commentOn,
onCompleted,
onError,
quoteOn
}: CreatePublicationProps) => {
}: CreatePostProps) => {
const { push } = useRouter();
const { cache } = useApolloClient();
const { currentProfile } = useProfileStore();
Expand Down Expand Up @@ -374,4 +374,4 @@ const useCreatePublication = ({
};
};

export default useCreatePublication;
export default useCreatePost;
4 changes: 2 additions & 2 deletions apps/web/src/pages/posts/[id]/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import ViewPublication from "@components/Publication";
import ViewPost from "@components/Post";

export default ViewPublication;
export default ViewPost;
4 changes: 2 additions & 2 deletions apps/web/src/pages/posts/[id]/quotes.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import ViewPublication from "@components/Publication";
import ViewPost from "@components/Post";

export default ViewPublication;
export default ViewPost;

0 comments on commit 2d64d44

Please sign in to comment.