From f737fed4f003fbeb7187629a7b730c64a87b72b9 Mon Sep 17 00:00:00 2001
From: crupest <crupest@outlook.com>
Date: Wed, 17 Jun 2020 14:51:33 +0800
Subject: refactor(front): Fix #104 .

---
 .../ClientApp/src/app/timeline/TimelinePageTemplateUI.tsx  | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

(limited to 'Timeline/ClientApp/src/app/timeline/TimelinePageTemplateUI.tsx')

diff --git a/Timeline/ClientApp/src/app/timeline/TimelinePageTemplateUI.tsx b/Timeline/ClientApp/src/app/timeline/TimelinePageTemplateUI.tsx
index 66935e00..924e7883 100644
--- a/Timeline/ClientApp/src/app/timeline/TimelinePageTemplateUI.tsx
+++ b/Timeline/ClientApp/src/app/timeline/TimelinePageTemplateUI.tsx
@@ -26,7 +26,7 @@ export interface TimelineCardComponentProps<TTimeline, TManageItems> {
 }
 
 export interface TimelinePageTemplateUIProps<
-  TTimeline extends { name: string },
+  TTimeline extends { uniqueId: string },
   TManageItems
 > {
   avatarKey?: string | number;
@@ -43,7 +43,7 @@ export interface TimelinePageTemplateUIProps<
 }
 
 export default function TimelinePageTemplateUI<
-  TTimeline extends { name: string },
+  TTimeline extends { uniqueId: string },
   TEditItems
 >(
   props: TimelinePageTemplateUIProps<TTimeline, TEditItems>
@@ -127,11 +127,11 @@ export default function TimelinePageTemplateUI<
 
   const [cardHeight, setCardHeight] = React.useState<number>(0);
 
-  const genCardCollapseLocalStorageKey = (timelineName: string): string =>
-    `timeline.${timelineName}.cardCollapse`;
+  const genCardCollapseLocalStorageKey = (uniqueId: string): string =>
+    `timeline.${uniqueId}.cardCollapse`;
 
   const cardCollapseLocalStorageKey =
-    timeline != null ? genCardCollapseLocalStorageKey(timeline.name) : null;
+    timeline != null ? genCardCollapseLocalStorageKey(timeline.uniqueId) : null;
 
   const [infoCardCollapse, setInfoCardCollapse] = React.useState<boolean>(true);
   React.useEffect(() => {
@@ -171,7 +171,7 @@ export default function TimelinePageTemplateUI<
                 <TimelinePostEdit
                   onPost={props.onPost}
                   onHeightChange={onPostEditHeightChange}
-                  timelineName={timeline.name}
+                  timelineUniqueId={timeline.uniqueId}
                 />
               </>
             );
@@ -202,7 +202,7 @@ export default function TimelinePageTemplateUI<
                 const newState = !infoCardCollapse;
                 setInfoCardCollapse(newState);
                 window.localStorage.setItem(
-                  genCardCollapseLocalStorageKey(timeline.name),
+                  genCardCollapseLocalStorageKey(timeline.uniqueId),
                   newState.toString()
                 );
               }}
-- 
cgit v1.2.3

