1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as React from 'react';
6 import { TreeItem, TreeItemStatus } from '../tree/tree';
7 import { FileTreeData } from '../file-tree/file-tree-data';
8 import { FileTree } from '../file-tree/file-tree';
9 import { IconButton, Grid, Typography, StyleRulesCallback, withStyles, WithStyles, CardHeader, Card, Button } from '@material-ui/core';
10 import { CustomizeTableIcon } from '../icon/icon';
12 export interface CollectionPanelFilesProps {
13 items: Array<TreeItem<FileTreeData>>;
14 onUploadDataClick: () => void;
15 onItemMenuOpen: (event: React.MouseEvent<HTMLElement>, item: TreeItem<FileTreeData>) => void;
16 onOptionsMenuOpen: (event: React.MouseEvent<HTMLElement>) => void;
17 onSelectionToggle: (event: React.MouseEvent<HTMLElement>, item: TreeItem<FileTreeData>) => void;
18 onCollapseToggle: (id: string, status: TreeItemStatus) => void;
21 type CssRules = 'root' | 'cardSubheader' | 'nameHeader' | 'fileSizeHeader';
23 const styles: StyleRulesCallback<CssRules> = theme => ({
25 paddingBottom: theme.spacing.unit
39 export const CollectionPanelFiles =
41 ({ onItemMenuOpen, onOptionsMenuOpen, onUploadDataClick, classes, ...treeProps }: CollectionPanelFilesProps & WithStyles<CssRules>) =>
42 <Card className={classes.root}>
46 <Button onClick={onUploadDataClick}
54 className={classes.cardSubheader}
56 <IconButton onClick={onOptionsMenuOpen}>
57 <CustomizeTableIcon />
60 <Grid container justify="space-between">
61 <Typography variant="caption" className={classes.nameHeader}>
64 <Typography variant="caption" className={classes.fileSizeHeader}>
68 <FileTree onMenuOpen={onItemMenuOpen} {...treeProps} />