feat: Enable 'new document' action

This commit is contained in:
Tom Moor
2021-10-24 17:51:25 -07:00
parent adca894e83
commit bb36425175
2 changed files with 9 additions and 1 deletions

View File

@@ -33,6 +33,7 @@ export const createCollection = createAction({
name: ({ t }) => t("New collection"),
section: CollectionSection,
icon: <PlusIcon />,
keywords: "create",
visible: ({ stores }) =>
stores.policies.abilities(stores.auth.team?.id || "").createCollection,
perform: ({ t, event }) => {

View File

@@ -16,6 +16,7 @@ export const openDocument = createAction({
name: ({ t }) => t("Open document"),
section: DocumentSection,
shortcut: ["o", "d"],
keywords: "go to",
icon: <DocumentIcon />,
children: ({ stores }) => {
const paths = stores.collections.pathsToDocuments;
@@ -41,6 +42,7 @@ export const createDocument = createAction({
name: ({ t }) => t("New document"),
section: DocumentSection,
icon: <NewDocumentIcon />,
keywords: "create",
visible: ({ activeCollectionId, stores }) =>
!!activeCollectionId &&
stores.policies.abilities(activeCollectionId).update,
@@ -52,6 +54,7 @@ export const importDocument = createAction({
name: ({ t }) => t("Import document"),
section: DocumentSection,
icon: <ImportIcon />,
keywords: "upload",
visible: ({ activeCollectionId, stores }) =>
!!activeCollectionId &&
stores.policies.abilities(activeCollectionId).update,
@@ -87,4 +90,8 @@ export const importDocument = createAction({
},
});
export const rootDocumentActions = [openDocument, importDocument];
export const rootDocumentActions = [
openDocument,
createDocument,
importDocument,
];