import { isRepost } from "@hey/helpers/postHelpers"; import type { AnyPostFragment } from "@hey/indexer"; import { memo } from "react"; import CollectAction from "@/components/Post/OpenAction/CollectAction"; import SmallCollectButton from "@/components/Post/OpenAction/CollectAction/SmallCollectButton"; import TipAction from "@/components/Post/OpenAction/TipAction"; import stopEventPropagation from "@/helpers/stopEventPropagation"; import Comment from "./Comment"; import Like from "./Like"; import ShareMenu from "./Share"; interface PostActionsProps { post: AnyPostFragment; showCount?: boolean; } const PostActions = ({ post, showCount = false }: PostActionsProps) => { const targetPost = isRepost(post) ? post.repostOf : post; const hasPostAction = (targetPost.actions?.length || 0) > 0; const tipEnabled = targetPost.author?.hasSubscribed; const canAct = hasPostAction && targetPost.actions.some( (action) => action.__typename === "SimpleCollectAction" ); return ( {canAct && !showCount ? : null} {tipEnabled && } {canAct ? : null} ); }; export default memo(PostActions);