-interface MainPanelDataProps {
- user?: User;
- working: boolean;
- loading: boolean;
-}
-
-interface MainPanelGeneralProps {
- buildInfo: string;
-}
-
-interface MainPanelState {
- searchText: string;
-}
-
-type MainPanelProps = MainPanelDataProps & MainPanelGeneralProps & DispatchProp<any> & WithStyles<CssRules>;
-
-export const MainPanel = withStyles(styles)(
- connect<MainPanelDataProps>(
- (state: RootState) => ({
- user: state.auth.user,
- working: isSystemWorking(state.progressIndicator),
- loading: isWorkbenchLoading(state)
- })
- )(
- class extends React.Component<MainPanelProps, MainPanelState> {
- state = {
- searchText: "",
- };
-
- render() {
- const { classes, user, buildInfo, working, loading } = this.props;
- const { searchText } = this.state;
- return loading
- ? <WorkbenchLoadingScreen />
- : <>
- <MainAppBar
- searchText={searchText}
- user={user}
- onSearch={this.onSearch}
- buildInfo={buildInfo}>
- {working ? <LinearProgress color="secondary" /> : null}
- </MainAppBar>
- <Grid container direction="column" className={classes.root}>
- {user ? <WorkbenchPanel /> : <LoginPanel />}
- </Grid>
- </>;
- }
-
- onSearch = (searchText: string) => {
- this.setState({ searchText });
- this.props.dispatch(push(`/search?q=${searchText}`));
- }
- }
- )
-);
\ No newline at end of file