From 008181a9aa459c95915181b21b9307df566fb28d Mon Sep 17 00:00:00 2001 From: hexxa Date: Sun, 29 Aug 2021 18:13:19 +0800 Subject: [PATCH] fix(ui/admin): improve admin pane layout --- src/client/web/src/components/pane_admin.tsx | 379 ++++++++++--------- 1 file changed, 193 insertions(+), 186 deletions(-) diff --git a/src/client/web/src/components/pane_admin.tsx b/src/client/web/src/components/pane_admin.tsx index 80c21b4..ee049e0 100644 --- a/src/client/web/src/components/pane_admin.tsx +++ b/src/client/web/src/components/pane_admin.tsx @@ -1,10 +1,12 @@ import * as React from "react"; -import { Map, Set } from "immutable"; +import { List, Map, Set } from "immutable"; +import FileSize from "filesize"; import { alertMsg } from "../common/env"; import { ICoreState, MsgProps } from "./core_state"; import { User, Quota } from "../client"; import { updater } from "./state_updater"; +import { Flexbox } from "./layout/flexbox"; export interface AdminProps { users: Map; @@ -154,47 +156,39 @@ export class UserForm extends React.Component< padding: "1rem", }} > -
-
-
-
- {this.props.msg.pkg.get("user.id")} {this.props.id} -
-
+ + {this.props.msg.pkg.get("user.name")} {this.props.name} -
-
-
+ +  /  + + {this.props.msg.pkg.get("user.id")} {this.props.id} + +
, -
- -
- + , + ])} + childrenStyles={List([ + { alignItems: "flex-start", flexBasis: "70%" }, + { + justifyContent: "flex-end", + }, + ])} + />
-
-
+ -
-
Role
+ +
+ {this.props.msg.pkg.get("user.role")} +
-
+ -
+
- {this.props.msg.pkg.get("spaceLimit")} + {`${this.props.msg.pkg.get("spaceLimit")} (${FileSize( + parseInt(this.state.quota.spaceLimit, 10), + { round: 0 } + )})`}
-
+ -
+
- {this.props.msg.pkg.get("uploadLimit")} + {`${this.props.msg.pkg.get("uploadLimit")} (${FileSize( + this.state.quota.uploadSpeedLimit, + { round: 0 } + )})`}
-
+ -
+
- {this.props.msg.pkg.get("downloadLimit")} + {`${this.props.msg.pkg.get("downloadLimit")} (${FileSize( + this.state.quota.downloadSpeedLimit, + { round: 0 } + )})`}
-
-
-
-
-
, + + - - + , + ])} + childrenStyles={List([ + { alignItems: "flex-start", flexBasis: "70%" }, + { + justifyContent: "flex-end", + flexBasis: "30%", + }, + ])} + />
-
-
-
Password
+ +
+ {this.props.msg.pkg.get("user.password")} +
- - -
+ + +
, -
- -
- + , + ])} + childrenStyles={List([ + { alignItems: "flex-start", flexBasis: "70%" }, + { + justifyContent: "flex-end", + }, + ])} + className="margin-t-m" + /> ); } @@ -429,7 +438,7 @@ export class AdminPane extends React.Component { return (
- {role} + {role}
-
-
- - -
-
-
- - {this.props.msg.pkg.get("admin.users")} - - -
- {userList} -
+ , + ])} + childrenStyles={List([ + { + alignItems: "flex-start", + }, + { justifyContent: "flex-end" }, + ])} + className="margin-t-m" + />
-
- - {this.props.msg.pkg.get("role.add")} - - -
+ {this.props.msg.pkg.get("admin.users")}, + , + ])} + className="title-m bold margin-b-m" + /> -
-
- - - -
-
- -
-
+ {userList}
-
-
-
- - {this.props.msg.pkg.get("admin.roles")} - - -
- {roleList} +
+
+ {this.props.msg.pkg.get("role.add")}, + , + ])} + className="title-m bold margin-b-m" + /> + + + + , + , + ])} + childrenStyles={List([{}, { justifyContent: "flex-end" }])} + />
+ +
+ + {this.props.msg.pkg.get("admin.roles")}, + , + ])} + className="title-m bold margin-b-m" + /> + {roleList}
);