Add collection access hint to invite screen

This commit is contained in:
Tom Moor
2023-12-16 13:24:53 -05:00
parent 00ecf84dbd
commit 557fb94642
3 changed files with 37 additions and 3 deletions

View File

@@ -41,7 +41,7 @@ function Invite({ onSubmit }: Props) {
role: UserRole.Member,
},
]);
const { users } = useStores();
const { users, collections } = useStores();
const user = useCurrentUser();
const team = useCurrentTeam();
const { t } = useTranslation();
@@ -136,6 +136,27 @@ function Invite({ onSubmit }: Props) {
[handleAdd]
);
const collectionCount = collections.nonPrivate.length;
const collectionAccessNote = (
<span>
<Trans>Invited members will receive access to</Trans>{" "}
<Tooltip
tooltip={
<>
{collections.nonPrivate.map((collection) => (
<li key={collection.id}>{collection.name}</li>
))}
</>
}
>
<Def>
<Trans>{{ collectionCount }} collections</Trans>
</Def>
</Tooltip>
.
</span>
);
return (
<form onSubmit={handleSubmit}>
{team.guestSignin ? (
@@ -145,7 +166,8 @@ function Invite({ onSubmit }: Props) {
values={{
signinMethods: team.signinMethods,
}}
/>
/>{" "}
{collectionAccessNote}
</Text>
) : (
<Text type="secondary">
@@ -160,7 +182,8 @@ function Invite({ onSubmit }: Props) {
As an admin you can also{" "}
<Link to="/settings/security">enable email sign-in</Link>.
</Trans>
)}
)}{" "}
{collectionAccessNote}
</Text>
)}
{team.subdomain && (
@@ -270,4 +293,8 @@ const Remove = styled("div")`
margin-right: -32px;
`;
const Def = styled("span")`
text-decoration: underline dotted;
`;
export default observer(Invite);

View File

@@ -67,6 +67,11 @@ export default class CollectionsStore extends Store<Collection> {
});
}
@computed
get nonPrivate(): Collection[] {
return this.all.filter((collection) => collection.isPrivate);
}
@computed
get all(): Collection[] {
return sortBy(

View File

@@ -632,6 +632,8 @@
"We sent out your invites!": "We sent out your invites!",
"Those email addresses are already invited": "Those email addresses are already invited",
"Sorry, you can only send {{MAX_INVITES}} invites at a time": "Sorry, you can only send {{MAX_INVITES}} invites at a time",
"Invited members will receive access to": "Invited members will receive access to",
"{{collectionCount}} collections": "{{collectionCount}} collections",
"Invite members or guests to join your workspace. They can sign in with {{signinMethods}} or use their email address.": "Invite members or guests to join your workspace. They can sign in with {{signinMethods}} or use their email address.",
"Invite members to join your workspace. They will need to sign in with {{signinMethods}}.": "Invite members to join your workspace. They will need to sign in with {{signinMethods}}.",
"As an admin you can also <2>enable email sign-in</2>.": "As an admin you can also <2>enable email sign-in</2>.",