import React from 'react';
import { BrowserRouter as Router, Route } from 'react-router-dom';
import { AppLoader } from '../AppLoader';
import { Header } from '../Header';
import { Page } from '../Page';
import { Widgets } from '../Widgets';
import { useConfig, useLoading, usePluginsRegistered } from './hooks';
export function App() {
    var config = useConfig();
    var arePluginsRegistered = usePluginsRegistered();
    var isLoading = useLoading({ config: config, arePluginsRegistered: arePluginsRegistered });
    return (React.createElement(Router, null,
        React.createElement(React.Fragment, null,
            !isLoading && (React.createElement(React.Fragment, null,
                React.createElement(Header, { version: config ? config.version : undefined, tabs: config ? config.tabs.map(function (tab) { return tab.title; }) : [] }),
                React.createElement(Page, null, config &&
                    config.tabs.map(function (tab, index) {
                        var pathName = "/" + tab.title.toLowerCase();
                        if (index === 0) {
                            pathName = '/';
                        }
                        return (React.createElement(Route, { key: pathName, exact: index === 0, path: pathName, component: function () { return React.createElement(Widgets, { tab: tab }); } }));
                    })))),
            React.createElement(AppLoader, { visible: isLoading }))));
}
//# sourceMappingURL=index.js.map