Skip to content

Commit a478810

Browse files
lourouthierryskoda
andauthored
refactor: Profile Editing & Component Architecture Improvements (#1586)
Co-authored-by: Thierry <[email protected]>
1 parent 513c8b4 commit a478810

File tree

57 files changed

+1375
-998
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1375
-998
lines changed

components/AccountSettingsButton.tsx

-141
This file was deleted.

containers/GroupScreenMembersTable.tsx

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { IProfileSocials } from "@/features/profiles/profile-types";
1+
import { IProfileSocials } from "@/features/profiles/profile.types";
22
import { getInboxProfileSocialsQueryConfig } from "@/queries/useInboxProfileSocialsQuery";
33
import { captureErrorWithFriendlyToast } from "@/utils/capture-error";
44
import { GroupWithCodecsType } from "@/utils/xmtpRN/xmtp-client/xmtp-client.types";
@@ -130,10 +130,11 @@ export const GroupScreenMembersTable: FC<GroupScreenMembersTableProps> = memo(
130130
async (selectedIndex?: number) => {
131131
switch (selectedIndex) {
132132
case 0:
133-
navigate("Profile", {
134-
address: a.address,
135-
fromGroupTopic: topic,
136-
});
133+
// TODO
134+
// navigate("Profile", {
135+
// address: a.address,
136+
// fromGroupTopic: topic,
137+
// });
137138
break;
138139
case promoteSuperAdminIndex:
139140
logger.debug("Promoting super admin...");
@@ -221,7 +222,6 @@ export const GroupScreenMembersTable: FC<GroupScreenMembersTableProps> = memo(
221222
revokeSuperAdmin,
222223
styles.adminText,
223224
styles.tableViewRight,
224-
topic,
225225
]);
226226

227227
return (

design-system/settings-list/settings-list-row.tsx

-2
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,10 @@ import { ISettingsListRow } from "./settings-list.types";
99

1010
type ISettingsListRowProps = {
1111
row: ISettingsListRow;
12-
editMode?: boolean;
1312
};
1413

1514
export const SettingsListRow = memo(function SettingsListRow({
1615
row,
17-
editMode,
1816
}: ISettingsListRowProps) {
1917
const { theme, themed } = useAppTheme();
2018

design-system/settings-list/settings-list.tsx

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,22 @@
1+
import { ThemedStyle, useAppTheme } from "@/theme/useAppTheme";
12
import React, { memo } from "react";
23
import { View, ViewStyle } from "react-native";
3-
import { useAppTheme, ThemedStyle } from "@/theme/useAppTheme";
44
import { SettingsListRow } from "./settings-list-row";
55
import { ISettingsListRow } from "./settings-list.types";
66

77
type ISettingsListProps = {
88
rows: ISettingsListRow[];
9-
editMode?: boolean;
109
};
1110

1211
export const SettingsList = memo(function SettingsList({
1312
rows,
14-
editMode,
1513
}: ISettingsListProps) {
1614
const { themed } = useAppTheme();
1715

1816
return (
1917
<View style={themed($container)}>
2018
{rows.map((row, index) => (
21-
<SettingsListRow
22-
key={row.label + index}
23-
row={row}
24-
editMode={editMode}
25-
/>
19+
<SettingsListRow key={row.label + index} row={row} />
2620
))}
2721
</View>
2822
);

features/conversation-list/conversation-list.screen-header.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ function HeaderTitle() {
137137
function ProfileAvatar() {
138138
const { theme, themed } = useAppTheme();
139139
const navigation = useNavigation();
140-
const currentAccount = useCurrentAccount();
141140
const currentAccountInboxId = useSafeCurrentAccountInboxId();
142141
const { data: preferredName } = usePreferredInboxName({
143142
inboxId: currentAccountInboxId,
@@ -154,7 +153,7 @@ function ProfileAvatar() {
154153
<Pressable
155154
onPress={() => {
156155
navigation.navigate("Profile", {
157-
address: currentAccount!,
156+
inboxId: currentAccountInboxId,
158157
});
159158
}}
160159
hitSlop={theme.spacing.sm}

features/conversation/conversation-message/conversation-message-content-types/conversation-message-chat-group-update.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export function ChatGroupMemberLeft({ inboxId }: IChatGroupMemberLeftProps) {
101101
style={themed($pressableContent)}
102102
onPress={() => {
103103
navigate("Profile", {
104-
address: firstSocials.address ?? "",
104+
inboxId,
105105
});
106106
}}
107107
>
@@ -151,7 +151,7 @@ function ChatGroupMemberJoined({ inboxId }: IChatGroupMemberJoinedProps) {
151151
<Pressable
152152
onPress={() => {
153153
navigate("Profile", {
154-
address: firstSocials.address ?? "",
154+
inboxId,
155155
});
156156
}}
157157
style={themed($pressableContent)}
@@ -225,7 +225,7 @@ function ChatGroupMetadataUpdate({
225225
<Pressable
226226
onPress={() => {
227227
navigate("Profile", {
228-
address: firstSocials.address ?? "",
228+
inboxId: initiatorInboxId,
229229
});
230230
}}
231231
style={themed($pressableContent)}

features/conversation/conversation-message/conversation-message-reactions/use-conversation-message-reactions-rolled-up.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,11 @@ export function useConversationMessageReactionsRolledUp(args: {
100100
}));
101101

102102
return {
103+
messageId,
103104
totalCount,
104105
userReacted,
105106
preview,
106107
detailed,
107-
messageId,
108108
};
109109
}, [reactionsBySender, membersSocials, messageId]);
110110
}

features/conversation/conversation-message/conversation-message-sender-avatar.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ export function ConversationSenderAvatar({
2727

2828
const openProfile = useCallback(() => {
2929
if (address) {
30-
navigate("Profile", { address });
30+
navigate("Profile", { inboxId });
3131
}
32-
}, [address]);
32+
}, [address, inboxId]);
3333

3434
return (
3535
<TouchableOpacity onPress={openProfile}>

features/conversation/conversation-screen-header/conversation-screen-dm-header-title.tsx

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { ConversationHeaderTitle } from "@/features/conversation/conversation-screen-header/conversation-screen-header-title";
2-
import { usePreferredInboxAddress } from "@/hooks/usePreferredInboxAddress";
32
import { usePreferredInboxAvatar } from "@/hooks/usePreferredInboxAvatar";
43
import { usePreferredInboxName } from "@/hooks/usePreferredInboxName";
54
import { useDmPeerInboxIdQuery } from "@/queries/use-dm-peer-inbox-id-query";
@@ -28,15 +27,11 @@ export const DmConversationTitle = ({ topic }: DmConversationTitleProps) => {
2827
caller: "DmConversationTitle",
2928
});
3029

31-
const { data: peerAddress } = usePreferredInboxAddress({
32-
inboxId: peerInboxId!,
33-
});
34-
3530
const onPress = useCallback(() => {
36-
if (peerAddress) {
37-
navigation.push("Profile", { address: peerAddress });
31+
if (peerInboxId) {
32+
navigation.push("Profile", { inboxId: peerInboxId });
3833
}
39-
}, [navigation, peerAddress]);
34+
}, [navigation, peerInboxId]);
4035

4136
const onLongPress = useCallback(() => {
4237
copyToClipboard(JSON.stringify(topic));

features/conversation/conversation-screen-header/conversation-screen-new-dm-header-title.tsx

-51
This file was deleted.

features/conversation/utils/inbox-id-is-part-of-converastion.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
import { getCurrentAccount } from "@/features/multi-inbox/multi-inbox.store";
2-
import { getSafeCurrentSender } from "@/features/multi-inbox/multi-inbox.store";
1+
import {
2+
getCurrentAccount,
3+
getSafeCurrentSender,
4+
} from "@/features/multi-inbox/multi-inbox.store";
35
import {
46
ensureDmPeerInboxIdQueryData,
57
getDmPeerInboxIdQueryData,

features/groups/invite-to-group/invite-users-to-exisiting-group.screen.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ import { SearchBar } from "@/components/SearchBar";
2424
import TableView from "@/components/TableView/TableView";
2525
import { TableViewPicto } from "@/components/TableView/TableViewImage";
2626
import { config } from "@/config";
27-
import { IProfileSocials } from "@/features/profiles/profile-types";
27+
import { ActivityIndicator } from "@/design-system/activity-indicator";
28+
import { getSafeCurrentSender } from "@/features/multi-inbox/multi-inbox.store";
29+
import { IProfileSocials } from "@/features/profiles/profile.types";
2830
import { useGroupMembers } from "@/hooks/useGroupMembers";
2931
import { translate } from "@/i18n";
3032
import { setProfileRecordSocialsQueryData } from "@/queries/useProfileSocialsQuery";
@@ -35,8 +37,6 @@ import { getCleanAddress } from "@/utils/evm/getCleanAddress";
3537
import { isEmptyObject } from "@/utils/objects";
3638
import { getPreferredName } from "@/utils/profile";
3739
import { accountCanMessagePeer } from "@/utils/xmtpRN/xmtp-consent/account-can-message-peer";
38-
import { ActivityIndicator } from "@/design-system/activity-indicator";
39-
import { getSafeCurrentSender } from "@/features/multi-inbox/multi-inbox.store";
4040
export function InviteUsersToExistingGroupScreen({
4141
route,
4242
navigation,

0 commit comments

Comments
 (0)