From 58e23e759d730dd9d9733a64e5f16cc5aafeba35 Mon Sep 17 00:00:00 2001
From: crupest <crupest@outlook.com>
Date: Mon, 15 Feb 2021 01:08:05 +0800
Subject: refactor: Refactor timeline card.

---
 FrontEnd/src/app/views/timeline/index.tsx | 33 ++++++++-----------------------
 1 file changed, 8 insertions(+), 25 deletions(-)

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

diff --git a/FrontEnd/src/app/views/timeline/index.tsx b/FrontEnd/src/app/views/timeline/index.tsx
index 8048dd12..c5bfd7ab 100644
--- a/FrontEnd/src/app/views/timeline/index.tsx
+++ b/FrontEnd/src/app/views/timeline/index.tsx
@@ -2,38 +2,21 @@ import React from "react";
 import { useParams } from "react-router";
 
 import TimelinePageTemplate from "../timeline-common/TimelinePageTemplate";
-
-import TimelinePageUI from "./TimelinePageUI";
-import { OrdinaryTimelineManageItem } from "./TimelineInfoCard";
-import TimelineDeleteDialog from "./TimelineDeleteDialog";
+import TimelineCard from "./TimelineCard";
 
 const TimelinePage: React.FC = () => {
   const { name } = useParams<{ name: string }>();
 
-  const [dialog, setDialog] = React.useState<OrdinaryTimelineManageItem | null>(
-    null
-  );
   const [reloadKey, setReloadKey] = React.useState<number>(0);
 
-  let dialogElement: React.ReactElement | undefined;
-  if (dialog === "delete") {
-    dialogElement = (
-      <TimelineDeleteDialog open close={() => setDialog(null)} name={name} />
-    );
-  }
-
   return (
-    <>
-      <TimelinePageTemplate
-        name={name}
-        UiComponent={TimelinePageUI}
-        onManage={(item) => setDialog(item)}
-        notFoundI18nKey="timeline.timelineNotExist"
-        reloadKey={reloadKey}
-        onReload={() => setReloadKey(reloadKey + 1)}
-      />
-      {dialogElement}
-    </>
+    <TimelinePageTemplate
+      timelineName={name}
+      notFoundI18nKey="timeline.timelineNotExist"
+      reloadKey={reloadKey}
+      CardComponent={TimelineCard}
+      onReload={() => setReloadKey(reloadKey + 1)}
+    />
   );
 };
 
-- 
cgit v1.2.3

