Repository URL to install this package:
|
Version:
3.12.20 ▾
|
import { useDispatch, useSelector } from 'react-redux';
import { useExplorer } from '../../hooks';
import AddFiles from './AddFiles';
import Styled from './AddFiles.styled';
import { DropFilesWindow, SlideTransition } from '@filerobot/common';
import { selectIsUploadsPanelOpened, selectShowAddFilesPanel, showAddFilesPanelUpdated } from '../../slices/panels.slice';
import { jsx as _jsx } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
import { Fragment as _Fragment } from "react/jsx-runtime";
var AddFilesPanel = function AddFilesPanel(_ref) {
var zIndex = _ref.zIndex;
var dispatch = useDispatch();
var _useExplorer = useExplorer(),
i18n = _useExplorer.i18n,
requestCloseModal = _useExplorer.requestCloseModal,
_useExplorer$opts = _useExplorer.opts,
opts = _useExplorer$opts === void 0 ? {} : _useExplorer$opts;
var noItemsBrowser = opts.noItemsBrowser,
showDragDropPanel = opts.showDragDropPanel;
var showAddFilesPanel = useSelector(selectShowAddFilesPanel);
var showUploadsPanel = useSelector(selectIsUploadsPanelOpened);
var shouldShowAddFilesPanel = showAddFilesPanel || noItemsBrowser && !showUploadsPanel;
var closeModalHandler = function closeModalHandler() {
if (noItemsBrowser) {
requestCloseModal();
return;
}
dispatch(showAddFilesPanelUpdated(false));
};
return /*#__PURE__*/_jsx(SlideTransition, {
zIndex: zIndex,
handleClose: closeModalHandler,
children: shouldShowAddFilesPanel && /*#__PURE__*/_jsxs(_Fragment, {
children: [/*#__PURE__*/_jsxs(Styled.AddFilesPanelWrapper, {
showDragDropPanel: showDragDropPanel,
children: [!showDragDropPanel && /*#__PURE__*/_jsxs(Styled.ExplorerTopBar, {
children: [/*#__PURE__*/_jsx(Styled.ExplorerTopBarTitle, {
children: i18n('topBarUploadLabel')
}), /*#__PURE__*/_jsx(Styled.CloseButton, {
onClick: closeModalHandler
})]
}), /*#__PURE__*/_jsx(AddFiles, {})]
}), /*#__PURE__*/_jsx(DropFilesWindow, {
dropFileHint: i18n('explorerDropFilesHint')
})]
})
});
};
export default AddFilesPanel;