Skip to content

Commit

Permalink
Update pinned conversation as well
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Risch authored and Alex Risch committed Aug 13, 2024
1 parent fc647cd commit 1e40121
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions components/PinnedConversations/PinnedConversation.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { useGroupNameQuery } from "@queries/useGroupNameQuery";
import { useGroupPhotoQuery } from "@queries/useGroupPhotoQuery";
import { backgroundColor, textSecondaryColor } from "@styles/colors";
import { AvatarSizes } from "@styles/sizes";
import { FC, useCallback } from "react";
Expand All @@ -9,10 +11,12 @@ import {
} from "react-native";

import Avatar from "..//Avatar";
import { useChatStore, useProfilesStore } from "../../data/store/accountsStore";
import {
useChatStore,
useCurrentAccount,
useProfilesStore,
} from "../../data/store/accountsStore";
import { XmtpConversation } from "../../data/store/chatStore";
import { useGroupName } from "../../hooks/useGroupName";
import { useGroupPhoto } from "../../hooks/useGroupPhoto";
import { navigate } from "../../utils/navigation";
import { getPreferredAvatar, getPreferredName } from "../../utils/profile";
import GroupAvatar from "../GroupAvatar";
Expand All @@ -22,10 +26,15 @@ interface Props {
}

export const PinnedConversation: FC<Props> = ({ conversation }) => {
const account = useCurrentAccount() as string;
const profiles = useProfilesStore((s) => s.profiles);
const { topic, isGroup } = conversation;
const { groupName } = useGroupName(topic);
const { groupPhoto } = useGroupPhoto(topic);
const { data: groupName } = useGroupNameQuery(account, topic, {
refetchOnMount: false,
});
const { data: groupPhoto } = useGroupPhotoQuery(account, topic, {
refetchOnMount: false,
});
const title = isGroup ? groupName : conversation.conversationTitle;
const socials = profiles[conversation.peerAddress as string]?.socials;
const avatar = isGroup ? groupPhoto : getPreferredAvatar(socials);
Expand Down

0 comments on commit 1e40121

Please sign in to comment.