Skip to content

Commit

Permalink
fix: profile info
Browse files Browse the repository at this point in the history
  • Loading branch information
friendlysxw committed Nov 10, 2023
1 parent 82cd0d3 commit 9b1d27d
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default function LensFollowProfileCard({
() => ({
handle: getHandle(profile),
address: getOwnedByAddress(profile),
name: getName(profile),
name: getName(profile) || profile?.id,
avatar: getAvatar(profile),
bio: getBio(profile),
isFollowed:
Expand Down
8 changes: 6 additions & 2 deletions apps/u3/src/components/social/lens/LensPostCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,17 @@ export default function LensPostCard({
isPending: isPendingReactionUpvote,
} = useReactionLensUpvote({
publication,
onReactionSuccess: ({ originPublication }) => {
onReactionSuccess: ({ originPublication, hasUpvoted: upvoted }) => {
if (originPublication?.id !== updatedPublication.id) return;
setUpdatedPublication((prev) => {
if (!prev) return prev;
const { stats } = prev;
const { stats, operations } = prev;
return {
...prev,
operations: {
...operations,
hasUpvoted: upvoted,
},
stats: {
...stats,
upvotes: Number(stats.upvotes) + 1,
Expand Down
1 change: 1 addition & 0 deletions apps/u3/src/components/social/lens/v1/LensPostCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export default function LensPostCardV1({
navigate(`/social/post-detail/lens/${data.id}`);
}}
data={cardData}
likeDisabled
replyDisabled={replyDisabled}
repostDisabled={repostDisabled}
shareLink={getSocialDetailShareUrlWithLens(data.id)}
Expand Down
4 changes: 3 additions & 1 deletion apps/u3/src/hooks/social/lens/useCreateLensComment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ export function useCreateLensComment(props?: {
commentOn: {
id: publicationId,
},
metadata,
metadata: {
...(metadata?.lens || {}),
},
});
toast.success('Comment successfully!');
} catch (err) {
Expand Down
4 changes: 3 additions & 1 deletion apps/u3/src/utils/profile/biolink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ export const isFarcasterHandle = (handle: string) => {
};
export const lensHandleToBioLinkHandle = (handle: string) => {
return handle
? `${handle.replace(/\.[^.]+$/, '')}.${BIOLINK_LENS_SUFFIX}`
? `${handle
.replace('test/', '')
.replace(/\.[^.]+$/, '')}.${BIOLINK_LENS_SUFFIX}`
: '';
};
export const farcasterHandleToBioLinkHandle = (handle: string) => {
Expand Down
8 changes: 4 additions & 4 deletions apps/u3/src/utils/social/lens/lens-ui-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ export const lensPublicationToPostCardData = (
return {
platform: SocialPlatform.Lens,
avatar: getAvatar(publication?.by),
name: getName(publication?.by),
handle: getHandle(publication?.by),
name: getName(publication?.by) || publication?.by?.id,
handle: getHandle(publication?.by) || publication?.by?.id,
createdAt: publication?.createdAt || '',
content: getContent(publication?.metadata),
totalLikes: publication?.stats?.upvotes || 0,
Expand All @@ -29,8 +29,8 @@ export const lensPublicationToReplyCardData = (
return {
platform: SocialPlatform.Lens,
avatar: getAvatar(publication?.by),
name: getName(publication?.by),
handle: getHandle(publication?.by),
name: getName(publication?.by) || publication?.by?.id,
handle: getHandle(publication?.by) || publication?.by?.id,
createdAt: publication?.createdAt || '',
content: getContent(publication?.metadata),
totalLikes: publication?.stats?.upvotes || 0,
Expand Down

0 comments on commit 9b1d27d

Please sign in to comment.