Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3300606
D10944.id36950.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D10944.id36950.diff
View Options
diff --git a/web/modals/threads/members/add-members-modal.react.js b/web/modals/threads/members/add-members-modal.react.js
--- a/web/modals/threads/members/add-members-modal.react.js
+++ b/web/modals/threads/members/add-members-modal.react.js
@@ -21,19 +21,39 @@
type ContentProps = {
+searchText: string,
+threadID: string,
- +onClose: () => void,
};
function AddMembersModalContent(props: ContentProps): React.Node {
- const { searchText, threadID, onClose } = props;
-
- const { pendingUsersToAdd } = useAddUsersListContext();
+ const { searchText, threadID } = props;
const { userInfos, sortedUsersWithENSNames } = useAddMembersListUserInfos({
threadID,
searchText,
});
+ return (
+ <div className={css.addMembersContent}>
+ <div className={css.addMembersListContainer}>
+ <AddUsersList
+ searchModeActive={searchText.length > 0}
+ userInfos={userInfos}
+ sortedUsersWithENSNames={sortedUsersWithENSNames}
+ />
+ </div>
+ </div>
+ );
+}
+
+type Props = {
+ +threadID: string,
+ +onClose: () => void,
+};
+
+function AddMembersModal(props: Props): React.Node {
+ const { threadID, onClose } = props;
+
+ const { pendingUsersToAdd } = useAddUsersListContext();
+
const dispatchActionPromise = useDispatchActionPromise();
const callChangeThreadSettings = useChangeThreadSettings();
@@ -54,48 +74,24 @@
threadID,
]);
- return (
- <div className={css.addMembersContent}>
- <div className={css.addMembersListContainer}>
- <AddUsersList
- searchModeActive={searchText.length > 0}
- userInfos={userInfos}
- sortedUsersWithENSNames={sortedUsersWithENSNames}
- />
- </div>
- <div className={css.addMembersFooter}>
- <Button onClick={onClose} variant="outline">
- Cancel
- </Button>
- <Button
- disabled={!pendingUsersToAdd.size}
- variant="filled"
- onClick={addUsers}
- >
- Add selected members
- </Button>
- </div>
- </div>
+ const primaryButton = React.useMemo(
+ () => (
+ <Button
+ disabled={!pendingUsersToAdd.size}
+ variant="filled"
+ onClick={addUsers}
+ >
+ Add selected members
+ </Button>
+ ),
+ [addUsers, pendingUsersToAdd.size],
);
-}
-
-type Props = {
- +threadID: string,
- +onClose: () => void,
-};
-
-function AddMembersModal(props: Props): React.Node {
- const { threadID, onClose } = props;
const addMembersModalContent = React.useCallback(
(searchText: string) => (
- <AddMembersModalContent
- searchText={searchText}
- threadID={threadID}
- onClose={onClose}
- />
+ <AddMembersModalContent searchText={searchText} threadID={threadID} />
),
- [onClose, threadID],
+ [threadID],
);
return (
@@ -104,6 +100,7 @@
searchPlaceholder="Search members"
onClose={onClose}
size="fit-content"
+ primaryButton={primaryButton}
>
{addMembersModalContent}
</SearchModal>
diff --git a/web/modals/threads/members/members-modal.css b/web/modals/threads/members/members-modal.css
--- a/web/modals/threads/members/members-modal.css
+++ b/web/modals/threads/members/members-modal.css
@@ -93,10 +93,3 @@
overflow: auto;
flex: 1;
}
-
-div.addMembersFooter {
- display: flex;
- justify-content: end;
- column-gap: 16px;
- margin-top: 16px;
-}
diff --git a/web/sidebar/community-creation/community-creation-members-modal.react.js b/web/sidebar/community-creation/community-creation-members-modal.react.js
--- a/web/sidebar/community-creation/community-creation-members-modal.react.js
+++ b/web/sidebar/community-creation/community-creation-members-modal.react.js
@@ -30,11 +30,7 @@
searchText={searchText}
placeholder="Search members"
/>
- <AddMembersModalContent
- searchText={searchText}
- threadID={threadID}
- onClose={onClose}
- />
+ <AddMembersModalContent searchText={searchText} threadID={threadID} />
</div>
</Modal>
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 18, 8:19 PM (21 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2535799
Default Alt Text
D10944.id36950.diff (4 KB)
Attached To
Mode
D10944: [web] lift primary button logic from AddMembersModalContent into AddMembersModal
Attached
Detach File
Event Timeline
Log In to Comment