From b082a3ba08c9782c0834af77e6c3f0438534ad72 Mon Sep 17 00:00:00 2001 From: crupest Date: Wed, 4 Nov 2020 10:31:34 +0800 Subject: refactor: Refactor operation dialog. --- FrontEnd/src/app/views/timeline/TimelineDeleteDialog.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'FrontEnd/src/app/views/timeline') diff --git a/FrontEnd/src/app/views/timeline/TimelineDeleteDialog.tsx b/FrontEnd/src/app/views/timeline/TimelineDeleteDialog.tsx index 894b8195..33609158 100644 --- a/FrontEnd/src/app/views/timeline/TimelineDeleteDialog.tsx +++ b/FrontEnd/src/app/views/timeline/TimelineDeleteDialog.tsx @@ -33,15 +33,15 @@ const TimelineDeleteDialog: React.FC = (props) => { inputScheme={[ { type: "text", - validator: (value) => { - if (value !== name) { - return "timeline.deleteDialog.notMatch"; - } else { - return null; - } - }, }, ]} + inputValidator={([value]) => { + if (value !== name) { + return { 0: "timeline.deleteDialog.notMatch" }; + } else { + return null; + } + }} onProcess={() => { return timelineService.deleteTimeline(name).toPromise(); }} -- cgit v1.2.3 From cdee687e1d37ca794e878ec599a74a77dd6cdf78 Mon Sep 17 00:00:00 2001 From: crupest Date: Wed, 4 Nov 2020 12:01:50 +0800 Subject: feat: Enhance design. --- FrontEnd/src/app/views/timeline-common/Timeline.tsx | 7 ++++++- .../app/views/timeline-common/TimelinePageTemplateUI.tsx | 15 +++++++++------ FrontEnd/src/app/views/timeline/TimelineInfoCard.tsx | 2 +- FrontEnd/src/app/views/user/UserInfoCard.tsx | 5 +---- 4 files changed, 17 insertions(+), 12 deletions(-) (limited to 'FrontEnd/src/app/views/timeline') diff --git a/FrontEnd/src/app/views/timeline-common/Timeline.tsx b/FrontEnd/src/app/views/timeline-common/Timeline.tsx index 6bd1b96d..9047919c 100644 --- a/FrontEnd/src/app/views/timeline-common/Timeline.tsx +++ b/FrontEnd/src/app/views/timeline-common/Timeline.tsx @@ -14,6 +14,7 @@ export type TimelineDeleteCallback = (index: number, id: number) => void; export interface TimelineProps { className?: string; + style?: React.CSSProperties; posts: TimelinePostInfoEx[]; onDelete: TimelineDeleteCallback; onResize?: () => void; @@ -52,7 +53,11 @@ const Timeline: React.FC = (props) => { }, [posts, onDelete]); return ( -
+
{(() => { const length = posts.length; diff --git a/FrontEnd/src/app/views/timeline-common/TimelinePageTemplateUI.tsx b/FrontEnd/src/app/views/timeline-common/TimelinePageTemplateUI.tsx index 35c1a65d..036577b1 100644 --- a/FrontEnd/src/app/views/timeline-common/TimelinePageTemplateUI.tsx +++ b/FrontEnd/src/app/views/timeline-common/TimelinePageTemplateUI.tsx @@ -47,13 +47,10 @@ export default function TimelinePageTemplateUI( const { t } = useTranslation(); - const bottomSpaceRef = React.useRef(null); + const [bottomSpaceHeight, setBottomSpaceHeight] = React.useState(0); const onPostEditHeightChange = React.useCallback((height: number): void => { - const { current: bottomSpaceDiv } = bottomSpaceRef; - if (bottomSpaceDiv != null) { - bottomSpaceDiv.style.height = `${height}px`; - } + setBottomSpaceHeight(height); if (height === 0) { const alertHost = getAlertHost(); if (alertHost != null) { @@ -177,6 +174,9 @@ export default function TimelinePageTemplateUI( timelineBody = ( ( timelineBody = ( <> {timelineBody} -
+
= (props) => { collapse={collapse} toggleCollapse={toggleCollapse} > -

+

{timeline.title} {timeline.name}

diff --git a/FrontEnd/src/app/views/user/UserInfoCard.tsx b/FrontEnd/src/app/views/user/UserInfoCard.tsx index e4edd80d..4a0c9e87 100644 --- a/FrontEnd/src/app/views/user/UserInfoCard.tsx +++ b/FrontEnd/src/app/views/user/UserInfoCard.tsx @@ -35,16 +35,13 @@ const UserInfoCard: React.FC = (props) => { collapse={collapse} toggleCollapse={toggleCollapse} > -

+

{timeline.title} {timeline.name}

{timeline.owner.nickname} - - @{timeline.owner.username} -

{timeline.description}

-- cgit v1.2.3