email wiring
This commit is contained in:
parent
ee23b71f0f
commit
42cd937f0a
12 changed files with 494 additions and 45 deletions
|
|
@ -29,11 +29,8 @@ function roleLabel(member) {
|
|||
return "User";
|
||||
}
|
||||
|
||||
function groupLabel(member) {
|
||||
if (member.is_domain_owner || member.org_role === "owner" || member.org_role === "admin") {
|
||||
return "Admin";
|
||||
}
|
||||
return "—";
|
||||
function sectionLabel(member) {
|
||||
return member.section_name || "—";
|
||||
}
|
||||
|
||||
function StatusBadge({ status }) {
|
||||
|
|
@ -98,6 +95,7 @@ export default function CompanyPeople({ account }) {
|
|||
const [search, setSearch] = useState("");
|
||||
const [roleFilter, setRoleFilter] = useState("all");
|
||||
const [drawerOpen, setDrawerOpen] = useState(false);
|
||||
const [notice, setNotice] = useState("");
|
||||
|
||||
const loadMembers = useCallback(async () => {
|
||||
setLoading(true);
|
||||
|
|
@ -187,6 +185,7 @@ export default function CompanyPeople({ account }) {
|
|||
</select>
|
||||
</div>
|
||||
|
||||
{notice && <p className="people-notice" role="status">{notice}</p>}
|
||||
{error && <p className="form-error" role="alert">{error}</p>}
|
||||
|
||||
<div className="people-table-wrap">
|
||||
|
|
@ -198,7 +197,7 @@ export default function CompanyPeople({ account }) {
|
|||
<th>Email</th>
|
||||
<th>Status</th>
|
||||
<th>Role</th>
|
||||
<th>Group</th>
|
||||
<th>Section</th>
|
||||
<th>Storage</th>
|
||||
<th>Last active</th>
|
||||
<th aria-label="Actions" />
|
||||
|
|
@ -230,7 +229,7 @@ export default function CompanyPeople({ account }) {
|
|||
<td>{member.email}</td>
|
||||
<td><StatusBadge status={member.member_status} /></td>
|
||||
<td>{roleLabel(member)}</td>
|
||||
<td>{groupLabel(member)}</td>
|
||||
<td>{sectionLabel(member)}</td>
|
||||
<td>{member.member_status === "invited" ? "—" : "—"}</td>
|
||||
<td>{member.member_status === "invited" ? "—" : "—"}</td>
|
||||
<td>
|
||||
|
|
@ -249,7 +248,17 @@ export default function CompanyPeople({ account }) {
|
|||
<AddUserPanel
|
||||
companyDomain={companyDomain}
|
||||
onClose={() => setDrawerOpen(false)}
|
||||
onCreated={() => loadMembers()}
|
||||
onCreated={(member) => {
|
||||
loadMembers();
|
||||
if (member.invitation_sent) {
|
||||
setNotice(`Invitation email sent to ${member.invitation_email}.`);
|
||||
} else if (member.member_status === "invited") {
|
||||
setNotice("User created. Invitation email was not sent.");
|
||||
} else {
|
||||
setNotice("User created.");
|
||||
}
|
||||
window.setTimeout(() => setNotice(""), 5000);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</section>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue