From 2bb2377601c44ab406fade8e7bfdc888900abe7f Mon Sep 17 00:00:00 2001
From: crupest <crupest@outlook.com>
Date: Tue, 12 Jan 2021 22:01:51 +0800
Subject: ...

---
 .../TimelinePropertyChangeDialog.tsx               | 23 ++++++++++------------
 1 file changed, 10 insertions(+), 13 deletions(-)

(limited to 'FrontEnd/src/app/views/timeline-common/TimelinePropertyChangeDialog.tsx')

diff --git a/FrontEnd/src/app/views/timeline-common/TimelinePropertyChangeDialog.tsx b/FrontEnd/src/app/views/timeline-common/TimelinePropertyChangeDialog.tsx
index aae227e6..ab3285f5 100644
--- a/FrontEnd/src/app/views/timeline-common/TimelinePropertyChangeDialog.tsx
+++ b/FrontEnd/src/app/views/timeline-common/TimelinePropertyChangeDialog.tsx
@@ -4,20 +4,15 @@ import {
   TimelineVisibility,
   kTimelineVisibilities,
   TimelineChangePropertyRequest,
+  TimelineInfo,
 } from "@/services/timeline";
 
 import OperationDialog from "../common/OperationDialog";
 
-export interface TimelinePropertyInfo {
-  title: string;
-  visibility: TimelineVisibility;
-  description: string;
-}
-
 export interface TimelinePropertyChangeDialogProps {
   open: boolean;
   close: () => void;
-  oldInfo: TimelinePropertyInfo;
+  timeline: TimelineInfo;
   onProcess: (request: TimelineChangePropertyRequest) => Promise<void>;
 }
 
@@ -30,6 +25,8 @@ const labelMap: { [key in TimelineVisibility]: string } = {
 const TimelinePropertyChangeDialog: React.FC<TimelinePropertyChangeDialogProps> = (
   props
 ) => {
+  const { timeline } = props;
+
   return (
     <OperationDialog
       title={"timeline.dialogChangeProperty.title"}
@@ -37,7 +34,7 @@ const TimelinePropertyChangeDialog: React.FC<TimelinePropertyChangeDialogProps>
         {
           type: "text",
           label: "timeline.dialogChangeProperty.titleField",
-          initValue: props.oldInfo.title,
+          initValue: timeline.title,
         },
         {
           type: "select",
@@ -46,25 +43,25 @@ const TimelinePropertyChangeDialog: React.FC<TimelinePropertyChangeDialogProps>
             label: labelMap[v],
             value: v,
           })),
-          initValue: props.oldInfo.visibility,
+          initValue: timeline.visibility,
         },
         {
           type: "text",
           label: "timeline.dialogChangeProperty.description",
-          initValue: props.oldInfo.description,
+          initValue: timeline.description,
         },
       ]}
       open={props.open}
       close={props.close}
       onProcess={([newTitle, newVisibility, newDescription]) => {
         const req: TimelineChangePropertyRequest = {};
-        if (newTitle !== props.oldInfo.title) {
+        if (newTitle !== timeline.title) {
           req.title = newTitle;
         }
-        if (newVisibility !== props.oldInfo.visibility) {
+        if (newVisibility !== timeline.visibility) {
           req.visibility = newVisibility as TimelineVisibility;
         }
-        if (newDescription !== props.oldInfo.description) {
+        if (newDescription !== timeline.description) {
           req.description = newDescription;
         }
         return props.onProcess(req);
-- 
cgit v1.2.3

