fix(uploadings_panel): normalize styles and clean up

This commit is contained in:
hexxa 2022-03-18 19:26:37 +08:00 committed by Hexxa
parent e013acadfe
commit d022ea064d
6 changed files with 134 additions and 178 deletions

View file

@ -441,7 +441,7 @@
.title-l { .title-l {
font-size: 1.8rem; font-size: 1.8rem;
font-weight: bold; font-weight: bold;
line-height: 2.5rem; line-height: 3.2rem;
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
@ -451,7 +451,7 @@
.desc-l { .desc-l {
font-size: 1.2rem; font-size: 1.2rem;
line-height: 2rem; line-height: 3.2rem;
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
@ -461,7 +461,7 @@
.title-m { .title-m {
font-size: 1.4rem; font-size: 1.4rem;
line-height: 2rem; line-height: 3.2rem;
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
@ -471,7 +471,7 @@
.title-m-wrap { .title-m-wrap {
font-size: 1.4rem; font-size: 1.4rem;
line-height: 2rem; line-height: 3.2rem;
overflow: hidden; overflow: hidden;
overflow-wrap: break-word; overflow-wrap: break-word;
display: block; display: block;
@ -479,7 +479,7 @@
.desc-m { .desc-m {
font-size: 1.2rem; font-size: 1.2rem;
line-height: 2rem; line-height: 3.2rem;
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;

View file

@ -22,9 +22,6 @@ html {
"Arial", sans-serif; "Arial", sans-serif;
font-size: 62.5%; font-size: 62.5%;
} }
body {
line-height: 200%;
}
*:focus { *:focus {
outline: none; outline: none;
} }
@ -68,16 +65,12 @@ table {
} }
input { input {
font-size: 1.4rem; font-size: 1.2rem;
line-height: 1.4rem; line-height: 1.4rem;
height: 1.4rem; height: 1.4rem;
font-weight: bold;
border: none;
padding: 0.8rem 1rem; padding: 0.8rem 1rem;
width: 10rem; border: solid 1px #95a5a6;
border-radius: 0.5rem; border-radius: 0.5rem;
transition: opacity 300ms, box-shadow 300ms; transition: opacity 300ms, box-shadow 300ms;
} }
@ -87,13 +80,14 @@ input:focus {
button { button {
cursor: pointer; cursor: pointer;
font-size: 1.2rem;
line-height: 1.2rem;
padding: 1rem 1rem;
font-weight: bold;
border: none; border: none;
border-radius: 0.5rem; border-radius: 0.5rem;
outline: none; outline: none;
padding: 0.8rem 1rem;
font-weight: bold;
border-radius: 0.5rem;
transition: opacity 300ms; transition: opacity 300ms;
} }

View file

@ -180,11 +180,7 @@ input:focus {
height: 4rem; height: 4rem;
} }
.theme-default #space-used {
text-align: right;
line-height: 3rem;
font-size: 1.4rem;
}
.container { .container {
width: 100%; width: 100%;
@ -203,10 +199,7 @@ input:focus {
margin-right: 0; margin-right: 0;
} */ } */
.theme-default .select-btn {
width: 8rem;
display: inline-block;
}
.theme-default #op-bar { .theme-default #op-bar {
} }
@ -340,40 +333,6 @@ input:focus {
padding: 0 1rem; padding: 0 1rem;
} }
.theme-default #upload-list .info {
display: inline-block;
width: 70%;
}
.theme-default #upload-list .op {
display: inline-block;
width: 30%;
text-align: right;
}
.theme-default #upload-list .title {
font-size: 1.4rem;
line-height: 4rem;
overflow-wrap: break-word;
}
.theme-default #upload-list .desc {
font-size: 1.2rem;
line-height: 4rem;
overflow-wrap: break-word;
}
.theme-default #upload-list .progress-grey {
background-color: #ecf0f6;
width: 100%;
height: 0.3rem;
}
.theme-default #upload-list .progress-green {
background-color: #1abc9c;
height: 100%;
}
.theme-default .upload-item { .theme-default .upload-item {
padding: 1rem 0 1rem 0; padding: 1rem 0 1rem 0;
} }
@ -566,7 +525,6 @@ input:focus {
color: #34495e; color: #34495e;
background-color: #ecf0f6; background-color: #ecf0f6;
border: solid 1px #95a5a6; border: solid 1px #95a5a6;
/* margin: 0.5rem 0 1rem 0; */
} }
.theme-default .h1, .theme-default .h1,
@ -610,10 +568,6 @@ input:focus {
line-height: 3rem; line-height: 3rem;
} }
.theme-default button {
font-size: 1.2rem;
}
.theme-default .button-default { .theme-default .button-default {
color: #697384; color: #697384;
background-color: #ecf0f6; background-color: #ecf0f6;
@ -627,10 +581,3 @@ input:focus {
width: 48rem; width: 48rem;
} }
.theme-default .badge {
border: none;
border-radius: 0.5rem;
font-weight: bold;
font-size: 1.2rem;
padding: 0.8rem 1rem;
}

View file

@ -66,3 +66,48 @@
line-height: 3rem; line-height: 3rem;
font-size: 1.4rem; font-size: 1.4rem;
} }
.theme-default .badge {
border: none;
border-radius: 0.5rem;
font-weight: bold;
font-size: 1.2rem;
padding: 1rem 1rem;
line-height: 1.2rem;
display: inline-block;
}
.theme-default #upload-list .progress-grey {
background-color: #ecf0f6;
width: 100%;
height: 0.3rem;
}
.theme-default #upload-list .progress-green {
background-color: #1abc9c;
height: 100%;
transition: width 300ms;
}
.theme-default #upload-list .info {
display: inline-block;
width: 70%;
}
.theme-default #upload-list .op {
display: inline-block;
width: 30%;
text-align: right;
}
.theme-default #upload-list .title {
font-size: 1.4rem;
line-height: 3.2rem;
overflow-wrap: break-word;
}
.theme-default #upload-list .desc {
font-size: 1.2rem;
line-height: 3.2rem;
overflow-wrap: break-word;
}

