feat(ui): note in the add-member modal that search covers existing users only

Both fields select from a server-side search over existing accounts, so a
typed-in address or id never becomes a value. Say so up front rather than
letting the form look like it accepts a new user and fail on submit.

Applies to the organization member modal too, which shares this component.
This commit is contained in:
Yuneng Jiang 2026-08-01 09:28:02 -07:00
parent 2a13bbe1cb
commit 48b3d18893
No known key found for this signature in database
2 changed files with 19 additions and 1 deletions

View file

@ -65,4 +65,14 @@ describe("UserSearchModal", () => {
expect(userFilterUICall).not.toHaveBeenCalled();
});
it("tells the user that only existing accounts can be selected", () => {
renderModal();
const notice = screen.getByRole("alert");
expect(notice).toHaveTextContent(/users that already exist/i);
expect(notice).toHaveTextContent(/ask a proxy admin to create their account first/i);
// info, not warning: a warning here would read as an error state on an empty form
expect(notice.className).toMatch(/ant-alert-info/);
});
});

View file

@ -1,5 +1,5 @@
import { useState } from "react";
import { Modal, Form, Button, Select, Tooltip } from "antd";
import { Modal, Form, Button, Select, Tooltip, Alert } from "antd";
import { UserAddOutlined } from "@ant-design/icons";
import { useDebouncedCallback } from "@tanstack/react-pacer/debouncer";
import { userFilterUICall } from "@/components/networking";
@ -140,6 +140,14 @@ const UserSearchModal: React.FC<UserSearchModalProps> = ({
role: defaultRole,
}}
>
<Alert
type="info"
showIcon
className="mb-4"
message="Search selects from users that already exist. To add someone new, ask a proxy admin to create their account first."
data-testid="member-existing-users-notice"
/>
<Form.Item label="Email" name="user_email" className="mb-4">
<Select
showSearch