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, { TreeItem } 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 import { actions as projectActions } from "../../store/project-action";
21 import ListItemText from "@material-ui/core/ListItemText/ListItemText";
23 const drawerWidth = 240;
25 type CssRules = 'root' | 'appBar' | 'drawerPaper' | 'content' | 'toolbar';
27 const styles: StyleRulesCallback<CssRules> = (theme: Theme) => ({
38 zIndex: theme.zIndex.drawer + 1,
39 backgroundColor: '#692498'
47 backgroundColor: theme.palette.background.default,
48 padding: theme.spacing.unit * 3,
51 toolbar: theme.mixins.toolbar
54 interface WorkbenchProps {
55 projects: Array<TreeItem<Project>>;
56 toggleProjectTreeItem: (id: string) => any;
59 interface WorkbenchState {
62 class Workbench extends React.Component<WorkbenchProps & WithStyles<CssRules>, WorkbenchState> {
64 const {classes} = this.props;
66 <div className={classes.root}>
67 <AppBar position="absolute" className={classes.appBar}>
69 <Typography variant="title" color="inherit" noWrap>
70 Arvados<br/>Workbench 2
77 paper: classes.drawerPaper,
79 <div className={classes.toolbar}/>
80 <Tree items={this.props.projects}
81 toggleItem={this.props.toggleProjectTreeItem}
82 render={(p: Project) => <ListItemText primary={p.name}/>}
85 <main className={classes.content}>
86 <div className={classes.toolbar}/>
88 <Route exact path="/">
89 <Typography noWrap>Hello new workbench!</Typography>
91 <Route path="/project/:name" component={ProjectList}/>
99 export default connect(
100 (state: RootState) => ({
101 projects: state.projects
103 toggleProjectTreeItem: (id: string) => projectActions.toggleProjectTreeItem(id)
106 withStyles(styles)(Workbench)