X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/55bb503e1b885a53ca20fc120c862c7af2db33af..7c6b67e16b7f00561d576aca20e4d428186ac397:/src/components/collection-panel-files/collection-panel-files.tsx

diff --git a/src/components/collection-panel-files/collection-panel-files.tsx b/src/components/collection-panel-files/collection-panel-files.tsx
index df277e33fa..c3cb4acc48 100644
--- a/src/components/collection-panel-files/collection-panel-files.tsx
+++ b/src/components/collection-panel-files/collection-panel-files.tsx
@@ -6,58 +6,76 @@ import * as React from 'react';
 import { TreeItem, TreeItemStatus } from '../tree/tree';
 import { FileTreeData } from '../file-tree/file-tree-data';
 import { FileTree } from '../file-tree/file-tree';
-import { CollectionPanelFilesState } from '../../store/collection-panel/collection-panel-files/collection-panel-files-state';
+import { IconButton, Grid, Typography, StyleRulesCallback, withStyles, WithStyles, CardHeader, Card, Button, Tooltip } from '@material-ui/core';
+import { CustomizeTableIcon } from '../icon/icon';
+import { DownloadIcon } from '~/components/icon/icon';
 
 export interface CollectionPanelFilesProps {
     items: Array<TreeItem<FileTreeData>>;
-    onItemContextMenu: (event: React.MouseEvent<HTMLElement>, item: TreeItem<FileTreeData>) => void;
-    onCommonContextMenu: (event: React.MouseEvent<HTMLElement>) => void;
+    onUploadDataClick: () => void;
+    onItemMenuOpen: (event: React.MouseEvent<HTMLElement>, item: TreeItem<FileTreeData>) => void;
+    onOptionsMenuOpen: (event: React.MouseEvent<HTMLElement>) => void;
     onSelectionToggle: (event: React.MouseEvent<HTMLElement>, item: TreeItem<FileTreeData>) => void;
     onCollapseToggle: (id: string, status: TreeItemStatus) => void;
 }
 
-export const CollectionPanelFiles = ({ onItemContextMenu, onCommonContextMenu, ...treeProps }: CollectionPanelFilesProps) =>
-    <div>
-        <FileTree onContextMenu={onItemContextMenu} {...treeProps} />
-    </div>;
+type CssRules = 'root' | 'cardSubheader' | 'nameHeader' | 'fileSizeHeader' | 'uploadIcon' | 'button';
 
-export const collectionPanelItems: Array<TreeItem<FileTreeData>> = [{
-    active: false,
-    data: {
-        name: "Directory 1",
-        type: "directory"
+const styles: StyleRulesCallback<CssRules> = theme => ({
+    root: {
+        paddingBottom: theme.spacing.unit
     },
-    id: "Directory 1",
-    open: true,
-    status: TreeItemStatus.LOADED,
-    items: [{
-        active: false,
-        data: {
-            name: "Directory 1.1",
-            type: "directory"
-        },
-        id: "Directory 1.1",
-        open: false,
-        status: TreeItemStatus.LOADED,
-        items: []
-    }, {
-        active: false,
-        data: {
-            name: "File 1.1",
-            type: "file"
-        },
-        id: "File 1.1",
-        open: false,
-        status: TreeItemStatus.LOADED,
-        items: []
-    }]
-}, {
-    active: false,
-    data: {
-        name: "Directory 2",
-        type: "directory"
+    cardSubheader: {
+        paddingTop: 0,
+        paddingBottom: 0
     },
-    id: "Directory 2",
-    open: false,
-    status: TreeItemStatus.LOADED
-}]; 
+    nameHeader: {
+        marginLeft: '75px'
+    },
+    fileSizeHeader: {
+        marginRight: '65px'
+    },
+    uploadIcon: {
+        transform: 'rotate(180deg)'
+    },
+    button: {
+        marginRight: -theme.spacing.unit,
+        marginTop: '0px'
+    }
+});
+
+export const CollectionPanelFiles =
+    withStyles(styles)(
+        ({ onItemMenuOpen, onOptionsMenuOpen, onUploadDataClick, classes, ...treeProps }: CollectionPanelFilesProps & WithStyles<CssRules>) =>
+            <Card className={classes.root}>
+                <CardHeader
+                    title="Files"
+                    classes={{ action: classes.button }}
+                    action={
+                        <Button onClick={onUploadDataClick}
+                            variant='raised'
+                            color='primary'
+                            size='small'>
+                            <DownloadIcon className={classes.uploadIcon} />
+                            Upload data
+                    </Button>
+                    } />
+                <CardHeader
+                    className={classes.cardSubheader}
+                    action={
+                        <Tooltip title="More options">
+                            <IconButton onClick={onOptionsMenuOpen}>
+                                <CustomizeTableIcon />
+                            </IconButton>
+                        </Tooltip>
+                    } />
+                <Grid container justify="space-between">
+                    <Typography variant="caption" className={classes.nameHeader}>
+                        Name
+                    </Typography>
+                    <Typography variant="caption" className={classes.fileSizeHeader}>
+                        File size
+                    </Typography>
+                </Grid>
+                <FileTree onMenuOpen={onItemMenuOpen} {...treeProps} />
+            </Card>);
