From 928ba0ce419bacba113951095278a5138ead34cf Mon Sep 17 00:00:00 2001
From: crupest <crupest@outlook.com>
Date: Sun, 10 Apr 2022 16:04:03 +0800
Subject: ...

---
 .../views/timeline/PostPropertyChangeDialog.tsx    | 42 ++++++++++++++++++++++
 1 file changed, 42 insertions(+)
 create mode 100644 FrontEnd/src/views/timeline/PostPropertyChangeDialog.tsx

(limited to 'FrontEnd/src/views/timeline/PostPropertyChangeDialog.tsx')

diff --git a/FrontEnd/src/views/timeline/PostPropertyChangeDialog.tsx b/FrontEnd/src/views/timeline/PostPropertyChangeDialog.tsx
new file mode 100644
index 00000000..d000093d
--- /dev/null
+++ b/FrontEnd/src/views/timeline/PostPropertyChangeDialog.tsx
@@ -0,0 +1,42 @@
+import React from "react";
+
+import { getHttpTimelineClient, HttpTimelinePostInfo } from "@/http/timeline";
+
+import OperationDialog from "../common/dailog/OperationDialog";
+
+function PostPropertyChangeDialog(props: {
+  open: boolean;
+  onClose: () => void;
+  post: HttpTimelinePostInfo;
+  onSuccess: (post: HttpTimelinePostInfo) => void;
+}): React.ReactElement | null {
+  const { open, onClose, post, onSuccess } = props;
+
+  return (
+    <OperationDialog
+      title="timeline.changePostPropertyDialog.title"
+      onClose={onClose}
+      open={open}
+      inputScheme={[
+        {
+          label: "timeline.changePostPropertyDialog.time",
+          type: "datetime",
+          initValue: post.time,
+        },
+      ]}
+      onProcess={([time]) => {
+        return getHttpTimelineClient().patchPost(
+          post.timelineOwnerV2,
+          post.timelineNameV2,
+          post.id,
+          {
+            time: time === "" ? undefined : new Date(time).toISOString(),
+          }
+        );
+      }}
+      onSuccessAndClose={onSuccess}
+    />
+  );
+}
+
+export default PostPropertyChangeDialog;
-- 
cgit v1.2.3

