fix(fe/panels): remove redundant code

This commit is contained in:
hexxa 2022-02-27 10:50:14 +08:00 committed by Hexxa
parent 05d8adb6d5
commit 6bd5343673
4 changed files with 45 additions and 71 deletions

View file

@ -180,8 +180,6 @@ export class PaneSettings extends React.Component<Props, State, {}> {
<div className="hr"></div> <div className="hr"></div>
</div> </div>
); );
// const val = clientErr;
// const sortVals = List<string>([]);
errRows = errRows.push(elem); errRows = errRows.push(elem);
}); });

View file

@ -751,13 +751,7 @@ export class FilesPanel extends React.Component<Props, State, {}> {
</div> </div>
); );
// const sortVals = List<string>([item.isDir ? "d" : "f", itemPath]);
return elem; return elem;
// return {
// elem,
// sortVals,
// val: item,
// };
}); });
return <Rows rows={List(rows)} />; return <Rows rows={List(rows)} />;

View file

@ -13,7 +13,7 @@ import { ICoreState, MsgProps, UIProps } from "./core_state";
import { LoginProps } from "./pane_login"; import { LoginProps } from "./pane_login";
import { Flexbox } from "./layout/flexbox"; import { Flexbox } from "./layout/flexbox";
import { Container } from "./layout/container"; import { Container } from "./layout/container";
import { Rows, Row } from "./layout/rows"; import { Rows } from "./layout/rows";
import { shareIDQuery } from "../client/files"; import { shareIDQuery } from "../client/files";
import { loadingCtrl, ctrlOn, ctrlOff } from "../common/controls"; import { loadingCtrl, ctrlOn, ctrlOff } from "../common/controls";
import { CronTable } from "../common/cron"; import { CronTable } from "../common/cron";
@ -90,56 +90,53 @@ export class SharingsPanel extends React.Component<Props, State, {}> {
}; };
makeRows = (sharings: Map<string, string>): List<React.ReactNode> => { makeRows = (sharings: Map<string, string>): List<React.ReactNode> => {
const sharingRows = sharings.keySeq().map((dirPath: string):React.ReactNode => { const sharingRows = sharings
const shareID = sharings.get(dirPath); .keySeq()
const sharingURL = `${ .map((dirPath: string): React.ReactNode => {
document.location.href.split("?")[0] const shareID = sharings.get(dirPath);
}?${shareIDQuery}=${shareID}`; const sharingURL = `${
document.location.href.split("?")[0]
}?${shareIDQuery}=${shareID}`;
const row1 = ( const row1 = (
<div> <div>
<div className="info">{dirPath}</div> <div className="info">{dirPath}</div>
<div className="op"> <div className="op">
<Flexbox <Flexbox
children={List([ children={List([
<span className="margin-r-m"> <span className="margin-r-m">
<QRCodeIcon value={sharingURL} size={128} pos={false} /> <QRCodeIcon value={sharingURL} size={128} pos={false} />
</span>, </span>,
<button <button
onClick={() => { onClick={() => {
this.deleteSharing(dirPath); this.deleteSharing(dirPath);
}} }}
> >
{this.props.msg.pkg.get("op.cancel")} {this.props.msg.pkg.get("op.cancel")}
</button>, </button>,
])} ])}
childrenStyles={List([ childrenStyles={List([
{ flex: "0 0 auto" }, { flex: "0 0 auto" },
{ flex: "0 0 auto" }, { flex: "0 0 auto" },
])} ])}
style={{ justifyContent: "flex-end" }} style={{ justifyContent: "flex-end" }}
/> />
</div>
</div> </div>
</div> );
);
const elem = ( const elem = (
<div className="sharing-item" key={dirPath}> <div className="sharing-item" key={dirPath}>
{row1} {row1}
<div className="desc">{sharingURL}</div> <div className="desc">{sharingURL}</div>
<div className="hr"></div> <div className="hr"></div>
</div> </div>
); );
return elem; return elem;
// return { });
// elem,
// sortVals: List([dirPath]),
// val: dirPath,
// };
});
return sharingRows.toList(); return sharingRows.toList();
}; };
@ -175,13 +172,7 @@ export class SharingsPanel extends React.Component<Props, State, {}> {
); );
const sharingRows = this.makeRows(this.props.sharingsInfo.sharings); const sharingRows = this.makeRows(this.props.sharingsInfo.sharings);
const view = ( const view = <Rows rows={sharingRows} />;
<Rows
rows={sharingRows}
// sortKeys={List([this.props.msg.pkg.get("item.path")])}
// updateRows={this.updateSharings}
/>
);
const noSharingView = ( const noSharingView = (
<Container> <Container>
<Flexbox <Flexbox

View file

@ -14,7 +14,7 @@ import { LoginProps } from "./pane_login";
import { UploadEntry, UploadState } from "../worker/interface"; 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, Row } from "./layout/rows"; import { Rows } from "./layout/rows";
import { loadingCtrl, ctrlOn, ctrlOff } from "../common/controls"; import { loadingCtrl, ctrlOn, ctrlOff } from "../common/controls";
import { HotkeyHandler } from "../common/hotkeys"; import { HotkeyHandler } from "../common/hotkeys";
@ -173,8 +173,6 @@ export class UploadingsPanel extends React.Component<Props, State, {}> {
</div> </div>
); );
// file path
// const sortVals = List<string>([uploading.filePath]);
return elem; return elem;
}); });
}; };
@ -207,14 +205,7 @@ 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 sortKeys = List([this.props.msg.pkg.get("item.path")]); const view = <Rows rows={uploadingRows} />;
const view = (
<Rows
// sortKeys={sortKeys}
rows={uploadingRows}
// updateRows={this.updateUploadings}
/>
);
const noUploadingView = ( const noUploadingView = (
<Container> <Container>