mirror of
https://github.com/outline/outline.git
synced 2026-12-06 19:22:29 +03:00
* shares.info, collections.info, documents.info * shares.list, shares.create, shares.update * shares.sitemap * parity with existing document shared screen * collection share popover * parent share and table * collection scene * collection link in sidebar * sidebar and breadcrumb collection link click * collection link click in editor * meta * more meta + 404 page * map internal link, remove showLastUpdated option * fix shares.list pagination * show last updated * shareLoader tests * lint * sidebar context for collection link * badge in shares table * fix existing tests * tsc * update failing test snapshot * env * signed url for collection attachments * include collection content in SSR for screen readers * search * drafts can be shared * review * tsc, remove old shared-doc scene * tweaks * DRY * refactor loader * Remove share/collection urls * fix: Collection overview should not be editable when viewing shared link and logged in * Tweak public breadcrumb * fix: Deleted documents should never be exposed through share * empty sharedTree array where includeChildDocuments is false * revert includeChildDocs guard for logical correctness + SSR bug fix * fix: check document is part of share --------- Co-authored-by: Tom Moor <tom@getoutline.com>
54 lines
1.5 KiB
TypeScript
54 lines
1.5 KiB
TypeScript
import { observer } from "mobx-react";
|
|
import { useTranslation } from "react-i18next";
|
|
import Icon from "@shared/components/Icon";
|
|
import { NavigationNode } from "@shared/types";
|
|
import useStores from "~/hooks/useStores";
|
|
import { sharedModelPath } from "~/utils/routeHelpers";
|
|
import { SharedDocumentLink } from "./SharedDocumentLink";
|
|
import SidebarLink from "./SidebarLink";
|
|
|
|
type Props = {
|
|
node: NavigationNode;
|
|
shareId: string;
|
|
};
|
|
|
|
function CollectionLink({ node, shareId }: Props) {
|
|
const { t } = useTranslation();
|
|
const { documents, ui } = useStores();
|
|
|
|
const icon = node.icon ?? node.emoji;
|
|
|
|
return (
|
|
<>
|
|
<SidebarLink
|
|
to={{
|
|
pathname: sharedModelPath(shareId),
|
|
state: {
|
|
title: node.title,
|
|
},
|
|
}}
|
|
icon={icon && <Icon value={icon} color={node.color} />}
|
|
label={node.title || t("Untitled")}
|
|
depth={0}
|
|
exact={false}
|
|
scrollIntoViewIfNeeded={true}
|
|
isActive={() => ui.activeCollectionId === node.id}
|
|
/>
|
|
{node.children.map((childNode, index) => (
|
|
<SharedDocumentLink
|
|
key={childNode.id}
|
|
index={index}
|
|
depth={2}
|
|
shareId={shareId}
|
|
node={childNode}
|
|
prefetchDocument={documents.prefetchDocument}
|
|
activeDocumentId={ui.activeDocumentId}
|
|
activeDocument={documents.active}
|
|
/>
|
|
))}
|
|
</>
|
|
);
|
|
}
|
|
|
|
export const SharedCollectionLink = observer(CollectionLink);
|