github.com/grafana/pyroscope@v1.18.0/public/app/app.tsx (about)

     1  import React from 'react';
     2  import { TenantWall } from '@pyroscope/components/TenantWall';
     3  import { useSelectFirstApp } from '@pyroscope/hooks/useAppNames';
     4  import '@pyroscope/jquery-import';
     5  import { SingleView } from '@pyroscope/pages/SingleView';
     6  import { ROUTES } from '@pyroscope/pages/routes';
     7  import store from '@pyroscope/redux/store';
     8  import Notifications from '@pyroscope/ui/Notifications';
     9  import { history } from '@pyroscope/util/history';
    10  import '@szhsin/react-menu/dist/index.css';
    11  import ReactDOM from 'react-dom/client';
    12  import { Provider } from 'react-redux';
    13  import { Route, Router, Switch } from 'react-router-dom';
    14  import { setupReduxQuerySync } from './redux/useReduxQuerySync';
    15  import './sass/profile.scss';
    16  
    17  const container = document.getElementById('reactRoot') as HTMLElement;
    18  const root = ReactDOM.createRoot(container);
    19  
    20  setupReduxQuerySync();
    21  
    22  declare global {
    23    interface Window {
    24      __grafana_public_path__: string;
    25    }
    26  }
    27  
    28  if (typeof window !== 'undefined') {
    29    // Icons from @grafana/ui are not bundled, this forces them to be loaded via a CDN instead.
    30    window.__grafana_public_path__ = 'assets/grafana/';
    31  }
    32  
    33  function App() {
    34    useSelectFirstApp();
    35  
    36    return (
    37      <Router history={history}>
    38        <div className="app">
    39          <div className="pyroscope-app">
    40            <TenantWall>
    41              <Switch>
    42                <Route exact path={ROUTES.SINGLE_VIEW}>
    43                  <SingleView />
    44                </Route>
    45              </Switch>
    46            </TenantWall>
    47          </div>
    48        </div>
    49      </Router>
    50    );
    51  }
    52  
    53  root.render(
    54    <Provider store={store}>
    55      <Notifications />
    56      <App />
    57    </Provider>
    58  );