Merge pull request #605 from ONLYOFFICE/feature/add-new-option

Client:EmptyView Added new option
This commit is contained in:
Alexey Safronov 2024-08-28 16:14:49 +04:00 committed by GitHub
commit bc2d7792a5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 18 additions and 0 deletions

View File

@ -3,6 +3,8 @@
"CollaboratorEmptyTitle": "The room is empty.", "CollaboratorEmptyTitle": "The room is empty.",
"CreateDocument": "Create a new document", "CreateDocument": "Create a new document",
"CreateDocumentDescription": "Take advantage of vast word processing functionality.", "CreateDocumentDescription": "Take advantage of vast word processing functionality.",
"CreateForm": "Create a new PDF form",
"CreateFormDescription": "Collect votes, get opinions and store data using PDF forms",
"CreateNewFileDescription": "Start working in the room by creating files or folders", "CreateNewFileDescription": "Start working in the room by creating files or folders",
"CreateNewFileTitle": "Create a new file", "CreateNewFileTitle": "Create a new file",
"CreatePresentation": "Create a new presentation", "CreatePresentation": "Create a new presentation",

View File

@ -10,6 +10,7 @@ import {
ShareAccessRights, ShareAccessRights,
} from "@docspace/shared/enums"; } from "@docspace/shared/enums";
import UploadPDFFormIcon from "PUBLIC_DIR/images/emptyview/upload.pdf.form.svg";
import CreateNewFormIcon from "PUBLIC_DIR/images/emptyview/create.new.form.svg"; import CreateNewFormIcon from "PUBLIC_DIR/images/emptyview/create.new.form.svg";
import CreateNewSpreadsheetIcon from "PUBLIC_DIR/images/emptyview/create.new.spreadsheet.svg"; import CreateNewSpreadsheetIcon from "PUBLIC_DIR/images/emptyview/create.new.spreadsheet.svg";
import CreateNewPresentation from "PUBLIC_DIR/images/emptyview/create.new.presentation.svg"; import CreateNewPresentation from "PUBLIC_DIR/images/emptyview/create.new.presentation.svg";
@ -232,6 +233,15 @@ export const getOptions = (
disabled: false, disabled: false,
}; };
const createForm = {
title: t("EmptyView:CreateForm"),
description: t("EmptyView:CreateFormDescription"),
icon: <UploadPDFFormIcon />,
key: "create-form-option",
onClick: () => actions.onCreate("pdf"),
disabled: false,
};
const createRoom = { const createRoom = {
title: t("EmptyView:CreateRoomTitleOption"), title: t("EmptyView:CreateRoomTitleOption"),
description: t("EmptyView:CreateRoomDescriotionOption"), description: t("EmptyView:CreateRoomDescriotionOption"),
@ -316,6 +326,7 @@ export const getOptions = (
createDoc, createDoc,
createSpreadsheet, createSpreadsheet,
createPresentation, createPresentation,
createForm,
]) ])
.with([FolderType.Recent, P._], () => ({ .with([FolderType.Recent, P._], () => ({
...actions.onGoToPersonal(), ...actions.onGoToPersonal(),
@ -360,6 +371,7 @@ export const getOptions = (
createDoc, createDoc,
createSpreadsheet, createSpreadsheet,
createPresentation, createPresentation,
createForm,
]) ])
.otherwise(() => []); .otherwise(() => []);
} }

View File

@ -4,6 +4,7 @@ import { useNavigate, LinkProps } from "react-router-dom";
import { import {
Events, Events,
FileExtensions,
FilesSelectorFilterTypes, FilesSelectorFilterTypes,
FilterType, FilterType,
RoomSearchArea, RoomSearchArea,
@ -216,10 +217,13 @@ export const useOptions = (
(extension: ExtensiontionType, withoutDialog?: boolean) => { (extension: ExtensiontionType, withoutDialog?: boolean) => {
const event: CreateEvent = new Event(Events.CREATE); const event: CreateEvent = new Event(Events.CREATE);
const edit = extension === FileExtensions.PDF;
const payload = { const payload = {
id: -1, id: -1,
extension, extension,
withoutDialog, withoutDialog,
edit,
}; };
event.payload = payload; event.payload = payload;