diff options
| author | crupest <crupest@outlook.com> | 2021-06-03 23:20:22 +0800 |
|---|---|---|
| committer | crupest <crupest@outlook.com> | 2021-06-03 23:20:22 +0800 |
| commit | 5a96a88121f3ecb846c5cd55c3f51624b4e21402 (patch) | |
| tree | 68ebf231a0887440c4390cba494fe43f34050b2d /FrontEnd/src/app/views/timeline-common/PostPropertyChangeDialog.tsx | |
| parent | b8a43d19cc3e850d42959ca019a3de6a453de11d (diff) | |
| download | timeline-5a96a88121f3ecb846c5cd55c3f51624b4e21402.tar.gz timeline-5a96a88121f3ecb846c5cd55c3f51624b4e21402.tar.bz2 timeline-5a96a88121f3ecb846c5cd55c3f51624b4e21402.zip | |
feat: Add change post property dialog.
Diffstat (limited to 'FrontEnd/src/app/views/timeline-common/PostPropertyChangeDialog.tsx')
| -rw-r--r-- | FrontEnd/src/app/views/timeline-common/PostPropertyChangeDialog.tsx | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/FrontEnd/src/app/views/timeline-common/PostPropertyChangeDialog.tsx b/FrontEnd/src/app/views/timeline-common/PostPropertyChangeDialog.tsx new file mode 100644 index 00000000..001e52d7 --- /dev/null +++ b/FrontEnd/src/app/views/timeline-common/PostPropertyChangeDialog.tsx @@ -0,0 +1,36 @@ +import React from "react"; + +import { getHttpTimelineClient, HttpTimelinePostInfo } from "@/http/timeline"; + +import OperationDialog from "../common/OperationDialog"; + +function PostPropertyChangeDialog(props: { + onClose: () => void; + post: HttpTimelinePostInfo; + onSuccess: (post: HttpTimelinePostInfo) => void; +}): React.ReactElement | null { + const { onClose, post, onSuccess } = props; + + return ( + <OperationDialog + title="timeline.changePostPropertyDialog.title" + close={onClose} + open + inputScheme={[ + { + label: "timeline.changePostPropertyDialog.time", + type: "datetime", + initValue: post.time, + }, + ]} + onProcess={([time]) => { + return getHttpTimelineClient().patchPost(post.timelineName, post.id, { + time: time === "" ? undefined : new Date(time).toISOString(), + }); + }} + onSuccessAndClose={onSuccess} + /> + ); +} + +export default PostPropertyChangeDialog; |
