diff --git a/src/pages/matter/Detail.tsx b/src/pages/matter/Detail.tsx index e6fc947..b61c131 100644 --- a/src/pages/matter/Detail.tsx +++ b/src/pages/matter/Detail.tsx @@ -1,9 +1,9 @@ import React from "react"; -import {RouteComponentProps} from "react-router-dom"; +import { RouteComponentProps } from "react-router-dom"; import "./Detail.less"; import TankComponent from "../../common/component/TankComponent"; import Matter from "../../common/model/matter/Matter"; -import {Space, Spin, Tag} from "antd"; +import { Space, Spin, Tag } from "antd"; import StringUtil from "../../common/util/StringUtil"; import TankTitle from "../widget/TankTitle"; import DownloadToken from "../../common/model/download/token/DownloadToken"; @@ -20,11 +20,9 @@ interface RouteParam { uuid: string; } -interface IProps extends RouteComponentProps { -} +interface IProps extends RouteComponentProps {} -interface IState { -} +interface IState {} export default class Detail extends TankComponent { matter = new Matter(); @@ -36,7 +34,7 @@ export default class Detail extends TankComponent { } componentDidMount() { - const {uuid} = this.props.match.params; + const { uuid } = this.props.match.params; this.matter.uuid = uuid; let that = this; this.matter.httpDetail((response: any) => { @@ -48,48 +46,58 @@ export default class Detail extends TankComponent { } copyLink = () => { - const {privacy} = this.matter; + const { privacy } = this.matter; const textToCopy = this.matter.getDownloadUrl( privacy ? this.downloadToken.uuid! : undefined ); ClipboardUtil.copy(textToCopy, () => { MessageBoxUtil.success(Lang.t("copySuccess")); - }) + }); + }; + + recovery = () => { + this.matter.httpRecovery(() => { + this.matter.httpDetail(() => { + this.updateUI(); + }); + MessageBoxUtil.success(Lang.t("copySuccess")); + }); }; render() { - const {matter} = this; + const { matter } = this; return (
- +
- {matter.name} {Lang.t("matter.deleted")} - - - {matter.path} + {matter.name} + {matter.deleted && ( + + {Lang.t("matter.deleted")} + + )} + {matter.path} {DateUtil.simpleDateTime(matter.createTime)} {DateUtil.simpleDateTime(matter.updateTime)} - { - matter.deleted && ( - - {DateUtil.simpleDateTime(matter.deleteTime)} - - ) - } + {matter.deleted && ( + + {DateUtil.simpleDateTime(matter.deleteTime)} + + )} + + {StringUtil.humanFileSize(matter.size)} + {!matter.dir ? ( <> - - {StringUtil.humanFileSize(matter.size)} - {matter.privacy ? Lang.t("matter.privateInfo") @@ -100,22 +108,37 @@ export default class Detail extends TankComponent { - matter.download()}>{Lang.t("matter.download")} - matter.preview()}>{Lang.t("matter.preview")} - - {matter.privacy ? Lang.t("matter.oneTimeLink") : Lang.t("matter.copyPath")} + matter.download()}> + {Lang.t("matter.download")} + matter.preview()}> + {Lang.t("matter.preview")} + + + {matter.privacy + ? Lang.t("matter.oneTimeLink") + : Lang.t("matter.copyPath")} + + {matter.deleted ? ( + + {Lang.t("matter.recovery")} + + ) : null} ) : null} + {matter.dir && matter.deleted && ( + + {Lang.t("matter.recovery")} + + )}
-
{!matter.dir && matter.uuid && matter.isImage() ? ( - + ) : null}
);