Skip to content

Commit

Permalink
[Timeline]: save changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuznietsov committed Jul 9, 2024
1 parent 54cde2d commit 9027f4c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 19 deletions.
26 changes: 13 additions & 13 deletions app/src/demo/tables/editableTable/TaskBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ export function TaskBar({ task, timelineController }: { task: Task, timelineCont
<Text cx={ css.header } fontSize="14" lineHeight="18" fontWeight="600">
{task.name}
</Text>
<FlexRow columnGap="12" alignItems="top" size="24">
<FlexCell width="auto">
<FlexRow columnGap="12" alignItems="center" justifyContent="start" size="24">
<FlexCell width="auto" minWidth={ 100 }>
<Text cx={ css.content } fontSize="12" lineHeight="18" fontWeight="600">
Status:
</Text>
Expand All @@ -89,21 +89,21 @@ export function TaskBar({ task, timelineController }: { task: Task, timelineCont
</FlexRow>
{ task.type === 'task'
&& (
<FlexRow columnGap="12" size="24" alignItems="top">
<FlexCell width="auto">
<FlexRow columnGap="12" size="24" alignItems="center" justifyContent="start">
<FlexCell width="auto" minWidth={ 100 }>
<Text cx={ css.content } fontSize="12" lineHeight="18" fontWeight="600">
Assignee:
</Text>
</FlexCell>
<FlexCell width="auto">
<FlexCell width="auto" textAlign="right">
<Text cx={ css.content } fontSize="12" lineHeight="18">
{ assignee?.fullName }
</Text>
</FlexCell>
</FlexRow>
)}
<FlexRow columnGap="12" size="24" alignItems="top">
<FlexCell width="auto">
<FlexRow columnGap="12" size="24" alignItems="center" justifyContent="start">
<FlexCell width="auto" minWidth={ 100 }>
<Text cx={ css.content } fontSize="12" lineHeight="18" fontWeight="600">
Start date:
</Text>
Expand All @@ -116,8 +116,8 @@ export function TaskBar({ task, timelineController }: { task: Task, timelineCont
</FlexRow>
{ task.type === 'task'
&& (
<FlexRow columnGap="12" size="24" alignItems="top">
<FlexCell width="auto">
<FlexRow columnGap="12" size="24" alignItems="center" justifyContent="start">
<FlexCell width="auto" minWidth={ 100 }>
<Text cx={ css.content } fontSize="12" lineHeight="18" fontWeight="600">
Planned start date:
</Text>
Expand All @@ -131,8 +131,8 @@ export function TaskBar({ task, timelineController }: { task: Task, timelineCont
)}
{ task.type === 'task'
&& (
<FlexRow columnGap="12" size="24" alignItems="top">
<FlexCell width="auto">
<FlexRow columnGap="12" size="24" alignItems="center" justifyContent="start">
<FlexCell width="auto" minWidth={ 100 }>
<Text cx={ css.content } fontSize="12" lineHeight="18" fontWeight="600">
Due date:
</Text>
Expand All @@ -144,8 +144,8 @@ export function TaskBar({ task, timelineController }: { task: Task, timelineCont
</FlexCell>
</FlexRow>
)}
<FlexRow columnGap="12" size="24" alignItems="top">
<FlexCell width="auto">
<FlexRow columnGap="12" size="24" alignItems="center" justifyContent="start">
<FlexCell width="auto" minWidth={ 100 }>
<Text cx={ css.content } fontSize="12" lineHeight="18" fontWeight="600">
Planned end date:
</Text>
Expand Down
2 changes: 1 addition & 1 deletion uui-timeline/src/Canvas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class Canvas<TProps extends CanvasProps, TState extends CanvasState> exte
}

componentDidMount() {
this.props.timelineController.subscribe(this.handleRenderCanvas);
this.props.timelineController.subscribe(() => this.forceUpdate());
this.props.timelineController.subscribe(this.handleResize);
this.handleRenderCanvas(this.props.timelineController.getTransform());
}
Expand Down
2 changes: 1 addition & 1 deletion uui-timeline/src/TimelineGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,5 +129,5 @@ export function TimelineGrid({ timelineController, ...restProps }: TimelineGridP
renderToday(ctx, t);
};

return <Canvas renderCanvas={ draw } canvasHeight={ canvasHeight } timelineController={ timelineController } />;
return <Canvas renderCanvas={ restProps.renderCanvas ?? draw } canvasHeight={ canvasHeight } timelineController={ timelineController } />;
}
4 changes: 0 additions & 4 deletions uui-timeline/src/useCanvas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ export function useCanvas(
};
}, [handleRenderCanvas, handleResize, timelineController]);

useLayoutEffect(() => {
handleRenderCanvas(timelineController.getTransform());
}, deps ? [...deps] : undefined);

useEffect(() => {
handleRenderCanvas(timelineController.getTransform());
});
Expand Down

0 comments on commit 9027f4c

Please sign in to comment.