1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as React from 'react';
7 import { StyleRulesCallback, Theme, WithStyles, withStyles } from '@material-ui/core/styles';
8 import Drawer from '@material-ui/core/Drawer';
9 import AppBar from '@material-ui/core/AppBar';
10 import Toolbar from '@material-ui/core/Toolbar';
11 import Typography from '@material-ui/core/Typography';
12 import { connect } from "react-redux";
13 import Tree from "../../components/tree/tree";
14 import { Project } from "../../models/project";
15 import { RootState } from "../../store/root-reducer";
16 import ProjectList from "../../components/project-list/project-list";
17 import { Route, Switch } from "react-router";
18 import { Link } from "react-router-dom";
20 const drawerWidth = 240;
22 type CssRules = 'root' | 'appBar' | 'drawerPaper' | 'content' | 'toolbar';
24 const styles: StyleRulesCallback<CssRules> = (theme: Theme) => ({
35 zIndex: theme.zIndex.drawer + 1,
36 backgroundColor: '#692498'
44 backgroundColor: theme.palette.background.default,
45 padding: theme.spacing.unit * 3,
48 toolbar: theme.mixins.toolbar
51 interface WorkbenchProps {
55 interface WorkbenchState {
58 class Workbench extends React.Component<WorkbenchProps & WithStyles<CssRules>, WorkbenchState> {
60 const {classes} = this.props;
63 <div className={classes.root}>
64 <AppBar position="absolute" className={classes.appBar}>
66 <Typography variant="title" color="inherit" noWrap>
67 Arvados<br/>Workbench 2
74 paper: classes.drawerPaper,
76 <div className={classes.toolbar}/>
77 <Tree items={this.props.projects} render={(p: Project) =>
78 <Link to={`/project/${p.name}`}>{p.name}</Link>
81 <main className={classes.content}>
82 <div className={classes.toolbar}/>
84 <Route exact path="/">
85 <Typography noWrap>Hello new workbench!</Typography>
87 <Route path="/project/:name" component={ProjectList}/>
95 export default connect<WorkbenchProps>(
96 (state: RootState) => ({
97 projects: state.projects
100 withStyles(styles)(Workbench)