Client:Pages:PortalSettings:Plugins: add drag and drop to list
This commit is contained in:
parent
a7f004cf11
commit
8cab7256f5
@ -1,25 +1,25 @@
|
||||
// (c) Copyright Ascensio System SIA 2010-2024
|
||||
//
|
||||
//
|
||||
// This program is a free software product.
|
||||
// You can redistribute it and/or modify it under the terms
|
||||
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
|
||||
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
|
||||
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
|
||||
// any third-party rights.
|
||||
//
|
||||
//
|
||||
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
|
||||
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
|
||||
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
//
|
||||
//
|
||||
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
|
||||
//
|
||||
//
|
||||
// The interactive user interfaces in modified source and object code versions of the Program must
|
||||
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
|
||||
//
|
||||
//
|
||||
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
|
||||
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
|
||||
// trademark law for use of our trademarks.
|
||||
//
|
||||
//
|
||||
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
|
||||
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
|
||||
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
@ -27,7 +27,7 @@
|
||||
import React from "react";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import { useDropzone } from "react-dropzone";
|
||||
import { setDocumentTitle } from "SRC_DIR/helpers/utils";
|
||||
|
||||
import Header from "./sub-components/header";
|
||||
@ -60,6 +60,23 @@ const PluginPage = ({
|
||||
}) => {
|
||||
const { t } = useTranslation(["WebPlugins", "Common"]);
|
||||
|
||||
const onDrop = (files) => {
|
||||
let formData = new FormData();
|
||||
|
||||
formData.append("file", files[0]);
|
||||
addPlugin(formData);
|
||||
};
|
||||
|
||||
const { getRootProps, getInputProps } = useDropzone({
|
||||
maxFiles: 1,
|
||||
noClick: withUpload,
|
||||
noKeyboard: withUpload,
|
||||
// maxSize: 1000000,
|
||||
accept: [".zip"],
|
||||
// @ts-expect-error onDrop
|
||||
onDrop,
|
||||
});
|
||||
|
||||
React.useEffect(() => {
|
||||
setDocumentTitle(t("Common:Plugins"));
|
||||
}, []);
|
||||
@ -71,24 +88,31 @@ const PluginPage = ({
|
||||
<ListLoader withUpload={withUpload} />
|
||||
</StyledContainer>
|
||||
) : isEmptyList ? (
|
||||
<StyledEmptyContainer>
|
||||
<StyledEmptyContainer {...getRootProps()}>
|
||||
<EmptyScreen
|
||||
t={t}
|
||||
theme={theme}
|
||||
onAddAction={addPlugin}
|
||||
currentColorScheme={currentColorScheme}
|
||||
withUpload={withUpload}
|
||||
inputProps={getInputProps()}
|
||||
/>
|
||||
</StyledEmptyContainer>
|
||||
) : (
|
||||
<StyledContainer>
|
||||
<StyledContainer {...getRootProps()}>
|
||||
{/* <Header
|
||||
t={t}
|
||||
currentColorScheme={currentColorScheme}
|
||||
|
||||
withUpload={withUpload}
|
||||
/> */}
|
||||
{withUpload && <UploadButton t={t} addPlugin={addPlugin} />}
|
||||
{withUpload && (
|
||||
<UploadButton
|
||||
t={t}
|
||||
addPlugin={addPlugin}
|
||||
inputProps={getInputProps()}
|
||||
/>
|
||||
)}
|
||||
<PluginListContainer>
|
||||
{pluginList.map((plugin) => (
|
||||
<PluginItem
|
||||
|
@ -1,25 +1,25 @@
|
||||
// (c) Copyright Ascensio System SIA 2010-2024
|
||||
//
|
||||
//
|
||||
// This program is a free software product.
|
||||
// You can redistribute it and/or modify it under the terms
|
||||
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
|
||||
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
|
||||
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
|
||||
// any third-party rights.
|
||||
//
|
||||
//
|
||||
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
|
||||
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
|
||||
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
//
|
||||
//
|
||||
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
|
||||
//
|
||||
//
|
||||
// The interactive user interfaces in modified source and object code versions of the Program must
|
||||
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
|
||||
//
|
||||
//
|
||||
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
|
||||
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
|
||||
// trademark law for use of our trademarks.
|
||||
//
|
||||
//
|
||||
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
|
||||
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
|
||||
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
@ -43,6 +43,7 @@ const EmptyScreen = ({
|
||||
currentColorScheme,
|
||||
|
||||
withUpload,
|
||||
inputProps,
|
||||
}) => {
|
||||
const imageSrc = theme.isBase
|
||||
? EmptyScreenPluginsUrl
|
||||
@ -55,7 +56,11 @@ const EmptyScreen = ({
|
||||
style={{ gridColumnGap: "39px" }}
|
||||
buttonStyle={{ marginTop: "16px" }}
|
||||
imageSrc={imageSrc}
|
||||
buttons={withUpload && <UploadButton t={t} addPlugin={onAddAction} />}
|
||||
buttons={
|
||||
withUpload && (
|
||||
<UploadButton t={t} addPlugin={onAddAction} inputProps={inputProps} />
|
||||
)
|
||||
}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
@ -1,25 +1,25 @@
|
||||
// (c) Copyright Ascensio System SIA 2010-2024
|
||||
//
|
||||
//
|
||||
// This program is a free software product.
|
||||
// You can redistribute it and/or modify it under the terms
|
||||
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
|
||||
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
|
||||
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
|
||||
// any third-party rights.
|
||||
//
|
||||
//
|
||||
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
|
||||
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
|
||||
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
//
|
||||
//
|
||||
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
|
||||
//
|
||||
//
|
||||
// The interactive user interfaces in modified source and object code versions of the Program must
|
||||
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
|
||||
//
|
||||
//
|
||||
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
|
||||
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
|
||||
// trademark law for use of our trademarks.
|
||||
//
|
||||
//
|
||||
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
|
||||
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
|
||||
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
@ -33,7 +33,7 @@ const StyledUploadButton = styled.div`
|
||||
width: auto;
|
||||
`;
|
||||
|
||||
const UploadButton = ({ t, addPlugin }) => {
|
||||
const UploadButton = ({ t, addPlugin, inputProps }) => {
|
||||
const pluginInputRef = React.useRef(null);
|
||||
|
||||
const onAddAction = () => {
|
||||
@ -72,6 +72,7 @@ const UploadButton = ({ t, addPlugin }) => {
|
||||
ref={pluginInputRef}
|
||||
style={{ display: "none" }}
|
||||
/>
|
||||
{inputProps && <input {...inputProps} />}
|
||||
</StyledUploadButton>
|
||||
);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user