diff --git a/src/client/web/src/components/layout/columns.tsx b/src/client/web/src/components/layout/columns.tsx index a44e92d..f7974a2 100644 --- a/src/client/web/src/components/layout/columns.tsx +++ b/src/client/web/src/components/layout/columns.tsx @@ -7,6 +7,7 @@ export interface Props { childrenClassNames?: List; style?: React.CSSProperties; className?: string; + colKey?: string; } export const Columns = (props: Props) => { @@ -15,9 +16,10 @@ export const Columns = (props: Props) => { const cells = row.map((cell: React.ReactNode, j: number) => { const width = props.widths.get(j, Math.trunc(100 / row.size)); const className = props.childrenClassNames.get(j, ""); + return (
@@ -27,7 +29,7 @@ export const Columns = (props: Props) => { }); return ( -
+
{cells}
diff --git a/src/client/web/src/components/pane_admin.tsx b/src/client/web/src/components/pane_admin.tsx index 1d32ed0..f987505 100644 --- a/src/client/web/src/components/pane_admin.tsx +++ b/src/client/web/src/components/pane_admin.tsx @@ -213,6 +213,7 @@ export class UserForm extends React.Component< return (
diff --git a/src/client/web/src/components/panel_files.tsx b/src/client/web/src/components/panel_files.tsx index a2de647..aee02c7 100644 --- a/src/client/web/src/components/panel_files.tsx +++ b/src/client/web/src/components/panel_files.tsx @@ -503,142 +503,150 @@ export class FilesPanel extends React.Component { ? "hidden" : ""; - const rows = sortedItems.map((item: MetadataResp): React.ReactNode => { - const isSelected = this.state.selectedItems.has(item.name); - const dirPath = this.props.filesInfo.dirPath.join("/"); - const itemPath = dirPath.endsWith("/") - ? `${dirPath}${item.name}` - : `${dirPath}/${item.name}`; + const rows = sortedItems.map( + (item: MetadataResp, i: number): React.ReactNode => { + const isSelected = this.state.selectedItems.has(item.name); + const dirPath = this.props.filesInfo.dirPath.join("/"); + const itemPath = dirPath.endsWith("/") + ? `${dirPath}${item.name}` + : `${dirPath}/${item.name}`; - const selectedIconColor = isSelected ? "focus-font" : "minor-font"; - const descIconColor = this.state.showDetail.has(item.name) - ? "focus-font" - : "major-font"; - const icon = item.isDir ? ( - - ) : ( - - ); + const selectedIconColor = isSelected ? "focus-font" : "minor-font"; + const descIconColor = this.state.showDetail.has(item.name) + ? "focus-font" + : "major-font"; + const icon = item.isDir ? ( + + ) : ( + + ); - const modTimeDate = new Date(item.modTime); - const modTimeFormatted = `${modTimeDate.getFullYear()}-${ - modTimeDate.getMonth() + 1 - }-${modTimeDate.getDate()}`; - const downloadPath = `/v1/fs/files?fp=${itemPath}`; - const name = item.isDir ? ( - - this.gotoChild(item.name)}> - {item.name} + const modTimeDate = new Date(item.modTime); + const modTimeFormatted = `${modTimeDate.getFullYear()}-${ + modTimeDate.getMonth() + 1 + }-${modTimeDate.getDate()}`; + const downloadPath = `/v1/fs/files?fp=${itemPath}`; + const name = item.isDir ? ( + + this.gotoChild(item.name)} + > + {item.name} + + {` - ${modTimeFormatted}`} - {` - ${modTimeFormatted}`} - - ) : ( - - - {item.name} - - {` - ${modTimeFormatted}`} - - ); + ) : ( + + + {item.name} + + {` - ${modTimeFormatted}`} + + ); - const checkIcon = isSelected ? ( - this.select(item.name)} - /> - ) : ( - this.select(item.name)} - /> - ); - - const op = item.isDir ? ( -
{checkIcon}
- ) : ( -
- this.toggleDetail(item.name)} + className={`${selectedIconColor} ${shareModeClass}`} + onClick={() => this.select(item.name)} /> - {checkIcon} -
- ); + ) : ( + this.select(item.name)} + /> + ); - const absDownloadURL = `${document.location.protocol}//${document.location.hostname}:${document.location.port}${downloadPath}`; - const pathTitle = this.props.msg.pkg.get("item.downloadURL"); - const modTimeTitle = this.props.msg.pkg.get("item.modTime"); - const sizeTitle = this.props.msg.pkg.get("item.size"); - const itemSize = FileSize(item.size, { round: 0 }); + const op = item.isDir ? ( +
{checkIcon}
+ ) : ( +
+ this.toggleDetail(item.name)} + /> + {checkIcon} +
+ ); - const descStateClass = this.state.showDetail.has(item.name) - ? "margin-t-m padding-m" - : "no-height"; - const desc = ( -
-
-
- {pathTitle} - {absDownloadURL} + const absDownloadURL = `${document.location.protocol}//${document.location.hostname}:${document.location.port}${downloadPath}`; + const pathTitle = this.props.msg.pkg.get("item.downloadURL"); + const modTimeTitle = this.props.msg.pkg.get("item.modTime"); + const sizeTitle = this.props.msg.pkg.get("item.size"); + const itemSize = FileSize(item.size, { round: 0 }); + + const descStateClass = this.state.showDetail.has(item.name) + ? "margin-t-m padding-m" + : "no-height"; + const desc = ( +
+
+
+ {pathTitle} + {absDownloadURL} +
+
+ +
+
+ {modTimeTitle} + + {modTimeFormatted} + +
+
+ {sizeTitle} + {itemSize} +
+
+ +
+
+ SHA1, + this.generateHash(itemPath)} + size={"2rem"} + className={`minor-font ${shareModeClass}`} + />, + ])} + childrenStyles={List([{}, { justifyContent: "flex-end" }])} + /> +
{item.sha1}
+
+ ); -
-
- {modTimeTitle} - {modTimeFormatted} -
-
- {sizeTitle} - {itemSize} -
+ const cells = List([ +
{icon}
, +
{name}
, +
{itemSize}
, +
{op}
, + ]); + + const tableCols = ( + + ); + + return ( +
+ {tableCols} + {desc} +
- -
-
- SHA1, - this.generateHash(itemPath)} - size={"2rem"} - className={`minor-font ${shareModeClass}`} - />, - ])} - childrenStyles={List([{}, { justifyContent: "flex-end" }])} - /> -
{item.sha1}
-
-
-
- ); - - const cells = List([ -
{icon}
, -
{name}
, -
{itemSize}
, -
{op}
, - ]); - - const tableCols = ( - - ); - - return ( -
- {tableCols} - {desc} -
-
- ); - }); + ); + } + ); return
{rows}
; };