From: Lucas Di Pentima Date: Tue, 30 Jun 2020 19:29:43 +0000 (-0300) Subject: 15610: Fixes layout issues with the collection panel file listing. X-Git-Tag: 2.1.0~22^2~6 X-Git-Url: https://git.arvados.org/arvados-workbench2.git/commitdiff_plain/9ab0347489bd312c986c3ff2f9489a83545f213f 15610: Fixes layout issues with the collection panel file listing. * VirtualTree now just occupies all available space. * VirtualTree's root container expands so that it occupies the remaining height of the browser window. * Reduced vertical padding on many places to show more information on screen. * Moved file listing 'hamburger' button next to the 'upload button' to save vertical space. Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- diff --git a/src/components/collection-panel-files/collection-panel-files.tsx b/src/components/collection-panel-files/collection-panel-files.tsx index 4d7e9384..c8875f70 100644 --- a/src/components/collection-panel-files/collection-panel-files.tsx +++ b/src/components/collection-panel-files/collection-panel-files.tsx @@ -29,7 +29,8 @@ type CssRules = 'root' | 'cardSubheader' | 'nameHeader' | 'fileSizeHeader' | 'up const styles: StyleRulesCallback = theme => ({ root: { - paddingBottom: theme.spacing.unit + paddingBottom: theme.spacing.unit, + height: '100%' }, cardSubheader: { paddingTop: 0, @@ -61,9 +62,10 @@ export const CollectionPanelFiles = + {isWritable && - } /> + } + {!tooManyFiles && + + onOptionsMenuOpen(ev, isWritable)}> + + + } + + } /> { tooManyFiles ?
File listing may take some time, please click to browse:
: <> - - onOptionsMenuOpen(ev, isWritable)}> - - - - } /> Name @@ -100,7 +100,7 @@ export const CollectionPanelFiles = { isLoading ?
(loading files...)
- : onItemMenuOpen(ev, item, isWritable)} {...treeProps} /> } + :
onItemMenuOpen(ev, item, isWritable)} {...treeProps} />
} }
); diff --git a/src/components/file-tree/file-tree.tsx b/src/components/file-tree/file-tree.tsx index d4b47be9..b5d98c08 100644 --- a/src/components/file-tree/file-tree.tsx +++ b/src/components/file-tree/file-tree.tsx @@ -4,7 +4,7 @@ import * as React from "react"; import { TreeItem, TreeItemStatus } from "../tree/tree"; -import { VirtualTree } from "../tree/virtual-tree"; +import { VirtualTree as Tree } from "../tree/virtual-tree"; import { FileTreeData } from "./file-tree-data"; import { FileTreeItem } from "./file-tree-item"; @@ -17,7 +17,6 @@ export interface FileTreeProps { currentItemUuid?: string; } -const Tree = VirtualTree(20); export class FileTree extends React.Component { render() { return (height: number, width: number, items: VirtualT {Row(items, render, treeProps)} ; -export const VirtualTree = (maxElements: number) => withStyles(styles)( +export const VirtualTree = withStyles(styles)( class Component extends React.Component & WithStyles, {}> { render(): ReactElement { const { items, render } = this.props; - // Virtual list viewport's maximum height - const itemsQty = items && items.length || 0; - const viewportHeight = min([itemsQty, maxElements])! * itemSize; - - return
+ return {({ height, width }) => { return VirtualList(height, width, items || [], render, this.props); }} -
; + ; } } ); diff --git a/src/views/collection-panel/collection-panel.tsx b/src/views/collection-panel/collection-panel.tsx index 1cfa48de..ea69b0df 100644 --- a/src/views/collection-panel/collection-panel.tsx +++ b/src/views/collection-panel/collection-panel.tsx @@ -31,11 +31,42 @@ import { getUserUuid } from '~/common/getuser'; import { getProgressIndicator } from '~/store/progress-indicator/progress-indicator-reducer'; import { COLLECTION_PANEL_LOAD_FILES, loadCollectionFiles, COLLECTION_PANEL_LOAD_FILES_THRESHOLD } from '~/store/collection-panel/collection-panel-files/collection-panel-files-actions'; -type CssRules = 'card' | 'iconHeader' | 'tag' | 'label' | 'value' | 'link' | 'centeredLabel' | 'readOnlyIcon'; +type CssRules = 'root' + | 'card' + | 'cardHeader' + | 'filesCard' + | 'cardContent' + | 'iconHeader' + | 'tag' + | 'label' + | 'value' + | 'link' + | 'centeredLabel' + | 'readOnlyIcon'; const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ + root: { + display: 'flex', + flexFlow: 'column', + height: 'calc(100vh - 130px)', // (100% viewport height) - (top bar + breadcrumbs) + }, card: { - marginBottom: theme.spacing.unit * 2 + marginBottom: theme.spacing.unit * 2, + }, + cardHeader: { + paddingTop: theme.spacing.unit, + paddingBottom: 0, + }, + filesCard: { + marginBottom: theme.spacing.unit * 2, + flex: 1, + }, + cardContent: { + paddingTop: 0, + paddingBottom: theme.spacing.unit, + '&:last-child': { + paddingBottom: theme.spacing.unit, + } }, iconHeader: { fontSize: '1.875rem', @@ -101,9 +132,10 @@ export const CollectionPanel = withStyles(styles)( render() { const { classes, item, dispatch, isWritable, isLoadingFiles, tooManyFiles } = this.props; return item - ? <> + ?
@@ -133,7 +165,7 @@ export const CollectionPanel = withStyles(styles)( titleTypographyProps={this.titleProps} subheader={item.description} subheaderTypographyProps={this.titleProps} /> - + - + {isWritable && @@ -189,7 +221,7 @@ export const CollectionPanel = withStyles(styles)( -
+
- +
: null; }