diff --git a/app/components/Sharing/MemberListItem.tsx b/app/components/Sharing/MemberListItem.tsx
index 713a854d34..c527bbfdad 100644
--- a/app/components/Sharing/MemberListItem.tsx
+++ b/app/components/Sharing/MemberListItem.tsx
@@ -1,4 +1,5 @@
import { observer } from "mobx-react";
+import { PlusIcon } from "outline-icons";
import * as React from "react";
import { useTranslation } from "react-i18next";
import styled from "styled-components";
@@ -107,6 +108,10 @@ const MemberListItem = ({
);
};
+export const InviteIcon = styled(PlusIcon)`
+ opacity: 0;
+`;
+
export const StyledListItem = styled(ListItem).attrs({
small: true,
border: false,
@@ -114,6 +119,10 @@ export const StyledListItem = styled(ListItem).attrs({
margin: 0 -16px;
padding: 6px 16px;
border-radius: 8px;
+
+ &:hover ${InviteIcon} {
+ opacity: 1;
+ }
`;
export default observer(MemberListItem);
diff --git a/app/components/Sharing/SharePopover.tsx b/app/components/Sharing/SharePopover.tsx
index 37a03e660f..158934d257 100644
--- a/app/components/Sharing/SharePopover.tsx
+++ b/app/components/Sharing/SharePopover.tsx
@@ -31,7 +31,7 @@ import useThrottledCallback from "~/hooks/useThrottledCallback";
import { documentPath, urlify } from "~/utils/routeHelpers";
import Avatar from "../Avatar";
import { AvatarSize } from "../Avatar/Avatar";
-import Button from "../Button";
+import ButtonSmall from "../ButtonSmall";
import Empty from "../Empty";
import CollectionIcon from "../Icons/CollectionIcon";
import { NativeInput } from "../Input";
@@ -39,7 +39,7 @@ import NudeButton from "../NudeButton";
import Squircle from "../Squircle";
import Tooltip from "../Tooltip";
import DocumentMembersList from "./DocumentMemberList";
-import { StyledListItem } from "./MemberListItem";
+import { InviteIcon, StyledListItem } from "./MemberListItem";
import PublicAccess from "./PublicAccess";
type Props = {
@@ -169,14 +169,17 @@ function SharePopover({
}, [onRequestClose, t]);
const handleInvite = React.useCallback(
- (user: User) => {
+ async (user: User) => {
setInvitedInSession((prev) => [...prev, user.id]);
- return userMemberships.create({
+ await userMemberships.create({
documentId: document.id,
userId: user.id,
});
+ toast.message(
+ t("{{ userName }} was invited to the document", { userName: user.name })
+ );
},
- [userMemberships, document.id]
+ [t, userMemberships, document.id]
);
const handleQuery = React.useCallback(
@@ -207,15 +210,15 @@ function SharePopover({
placeholder={`${t("Invite by name")}…`}
value={query}
onChange={handleQuery}
- onFocus={showPicker}
+ onClick={showPicker}
style={{ padding: "6px 0" }}
/>
{picker ? (
invitedInSession.length ? (
-
+
) : null
) : (
}
+ actions={}
/>
))}
>
diff --git a/shared/i18n/locales/en_US/translation.json b/shared/i18n/locales/en_US/translation.json
index 76cc3eb1eb..9edf479ba9 100644
--- a/shared/i18n/locales/en_US/translation.json
+++ b/shared/i18n/locales/en_US/translation.json
@@ -258,6 +258,7 @@
"Anyone with the link can access because the parent document, <2>{documentTitle}2>, is shared": "Anyone with the link can access because the parent document, <2>{documentTitle}2>, is shared",
"Anyone with the link can access": "Anyone with the link can access",
"Publish to internet": "Publish to internet",
+ "{{ userName }} was invited to the document": "{{ userName }} was invited to the document",
"Invite by name": "Invite by name",
"Done": "Done",
"No matches": "No matches",