All files / nexshop-web-contents/src/component contents-main-view.js

100% Statements 15/15
100% Branches 4/4
100% Functions 3/3
100% Lines 15/15
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 1021x 1x 1x 1x 1x 1x 1x 1x       13x   13x       1x   1x                                       22x   22x                                                                                         1x                              
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,
};