fix(fe/panes): refine styles of panes

This commit is contained in:
hexxa 2021-12-25 20:04:47 +08:00 committed by Hexxa
parent a66046bd01
commit 4fd9bd9c33
5 changed files with 397 additions and 359 deletions

View file

@ -494,3 +494,7 @@
.full-width { .full-width {
width: 100%; width: 100%;
} }
.bold {
font-weight: bold;
}

View file

@ -182,6 +182,7 @@
font-size: 1.4rem; font-size: 1.4rem;
line-height: 2rem; line-height: 2rem;
display: block; display: block;
overflow-wrap: break-word;
} }
.theme-default #item-rows .hr { .theme-default #item-rows .hr {
@ -370,7 +371,7 @@
.theme-default .pane-title { .theme-default .pane-title {
color: black; color: black;
line-height: 4rem; font-size: 1.6rem;
} }
.theme-default #pane-settings { .theme-default #pane-settings {
@ -382,9 +383,14 @@
} }
.theme-default .user-form { .theme-default .user-form {
border: dashed 2px #ccc; font-size: 1.4rem;
padding: 1rem; padding: 1rem 0;
margin-top: 1rem; margin-top: 1rem;
border-bottom: dashed 1px #000;
}
.theme-default .more {
border: dashed 1px #ccc;
} }
.theme-default .role-list-item { .theme-default .role-list-item {

View file

@ -14,7 +14,7 @@ import { colorClass } from "../visual/colors";
const defaultIconProps: IconProps = { const defaultIconProps: IconProps = {
name: "RiFolder2Fill", name: "RiFolder2Fill",
size: "1.6rem", size: "1.6rem",
color: `${colorClass("1")}-font`, color: `${colorClass("cyan1")}-font`,
}; };
export interface Props { export interface Props {

View file

@ -2,6 +2,8 @@ import * as React from "react";
import { List, Map, Set } from "immutable"; import { List, Map, Set } from "immutable";
import FileSize from "filesize"; import FileSize from "filesize";
import { RiMore2Fill } from "@react-icons/all-files/ri/RiMore2Fill";
import { alertMsg, confirmMsg } from "../common/env"; import { alertMsg, confirmMsg } from "../common/env";
import { ICoreState, MsgProps, UIProps } from "./core_state"; import { ICoreState, MsgProps, UIProps } from "./core_state";
import { User, Quota } from "../client"; import { User, Quota } from "../client";
@ -39,6 +41,7 @@ export interface UserFormState {
newPwd2: string; newPwd2: string;
role: string; role: string;
quota: Quota; quota: Quota;
folded: boolean;
} }
export class UserForm extends React.Component< export class UserForm extends React.Component<
@ -59,6 +62,7 @@ export class UserForm extends React.Component<
uploadSpeedLimit: p.quota.uploadSpeedLimit, uploadSpeedLimit: p.quota.uploadSpeedLimit,
downloadSpeedLimit: p.quota.downloadSpeedLimit, downloadSpeedLimit: p.quota.downloadSpeedLimit,
}, },
folded: true,
}; };
} }
@ -150,25 +154,40 @@ export class UserForm extends React.Component<
}); });
}; };
toggle = () => {
this.setState({ folded: !this.state.folded });
};
render() { render() {
const foldedClass = this.state.folded ? "hidden" : "";
const foldIconColor = this.state.folded ? "black-font" : "cyan1-font";
return ( return (
<div className="user-form"> <div className="user-form">
<Flexbox <Flexbox
children={List([ children={List([
<div> <div>
<div className="key-value"> <span className="bold">{`${this.props.msg.pkg.get(
{`${this.props.msg.pkg.get("user.name")}: `} "user.name"
<span className="value">{this.props.name}</span> )}: `}</span>
</div> <span className="margin-r-m">{this.props.name}</span>
<div className="key-value"> <span className="bold">{`${this.props.msg.pkg.get(
{`${this.props.msg.pkg.get("user.id")}: `} "user.id"
<span className="value">{this.props.id}</span> )}: `}</span>
</div> <span>{this.props.id}</span>
</div>, </div>,
<span>
<RiMore2Fill
size="1.2rem"
className={`margin-r-m ${foldIconColor}`}
onClick={this.toggle}
/>
<button onClick={this.delUser}> <button onClick={this.delUser}>
{this.props.msg.pkg.get("delete")} {this.props.msg.pkg.get("delete")}
</button>, </button>
</span>,
])} ])}
childrenStyles={List([ childrenStyles={List([
{ alignItems: "flex-start", flexBasis: "70%" }, { alignItems: "flex-start", flexBasis: "70%" },
@ -178,9 +197,11 @@ export class UserForm extends React.Component<
])} ])}
/> />
<div className={foldedClass}>
<div className="hr"></div> <div className="hr"></div>
<Flexbox <Flexbox
className="margin-t-m"
children={List([ children={List([
<div> <div>
<span className="float-input"> <span className="float-input">
@ -261,6 +282,7 @@ export class UserForm extends React.Component<
<div className="hr"></div> <div className="hr"></div>
<Flexbox <Flexbox
className="margin-t-m"
children={List([ children={List([
<div> <div>
<div className="float-input"> <div className="float-input">
@ -303,6 +325,7 @@ export class UserForm extends React.Component<
])} ])}
/> />
</div> </div>
</div>
); );
} }
} }
@ -343,19 +366,14 @@ export class AdminPane extends React.Component<Props, State, {}> {
}; };
addRole = async () => { addRole = async () => {
return updater() const status = await updater().addRole(this.state.newRole);
.addRole(this.state.newRole)
.then((status: string) => {
if (status !== "") { if (status !== "") {
alertMsg(this.props.msg.pkg.get("add.fail")); alertMsg(this.props.msg.pkg.get("add.fail"));
} else { } else {
alertMsg(this.props.msg.pkg.get("add.ok")); alertMsg(this.props.msg.pkg.get("add.ok"));
} await updater().listRoles();
return updater().listRoles();
})
.then(() => {
this.props.update(updater().updateAdmin); this.props.update(updater().updateAdmin);
}); }
}; };
delRole = async (role: string) => { delRole = async (role: string) => {
@ -363,19 +381,14 @@ export class AdminPane extends React.Component<Props, State, {}> {
return; return;
} }
return updater() const status = await updater().delRole(role);
.delRole(role)
.then((status: string) => {
if (status !== "") { if (status !== "") {
this.props.msg.pkg.get("delete.fail"); this.props.msg.pkg.get("delete.fail");
} else { } else {
this.props.msg.pkg.get("delete.ok"); this.props.msg.pkg.get("delete.ok");
} await updater().listRoles();
return updater().listRoles();
})
.then(() => {
this.props.update(updater().updateAdmin); this.props.update(updater().updateAdmin);
}); }
}; };
addUser = async () => { addUser = async () => {
@ -384,8 +397,7 @@ export class AdminPane extends React.Component<Props, State, {}> {
return; return;
} }
return updater() const status = await updater().addUser({
.addUser({
id: "", // backend will fill it id: "", // backend will fill it
name: this.state.newUserName, name: this.state.newUserName,
pwd: this.state.newUserPwd1, pwd: this.state.newUserPwd1,
@ -393,24 +405,21 @@ export class AdminPane extends React.Component<Props, State, {}> {
quota: undefined, quota: undefined,
usedSpace: "0", usedSpace: "0",
preferences: undefined, preferences: undefined,
}) });
.then((status: string) => {
if (status !== "") { if (status !== "") {
alertMsg(this.props.msg.pkg.get("add.fail")); alertMsg(this.props.msg.pkg.get("add.fail"));
} else { } else {
alertMsg(this.props.msg.pkg.get("add.ok")); alertMsg(this.props.msg.pkg.get("add.ok"));
}
this.setState({ this.setState({
newUserName: "", newUserName: "",
newUserPwd1: "", newUserPwd1: "",
newUserPwd2: "", newUserPwd2: "",
newUserRole: "", newUserRole: "",
}); });
return updater().listUsers(); await updater().listUsers();
})
.then(() => {
this.props.update(updater().updateAdmin); this.props.update(updater().updateAdmin);
}); }
}; };
render() { render() {
@ -464,7 +473,9 @@ export class AdminPane extends React.Component<Props, State, {}> {
<Container> <Container>
<Flexbox <Flexbox
children={List([ children={List([
<h5 className="title">{this.props.msg.pkg.get("user.add")}</h5>, <h5 className="pane-title">
{this.props.msg.pkg.get("user.add")}
</h5>,
<button onClick={this.addUser}> <button onClick={this.addUser}>
{this.props.msg.pkg.get("add")} {this.props.msg.pkg.get("add")}
</button>, </button>,
@ -472,6 +483,8 @@ export class AdminPane extends React.Component<Props, State, {}> {
childrenStyles={List([{}, { justifyContent: "flex-end" }])} childrenStyles={List([{}, { justifyContent: "flex-end" }])}
/> />
<div className="hr"></div>
<span className="float-input"> <span className="float-input">
<div className="label">{this.props.msg.pkg.get("user.name")}</div> <div className="label">{this.props.msg.pkg.get("user.name")}</div>
<input <input
@ -520,12 +533,15 @@ export class AdminPane extends React.Component<Props, State, {}> {
<Container> <Container>
<Flexbox <Flexbox
children={List([ children={List([
<h5 className="title"> <h5 className="pane-title">
{this.props.msg.pkg.get("admin.users")} {this.props.msg.pkg.get("admin.users")}
</h5>, </h5>,
<span></span>, <span></span>,
])} ])}
/> />
<div className="hr"></div>
{userList} {userList}
</Container> </Container>
@ -533,11 +549,15 @@ export class AdminPane extends React.Component<Props, State, {}> {
<div> <div>
<Flexbox <Flexbox
children={List([ children={List([
<h5 className="title">{this.props.msg.pkg.get("role.add")}</h5>, <h5 className="pane-title">
{this.props.msg.pkg.get("role.add")}
</h5>,
<span></span>, <span></span>,
])} ])}
/> />
<div className="hr"></div>
<Flexbox <Flexbox
children={List([ children={List([
<input <input
@ -553,17 +573,20 @@ export class AdminPane extends React.Component<Props, State, {}> {
childrenStyles={List([{}, { justifyContent: "flex-end" }])} childrenStyles={List([{}, { justifyContent: "flex-end" }])}
/> />
</div> </div>
</Container>
<div className="hr"></div> <Container>
<Flexbox <Flexbox
children={List([ children={List([
<h5 className="title"> <h5 className="pane-title">
{this.props.msg.pkg.get("admin.roles")} {this.props.msg.pkg.get("admin.roles")}
</h5>, </h5>,
<span></span>, <span></span>,
])} ])}
/> />
<div className="hr"></div>
{roleList} {roleList}
</Container> </Container>
</div> </div>
@ -698,7 +721,7 @@ export class BgCfg extends React.Component<BgProps, BgState, {}> {
<div> <div>
<Flexbox <Flexbox
children={List([ children={List([
<h5 className="title">{this.props.msg.pkg.get("cfg.bg")}</h5>, <h5 className="pane-title">{this.props.msg.pkg.get("cfg.bg")}</h5>,
<span> <span>
<button onClick={this.resetClientCfg} className="margin-r-m"> <button onClick={this.resetClientCfg} className="margin-r-m">
@ -712,6 +735,8 @@ export class BgCfg extends React.Component<BgProps, BgState, {}> {
childrenStyles={List([{}, { justifyContent: "flex-end" }])} childrenStyles={List([{}, { justifyContent: "flex-end" }])}
/> />
<div className="hr"></div>
<div> <div>
<div className="float-input"> <div className="float-input">
<div className="label">{this.props.msg.pkg.get("cfg.bg.url")}</div> <div className="label">{this.props.msg.pkg.get("cfg.bg.url")}</div>

View file

@ -177,10 +177,9 @@ export class PaneSettings extends React.Component<Props, State, {}> {
/> />
</div> </div>
</div> </div>
</Container>
<div className="hr"></div> <Container>
<div>
<Flexbox <Flexbox
children={List([ children={List([
<h5 className="pane-title"> <h5 className="pane-title">
@ -193,6 +192,8 @@ export class PaneSettings extends React.Component<Props, State, {}> {
childrenStyles={List([{}, { justifyContent: "flex-end" }])} childrenStyles={List([{}, { justifyContent: "flex-end" }])}
/> />
<div className="hr"></div>
<span className="float-input"> <span className="float-input">
<div className="label"> <div className="label">
{this.props.msg.pkg.get("settings.pwd.old")} {this.props.msg.pkg.get("settings.pwd.old")}
@ -231,11 +232,9 @@ export class PaneSettings extends React.Component<Props, State, {}> {
placeholder={this.props.msg.pkg.get("settings.pwd.new2")} placeholder={this.props.msg.pkg.get("settings.pwd.new2")}
/> />
</span> </span>
</div> </Container>
<div className="hr"></div> <Container>
<div>
<Flexbox <Flexbox
children={List([ children={List([
<h5 className="pane-title"> <h5 className="pane-title">
@ -244,6 +243,9 @@ export class PaneSettings extends React.Component<Props, State, {}> {
])} ])}
childrenStyles={List([{}, { justifyContent: "flex-end" }])} childrenStyles={List([{}, { justifyContent: "flex-end" }])}
/> />
<div className="hr"></div>
<div> <div>
<button <button
onClick={() => { onClick={() => {
@ -262,11 +264,9 @@ export class PaneSettings extends React.Component<Props, State, {}> {
{this.props.msg.pkg.get("zhCN")} {this.props.msg.pkg.get("zhCN")}
</button> </button>
</div> </div>
</div> </Container>
<div className="hr"></div> <Container>
<div>
<Flexbox <Flexbox
children={List([ children={List([
<h5 className="pane-title"> <h5 className="pane-title">
@ -282,6 +282,8 @@ export class PaneSettings extends React.Component<Props, State, {}> {
childrenStyles={List([{}, { justifyContent: "flex-end" }])} childrenStyles={List([{}, { justifyContent: "flex-end" }])}
/> />
<div className="hr"></div>
<div className="float-input"> <div className="float-input">
<div className="label"> <div className="label">
{this.props.msg.pkg.get("settings.lanPackURL")} {this.props.msg.pkg.get("settings.lanPackURL")}
@ -295,14 +297,14 @@ export class PaneSettings extends React.Component<Props, State, {}> {
placeholder={this.props.msg.pkg.get("settings.lanPackURL")} placeholder={this.props.msg.pkg.get("settings.lanPackURL")}
/> />
</div> </div>
</div> </Container>
<div className="hr"></div> <Container>
<div>
<Flexbox <Flexbox
children={List([ children={List([
<h5 className="pane-title">{this.props.msg.pkg.get("cfg.bg")}</h5>, <h5 className="pane-title">
{this.props.msg.pkg.get("cfg.bg")}
</h5>,
<button onClick={this.syncPreferences}> <button onClick={this.syncPreferences}>
{this.props.msg.pkg.get("update")} {this.props.msg.pkg.get("update")}
@ -311,6 +313,8 @@ export class PaneSettings extends React.Component<Props, State, {}> {
childrenStyles={List([{}, { justifyContent: "flex-end" }])} childrenStyles={List([{}, { justifyContent: "flex-end" }])}
/> />
<div className="hr"></div>
<div> <div>
<div className="float-input"> <div className="float-input">
<div className="label"> <div className="label">
@ -364,7 +368,7 @@ export class PaneSettings extends React.Component<Props, State, {}> {
/> />
</div> </div>
</div> </div>
</div> </Container>
{/* <div className="hr"></div> {/* <div className="hr"></div>
<div> <div>
@ -400,7 +404,6 @@ export class PaneSettings extends React.Component<Props, State, {}> {
])} ])}
/> />
</div> */} </div> */}
</Container>
</div> </div>
); );
} }