mirror of
https://github.com/outline/outline.git
synced 2026-11-30 09:00:18 +03:00
Clarify invite
This commit is contained in:
1 parent
8502345b65
commit
2f527cbecd
3 files changed
+22
-8
No files matched your search
@@ -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);
|
||||
@@ -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" }}
|
||||
/>
|
||||
</AnimatePresence>
|
||||
{picker ? (
|
||||
invitedInSession.length ? (
|
||||
<Button onClick={hidePicker} neutral>
|
||||
<ButtonSmall onClick={hidePicker} neutral>
|
||||
{t("Done")}
|
||||
</Button>
|
||||
</ButtonSmall>
|
||||
) : null
|
||||
) : (
|
||||
<CopyToClipboard
|
||||
@@ -316,6 +319,7 @@ const Picker = observer(
|
||||
showBorder={false}
|
||||
/>
|
||||
}
|
||||
actions={<InviteIcon />}
|
||||
/>
|
||||
))}
|
||||
</>
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in new issue
Block a user