import React, {Component} from 'react';
import PropTypes from 'prop-types';
import ConfirmDeleteContentsItem from "./dialog/confirm-delete-contents-item/confirm-delete-contents-item";
import MoveTo from "./dialog/move-to/move-to";
import AddMenu from "./popup/add-menu/add-menu";
import Contents from "./contents/contents";
import CreateThat from "./dialog/create-that/create-that";
import Search from 'nexshop-web-search';
export default class ContentsMainView extends Component {
constructor(props) {
super(props);
this.closeAddMenu = this.closeAddMenu.bind(this);
}
closeAddMenu() {
const {closeAddMenu} = this.props;
closeAddMenu('add-menu');
}
render() {
const {
addMenuVisibility,
onCreatePlaylistMenuClicked,
onPlaylistCreated,
onCreateSceneMenuClicked,
onSceneCreated,
onAddButtonClicked,
onSelectFiles,
onCreateNewFolderClicked,
breadcrumb,
createSceneDialogVisibility,
createPlaylistDialogVisibility,
fetchExistContentNameAsync,
closeDialog,
contentNameExisted,
replaceContentNameValidity,
} = this.props;
return (
<div className="content">
<div className="search">
<Search />
</div>
<div className="add-content-wrapper">
<div className={`add-button ${addMenuVisibility ? 'add-button--rotate' : ''}`}
onClick={onAddButtonClicked}
/>
</div>
<Contents history={this.props.history}/>
{
addMenuVisibility &&
<AddMenu onClose={this.closeAddMenu}
onCreatePlaylistClicked={onCreatePlaylistMenuClicked}
onCreateSceneClicked={onCreateSceneMenuClicked}
onUploadFilesSelected={onSelectFiles}
onCreateNewFolderClicked={onCreateNewFolderClicked}
/>
}
<CreateThat whatThatIs={'Playlist'} visibility={createPlaylistDialogVisibility}
contentNameExisted={contentNameExisted}
fetchExistContentNameAsync={fetchExistContentNameAsync}
onCancel={closeDialog}
onClose={closeDialog}
onCreated={onPlaylistCreated}
breadcrumb={breadcrumb}
replaceContentNameValidity={replaceContentNameValidity}
/>
<CreateThat whatThatIs={'Scene'} visibility={createSceneDialogVisibility}
contentNameExisted={contentNameExisted}
fetchExistContentNameAsync={fetchExistContentNameAsync}
onCancel={closeDialog}
onClose={closeDialog}
onCreated={onSceneCreated}
breadcrumb={breadcrumb}
replaceContentNameValidity={replaceContentNameValidity}
/>
<ConfirmDeleteContentsItem/>
<MoveTo/>
</div>
);
}
}
ContentsMainView.propTypes = {
addMenuVisibility: PropTypes.bool.isRequired,
closeAddMenu: PropTypes.func.isRequired,
onAddButtonClicked: PropTypes.func.isRequired,
onCreatePlaylistMenuClicked: PropTypes.func.isRequired,
onPlaylistCreated: PropTypes.func,
onCreateSceneMenuClicked: PropTypes.func.isRequired,
onSceneCreated: PropTypes.func,
onSelectFiles: PropTypes.func,
onCreateNewFolderClicked: PropTypes.func,
closeDialog: PropTypes.func.isRequired,
breadcrumb: PropTypes.array.isRequired,
contentNameExisted: PropTypes.string.isRequired,
fetchExistContentNameAsync: PropTypes.func.isRequired,
replaceContentNameValidity: PropTypes.func.isRequired,
}; |