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 8, 2024
1 parent 4ff2ea5 commit 4f5b461
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
4 changes: 2 additions & 2 deletions apps/web/src/components/Composer/NewPublication.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,8 @@ const NewPublication: FC<NewPublicationProps> = ({ className, post }) => {
variables: {
request: {
contentUri: `${METADATA_ENDPOINT}/${metadataId}`,
...(isComment && { commentOn: post?.id }),
...(isQuote && { quoteOf: quotedPost?.id }),
...(isComment && { commentOn: { post: post?.id } }),
...(isQuote && { quoteOf: { post: quotedPost?.id } }),
...(collectModule.type && {
actions: [{ collectAction: collectModuleParams(collectModule) }]
})
Expand Down
4 changes: 3 additions & 1 deletion apps/web/src/components/Post/Actions/Share/Repost.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ interface RepostProps {
const Repost: FC<RepostProps> = ({ isLoading, post, setIsLoading }) => {
const { currentAccount } = useAccountStore();
const { isSuspended } = useAccountStatus();
const hasReposted = post.operations?.hasReposted.optimistic;
const hasReposted =
post.operations?.hasReposted.optimistic ||
post.operations?.hasReposted.onChain;

const [shares, { increment }] = useCounter(
post.stats.reposts + post.stats.quotes
Expand Down
23 changes: 13 additions & 10 deletions apps/web/src/components/Post/Actions/Share/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@ interface ShareMenuProps {
const ShareMenu: FC<ShareMenuProps> = ({ post, showCount }) => {
const [isLoading, setIsLoading] = useState(false);
const targetPost = isRepost(post) ? post?.repostOf : post;
const hasShared =
const hasReposted =
targetPost.operations?.hasReposted.optimistic ||
targetPost.operations?.hasQuoted.optimistic;
targetPost.operations?.hasReposted.onChain;
const hasQuoted =
targetPost.operations?.hasQuoted.optimistic ||
targetPost.operations?.hasQuoted.onChain;
const hasShared = hasReposted || hasQuoted;
const shares = targetPost.stats.reposts + targetPost.stats.quotes;

const iconClassName = "w-[15px] sm:w-[18px]";
Expand Down Expand Up @@ -72,14 +76,13 @@ const ShareMenu: FC<ShareMenuProps> = ({ post, showCount }) => {
post={targetPost}
setIsLoading={setIsLoading}
/>
{targetPost.operations?.hasReposted.optimistic &&
targetPost.id !== post.id && (
<UndoRepost
isLoading={isLoading}
post={post}
setIsLoading={setIsLoading}
/>
)}
{hasReposted && targetPost.id !== post.id && (
<UndoRepost
isLoading={isLoading}
post={post}
setIsLoading={setIsLoading}
/>
)}
<Quote post={targetPost} />
</MenuItems>
</MenuTransition>
Expand Down

0 comments on commit 4f5b461

Please sign in to comment.