Popover rebuild

This commit is contained in:
Tom Moor committed 2024-01-27 11:02:45 -05:00
1 parent 94d814290c
commit e2ff8c47e2
11 files changed
+412 -439

No files matched your search

+7 -2
View File
@@ -24,6 +24,7 @@ type Props = {
src?: string;
model?: IAvatar;
alt?: string;
shape?: "square";
showBorder?: boolean;
onClick?: React.MouseEventHandler<HTMLImageElement>;
className?: string;
@@ -65,11 +66,15 @@ const Relative = styled.div`
flex-shrink: 0;
`;
const CircleImg = styled.img<{ size: number; $showBorder?: boolean }>`
const CircleImg = styled.img<{
size: number;
shape?: "square";
$showBorder?: boolean;
}>`
display: block;
width: ${(props) => props.size}px;
height: ${(props) => props.size}px;
border-radius: 50%;
border-radius: ${(props) => (props.shape === "square" ? 4 : props.size)}px;
border: ${(props) =>
props.$showBorder === false
? "none"
+2 -4
View File
@@ -3,19 +3,17 @@ import Flex from "~/components/Flex";
const Initials = styled(Flex)<{
color?: string;
shape?: "square";
size: number;
$showBorder?: boolean;
}>`
align-items: center;
justify-content: center;
border-radius: 50%;
width: 100%;
height: 100%;
border-radius: ${(props) => (props.shape === "square" ? 4 : props.size)}px;
color: #fff;
background-color: ${(props) => props.color};
width: ${(props) => props.size}px;
height: ${(props) => props.size}px;
border-radius: 50%;
border: 2px solid
${(props) =>
props.$showBorder === false ? "transparent" : props.theme.background};
-215
View File
@@ -1,215 +0,0 @@
/* eslint-disable react/prop-types */
import { observer } from "mobx-react";
import * as React from "react";
import {
unstable_useComboboxState as useComboboxState,
unstable_Combobox as ComboboxInput,
unstable_ComboboxPopover as ComboboxPopover,
unstable_ComboboxOption as ComboboxOption,
} from "reakit/Combobox";
import styled from "styled-components";
import breakpoint from "styled-components-breakpoint";
import { s, ellipsis } from "@shared/styles";
import { Backdrop, Background, Placement } from "~/components/ContextMenu";
import { MenuAnchorCSS } from "~/components/ContextMenu/MenuItem";
import { LabelText, Outline, Wrapper } from "~/components/Input";
import { Positioner } from "~/components/InputSelect";
import { Portal } from "~/components/Portal";
import useBoolean from "~/hooks/useBoolean";
import useMobile from "~/hooks/useMobile";
import { undraggableOnDesktop } from "~/styles";
type Suggestion = {
id: string;
value: string;
/** A label to show instead of the value if a more rich component is needed */
label?: React.ReactNode;
[key: string]: any;
};
type Option = Omit<Suggestion, "value">;
type Props = Omit<React.InputHTMLAttributes<HTMLInputElement>, "list"> & {
/** All possible suggestions, populated as search result options */
suggestions: Suggestion[];
/** Value held by the search input bar */
value: string;
/** Label for search input */
label?: string;
/** Label for the search results list */
listLabel: string;
/** Handler which triggers upon search input change */
onChangeInput: (value: string) => void;
/** Handler which triggers when one of the search result options is selected */
onSelectOption: (option: Option) => void;
};
function Combobox({
suggestions = [],
value,
label,
listLabel,
onChangeInput,
onSelectOption,
...rest
}: Props) {
const [focused, handleFocus, handleBlur] = useBoolean();
const [listWidth, setListWidth] = React.useState<number | string>(0);
const isMobile = useMobile();
const handleChange = (ev: React.ChangeEvent<HTMLInputElement>) => {
state.setInputValue(ev.target.value);
};
const state = useComboboxState({
gutter: 2,
values: suggestions.map((s) => s.value),
});
const items = React.useMemo(
() => suggestions.filter((s) => state.matches.includes(s.value)),
[state.matches, suggestions]
);
React.useEffect(() => {
if (!isMobile && state.visible && state.unstable_disclosureRef.current) {
const elem = state.unstable_disclosureRef.current;
setListWidth(elem.clientWidth);
}
}, [state.visible, state.unstable_disclosureRef, isMobile]);
React.useEffect(() => {
state.setValues(suggestions.map((s) => s.value));
}, [suggestions]);
React.useEffect(() => {
onChangeInput(state.inputValue);
}, [state.inputValue, onChangeInput]);
return (
<>
<Wrapper>
<label>
{label && <LabelText>{label}</LabelText>}
<Outline focused={focused}>
<StyledComboboxInput
{...state}
onBlur={handleBlur}
onFocus={handleFocus}
onChange={handleChange}
type="search"
ref={
state.unstable_disclosureRef as React.RefObject<HTMLInputElement>
}
{...rest}
/>
</Outline>
</label>
</Wrapper>
<ComboboxPopover
{...state}
aria-label={listLabel}
modal
style={{
width: isMobile ? "auto" : `${listWidth}px`,
}}
>
{(
props: React.HTMLAttributes<HTMLDivElement> & {
placement: Placement;
}
) => {
const topAnchor = props.style?.top === "0";
const rightAnchor = props.placement === "bottom-end";
if (!items.length) {
return null;
}
return (
<>
{state.visible && isMobile && (
<Portal>
<Backdrop onClick={state.hide} />
</Portal>
)}
<Portal>
<Positioner {...props}>
<Background
dir="auto"
topAnchor={topAnchor}
rightAnchor={rightAnchor}
hiddenScrollbars
style={{ maxWidth: "100%" }}
>
{state.visible
? items.map((item) => (
<StyledComboboxOption
{...state}
key={item.id}
onClick={() => {
onSelectOption(item);
state.setInputValue("");
state.hide();
}}
>
{item.label ?? item.value}
</StyledComboboxOption>
))
: null}
</Background>
</Positioner>
</Portal>
</>
);
}}
</ComboboxPopover>
</>
);
}
const StyledComboboxInput = styled(ComboboxInput)`
border: 0;
flex: 1;
padding: 8px 12px 8px;
outline: none;
background: none;
color: ${s("text")};
height: 30px;
min-width: 0;
font-size: 15px;
${ellipsis()}
${undraggableOnDesktop()}
&:disabled,
&::placeholder {
color: ${s("placeholder")};
opacity: 1;
}
&:-webkit-autofill,
&:-webkit-autofill:hover,
&:-webkit-autofill:focus {
-webkit-box-shadow: 0 0 0px 1000px ${s("background")} inset;
}
&::-webkit-search-cancel-button {
-webkit-appearance: none;
}
${breakpoint("mobile", "tablet")`
font-size: 16px;
`};
`;
const StyledComboboxOption = styled(ComboboxOption)`
${MenuAnchorCSS}
/* overriding the styles from MenuAnchorCSS because we use &nbsp; here */
svg:not(:last-child) {
margin-right: 0px;
}
`;
export default observer(Combobox);
+7
View File
@@ -12,6 +12,7 @@ export type Props = Omit<React.HTMLAttributes<HTMLAnchorElement>, "title"> & {
title: React.ReactNode;
subtitle?: React.ReactNode;
actions?: React.ReactNode;
onClick?: React.MouseEventHandler<HTMLAnchorElement>;
border?: boolean;
small?: boolean;
};
@@ -74,6 +75,7 @@ const ListItem = (
const Wrapper = styled.a<{
$small?: boolean;
$border?: boolean;
onClick?: React.MouseEventHandler<HTMLAnchorElement>;
to?: LocationDescriptor;
}>`
display: flex;
@@ -89,6 +91,11 @@ const Wrapper = styled.a<{
border-bottom: 0;
}
&:hover {
background: ${(props) =>
props.onClick ? props.theme.secondaryBackground : "inherit"};
}
cursor: ${({ to }) => (to ? "var(--pointer)" : "default")};
`;
+7 -1
View File
@@ -1,8 +1,9 @@
import { darken } from "polished";
import styled from "styled-components";
import ActionButton, {
Props as ActionButtonProps,
} from "~/components/ActionButton";
import { undraggableOnDesktop } from "~/styles";
import { hover, undraggableOnDesktop } from "~/styles";
type Props = ActionButtonProps & {
width?: number | string;
@@ -32,6 +33,11 @@ const NudeButton = styled(ActionButton).attrs((props: Props) => ({
user-select: none;
color: inherit;
${undraggableOnDesktop()}
&:${hover},
&[aria-expanded="true"] {
background: ${(props) => darken(0.05, props.theme.buttonNeutralBackground)};
}
`;
export default NudeButton;
+5 -89
View File
@@ -1,25 +1,17 @@
import { t } from "i18next";
import isNil from "lodash/isNil";
import orderBy from "lodash/orderBy";
import { observer } from "mobx-react";
import * as React from "react";
import { useHistory } from "react-router-dom";
import { toast } from "sonner";
import styled from "styled-components";
import { Pagination } from "@shared/constants";
import Document from "~/models/Document";
import User from "~/models/User";
import UserMembership from "~/models/UserMembership";
import Avatar from "~/components/Avatar";
import { AvatarSize } from "~/components/Avatar/Avatar";
import Combobox from "~/components/Combobox";
import Flex from "~/components/Flex";
import LoadingIndicator from "~/components/LoadingIndicator";
import useCurrentUser from "~/hooks/useCurrentUser";
import usePolicy from "~/hooks/usePolicy";
import useRequest from "~/hooks/useRequest";
import useStores from "~/hooks/useStores";
import useThrottledCallback from "~/hooks/useThrottledCallback";
import { homePath } from "~/utils/routeHelpers";
import MemberListItem from "./MemberListItem";
@@ -28,13 +20,12 @@ type Props = {
document: Document;
/** Children to be rendered before the list of members */
children?: React.ReactNode;
/** List of users that have been invited to the document during the current editing session */
invitedInSession: string[];
};
function DocumentMembersList({ document, children }: Props) {
function DocumentMembersList({ document, invitedInSession }: Props) {
const { users, userMemberships } = useStores();
const [query, setQuery] = React.useState("");
const [selectedUser, setSelectedUser] = React.useState<User | null>(null);
const [invitedInSession, setInvitedInSession] = React.useState<string[]>([]);
const user = useCurrentUser();
const history = useHistory();
const can = usePolicy(document);
@@ -63,51 +54,6 @@ function DocumentMembersList({ document, children }: Props) {
void fetchDocumentMembers();
}, [fetchTeamMembers, fetchDocumentMembers]);
const inviteUser = React.useCallback(
(user: User) => {
setInvitedInSession((prev) => [...prev, user.id]);
return userMemberships.create({
documentId: document.id,
userId: user.id,
});
},
[userMemberships, document.id]
);
const fetchUsersByQuery = useThrottledCallback(
(query) =>
users.fetchPage({
query,
}),
250
);
const nonMembers = React.useMemo(
() =>
users.notInDocument(document.id, query).filter((u) => u.id !== user.id),
[users, users.orderedData, document.id, document.members, user.id, query]
);
React.useEffect(() => {
if (!isNil(query)) {
void fetchUsersByQuery(query);
}
}, [query, fetchUsersByQuery]);
React.useEffect(() => {
if (selectedUser) {
void inviteUser(selectedUser);
}
}, [selectedUser, inviteUser]);
const handleQuery = (value: string) => {
setQuery(value);
};
const handleSelect = (user: User) => {
setSelectedUser(user);
};
const handleRemoveUser = React.useCallback(
async (item) => {
try {
@@ -171,32 +117,7 @@ function DocumentMembersList({ document, children }: Props) {
}
return (
<RelativeFlex column>
{can.manageUsers && (
<Combobox
suggestions={nonMembers.map((user) => ({
id: user.id,
value: user.name,
label: (
<Flex align="center" gap={8}>
<Avatar
model={user}
size={AvatarSize.Small}
showBorder={false}
/>
<span>{user.name}</span>
</Flex>
),
}))}
value={query}
onChangeInput={handleQuery}
onSelectOption={handleSelect}
listLabel={t("Workspace members")}
placeholder={`${t("Find by name")}…`}
autoFocus
/>
)}
{children}
<>
{members.map((item) => (
<MemberListItem
key={item.id}
@@ -213,13 +134,8 @@ function DocumentMembersList({ document, children }: Props) {
}
/>
))}
</RelativeFlex>
</>
);
}
const RelativeFlex = styled(Flex)`
position: relative;
margin-bottom: 12px;
`;
export default observer(DocumentMembersList);
+47 -24
View File
@@ -1,8 +1,8 @@
import { observer } from "mobx-react";
import * as React from "react";
import { useTranslation } from "react-i18next";
import styled from "styled-components";
import { DocumentPermission } from "@shared/types";
import Membership from "~/models/Membership";
import User from "~/models/User";
import UserMembership from "~/models/UserMembership";
import Avatar from "~/components/Avatar";
@@ -13,7 +13,7 @@ import { EmptySelectValue, Permission } from "~/types";
type Props = {
user: User;
membership?: Membership | UserMembership | undefined;
membership?: UserMembership | undefined;
onAdd?: () => void;
onRemove?: () => void;
onLeave?: () => void;
@@ -64,32 +64,55 @@ const MemberListItem = ({
const disabled = !onUpdate && !onLeave;
return (
<ListItem
<StyledListItem
title={user.name}
image={<Avatar model={user} size={AvatarSize.Medium} />}
border={false}
style={{ marginRight: -8 }}
small
actions={
<InputMemberPermissionSelect
permissions={
onLeave
? [
currentPermission,
{
label: `${t("Leave")}…`,
value: EmptySelectValue,
},
]
: permissions
}
value={membership?.permission}
onChange={handleChange}
disabled={disabled}
/>
image={
<Avatar model={user} size={AvatarSize.Medium} showBorder={false} />
}
subtitle={
membership?.sourceId
? t("Has access through parent")
: user.isSuspended
? t("Suspended")
: user.isInvited
? t("Invited")
: user.isViewer
? t("Viewer")
: user.email
? user.email
: t("Member")
}
border={false}
actions={
disabled ? null : (
<div style={{ marginRight: -8 }}>
<InputMemberPermissionSelect
permissions={
onLeave
? [
currentPermission,
{
label: `${t("Leave")}…`,
value: EmptySelectValue,
},
]
: permissions
}
value={membership?.permission}
onChange={handleChange}
/>
</div>
)
}
small
/>
);
};
export const StyledListItem = styled(ListItem)`
margin: 0 -16px;
padding: 6px 16px;
border-radius: 8px;
`;
export default observer(MemberListItem);
+4 -3
View File
@@ -83,8 +83,9 @@ function PublicAccess({ document, share, sharedParent, onCopied }: Props) {
const handleUrlSlugChange = React.useMemo(
() =>
debounce(async (ev) => {
const share = shares.getByDocumentId(document.id);
invariant(share, "Share must exist");
if (!share) {
return;
}
const val = ev.target.value;
setUrlSlug(val);
@@ -109,7 +110,7 @@ function PublicAccess({ document, share, sharedParent, onCopied }: Props) {
}
}
}, 500),
[t, document.id, shares]
[t, share]
);
const userLocale = useUserLocale();
+315 -84
View File
@@ -1,30 +1,45 @@
import { AnimatePresence, m } from "framer-motion";
import { observer } from "mobx-react";
import { GroupIcon, QuestionMarkIcon, TeamIcon } from "outline-icons";
import {
BackIcon,
LinkIcon,
MoreIcon,
QuestionMarkIcon,
UserIcon,
} from "outline-icons";
import * as React from "react";
import { useTranslation } from "react-i18next";
import { toast } from "sonner";
import styled from "styled-components";
import styled, { useTheme } from "styled-components";
import { s } from "@shared/styles";
import { CollectionPermission } from "@shared/types";
import Collection from "~/models/Collection";
import Document from "~/models/Document";
import Share from "~/models/Share";
import Button from "~/components/Button";
import User from "~/models/User";
import CopyToClipboard from "~/components/CopyToClipboard";
import Flex from "~/components/Flex";
import Text from "~/components/Text";
import useBoolean from "~/hooks/useBoolean";
import useCurrentTeam from "~/hooks/useCurrentTeam";
import useCurrentUser from "~/hooks/useCurrentUser";
import useKeyDown from "~/hooks/useKeyDown";
import usePolicy from "~/hooks/usePolicy";
import useRequest from "~/hooks/useRequest";
import useStores from "~/hooks/useStores";
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 Empty from "../Empty";
import CollectionIcon from "../Icons/CollectionIcon";
import Item from "../List/Item";
import { NativeInput } from "../Input";
import NudeButton from "../NudeButton";
import Squircle from "../Squircle";
import Tooltip from "../Tooltip";
import DocumentMembersList from "./DocumentMemberList";
import { StyledListItem } from "./MemberListItem";
import PublicAccess from "./PublicAccess";
type Props = {
@@ -40,6 +55,28 @@ type Props = {
visible: boolean;
};
const presence = {
initial: {
opacity: 0,
width: 0,
marginRight: 0,
},
animate: {
opacity: 1,
width: "auto",
marginRight: 8,
transition: {
type: "spring",
bounce: 0,
},
},
exit: {
opacity: 0,
width: 0,
marginRight: 0,
},
};
function useUsersInCollection(collection?: Collection) {
const { users, memberships } = useStores();
const { request } = useRequest(() =>
@@ -66,15 +103,32 @@ function SharePopover({
onRequestClose,
visible,
}: Props) {
const user = useCurrentUser();
const team = useCurrentTeam();
const { t } = useTranslation();
const can = usePolicy(document);
const { userMemberships } = useStores();
const [query, setQuery] = React.useState("");
const [picker, showPicker, hidePicker] = useBoolean();
const timeout = React.useRef<ReturnType<typeof setTimeout>>();
const buttonRef = React.useRef<HTMLButtonElement>(null);
const collection = document.collection;
const [invitedInSession, setInvitedInSession] = React.useState<string[]>([]);
useKeyDown("Escape", onRequestClose);
useKeyDown(
"Escape",
(ev) => {
ev.preventDefault();
ev.stopImmediatePropagation();
if (picker) {
hidePicker();
} else {
onRequestClose();
}
},
{
allowInInput: true,
}
);
React.useEffect(() => {
if (visible) {
@@ -97,110 +151,273 @@ function SharePopover({
};
}, [onRequestClose, t]);
const usersInCollection = useUsersInCollection(collection);
const handleInvite = React.useCallback(
(user: User) => {
setInvitedInSession((prev) => [...prev, user.id]);
return userMemberships.create({
documentId: document.id,
userId: user.id,
});
},
[userMemberships, document.id]
);
const handleQuery = React.useCallback(
(event) => {
showPicker();
setQuery(event.target.value);
},
[showPicker, setQuery]
);
return (
<>
<Heading>
{t("People with access")}
{can.manageUsers && (
<Input align="center">
<AnimatePresence initial={false}>
{picker && (
<NudeButton
key="back"
as={m.button}
{...presence}
onClick={hidePicker}
>
<BackIcon />
</NudeButton>
)}
<NativeInput
key="input"
placeholder={`${t("Invite by name")}…`}
onChange={handleQuery}
value={query}
onFocus={showPicker}
style={{ padding: "6px 0" }}
autoFocus
/>
</AnimatePresence>
{picker ? (
invitedInSession.length ? (
<Button onClick={hidePicker} neutral>
{t("Done")}
</Button>
) : null
) : (
<CopyToClipboard
text={urlify(documentPath(document))}
onCopy={handleCopied}
>
<NudeButton type="button" disabled={!share} ref={buttonRef}>
<LinkIcon size={20} />
</NudeButton>
</CopyToClipboard>
)}
</Input>
)}
<CopyToClipboard
text={urlify(documentPath(document))}
onCopy={handleCopied}
>
<Button type="button" disabled={!share} ref={buttonRef} neutral>
{t("Copy link")}
</Button>
</CopyToClipboard>
</Heading>
<DocumentMembersList document={document}>
{picker && (
<Content>
<Picker document={document} query={query} onInvite={handleInvite} />
</Content>
)}
<Content style={{ display: picker ? "none" : "block" }}>
<DocumentOtherAccessList document={document}>
<DocumentMembersList
document={document}
invitedInSession={invitedInSession}
/>
</DocumentOtherAccessList>
{team.sharing && visible && can.share && (
<>
<Heading>{t("Public access")}</Heading>
<PublicAccess
document={document}
share={share}
sharedParent={sharedParent}
onCopied={handleCopied}
/>
</>
)}
</Content>
</>
);
}
const Picker = observer(
({
document,
query,
onInvite,
}: {
document: Document;
query: string;
onInvite: (user: User) => Promise<void>;
}) => {
const { users } = useStores();
const { t } = useTranslation();
const user = useCurrentUser();
const fetchUsersByQuery = useThrottledCallback(
(query) => users.fetchPage({ query }),
250
);
const suggestions = React.useMemo(
() =>
users.notInDocument(document.id, query).filter((u) => u.id !== user.id),
[users, users.orderedData, document.id, document.members, user.id, query]
);
React.useEffect(() => {
if (query) {
void fetchUsersByQuery(query);
}
}, [query, fetchUsersByQuery]);
return suggestions.length ? (
<>
{suggestions.map((suggestion) => (
<StyledListItem
key={suggestion.id}
onClick={() => onInvite(suggestion)}
title={suggestion.name}
subtitle={
suggestion.isSuspended
? t("Suspended")
: suggestion.isInvited
? t("Invited")
: suggestion.isViewer
? t("Viewer")
: suggestion.email
? suggestion.email
: t("Member")
}
image={
<Avatar
model={suggestion}
size={AvatarSize.Medium}
showBorder={false}
/>
}
border={false}
small
/>
))}
</>
) : (
<Empty>{t("No matches")}</Empty>
);
}
);
const DocumentOtherAccessList = observer(
({
document,
children,
}: {
document: Document;
children: React.ReactNode;
}) => {
const { t } = useTranslation();
const theme = useTheme();
const collection = document.collection;
const usersInCollection = useUsersInCollection(collection);
const user = useCurrentUser();
return (
<>
{collection ? (
<>
{collection.permission ? (
<Item
image={<TeamIcon />}
<StyledListItem
image={
<Squircle color={theme.accent} size={AvatarSize.Medium}>
<UserIcon color={theme.accentText} size={16} />
</Squircle>
}
title={t("All members")}
subtitle={t("Everyone in the workspace")}
actions={
<CollectionAccess>
<AccessTooltip>
{collection?.permission === CollectionPermission.ReadWrite
? t("Can edit")
: t("Can view")}
</CollectionAccess>
</AccessTooltip>
}
border={false}
small
/>
) : usersInCollection ? (
<Item
<StyledListItem
image={<CollectionIcon collection={collection} />}
title={t("Collection members")}
actions={<CollectionAccess>{t("Can view")}</CollectionAccess>}
title={collection.name}
subtitle={t("Everyone in the collection")}
actions={<AccessTooltip>{t("Can view")}</AccessTooltip>}
border={false}
small
/>
) : (
<Item
<StyledListItem
image={<Avatar model={user} showBorder={false} />}
title={user.name}
actions={<CollectionAccess>{t("Can edit")}</CollectionAccess>}
subtitle={t("You have full access")}
actions={<AccessTooltip>{t("Can edit")}</AccessTooltip>}
border={false}
small
/>
)}
{children}
</>
) : document.isDraft ? (
<Item
image={<Avatar model={document.createdBy} showBorder={false} />}
title={document.createdBy.name}
actions={
<CollectionAccess tooltip={t("Created the document")}>
{t("Can edit")}
</CollectionAccess>
}
border={false}
small
/>
<>
<StyledListItem
image={<Avatar model={document.createdBy} showBorder={false} />}
title={document.createdBy.name}
actions={
<AccessTooltip tooltip={t("Created the document")}>
{t("Can edit")}
</AccessTooltip>
}
border={false}
small
/>
{children}
</>
) : (
<Item
image={<MorePeopleIcon size={32} />}
title={t("More people may have access")}
actions={
<CollectionAccess
tooltip={t(
"This document may be shared with more workspace members through a parent document you do not have access to"
)}
>
{t("Can edit")}
</CollectionAccess>
}
border={false}
small
/>
<>
{children}
<StyledListItem
image={
<Squircle color={theme.accent} size={AvatarSize.Medium}>
<MoreIcon color={theme.accentText} size={16} />
</Squircle>
}
title={t("Other members")}
subtitle={t("Other workspace members may have access")}
actions={
<AccessTooltip
tooltip={t(
"This document may be shared with more workspace members through a parent document or collection you do not have access to"
)}
/>
}
border={false}
small
/>
</>
)}
</DocumentMembersList>
</>
);
}
);
{team.sharing && visible && can.share && (
<>
<Separator />
<Heading>{t("Public access")}</Heading>
<PublicAccess
document={document}
share={share}
sharedParent={sharedParent}
onCopied={handleCopied}
/>
</>
)}
</>
);
}
const CollectionAccess = ({
const AccessTooltip = ({
children,
tooltip,
}: {
children: React.ReactNode;
children?: React.ReactNode;
tooltip?: string;
}) => {
const { t } = useTranslation();
@@ -217,10 +434,7 @@ const CollectionAccess = ({
);
};
const MorePeopleIcon = styled(GroupIcon)`
margin: -4px;
color: ${s("textSecondary")};
`;
const Content = styled.div``;
const Heading = styled(Text).attrs({ size: "large", weight: "bold" })`
display: flex;
@@ -229,11 +443,28 @@ const Heading = styled(Text).attrs({ size: "large", weight: "bold" })`
margin-top: 12px;
`;
const Separator = styled.div`
height: 1px;
margin: 16px 0;
width: 100%;
background-color: ${s("divider")};
const Input = styled(Flex)`
position: sticky;
z-index: 1;
top: 0;
background: ${s("menuBackground")};
color: ${s("textTertiary")};
border-bottom: 1px solid ${s("inputBorder")};
padding: 0 24px 8px 24px;
margin-top: 0;
margin-left: -24px;
margin-right: -24px;
margin-bottom: 24px;
&:before {
content: "";
position: absolute;
left: 0;
right: 0;
top: -20px;
height: 20px;
background: ${s("menuBackground")};
}
`;
export default observer(SharePopover);
+2 -6
View File
@@ -243,12 +243,8 @@ router.post(
if (published !== undefined) {
share.published = published;
// Reset nested document sharing when unpublishing a share link. So that
// If it's ever re-published this doesn't immediately share nested docs
// without forewarning the user
if (!published) {
share.includeChildDocuments = false;
if (published) {
share.includeChildDocuments = true;
}
}
+16 -11
View File
@@ -245,8 +245,10 @@
"Could not remove user": "Could not remove user",
"Permissions for {{ userName }} updated": "Permissions for {{ userName }} updated",
"Could not update user": "Could not update user",
"Workspace members": "Workspace members",
"Find by name": "Find by name",
"Has access through parent": "Has access through parent",
"Suspended": "Suspended",
"Invited": "Invited",
"Member": "Member",
"Leave": "Leave",
"Only lowercase letters, digits and dashes allowed": "Only lowercase letters, digits and dashes allowed",
"Sorry, this link has already been used": "Sorry, this link has already been used",
@@ -259,14 +261,19 @@
"Share child documents": "Share child documents",
"Custom link": "Custom link",
"Copy public link": "Copy public link",
"People with access": "People with access",
"All members": "All members",
"Can view": "Can view",
"Collection members": "Collection members",
"Created the document": "Created the document",
"More people may have access": "More people may have access",
"This document may be shared with more workspace members through a parent document you do not have access to": "This document may be shared with more workspace members through a parent document you do not have access to",
"Invite by name": "Invite by name",
"Done": "Done",
"Public access": "Public access",
"No matches": "No matches",
"All members": "All members",
"Everyone in the workspace": "Everyone in the workspace",
"Can view": "Can view",
"Everyone in the collection": "Everyone in the collection",
"You have full access": "You have full access",
"Created the document": "Created the document",
"Other members": "Other members",
"Other workspace members may have access": "Other workspace members may have access",
"This document may be shared with more workspace members through a parent document or collection you do not have access to": "This document may be shared with more workspace members through a parent document or collection you do not have access to",
"Access inherited from collection": "Access inherited from collection",
"Logo": "Logo",
"Move document": "Move document",
@@ -506,7 +513,6 @@
"No people left to add": "No people left to add",
"Active <1></1> ago": "Active <1></1> ago",
"Never signed in": "Never signed in",
"Invited": "Invited",
"{{ userName }} was removed from the collection": "{{ userName }} was removed from the collection",
"{{ userName }} permissions were updated": "{{ userName }} permissions were updated",
"The {{ groupName }} group was removed from the collection": "The {{ groupName }} group was removed from the collection",
@@ -786,7 +792,6 @@
"Where do I find the file?": "Where do I find the file?",
"In Notion, click <em>Settings & Members</em> in the left sidebar and open Settings. Look for the Export section, and click <em>Export all workspace content</em>. Choose <em>HTML</em> as the format for the best data compatability.": "In Notion, click <em>Settings & Members</em> in the left sidebar and open Settings. Look for the Export section, and click <em>Export all workspace content</em>. Choose <em>HTML</em> as the format for the best data compatability.",
"Last active": "Last active",
"Suspended": "Suspended",
"Shared": "Shared",
"by {{ name }}": "by {{ name }}",
"Last accessed": "Last accessed",