diff --git a/.circleci/config.yml b/.circleci/config.yml index edba1a5a38..37169b47a5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,12 +4,6 @@ defaults: &defaults working_directory: ~/outline docker: - image: cimg/node:20.10 - - image: cimg/redis:5.0 - - image: cimg/postgres:14.2 - environment: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: password - POSTGRES_DB: circle_test resource_class: large environment: NODE_ENV: test @@ -78,6 +72,14 @@ jobs: test-server: <<: *defaults parallelism: 3 + docker: + - image: cimg/node:20.10 + - image: cimg/redis:5.0 + - image: cimg/postgres:14.2 + environment: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: password + POSTGRES_DB: circle_test steps: - checkout - restore_cache: diff --git a/app/actions/definitions/comments.tsx b/app/actions/definitions/comments.tsx index 2f430dcd29..f377374517 100644 --- a/app/actions/definitions/comments.tsx +++ b/app/actions/definitions/comments.tsx @@ -53,9 +53,13 @@ export const resolveCommentFactory = ({ perform: async ({ t }) => { await comment.resolve(); + const locationState = history.location.state as Record; history.replace({ ...history.location, - state: null, + state: { + sidebarContext: locationState["sidebarContext"], + commentId: undefined, + }, }); onResolve(); @@ -81,9 +85,13 @@ export const unresolveCommentFactory = ({ perform: async () => { await comment.unresolve(); + const locationState = history.location.state as Record; history.replace({ ...history.location, - state: null, + state: { + sidebarContext: locationState["sidebarContext"], + commentId: undefined, + }, }); onUnresolve(); diff --git a/app/actions/definitions/documents.tsx b/app/actions/definitions/documents.tsx index 12248a1c18..2b26305f01 100644 --- a/app/actions/definitions/documents.tsx +++ b/app/actions/definitions/documents.tsx @@ -46,7 +46,7 @@ import DocumentPermanentDelete from "~/scenes/DocumentPermanentDelete"; import DocumentPublish from "~/scenes/DocumentPublish"; import DeleteDocumentsInTrash from "~/scenes/Trash/components/DeleteDocumentsInTrash"; import ConfirmationDialog from "~/components/ConfirmationDialog"; -import DuplicateDialog from "~/components/DuplicateDialog"; +import DocumentCopy from "~/components/DocumentCopy"; import MarkdownIcon from "~/components/Icons/MarkdownIcon"; import SharePopover from "~/components/Sharing/Document"; import { getHeaderExpandedKey } from "~/components/Sidebar/components/Header"; @@ -562,7 +562,7 @@ export const duplicateDocument = createAction({ stores.dialogs.openModal({ title: t("Copy document"), content: ( - { stores.dialogs.closeAllModals(); @@ -732,7 +732,6 @@ export const importDocument = createAction({ history.push(document.url); } catch (err) { toast.error(err.message); - throw err; } }; @@ -1054,7 +1053,7 @@ export const openDocumentComments = createAction({ return; } - stores.ui.toggleComments(activeDocumentId); + stores.ui.toggleComments(); }, }); diff --git a/app/components/Actions.ts b/app/components/Actions.ts index 6f750eb8d8..2c2166a214 100644 --- a/app/components/Actions.ts +++ b/app/components/Actions.ts @@ -31,7 +31,6 @@ const Actions = styled(Flex)` left: 0; border-radius: 3px; background: ${s("background")}; - transition: ${s("backgroundTransition")}; padding: 12px; backdrop-filter: blur(20px); diff --git a/app/components/Authenticated.tsx b/app/components/Authenticated.tsx index 02eec34ea9..9f46bbea3f 100644 --- a/app/components/Authenticated.tsx +++ b/app/components/Authenticated.tsx @@ -5,6 +5,7 @@ import { Redirect } from "react-router-dom"; import useCurrentUser from "~/hooks/useCurrentUser"; import useStores from "~/hooks/useStores"; import { changeLanguage } from "~/utils/language"; +import { logoutPath } from "~/utils/routeHelpers"; import LoadingIndicator from "./LoadingIndicator"; type Props = { @@ -32,7 +33,7 @@ const Authenticated = ({ children }: Props) => { } void auth.logout(true); - return ; + return ; }; export default observer(Authenticated); diff --git a/app/components/AuthenticatedLayout.tsx b/app/components/AuthenticatedLayout.tsx index 5aa9679b69..f9bfe1f985 100644 --- a/app/components/AuthenticatedLayout.tsx +++ b/app/components/AuthenticatedLayout.tsx @@ -94,7 +94,7 @@ const AuthenticatedLayout: React.FC = ({ children }: Props) => { !showHistory && can.comment && ui.activeDocumentId && - ui.commentsExpanded.includes(ui.activeDocumentId) && + ui.commentsExpanded && team.getPreference(TeamPreference.Commenting); const sidebarRight = ( diff --git a/app/components/Breadcrumb.tsx b/app/components/Breadcrumb.tsx index d94ca8d49e..06ebe877bd 100644 --- a/app/components/Breadcrumb.tsx +++ b/app/components/Breadcrumb.tsx @@ -8,18 +8,16 @@ import BreadcrumbMenu from "~/menus/BreadcrumbMenu"; import { undraggableOnDesktop } from "~/styles"; import { MenuInternalLink } from "~/types"; -type Props = { +type Props = React.PropsWithChildren<{ items: MenuInternalLink[]; max?: number; highlightFirstItem?: boolean; -}; +}>; -function Breadcrumb({ - items, - highlightFirstItem, - children, - max = 2, -}: React.PropsWithChildren) { +function Breadcrumb( + { items, highlightFirstItem, children, max = 2 }: Props, + ref: React.RefObject | null +) { const totalItems = items.length; const topLevelItems: MenuInternalLink[] = [...items]; let overflowItems; @@ -37,9 +35,13 @@ function Breadcrumb({ } return ( - + {topLevelItems.map((item, index) => ( - + {item.icon} {item.to ? ( ` ${ellipsis()} + ${undraggableOnDesktop()} + display: flex; flex-shrink: 1; min-width: 0; @@ -76,7 +80,6 @@ const Item = styled(Link)<{ $highlight: boolean; $withIcon: boolean }>` height: 24px; font-weight: ${(props) => (props.$highlight ? "500" : "inherit")}; margin-left: ${(props) => (props.$withIcon ? "4px" : "0")}; - ${undraggableOnDesktop()} svg { flex-shrink: 0; @@ -87,4 +90,4 @@ const Item = styled(Link)<{ $highlight: boolean; $withIcon: boolean }>` } `; -export default Breadcrumb; +export default React.forwardRef(Breadcrumb); diff --git a/app/components/Collaborators.tsx b/app/components/Collaborators.tsx index 0442410a4e..9ee6e21040 100644 --- a/app/components/Collaborators.tsx +++ b/app/components/Collaborators.tsx @@ -18,6 +18,8 @@ import useStores from "~/hooks/useStores"; type Props = { /** The document to display live collaborators for */ document: Document; + /** The maximum number of collaborators to display, defaults to 6 */ + limit?: number; }; /** @@ -25,6 +27,7 @@ type Props = { * and presence status. */ function Collaborators(props: Props) { + const { limit = 6 } = props; const { t } = useTranslation(); const user = useCurrentUser(); const currentUserId = user?.id; @@ -75,8 +78,6 @@ function Collaborators(props: Props) { placement: "bottom-end", }); - const limit = 8; - return ( <> @@ -88,6 +89,7 @@ function Collaborators(props: Props) { > { const isPresent = presentIds.includes(collaborator.id); diff --git a/app/components/CollectionDescription.tsx b/app/components/CollectionDescription.tsx index b891bc3de3..0a45babb92 100644 --- a/app/components/CollectionDescription.tsx +++ b/app/components/CollectionDescription.tsx @@ -201,7 +201,6 @@ const Input = styled.div` margin: -8px; padding: 8px; border-radius: 8px; - transition: ${s("backgroundTransition")}; &:after { content: ""; diff --git a/app/components/ConfirmationDialog.tsx b/app/components/ConfirmationDialog.tsx index 299ebd3964..7475dfbf58 100644 --- a/app/components/ConfirmationDialog.tsx +++ b/app/components/ConfirmationDialog.tsx @@ -8,8 +8,8 @@ import Text from "~/components/Text"; import useStores from "~/hooks/useStores"; type Props = { - /** Callback when the dialog is submitted */ - onSubmit: () => Promise | void; + /** Callback when the dialog is submitted. Return false to prevent closing. */ + onSubmit: () => Promise | void; /** Text to display on the submit button */ submitText?: string; /** Text to display while the form is saving */ @@ -38,7 +38,10 @@ const ConfirmationDialog: React.FC = ({ ev.preventDefault(); setIsSaving(true); try { - await onSubmit(); + const res = await onSubmit(); + if (res === false) { + return; + } dialogs.closeAllModals(); } catch (err) { toast.error(err.message); diff --git a/app/components/ContentEditable.tsx b/app/components/ContentEditable.tsx index 6db6ab4361..ebbfdf1215 100644 --- a/app/components/ContentEditable.tsx +++ b/app/components/ContentEditable.tsx @@ -182,7 +182,6 @@ function placeCaret(element: HTMLElement, atStart: boolean) { const Content = styled.span` background: ${s("background")}; - transition: ${s("backgroundTransition")}; color: ${s("text")}; -webkit-text-fill-color: ${s("text")}; outline: none; diff --git a/app/components/ContextMenu/MenuItem.tsx b/app/components/ContextMenu/MenuItem.tsx index 2a3e76dd56..96d8c964c1 100644 --- a/app/components/ContextMenu/MenuItem.tsx +++ b/app/components/ContextMenu/MenuItem.tsx @@ -109,6 +109,8 @@ const Title = styled.div` ${ellipsis()} flex-grow: 1; display: flex; + align-items: center; + gap: 8px; `; type MenuAnchorProps = { diff --git a/app/components/ContextMenu/index.tsx b/app/components/ContextMenu/index.tsx index 35fe1ee265..93cf5368ba 100644 --- a/app/components/ContextMenu/index.tsx +++ b/app/components/ContextMenu/index.tsx @@ -262,22 +262,6 @@ export const Position = styled.div` transition-property: outline-width; transition-duration: 0; outline: none; - - &:after { - content: ""; - position: absolute; - top: 1px; - left: 1px; - right: 1px; - bottom: 1px; - pointer-events: none; - border-radius: 4px; - - outline-color: ${s("accent")}; - outline-width: initial; - outline-offset: -1px; - outline-style: solid; - } } /* diff --git a/app/components/DocumentBreadcrumb.tsx b/app/components/DocumentBreadcrumb.tsx index 47543e25f9..4fe98a1c68 100644 --- a/app/components/DocumentBreadcrumb.tsx +++ b/app/components/DocumentBreadcrumb.tsx @@ -8,15 +8,11 @@ import type { NavigationNode } from "@shared/types"; import Document from "~/models/Document"; import Breadcrumb from "~/components/Breadcrumb"; import CollectionIcon from "~/components/Icons/CollectionIcon"; +import { useLocationSidebarContext } from "~/hooks/useLocationSidebarContext"; import usePolicy from "~/hooks/usePolicy"; import useStores from "~/hooks/useStores"; import { MenuInternalLink } from "~/types"; -import { - archivePath, - collectionPath, - settingsPath, - trashPath, -} from "~/utils/routeHelpers"; +import { archivePath, settingsPath, trashPath } from "~/utils/routeHelpers"; type Props = { children?: React.ReactNode; @@ -57,14 +53,14 @@ function useCategory(document: Document): MenuInternalLink | null { return null; } -const DocumentBreadcrumb: React.FC = ({ - document, - children, - onlyText, -}: Props) => { +function DocumentBreadcrumb( + { document, children, onlyText }: Props, + ref: React.RefObject | null +) { const { collections } = useStores(); const { t } = useTranslation(); const category = useCategory(document); + const sidebarContext = useLocationSidebarContext(); const collection = document.collectionId ? collections.get(document.collectionId) : undefined; @@ -81,7 +77,10 @@ const DocumentBreadcrumb: React.FC = ({ type: "route", title: collection.name, icon: , - to: collectionPath(collection.path), + to: { + pathname: collection.path, + state: { sidebarContext }, + }, }; } else if (document.isCollectionDeleted) { collectionNode = { @@ -115,11 +114,14 @@ const DocumentBreadcrumb: React.FC = ({ ) : ( node.title ), - to: node.url, + to: { + pathname: node.url, + state: { sidebarContext }, + }, }); }); return output; - }, [path, category, collectionNode]); + }, [path, category, sidebarContext, collectionNode]); if (!collections.isLoaded) { return null; @@ -140,11 +142,11 @@ const DocumentBreadcrumb: React.FC = ({ } return ( - + {children} ); -}; +} const StyledIcon = styled(Icon)` margin-right: 2px; @@ -160,4 +162,4 @@ const SmallSlash = styled(GoToIcon)` opacity: 0.5; `; -export default observer(DocumentBreadcrumb); +export default observer(React.forwardRef(DocumentBreadcrumb)); diff --git a/app/components/DocumentCard.tsx b/app/components/DocumentCard.tsx index 0ee07e383a..e483207619 100644 --- a/app/components/DocumentCard.tsx +++ b/app/components/DocumentCard.tsx @@ -39,6 +39,7 @@ function DocumentCard(props: Props) { const { collections } = useStores(); const theme = useTheme(); const { document, pin, canUpdatePin, isDraggable } = props; + const pinnedToHome = React.useRef(!pin?.collectionId).current; const collection = document.collectionId ? collections.get(document.collectionId) : undefined; @@ -122,13 +123,13 @@ function DocumentCard(props: Props) { {collection?.icon && collection?.icon !== "letter" && collection?.icon !== "collection" && - !pin?.collectionId ? ( + pinnedToHome ? ( ) : ( @@ -143,12 +144,7 @@ function DocumentCard(props: Props) { - diff --git a/app/components/DocumentCopy.tsx b/app/components/DocumentCopy.tsx new file mode 100644 index 0000000000..ba90f940b7 --- /dev/null +++ b/app/components/DocumentCopy.tsx @@ -0,0 +1,149 @@ +import flatten from "lodash/flatten"; +import { observer } from "mobx-react"; +import * as React from "react"; +import { Trans, useTranslation } from "react-i18next"; +import { toast } from "sonner"; +import styled from "styled-components"; +import { NavigationNode } from "@shared/types"; +import Document from "~/models/Document"; +import { FlexContainer, Footer, StyledText } from "~/scenes/DocumentMove"; +import Button from "~/components/Button"; +import DocumentExplorer from "~/components/DocumentExplorer"; +import useCollectionTrees from "~/hooks/useCollectionTrees"; +import useStores from "~/hooks/useStores"; +import { flattenTree } from "~/utils/tree"; +import Switch from "./Switch"; +import Text from "./Text"; + +type Props = { + /** The original document to duplicate */ + document: Document; + onSubmit: (documents: Document[]) => void; +}; + +function DocumentCopy({ document, onSubmit }: Props) { + const { t } = useTranslation(); + const { policies } = useStores(); + const collectionTrees = useCollectionTrees(); + const [publish, setPublish] = React.useState(!!document.publishedAt); + const [recursive, setRecursive] = React.useState(true); + const [selectedPath, selectPath] = React.useState( + null + ); + + const items = React.useMemo(() => { + const nodes = flatten(collectionTrees.map(flattenTree)).filter((node) => + node.collectionId + ? policies.get(node.collectionId)?.abilities.createDocument + : true + ); + + if (document.isTemplate) { + return nodes + .filter((node) => node.type === "collection") + .map((node) => ({ ...node, children: [] })); + } + return nodes; + }, [policies, collectionTrees, document.isTemplate]); + + const handlePublishChange = React.useCallback( + (ev: React.ChangeEvent) => { + setPublish(ev.target.checked); + }, + [] + ); + + const handleRecursiveChange = React.useCallback( + (ev: React.ChangeEvent) => { + setRecursive(ev.target.checked); + }, + [] + ); + + const copy = async () => { + if (!selectedPath) { + toast.message(t("Select a location to copy")); + return; + } + + try { + const result = await document.duplicate({ + publish, + recursive, + title: document.title, + collectionId: selectedPath.collectionId, + ...(selectedPath.type === "document" + ? { parentDocumentId: selectedPath.id } + : {}), + }); + + toast.success(t("Document copied")); + onSubmit(result); + } catch (err) { + toast.error(t("Couldn’t copy the document, try again?")); + } + }; + + return ( + + + + {!document.isTemplate && ( + <> + {document.collectionId && ( + + + + )} + {document.publishedAt && document.childDocuments.length > 0 && ( + + + + )} + + )} + +
+ + {selectedPath ? ( + }} + /> + ) : ( + t("Select a location to copy") + )} + + +
+
+ ); +} + +const OptionsContainer = styled.div` + margin: 16px 0 8px 0; + padding-left: 24px; + padding-right: 24px; +`; + +export default observer(DocumentCopy); diff --git a/app/components/DocumentExplorer.tsx b/app/components/DocumentExplorer.tsx index a60a6a189c..677f6d9dd4 100644 --- a/app/components/DocumentExplorer.tsx +++ b/app/components/DocumentExplorer.tsx @@ -16,6 +16,7 @@ import styled, { useTheme } from "styled-components"; import breakpoint from "styled-components-breakpoint"; import Icon from "@shared/components/Icon"; import { NavigationNode } from "@shared/types"; +import { isModKey } from "@shared/utils/keyboard"; import DocumentExplorerNode from "~/components/DocumentExplorerNode"; import DocumentExplorerSearchResult from "~/components/DocumentExplorerSearchResult"; import Flex from "~/components/Flex"; @@ -25,21 +26,20 @@ import InputSearch from "~/components/InputSearch"; import Text from "~/components/Text"; import useMobile from "~/hooks/useMobile"; import useStores from "~/hooks/useStores"; -import { isModKey } from "~/utils/keyboard"; import { ancestors, descendants } from "~/utils/tree"; type Props = { /** Action taken upon submission of selected item, could be publish, move etc. */ onSubmit: () => void; - /** A side-effect of item selection */ onSelect: (item: NavigationNode | null) => void; - /** Items to be shown in explorer */ items: NavigationNode[]; + /** Automatically expand to and select item with the given id */ + defaultValue?: string; }; -function DocumentExplorer({ onSubmit, onSelect, items }: Props) { +function DocumentExplorer({ onSubmit, onSelect, items, defaultValue }: Props) { const isMobile = useMobile(); const { collections, documents } = useStores(); const { t } = useTranslation(); @@ -47,12 +47,25 @@ function DocumentExplorer({ onSubmit, onSelect, items }: Props) { const [searchTerm, setSearchTerm] = React.useState(); const [selectedNode, selectNode] = React.useState( - null + () => { + const node = + defaultValue && items.find((item) => item.id === defaultValue); + return node || null; + } ); const [initialScrollOffset, setInitialScrollOffset] = React.useState(0); const [activeNode, setActiveNode] = React.useState(0); - const [expandedNodes, setExpandedNodes] = React.useState([]); + const [expandedNodes, setExpandedNodes] = React.useState(() => { + if (defaultValue) { + const node = items.find((item) => item.id === defaultValue); + if (node) { + return ancestors(node).map((node) => node.id); + } + } + return []; + }); + const [itemRefs, setItemRefs] = React.useState< React.RefObject[] >([]); @@ -94,6 +107,15 @@ function DocumentExplorer({ onSubmit, onSelect, items }: Props) { onSelect(selectedNode); }, [selectedNode, onSelect]); + React.useEffect(() => { + if (defaultValue && selectedNode && listRef) { + const index = nodes.findIndex((node) => node.id === selectedNode.id); + if (index > 0) { + setTimeout(() => listRef.current?.scrollToItem(index, "center"), 50); + } + } + }, []); + function getNodes() { function includeDescendants(item: NavigationNode): NavigationNode[] { return expandedNodes.includes(item.id) diff --git a/app/components/DocumentListItem.tsx b/app/components/DocumentListItem.tsx index 47acf4d3a0..0db389d0ff 100644 --- a/app/components/DocumentListItem.tsx +++ b/app/components/DocumentListItem.tsx @@ -21,9 +21,11 @@ import StarButton, { AnimatedStar } from "~/components/Star"; import Tooltip from "~/components/Tooltip"; import useBoolean from "~/hooks/useBoolean"; import useCurrentUser from "~/hooks/useCurrentUser"; +import { useLocationSidebarContext } from "~/hooks/useLocationSidebarContext"; import DocumentMenu from "~/menus/DocumentMenu"; import { hover } from "~/styles"; import { documentPath } from "~/utils/routeHelpers"; +import { determineSidebarContext } from "./Sidebar/components/SidebarContext"; type Props = { document: Document; @@ -50,6 +52,7 @@ function DocumentListItem( ) { const { t } = useTranslation(); const user = useCurrentUser(); + const locationSidebarContext = useLocationSidebarContext(); const [menuOpen, handleMenuOpen, handleMenuClose] = useBoolean(); let itemRef: React.Ref = @@ -78,6 +81,12 @@ function DocumentListItem( !!document.title.toLowerCase().includes(highlight.toLowerCase()); const canStar = !document.isArchived && !document.isTemplate; + const sidebarContext = determineSidebarContext({ + document, + user, + currentContext: locationSidebarContext, + }); + return ( {t("New")} )} {document.isDraft && showDraft && ( - + {t("Draft")} )} diff --git a/app/components/DocumentMeta.tsx b/app/components/DocumentMeta.tsx index bc4160461f..5eee8d17dd 100644 --- a/app/components/DocumentMeta.tsx +++ b/app/components/DocumentMeta.tsx @@ -185,9 +185,9 @@ const DocumentMeta: React.FC = ({ {showCollection && collection && (  {t("in")}  - + - + )} {showParentDocuments && nestedDocumentsCount > 0 && ( @@ -210,6 +210,10 @@ const DocumentMeta: React.FC = ({ ); }; +const Strong = styled.strong` + font-weight: 550; +`; + const Container = styled(Flex)<{ rtl?: boolean }>` justify-content: ${(props) => (props.rtl ? "flex-end" : "flex-start")}; color: ${s("textTertiary")}; diff --git a/app/components/DuplicateDialog.tsx b/app/components/DuplicateDialog.tsx deleted file mode 100644 index e84191533c..0000000000 --- a/app/components/DuplicateDialog.tsx +++ /dev/null @@ -1,97 +0,0 @@ -import { observer } from "mobx-react"; -import * as React from "react"; -import { useTranslation } from "react-i18next"; -import { DocumentValidation } from "@shared/validations"; -import Document from "~/models/Document"; -import ConfirmationDialog from "~/components/ConfirmationDialog"; -import Input from "./Input"; -import Switch from "./Switch"; -import Text from "./Text"; - -type Props = { - /** The original document to duplicate */ - document: Document; - onSubmit: (documents: Document[]) => void; -}; - -function DuplicateDialog({ document, onSubmit }: Props) { - const { t } = useTranslation(); - const defaultTitle = t(`Copy of {{ documentName }}`, { - documentName: document.title, - }); - const [publish, setPublish] = React.useState(!!document.publishedAt); - const [recursive, setRecursive] = React.useState(true); - const [title, setTitle] = React.useState(defaultTitle); - - const handlePublishChange = React.useCallback( - (ev: React.ChangeEvent) => { - setPublish(ev.target.checked); - }, - [] - ); - - const handleRecursiveChange = React.useCallback( - (ev: React.ChangeEvent) => { - setRecursive(ev.target.checked); - }, - [] - ); - - const handleTitleChange = React.useCallback( - (ev: React.ChangeEvent) => { - setTitle(ev.target.value); - }, - [] - ); - - const handleSubmit = async () => { - const result = await document.duplicate({ - publish, - recursive, - title, - }); - onSubmit(result); - }; - - return ( - - - {!document.isTemplate && ( - <> - {document.collectionId && ( - - - - )} - {document.publishedAt && document.childDocuments.length > 0 && ( - - - - )} - - )} - - ); -} - -export default observer(DuplicateDialog); diff --git a/app/components/EventListItem.tsx b/app/components/EventListItem.tsx index 06d7c4abdb..241cc9e653 100644 --- a/app/components/EventListItem.tsx +++ b/app/components/EventListItem.tsx @@ -19,6 +19,7 @@ import Event from "~/models/Event"; import { Avatar } from "~/components/Avatar"; import Item, { Actions, Props as ItemProps } from "~/components/List/Item"; import Time from "~/components/Time"; +import { useLocationSidebarContext } from "~/hooks/useLocationSidebarContext"; import useStores from "~/hooks/useStores"; import RevisionMenu from "~/menus/RevisionMenu"; import { hover } from "~/styles"; @@ -35,6 +36,7 @@ const EventListItem = ({ event, latest, document, ...rest }: Props) => { const { t } = useTranslation(); const { revisions } = useStores(); const location = useLocation(); + const sidebarContext = useLocationSidebarContext(); const opts = { userName: event.actor.name, }; @@ -66,7 +68,10 @@ const EventListItem = ({ event, latest, document, ...rest }: Props) => { ); to = { pathname: documentHistoryPath(document, event.modelId || "latest"), - state: { retainScrollPosition: true }, + state: { + sidebarContext, + retainScrollPosition: true, + }, }; break; @@ -140,7 +145,6 @@ const EventListItem = ({ event, latest, document, ...rest }: Props) => { title={