View file

@ -25,7 +25,7 @@ export const BtnList = (props: Props) => {
const btns = props.btnNames.map((btnName: string, i: number) => { const btns = props.btnNames.map((btnName: string, i: number) => {
const cb = props.btnCallbacks.get(i); const cb = props.btnCallbacks.get(i);
return ( return (
<button key={`rows-${i}`} className="float" onClick={cb}> <button key={`rows-${i}`} className="float button-default" onClick={cb}>
{btnName} {btnName}
</button> </button>
); );

View file

@ -15,6 +15,7 @@ import { UploadEntry, UploadState } from "../worker/interface";
import { Flexbox } from "./layout/flexbox"; import { Flexbox } from "./layout/flexbox";
import { Container } from "./layout/container"; import { Container } from "./layout/container";
import { Rows } from "./layout/rows"; import { Rows } from "./layout/rows";
import { NotFoundBanner } from "./visual/notfound";
import { loadingCtrl, ctrlOn, ctrlOff } from "../common/controls"; import { loadingCtrl, ctrlOn, ctrlOff } from "../common/controls";
import { HotkeyHandler } from "../common/hotkeys"; import { HotkeyHandler } from "../common/hotkeys";
@ -66,9 +67,7 @@ export class UploadingsPanel extends React.Component<Props, State, {}> {
throw deleteStatus; throw deleteStatus;
} }
const statuses = await Promise.all([ const statuses = await Promise.all([updater().self()]);
updater().self(),
]);
if (statuses.join("") !== "") { if (statuses.join("") !== "") {
throw statuses.join(";"); throw statuses.join(";");
} }
@ -96,60 +95,52 @@ export class UploadingsPanel extends React.Component<Props, State, {}> {
? 100 ? 100
: Math.floor((uploading.uploaded / uploading.size) * 100); : Math.floor((uploading.uploaded / uploading.size) * 100);
let rightCell = ( let uploadState = <span></span>;
<div className="item-op">
<button
onClick={() => this.stopUploading(uploading.filePath)}
className="float-input"
>
{this.props.msg.pkg.get("browser.stop")}
</button>
<button
onClick={() => this.deleteUpload(uploading.filePath)}
className="float-input"
>
{this.props.msg.pkg.get("browser.delete")}
</button>
</div>
);
switch (uploading.state) { switch (uploading.state) {
case UploadState.Error: case UploadState.Error:
rightCell = ( uploadState = (
<div className="item-op">
<span className="badge white-font red0-bg margin-r-m"> <span className="badge white-font red0-bg margin-r-m">
{this.props.msg.pkg.get("state.error")} {this.props.msg.pkg.get("state.error")}
</span> </span>
<button
onClick={() => this.deleteUpload(uploading.filePath)}
className="float-input"
>
{this.props.msg.pkg.get("browser.delete")}
</button>
</div>
); );
break; break;
case UploadState.Stopped: case UploadState.Stopped:
rightCell = ( uploadState = (
<div className="item-op">
<span className="badge yellow0-font black-bg margin-r-m"> <span className="badge yellow0-font black-bg margin-r-m">
{this.props.msg.pkg.get("state.stopped")} {this.props.msg.pkg.get("state.stopped")}
</span> </span>
<button
onClick={() => this.deleteUpload(uploading.filePath)}
className="float-input"
>
{this.props.msg.pkg.get("browser.delete")}
</button>
</div>
); );
break; break;
default: default:
// no op // no op
} }
const stopButton =
uploading.state !== UploadState.Error &&
uploading.state !== UploadState.Stopped ? (
<button
onClick={() => this.stopUploading(uploading.filePath)}
className="inline-block margin-r-m margin-b-m"
>
{this.props.msg.pkg.get("browser.stop")}
</button>
) : null;
const operations = (
<div>
{uploadState}
{stopButton}
<button
onClick={() => this.deleteUpload(uploading.filePath)}
className="inline-block"
>
{this.props.msg.pkg.get("browser.delete")}
</button>
</div>
);
const progressBar = ( const progressBar = (
<div className="progress-grey"> <div className="progress-grey margin-t-s">
<div <div
className="progress-green" className="progress-green"
style={{ width: `${progress}%` }} style={{ width: `${progress}%` }}
@ -177,7 +168,7 @@ export class UploadingsPanel extends React.Component<Props, State, {}> {
</span> </span>
</div> </div>
<div className="op">{rightCell}</div> <div className="op">{operations}</div>
{progressBar} {progressBar}
{errorInfo} {errorInfo}
@ -201,6 +192,27 @@ export class UploadingsPanel extends React.Component<Props, State, {}> {
}; };
render() { render() {
const title = (
<Flexbox
children={List([
<Flexbox
children={List([
<RiUploadCloudFill
size="3.2rem"
className="margin-r-m black-font"
/>,
<span className="title-m bold">
{this.props.msg.pkg.get("browser.upload.title")}
</span>,
])}
/>,
<span></span>,
])}
/>
);
const orderByCallbacks = List([ const orderByCallbacks = List([
() => { () => {
this.orderBy(this.props.msg.pkg.get("item.path")); this.orderBy(this.props.msg.pkg.get("item.path"));
@ -217,66 +229,24 @@ export class UploadingsPanel extends React.Component<Props, State, {}> {
const uploadingRows = this.makeRowsInputs( const uploadingRows = this.makeRowsInputs(
this.props.uploadingsInfo.uploadings this.props.uploadingsInfo.uploadings
); );
const view = <Rows rows={uploadingRows} />; const view =
this.props.uploadingsInfo.uploadings.size > 0 ? (
const noUploadingView = ( <div>
<Container> {orderByButtons}
<Flexbox <Rows rows={uploadingRows} />
children={List([ </div>
<RiCloudOffFill size="4rem" className="margin-r-m red0-font" />, ) : (
<span> <NotFoundBanner title={this.props.msg.pkg.get("upload.404.title")} />
<h3 className="title-l">
{this.props.msg.pkg.get("upload.404.title")}
</h3>
<span className="desc-l grey0-font">
{this.props.msg.pkg.get("upload.404.desc")}
</span>
</span>,
])}
childrenStyles={List([
{ flex: "auto", justifyContent: "flex-end" },
{ flex: "auto" },
])}
/>
</Container>
); );
const list = return (
this.props.uploadingsInfo.uploadings.size === 0 ? ( <div id="upload-list">
noUploadingView
) : (
<Container> <Container>
<Flexbox {title}
children={List([ <div className="hr"></div>
<span className="margin-b-l">
<Flexbox
children={List([
<RiUploadCloudFill
size="3rem"
className="margin-r-m black-font"
/>,
<span>
<span className="title-m bold">
{this.props.msg.pkg.get("browser.upload.title")}
</span>
<span className="desc-m grey0-font">
{this.props.msg.pkg.get("browser.upload.desc")}
</span>
</span>,
])}
/>
</span>,
<span></span>,
])}
/>
{orderByButtons}
{view} {view}
</Container> </Container>
</div>
); );
return <div id="upload-list">{list}</div>;
} }
} }