From 0721e16721a598a2d0eea501e7efd265219f134f Mon Sep 17 00:00:00 2001 From: Lucas Di Pentima Date: Fri, 4 Mar 2022 18:51:50 -0300 Subject: [PATCH] 18787: Attempts to diminish the indentation madness, improving readability. Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- .../collection-panel-files.tsx | 160 +++++++++++------- 1 file changed, 99 insertions(+), 61 deletions(-) diff --git a/src/components/collection-panel-files/collection-panel-files.tsx b/src/components/collection-panel-files/collection-panel-files.tsx index 05b49363..3b91b6c1 100644 --- a/src/components/collection-panel-files/collection-panel-files.tsx +++ b/src/components/collection-panel-files/collection-panel-files.tsx @@ -419,29 +419,33 @@ export const CollectionPanelFiles = withStyles(styles)(connect((state: RootState [props.onOptionsMenuOpen] // eslint-disable-line react-hooks/exhaustive-deps ); - return ( -
-
-
- { - path - .map((p: string, index: number) => - {index === 0 ? 'Home' : p} /  - ) - } -
- - { - onOptionsMenuOpen(ev, isWritable); - }}> - + return
+
+
+ { path.map((p: string, index: number) => + {index === 0 ? 'Home' : p} /  + ) } +
+ + { + onOptionsMenuOpen(ev, isWritable); + }}> + + + +
+
+
1 ? classes.leftPanelVisible : classes.leftPanelHidden)} data-cy="collection-files-left-panel"> + 1 ? classes.backButton : classes.backButtonHidden}> + setPath([...path.slice(0, path.length -1)])}> +
@@ -524,44 +528,78 @@ export const CollectionPanelFiles = withStyles(styles)(connect((state: RootState {({ height, width }) => { const filtered = rightData.filter(({ name }) => name.indexOf(rightSearch) > -1); - return !!filtered.length ? - { - ({ index, style }) => { - const { id, type, name, size } = filtered[index]; - - return
-   - {getItemIcon(type, null)}
- {name} -
- - {formatFileSize(size)} - -
- } - } -
:
This collection is empty
- }} - :
- } -
+ return !!filtered.length + ? { ({ index, style }) => { + const { id, type, name } = filtered[index]; + + return
+ { getItemIcon(type, getActiveClass(name)) } +
+ {name} +
+ { getActiveClass(name) + ? + : null } +
; + } }
+ :
No directories available
+ } } + :
+ +
} +
+
+
+
+ +
+ { isWritable && + } +
{ rightData && !isLoading + ? {({ height, width }) => { + const filtered = rightData.filter(({ name }) => name.indexOf(rightSearch) > -1); + + return !!filtered.length + ? { ({ index, style }) => { + const { id, type, name, size } = filtered[index]; + + return
+   + {getItemIcon(type, null)} +
+ {name} +
+ + { formatFileSize(size) } + +
+ } }
+ :
This collection is empty
+ }}
+ :
+ +
}
- ); -})); + })); -- 2.30.2