mirror of
https://github.com/outline/outline.git
synced 2026-12-04 18:34:54 +03:00
chore: Remove old feature flag
fix: Loading jank when creating new collection Add italic prop to Text component
This commit is contained in:
1 parent
c54fcc3536
commit
4e1038837b
14 files changed
+203
-312
No files matched your search
@@ -19,7 +19,6 @@ import Text from "~/components/Text";
|
||||
import useBoolean from "~/hooks/useBoolean";
|
||||
import useCurrentTeam from "~/hooks/useCurrentTeam";
|
||||
import { EmptySelectValue } from "~/types";
|
||||
import { Feature, FeatureFlags } from "~/utils/FeatureFlags";
|
||||
|
||||
const IconPicker = React.lazy(() => import("~/components/IconPicker"));
|
||||
|
||||
@@ -156,18 +155,16 @@ export const CollectionForm = observer(function CollectionForm_({
|
||||
/>
|
||||
)}
|
||||
|
||||
{team.sharing &&
|
||||
(!collection ||
|
||||
FeatureFlags.isEnabled(Feature.newCollectionSharing)) && (
|
||||
<Switch
|
||||
id="sharing"
|
||||
label={t("Public document sharing")}
|
||||
note={t(
|
||||
"Allow documents within this collection to be shared publicly on the internet."
|
||||
)}
|
||||
{...register("sharing")}
|
||||
/>
|
||||
)}
|
||||
{team.sharing && (
|
||||
<Switch
|
||||
id="sharing"
|
||||
label={t("Public document sharing")}
|
||||
note={t(
|
||||
"Allow documents within this collection to be shared publicly on the internet."
|
||||
)}
|
||||
{...register("sharing")}
|
||||
/>
|
||||
)}
|
||||
|
||||
<Flex justify="flex-end">
|
||||
<Button
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { runInAction } from "mobx";
|
||||
import { observer } from "mobx-react";
|
||||
import * as React from "react";
|
||||
import { toast } from "sonner";
|
||||
import Collection from "~/models/Collection";
|
||||
import useStores from "~/hooks/useStores";
|
||||
import history from "~/utils/history";
|
||||
import { CollectionForm, FormData } from "./CollectionForm";
|
||||
@@ -17,8 +17,11 @@ export const CollectionNew = observer(function CollectionNew_({
|
||||
const handleSubmit = React.useCallback(
|
||||
async (data: FormData) => {
|
||||
try {
|
||||
const collection = new Collection(data, collections);
|
||||
await collection.save();
|
||||
const collection = await collections.save(data);
|
||||
// Avoid flash of loading state for the new collection, we know it's empty.
|
||||
runInAction(() => {
|
||||
collection.documents = [];
|
||||
});
|
||||
onSubmit?.();
|
||||
history.push(collection.path);
|
||||
} catch (error) {
|
||||
|
||||
@@ -140,7 +140,7 @@ const DocumentMeta: React.FC<Props> = ({
|
||||
}
|
||||
|
||||
const nestedDocumentsCount = collection
|
||||
? collection.getDocumentChildren(document.id).length
|
||||
? collection.getChildrenForDocument(document.id).length
|
||||
: 0;
|
||||
const canShowProgressBar = isTasks && !isTemplate;
|
||||
|
||||
|
||||
@@ -8,19 +8,23 @@ import Collection from "~/models/Collection";
|
||||
import Document from "~/models/Document";
|
||||
import DocumentsLoader from "~/components/DocumentsLoader";
|
||||
import { ResizingHeightContainer } from "~/components/ResizingHeightContainer";
|
||||
import Text from "~/components/Text";
|
||||
import usePolicy from "~/hooks/usePolicy";
|
||||
import useStores from "~/hooks/useStores";
|
||||
import history from "~/utils/history";
|
||||
import DocumentLink from "./DocumentLink";
|
||||
import DropCursor from "./DropCursor";
|
||||
import EmptyCollectionPlaceholder from "./EmptyCollectionPlaceholder";
|
||||
import Folder from "./Folder";
|
||||
import PlaceholderCollections from "./PlaceholderCollections";
|
||||
import { DragObject } from "./SidebarLink";
|
||||
import SidebarLink, { DragObject } from "./SidebarLink";
|
||||
import useCollectionDocuments from "./useCollectionDocuments";
|
||||
|
||||
type Props = {
|
||||
/** The collection to render the children of. */
|
||||
collection: Collection;
|
||||
/** Whether the children are shown in an expanded state. */
|
||||
expanded: boolean;
|
||||
/** Function to prefetch a document by ID. */
|
||||
prefetchDocument?: (documentId: string) => Promise<Document | void>;
|
||||
};
|
||||
|
||||
@@ -33,7 +37,6 @@ function CollectionLinkChildren({
|
||||
const manualSort = collection.sort.field === "index";
|
||||
const { documents } = useStores();
|
||||
const { t } = useTranslation();
|
||||
|
||||
const childDocuments = useCollectionDocuments(collection, documents.active);
|
||||
|
||||
// Drop to reorder document
|
||||
@@ -91,7 +94,17 @@ function CollectionLinkChildren({
|
||||
index={index}
|
||||
/>
|
||||
))}
|
||||
{childDocuments?.length === 0 && <EmptyCollectionPlaceholder />}
|
||||
{childDocuments?.length === 0 && (
|
||||
<SidebarLink
|
||||
label={
|
||||
<Text type="tertiary" size="small" italic>
|
||||
{t("Empty")}
|
||||
</Text>
|
||||
}
|
||||
onClick={() => history.push(collection.url)}
|
||||
depth={2}
|
||||
/>
|
||||
)}
|
||||
</DocumentsLoader>
|
||||
</Folder>
|
||||
);
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
import * as React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import styled from "styled-components";
|
||||
import Text from "~/components/Text";
|
||||
|
||||
const EmptyCollectionPlaceholder = () => {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<Empty type="tertiary" size="small">
|
||||
{t("Empty")}
|
||||
</Empty>
|
||||
);
|
||||
};
|
||||
|
||||
const Empty = styled(Text)`
|
||||
margin-left: 46px;
|
||||
margin-bottom: 0;
|
||||
line-height: 34px;
|
||||
font-style: italic;
|
||||
`;
|
||||
|
||||
export default EmptyCollectionPlaceholder;
|
||||
@@ -116,7 +116,7 @@ function StarredLink({ star }: Props) {
|
||||
? collections.get(document.collectionId)
|
||||
: undefined;
|
||||
const childDocuments = collection
|
||||
? collection.getDocumentChildren(documentId)
|
||||
? collection.getChildrenForDocument(documentId)
|
||||
: [];
|
||||
const hasChildDocuments = childDocuments.length > 0;
|
||||
|
||||
|
||||
@@ -12,6 +12,8 @@ type Props = {
|
||||
selectable?: boolean;
|
||||
/** The font weight of the text */
|
||||
weight?: "xbold" | "bold" | "normal";
|
||||
/** Whether the text should be italic */
|
||||
italic?: boolean;
|
||||
/** Whether the text should be truncated with an ellipsis */
|
||||
ellipsis?: boolean;
|
||||
};
|
||||
@@ -56,6 +58,8 @@ const Text = styled.span<Props>`
|
||||
: "inherit"};
|
||||
`}
|
||||
|
||||
font-style: ${(props) => (props.italic ? "italic" : "normal")};
|
||||
|
||||
white-space: normal;
|
||||
user-select: ${(props) => (props.selectable ? "text" : "none")};
|
||||
|
||||
|
||||
+22
-58
@@ -1,5 +1,5 @@
|
||||
import invariant from "invariant";
|
||||
import { action, computed, observable, reaction, runInAction } from "mobx";
|
||||
import { action, computed, observable, runInAction } from "mobx";
|
||||
import {
|
||||
CollectionPermission,
|
||||
FileOperationFormat,
|
||||
@@ -21,43 +21,27 @@ export default class Collection extends ParanoidModel {
|
||||
|
||||
store: CollectionsStore;
|
||||
|
||||
@observable
|
||||
isSaving: boolean;
|
||||
|
||||
isFetching = false;
|
||||
|
||||
@Field
|
||||
@observable
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* The name of the collection.
|
||||
*/
|
||||
/** The name of the collection. */
|
||||
@Field
|
||||
@observable
|
||||
name: string;
|
||||
|
||||
/** Collection description in Prosemirror format. */
|
||||
@Field
|
||||
@observable.shallow
|
||||
data: ProsemirrorData;
|
||||
|
||||
/**
|
||||
* An icon (or) emoji to use as the collection icon.
|
||||
*/
|
||||
/** An icon (or) emoji to use as the collection icon. */
|
||||
@Field
|
||||
@observable
|
||||
icon: string;
|
||||
|
||||
/**
|
||||
* The color to use for the collection icon and other highlights.
|
||||
*/
|
||||
/** The color to use for the collection icon and other highlights. */
|
||||
@Field
|
||||
@observable
|
||||
color?: string | null;
|
||||
|
||||
/**
|
||||
* The default permission for workspace users.
|
||||
*/
|
||||
/** The default permission for workspace users. */
|
||||
@Field
|
||||
@observable
|
||||
permission?: CollectionPermission;
|
||||
@@ -70,16 +54,12 @@ export default class Collection extends ParanoidModel {
|
||||
@observable
|
||||
sharing: boolean;
|
||||
|
||||
/**
|
||||
* The sort index for the collection.
|
||||
*/
|
||||
/** The sort index for the collection. */
|
||||
@Field
|
||||
@observable
|
||||
index: string;
|
||||
|
||||
/**
|
||||
* The sort field and direction for documents in the collection.
|
||||
*/
|
||||
/** The sort field and direction for documents in the collection. */
|
||||
@Field
|
||||
@observable
|
||||
sort: {
|
||||
@@ -87,33 +67,19 @@ export default class Collection extends ParanoidModel {
|
||||
direction: "asc" | "desc";
|
||||
};
|
||||
|
||||
/** The child documents of the collection. */
|
||||
@observable
|
||||
documents?: NavigationNode[];
|
||||
|
||||
/**
|
||||
* @deprecated Use path instead.
|
||||
*/
|
||||
/** @deprecated Use path instead. */
|
||||
@observable
|
||||
url: string;
|
||||
|
||||
/** The ID that appears in the collection slug. */
|
||||
@observable
|
||||
urlId: string;
|
||||
|
||||
constructor(fields: Partial<Collection>, store: CollectionsStore) {
|
||||
super(fields, store);
|
||||
|
||||
const resetDocumentPolicies = () => {
|
||||
this.store.rootStore.documents
|
||||
.inCollection(this.id)
|
||||
.forEach((document) => {
|
||||
this.store.rootStore.policies.remove(document.id);
|
||||
});
|
||||
};
|
||||
|
||||
reaction(() => this.permission, resetDocumentPolicies);
|
||||
reaction(() => this.sharing, resetDocumentPolicies);
|
||||
}
|
||||
|
||||
/** Returns whether the collection is empty, or undefined if not loaded. */
|
||||
@computed
|
||||
get isEmpty(): boolean | undefined {
|
||||
if (!this.documents) {
|
||||
@@ -137,11 +103,7 @@ export default class Collection extends ParanoidModel {
|
||||
return !this.permission;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether this collection has a description.
|
||||
*
|
||||
* @returns boolean
|
||||
*/
|
||||
/** Returns whether the collection description is not empty. */
|
||||
@computed
|
||||
get hasDescription(): boolean {
|
||||
return this.data ? !ProsemirrorHelper.isEmptyData(this.data) : false;
|
||||
@@ -167,11 +129,7 @@ export default class Collection extends ParanoidModel {
|
||||
return sortNavigationNodes(this.documents, this.sort);
|
||||
}
|
||||
|
||||
/**
|
||||
* The initial letter of the collection name.
|
||||
*
|
||||
* @returns string
|
||||
*/
|
||||
/** The initial letter of the collection name as a string. */
|
||||
@computed
|
||||
get initial() {
|
||||
return (this.name ? this.name[0] : "?").toUpperCase();
|
||||
@@ -277,7 +235,7 @@ export default class Collection extends ParanoidModel {
|
||||
this.index = index;
|
||||
}
|
||||
|
||||
getDocumentChildren(documentId: string) {
|
||||
getChildrenForDocument(documentId: string) {
|
||||
let result: NavigationNode[] = [];
|
||||
|
||||
const travelNodes = (nodes: NavigationNode[]) => {
|
||||
@@ -356,7 +314,11 @@ export default class Collection extends ParanoidModel {
|
||||
model: Collection,
|
||||
previousAttributes: Partial<Collection>
|
||||
) {
|
||||
if (previousAttributes && model.sharing !== previousAttributes?.sharing) {
|
||||
if (
|
||||
previousAttributes &&
|
||||
(model.sharing !== previousAttributes?.sharing ||
|
||||
model.permission !== previousAttributes?.permission)
|
||||
) {
|
||||
const { documents, policies } = model.store.rootStore;
|
||||
|
||||
documents.inCollection(model.id).forEach((document) => {
|
||||
@@ -364,4 +326,6 @@ export default class Collection extends ParanoidModel {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private isFetching = false;
|
||||
}
|
||||
@@ -1,81 +1,47 @@
|
||||
import { observer } from "mobx-react";
|
||||
import { NewDocumentIcon } from "outline-icons";
|
||||
import * as React from "react";
|
||||
import { Trans, useTranslation } from "react-i18next";
|
||||
import { Link } from "react-router-dom";
|
||||
import { Trans } from "react-i18next";
|
||||
import styled from "styled-components";
|
||||
import Collection from "~/models/Collection";
|
||||
import Button from "~/components/Button";
|
||||
import Fade from "~/components/Fade";
|
||||
import Flex from "~/components/Flex";
|
||||
import Text from "~/components/Text";
|
||||
import { editCollectionPermissions } from "~/actions/definitions/collections";
|
||||
import useActionContext from "~/hooks/useActionContext";
|
||||
import usePolicy from "~/hooks/usePolicy";
|
||||
import { Feature, FeatureFlags } from "~/utils/FeatureFlags";
|
||||
import { newDocumentPath } from "~/utils/routeHelpers";
|
||||
|
||||
type Props = {
|
||||
/** The collection to display the empty state for. */
|
||||
collection: Collection;
|
||||
};
|
||||
|
||||
function EmptyCollection({ collection }: Props) {
|
||||
const { t } = useTranslation();
|
||||
const can = usePolicy(collection);
|
||||
const context = useActionContext();
|
||||
const collectionName = collection ? collection.name : "";
|
||||
|
||||
return (
|
||||
<Centered column>
|
||||
<Text as="p" type="secondary">
|
||||
<Trans
|
||||
defaults="<em>{{ collectionName }}</em> doesn’t contain any
|
||||
<Fade>
|
||||
<Centered column>
|
||||
<Text as="p" type="secondary">
|
||||
<Trans
|
||||
defaults="<em>{{ collectionName }}</em> doesn’t contain any
|
||||
documents yet."
|
||||
values={{
|
||||
collectionName,
|
||||
}}
|
||||
components={{
|
||||
em: <strong />,
|
||||
}}
|
||||
/>
|
||||
<br />
|
||||
{can.createDocument && (
|
||||
<Trans>Get started by creating a new one!</Trans>
|
||||
)}
|
||||
</Text>
|
||||
{can.createDocument && (
|
||||
<Empty>
|
||||
<Link to={newDocumentPath(collection.id)}>
|
||||
<Button icon={<NewDocumentIcon />} neutral>
|
||||
{t("Create a document")}
|
||||
</Button>
|
||||
</Link>
|
||||
{FeatureFlags.isEnabled(Feature.newCollectionSharing) ? null : (
|
||||
<Button
|
||||
action={editCollectionPermissions}
|
||||
context={context}
|
||||
hideOnActionDisabled
|
||||
neutral
|
||||
>
|
||||
{t("Manage permissions")}…
|
||||
</Button>
|
||||
)}
|
||||
</Empty>
|
||||
)}
|
||||
</Centered>
|
||||
values={{
|
||||
collectionName,
|
||||
}}
|
||||
components={{
|
||||
em: <strong />,
|
||||
}}
|
||||
/>
|
||||
</Text>
|
||||
</Centered>
|
||||
</Fade>
|
||||
);
|
||||
}
|
||||
|
||||
const Centered = styled(Flex)`
|
||||
text-align: center;
|
||||
margin: 40vh auto 0;
|
||||
max-width: 380px;
|
||||
transform: translateY(-50%);
|
||||
`;
|
||||
|
||||
const Empty = styled(Flex)`
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin: 10px 0;
|
||||
gap: 8px;
|
||||
margin: 0 auto;
|
||||
max-width: 380px;
|
||||
height: 50vh;
|
||||
`;
|
||||
|
||||
export default observer(EmptyCollection);
|
||||
@@ -8,11 +8,9 @@ import { Avatar, AvatarSize } from "~/components/Avatar";
|
||||
import Facepile from "~/components/Facepile";
|
||||
import Fade from "~/components/Fade";
|
||||
import NudeButton from "~/components/NudeButton";
|
||||
import { editCollectionPermissions } from "~/actions/definitions/collections";
|
||||
import useActionContext from "~/hooks/useActionContext";
|
||||
import useMobile from "~/hooks/useMobile";
|
||||
import useStores from "~/hooks/useStores";
|
||||
import { Feature, FeatureFlags } from "~/utils/FeatureFlags";
|
||||
|
||||
type Props = {
|
||||
collection: Collection;
|
||||
@@ -71,11 +69,6 @@ const MembershipPreview = ({ collection, limit = 8 }: Props) => {
|
||||
return (
|
||||
<NudeButton
|
||||
context={context}
|
||||
action={
|
||||
FeatureFlags.isEnabled(Feature.newCollectionSharing)
|
||||
? undefined
|
||||
: editCollectionPermissions
|
||||
}
|
||||
tooltip={{
|
||||
content:
|
||||
usersCount > 0
|
||||
|
||||
+117
-139
@@ -17,7 +17,6 @@ import { colorPalette } from "@shared/utils/collections";
|
||||
import Collection from "~/models/Collection";
|
||||
import Search from "~/scenes/Search";
|
||||
import { Action } from "~/components/Actions";
|
||||
import Badge from "~/components/Badge";
|
||||
import CenteredContent from "~/components/CenteredContent";
|
||||
import CollectionDescription from "~/components/CollectionDescription";
|
||||
import Heading from "~/components/Heading";
|
||||
@@ -31,14 +30,12 @@ import PlaceholderText from "~/components/PlaceholderText";
|
||||
import Scene from "~/components/Scene";
|
||||
import Tab from "~/components/Tab";
|
||||
import Tabs from "~/components/Tabs";
|
||||
import Tooltip from "~/components/Tooltip";
|
||||
import { editCollection } from "~/actions/definitions/collections";
|
||||
import useCommandBarActions from "~/hooks/useCommandBarActions";
|
||||
import { useLastVisitedPath } from "~/hooks/useLastVisitedPath";
|
||||
import { usePinnedDocuments } from "~/hooks/usePinnedDocuments";
|
||||
import usePolicy from "~/hooks/usePolicy";
|
||||
import useStores from "~/hooks/useStores";
|
||||
import { Feature, FeatureFlags } from "~/utils/FeatureFlags";
|
||||
import { collectionPath, updateCollectionPath } from "~/utils/routeHelpers";
|
||||
import Actions from "./components/Actions";
|
||||
import DropToImport from "./components/DropToImport";
|
||||
@@ -154,8 +151,7 @@ function CollectionScene() {
|
||||
<>
|
||||
<MembershipPreview collection={collection} />
|
||||
<Action>
|
||||
{FeatureFlags.isEnabled(Feature.newCollectionSharing) &&
|
||||
can.update && <ShareButton collection={collection} />}
|
||||
{can.update && <ShareButton collection={collection} />}
|
||||
</Action>
|
||||
<Actions collection={collection} />
|
||||
</>
|
||||
@@ -167,142 +163,124 @@ function CollectionScene() {
|
||||
collectionId={collection.id}
|
||||
>
|
||||
<CenteredContent withStickyHeader>
|
||||
{collection.isEmpty ? (
|
||||
<Empty collection={collection} />
|
||||
) : (
|
||||
<>
|
||||
<CollectionHeading>
|
||||
<IconTitleWrapper>
|
||||
{can.update ? (
|
||||
<React.Suspense fallback={fallbackIcon}>
|
||||
<IconPicker
|
||||
icon={collection.icon ?? "collection"}
|
||||
color={collection.color ?? colorPalette[0]}
|
||||
initial={collection.name[0]}
|
||||
size={40}
|
||||
popoverPosition="bottom-start"
|
||||
onChange={handleIconChange}
|
||||
borderOnHover
|
||||
/>
|
||||
</React.Suspense>
|
||||
) : (
|
||||
fallbackIcon
|
||||
)}
|
||||
</IconTitleWrapper>
|
||||
{collection.name}
|
||||
{collection.isPrivate &&
|
||||
!FeatureFlags.isEnabled(Feature.newCollectionSharing) && (
|
||||
<Tooltip
|
||||
content={t(
|
||||
"This collection is only visible to those given access"
|
||||
)}
|
||||
placement="bottom"
|
||||
>
|
||||
<Badge>{t("Private")}</Badge>
|
||||
</Tooltip>
|
||||
)}
|
||||
</CollectionHeading>
|
||||
<CollectionHeading>
|
||||
<IconTitleWrapper>
|
||||
{can.update ? (
|
||||
<React.Suspense fallback={fallbackIcon}>
|
||||
<IconPicker
|
||||
icon={collection.icon ?? "collection"}
|
||||
color={collection.color ?? colorPalette[0]}
|
||||
initial={collection.name[0]}
|
||||
size={40}
|
||||
popoverPosition="bottom-start"
|
||||
onChange={handleIconChange}
|
||||
borderOnHover
|
||||
/>
|
||||
</React.Suspense>
|
||||
) : (
|
||||
fallbackIcon
|
||||
)}
|
||||
</IconTitleWrapper>
|
||||
{collection.name}
|
||||
</CollectionHeading>
|
||||
|
||||
<PinnedDocuments
|
||||
pins={pins}
|
||||
canUpdate={can.update}
|
||||
placeholderCount={count}
|
||||
/>
|
||||
<CollectionDescription collection={collection} />
|
||||
<PinnedDocuments
|
||||
pins={pins}
|
||||
canUpdate={can.update}
|
||||
placeholderCount={count}
|
||||
/>
|
||||
<CollectionDescription collection={collection} />
|
||||
|
||||
<Documents>
|
||||
<Tabs>
|
||||
<Tab to={collectionPath(collection.path)} exact>
|
||||
{t("Documents")}
|
||||
</Tab>
|
||||
<Tab to={collectionPath(collection.path, "updated")} exact>
|
||||
{t("Recently updated")}
|
||||
</Tab>
|
||||
<Tab to={collectionPath(collection.path, "published")} exact>
|
||||
{t("Recently published")}
|
||||
</Tab>
|
||||
<Tab to={collectionPath(collection.path, "old")} exact>
|
||||
{t("Least recently updated")}
|
||||
</Tab>
|
||||
<Tab
|
||||
to={collectionPath(collection.path, "alphabetical")}
|
||||
exact
|
||||
>
|
||||
{t("A–Z")}
|
||||
</Tab>
|
||||
</Tabs>
|
||||
<Switch>
|
||||
<Route path={collectionPath(collection.path, "alphabetical")}>
|
||||
<PaginatedDocumentList
|
||||
key="alphabetical"
|
||||
documents={documents.alphabeticalInCollection(
|
||||
collection.id
|
||||
)}
|
||||
fetch={documents.fetchAlphabetical}
|
||||
options={{
|
||||
collectionId: collection.id,
|
||||
}}
|
||||
/>
|
||||
</Route>
|
||||
<Route path={collectionPath(collection.path, "old")}>
|
||||
<PaginatedDocumentList
|
||||
key="old"
|
||||
documents={documents.leastRecentlyUpdatedInCollection(
|
||||
collection.id
|
||||
)}
|
||||
fetch={documents.fetchLeastRecentlyUpdated}
|
||||
options={{
|
||||
collectionId: collection.id,
|
||||
}}
|
||||
/>
|
||||
</Route>
|
||||
<Route path={collectionPath(collection.path, "recent")}>
|
||||
<Redirect
|
||||
to={collectionPath(collection.path, "published")}
|
||||
/>
|
||||
</Route>
|
||||
<Route path={collectionPath(collection.path, "published")}>
|
||||
<PaginatedDocumentList
|
||||
key="published"
|
||||
documents={documents.recentlyPublishedInCollection(
|
||||
collection.id
|
||||
)}
|
||||
fetch={documents.fetchRecentlyPublished}
|
||||
options={{
|
||||
collectionId: collection.id,
|
||||
}}
|
||||
showPublished
|
||||
/>
|
||||
</Route>
|
||||
<Route path={collectionPath(collection.path, "updated")}>
|
||||
<PaginatedDocumentList
|
||||
key="updated"
|
||||
documents={documents.recentlyUpdatedInCollection(
|
||||
collection.id
|
||||
)}
|
||||
fetch={documents.fetchRecentlyUpdated}
|
||||
options={{
|
||||
collectionId: collection.id,
|
||||
}}
|
||||
/>
|
||||
</Route>
|
||||
<Route path={collectionPath(collection.path)} exact>
|
||||
<PaginatedDocumentList
|
||||
documents={documents.rootInCollection(collection.id)}
|
||||
fetch={documents.fetchPage}
|
||||
options={{
|
||||
collectionId: collection.id,
|
||||
parentDocumentId: null,
|
||||
sort: collection.sort.field,
|
||||
direction: collection.sort.direction,
|
||||
}}
|
||||
showParentDocuments
|
||||
/>
|
||||
</Route>
|
||||
</Switch>
|
||||
</Documents>
|
||||
</>
|
||||
)}
|
||||
<Documents>
|
||||
<Tabs>
|
||||
<Tab to={collectionPath(collection.path)} exact>
|
||||
{t("Documents")}
|
||||
</Tab>
|
||||
<Tab to={collectionPath(collection.path, "updated")} exact>
|
||||
{t("Recently updated")}
|
||||
</Tab>
|
||||
<Tab to={collectionPath(collection.path, "published")} exact>
|
||||
{t("Recently published")}
|
||||
</Tab>
|
||||
<Tab to={collectionPath(collection.path, "old")} exact>
|
||||
{t("Least recently updated")}
|
||||
</Tab>
|
||||
<Tab to={collectionPath(collection.path, "alphabetical")} exact>
|
||||
{t("A–Z")}
|
||||
</Tab>
|
||||
</Tabs>
|
||||
{collection.isEmpty ? (
|
||||
<Empty collection={collection} />
|
||||
) : (
|
||||
<Switch>
|
||||
<Route path={collectionPath(collection.path, "alphabetical")}>
|
||||
<PaginatedDocumentList
|
||||
key="alphabetical"
|
||||
documents={documents.alphabeticalInCollection(
|
||||
collection.id
|
||||
)}
|
||||
fetch={documents.fetchAlphabetical}
|
||||
options={{
|
||||
collectionId: collection.id,
|
||||
}}
|
||||
/>
|
||||
</Route>
|
||||
<Route path={collectionPath(collection.path, "old")}>
|
||||
<PaginatedDocumentList
|
||||
key="old"
|
||||
documents={documents.leastRecentlyUpdatedInCollection(
|
||||
collection.id
|
||||
)}
|
||||
fetch={documents.fetchLeastRecentlyUpdated}
|
||||
options={{
|
||||
collectionId: collection.id,
|
||||
}}
|
||||
/>
|
||||
</Route>
|
||||
<Route path={collectionPath(collection.path, "recent")}>
|
||||
<Redirect to={collectionPath(collection.path, "published")} />
|
||||
</Route>
|
||||
<Route path={collectionPath(collection.path, "published")}>
|
||||
<PaginatedDocumentList
|
||||
key="published"
|
||||
documents={documents.recentlyPublishedInCollection(
|
||||
collection.id
|
||||
)}
|
||||
fetch={documents.fetchRecentlyPublished}
|
||||
options={{
|
||||
collectionId: collection.id,
|
||||
}}
|
||||
showPublished
|
||||
/>
|
||||
</Route>
|
||||
<Route path={collectionPath(collection.path, "updated")}>
|
||||
<PaginatedDocumentList
|
||||
key="updated"
|
||||
documents={documents.recentlyUpdatedInCollection(
|
||||
collection.id
|
||||
)}
|
||||
fetch={documents.fetchRecentlyUpdated}
|
||||
options={{
|
||||
collectionId: collection.id,
|
||||
}}
|
||||
/>
|
||||
</Route>
|
||||
<Route path={collectionPath(collection.path)} exact>
|
||||
<PaginatedDocumentList
|
||||
documents={documents.rootInCollection(collection.id)}
|
||||
fetch={documents.fetchPage}
|
||||
options={{
|
||||
collectionId: collection.id,
|
||||
parentDocumentId: null,
|
||||
sort: collection.sort.field,
|
||||
direction: collection.sort.direction,
|
||||
}}
|
||||
showParentDocuments
|
||||
/>
|
||||
</Route>
|
||||
</Switch>
|
||||
)}
|
||||
</Documents>
|
||||
</CenteredContent>
|
||||
</DropToImport>
|
||||
</Scene>
|
||||
|
||||
@@ -27,7 +27,7 @@ function References({ document }: Props) {
|
||||
? collections.get(document.collectionId)
|
||||
: undefined;
|
||||
const children = collection
|
||||
? collection.getDocumentChildren(document.id)
|
||||
? collection.getChildrenForDocument(document.id)
|
||||
: [];
|
||||
const showBacklinks = !!backlinks.length;
|
||||
const showChildDocuments = !!children.length;
|
||||
|
||||
@@ -31,7 +31,7 @@ function DocumentDelete({ document, onSubmit }: Props) {
|
||||
? collections.get(document.collectionId)
|
||||
: undefined;
|
||||
const nestedDocumentsCount = collection
|
||||
? collection.getDocumentChildren(document.id).length
|
||||
? collection.getChildrenForDocument(document.id).length
|
||||
: 0;
|
||||
const handleSubmit = React.useCallback(
|
||||
async (ev: React.SyntheticEvent) => {
|
||||
|
||||
@@ -337,9 +337,9 @@
|
||||
"Move document": "Move document",
|
||||
"New doc": "New doc",
|
||||
"You can't reorder documents in an alphabetically sorted collection": "You can't reorder documents in an alphabetically sorted collection",
|
||||
"Empty": "Empty",
|
||||
"Collections": "Collections",
|
||||
"Document not supported – try Markdown, Plain text, HTML, or Word": "Document not supported – try Markdown, Plain text, HTML, or Word",
|
||||
"Empty": "Empty",
|
||||
"Go back": "Go back",
|
||||
"Go forward": "Go forward",
|
||||
"Could not load shared documents": "Could not load shared documents",
|
||||
@@ -541,9 +541,6 @@
|
||||
"Collection menu": "Collection menu",
|
||||
"Drop documents to import": "Drop documents to import",
|
||||
"<em>{{ collectionName }}</em> doesn’t contain any\n documents yet.": "<em>{{ collectionName }}</em> doesn’t contain any\n documents yet.",
|
||||
"Get started by creating a new one!": "Get started by creating a new one!",
|
||||
"Create a document": "Create a document",
|
||||
"Manage permissions": "Manage permissions",
|
||||
"{{ usersCount }} users and {{ groupsCount }} groups with access": "{{ usersCount }} user and {{ groupsCount }} groups with access",
|
||||
"{{ usersCount }} users and {{ groupsCount }} groups with access_plural": "{{ usersCount }} users and {{ groupsCount }} groups with access",
|
||||
"{{ usersCount }} users and a group have access": "{{ usersCount }} user and a group have access",
|
||||
@@ -553,8 +550,6 @@
|
||||
"{{ groupsCount }} groups with access": "{{ groupsCount }} group with access",
|
||||
"{{ groupsCount }} groups with access_plural": "{{ groupsCount }} groups with access",
|
||||
"Share": "Share",
|
||||
"This collection is only visible to those given access": "This collection is only visible to those given access",
|
||||
"Private": "Private",
|
||||
"Recently updated": "Recently updated",
|
||||
"Recently published": "Recently published",
|
||||
"Least recently updated": "Least recently updated",
|
||||
|
||||
Reference in new issue
Block a user