WIP: 0943f64c6a Merge branch 'develop' into feature/submit-to-form-gallery

This commit is contained in:
Mushka Nikita 2023-06-15 11:05:02 +03:00
parent 0943f64c6a
commit f6a49ab912
7 changed files with 60 additions and 17 deletions

View File

@ -1,10 +1,11 @@
import { Link, ModalDialog } from "@docspace/components";
import { Button } from "@docspace/components";
import React from "react";
import React, { useState } from "react";
import { observer, inject } from "mobx-react";
import { Trans, withTranslation } from "react-i18next";
import { ReactSVG } from "react-svg";
import styled from "styled-components";
import SelectFileDialog from "@docspace/client/src/components/panels/SelectFileDialog";
export const StyledModalDialog = styled(ModalDialog)`
.modal-body {
@ -16,7 +17,7 @@ export const StyledModalDialog = styled(ModalDialog)`
font-weight: 400;
line-height: 20px;
color: #333333;
/* color: #333333; */
.guide-link {
color: #4781d1;
@ -72,19 +73,45 @@ const SubmitToFormGallery = ({
formItem,
setFormItem,
}) => {
const [isSelectingForm, setIsSelectingForm] = useState(false);
const onOpenFormSelector = () => setIsSelectingForm(true);
if (formItem) {
const splitted = formItem.title.split(".");
formItem.title = splitted.slice(0, -1).join(".");
formItem.exst = splitted.length !== 1 ? `.${splitted.at(-1)}` : null;
}
//TODO-mushka add final step to form submition
const onSubmitToGallery = () => {};
const onClose = () => {
setVisible(false);
setIsSelectingForm(false);
formItem && setFormItem(null);
};
console.log(formItem);
if (isSelectingForm)
return (
<SelectFileDialog
key="select-form-dialog"
displayType="aside"
onSelectFile={onSubmitToGallery}
isPanelVisible={true}
onClose={onClose}
filteredType="exceptPrivacyTrashArchiveFolders"
ByExtension
searchParam={".docxf"}
dialogName={t("Common:SelectAction")}
filesListTitle={t("Common:SelectDOCXFFormat")}
creationButtonPrimary
withSubfolders={false}
primaryButtonName={t("FormGallery:SubmitToGallery")}
/>
);
return (
<StyledModalDialog visible={visible} onClose={onClose} autoMaxHeight>
<ModalDialog.Header>{t("Common:SubmitToFormGallery")}</ModalDialog.Header>
@ -139,6 +166,7 @@ const SubmitToFormGallery = ({
primary
size="normal"
label={t("FormGallery:SelectForm")}
onClick={onOpenFormSelector}
scale
/>
) : (
@ -146,6 +174,7 @@ const SubmitToFormGallery = ({
primary
size="normal"
label={t("FormGallery:SubmitToGallery")}
onClick={onSubmitToGallery}
scale
/>
)}

View File

@ -105,16 +105,14 @@ class SelectFileDialog extends React.Component {
roomsFolder && roomsFolder.foldersCount ? true : false;
try {
[
resultingFolderTree,
resultingId,
] = await SelectionPanel.getBasicFolderInfo(
treeFolders,
filteredType,
folderId,
passedFoldersTree,
hasSharedFolder
);
[resultingFolderTree, resultingId] =
await SelectionPanel.getBasicFolderInfo(
treeFolders,
filteredType,
folderId,
passedFoldersTree,
hasSharedFolder
);
} catch (e) {
toastr.error(e);
@ -220,6 +218,7 @@ class SelectFileDialog extends React.Component {
footer,
dialogName,
creationButtonPrimary,
primaryButtonName,
maxInputWidth,
} = this.props;
const {
@ -232,7 +231,9 @@ class SelectFileDialog extends React.Component {
selectedFolderId,
} = this.state;
const buttonName = creationButtonPrimary
const buttonName = !!primaryButtonName
? primaryButtonName
: creationButtonPrimary
? t("Common:Create")
: t("Common:SaveButton");
const name = dialogName ? dialogName : t("Common:SelectFile");

View File

@ -695,7 +695,7 @@ class ContextOptionsStore {
}
: false;
//TODO-submit-to-form-gallery change to correct key when added
//TODO-mushka change to correct key when added
const separator1 = contextOptions.includes("make-form")
? {
key: "separator1",
@ -910,7 +910,7 @@ class ContextOptionsStore {
},
separator0,
{
//TODO-submit-to-form-gallery change to correct key when added
//TODO-mushka change to correct key when added
id: "option_make-form",
key: "make-form",
label: t("Common:SubmitToFormGallery"),

View File

@ -13,8 +13,9 @@ const ArticleAlerts = ({
isFreeTariff,
isPaymentPageAvailable,
isTeamTrainingAlertAvailable,
isSubmitToGalleryAlertAvailable,
}) => {
//TODO-submit-to-form-gallery clear up about alert switchind functionality, implement and return training alert
//TODO-mushka clear up about alert switchind functionality, implement and return training alert
return (
<StyledArticleAlertsComponent>
{isPaymentPageAvailable &&
@ -22,7 +23,9 @@ const ArticleAlerts = ({
(isFreeTariff || isGracePeriod) &&
showText && <ArticlePaymentAlert isFreeTariff={isFreeTariff} />}
{isTeamTrainingAlertAvailable && showText && (
{isTeamTrainingAlertAvailable && showText && <ArticleTeamTrainingAlert />}
{isSubmitToGalleryAlertAvailable && showText && (
<ArticleSubmitToFormGalleryAlert />
)}
</StyledArticleAlertsComponent>
@ -35,6 +38,7 @@ export default inject(({ auth }) => {
settingsStore,
isPaymentPageAvailable,
isTeamTrainingAlertAvailable,
isSubmitToGalleryAlertAvailable,
currentTariffStatusStore,
} = auth;
const { isFreeTariff, isNonProfit } = currentQuotaStore;
@ -48,5 +52,6 @@ export default inject(({ auth }) => {
isFreeTariff,
isPaymentPageAvailable,
isTeamTrainingAlertAvailable,
isSubmitToGalleryAlertAvailable,
};
})(observer(ArticleAlerts));

View File

@ -214,6 +214,12 @@ class AuthStore {
);
}
get isSubmitToGalleryAlertAvailable() {
const { user } = this.userStore;
if (!user) return false;
return true;
}
get isLiveChatAvailable() {
const { user } = this.userStore;

View File

@ -218,6 +218,7 @@
"SelectAction": "Select",
"SelectAll": "Select all",
"SelectDOCXFormat": "Select .DOCX file",
"SelectDOCXFFormat": "Select .DOCXF file",
"SelectFile": "Select file",
"SendButton": "Send",
"Sending": "Sending...",

View File

@ -216,6 +216,7 @@
"SelectAction": "Выбрать",
"SelectAll": "Выбрать все",
"SelectDOCXFormat": "Выбрать файл в формате .DOCX",
"SelectDOCXFFormat": "Выбрать файл в формате .DOCXF",
"SelectFile": "Выбрать файл",
"SendButton": "Отправить",
"Sending": "Отправка...",