import React, { useEffect } from 'react';
import { observer } from 'mobx-react-lite';
import { TableGridSwitchButton } from '../TableGridSwitchButton';
import { GridFolders, } from '../Grid/GridFolders';
import { TableFolders } from '../TableFolders';
import { InitialLoader } from '../InitialLoader';
function _TableGridSwitchFolders(props) {
    const { state } = props;
    const { gridFoldersState, tableFoldersState, toolbar } = state;
    const tableGridSwitchButton = (React.createElement(TableGridSwitchButton, { state: state.viewTypeState }));
    useEffect(() => {
        state.init();
    }, []);
    const { initTask: { status }, } = state;
    const isLoading = status.isIdle || status.isLoading;
    return (React.createElement(React.Fragment, null, isLoading ? (React.createElement(InitialLoader, { dataHook: "initial-loader", state: toolbar })) : state.viewType === 'grid' ? (React.createElement(GridFolders, { ...props, tableGridSwitchButton: tableGridSwitchButton, state: gridFoldersState })) : (React.createElement(TableFolders, { ...props, tableGridSwitchButton: tableGridSwitchButton, state: tableFoldersState }))));
}
export const TableGridSwitchFolders = observer(_TableGridSwitchFolders);
//# sourceMappingURL=TableGridSwitchFolders.js.map