Immutable timeline

Summary:
Removes the "Set current" button if the timeline isn't editable

Note that the styling does weird stuff to colors when a field is set as not editable

Differential Revision: D24419006

fbshipit-source-id: 84dcee2e04d5ed7ebb3dc0255e99d1756f195284
This commit is contained in:
Paco Estevez Garcia
2020-10-20 10:48:18 -07:00
committed by Facebook GitHub Bot
parent 38ef16aeeb
commit d733f8131f
2 changed files with 11 additions and 7 deletions

View File

@@ -572,6 +572,7 @@ class DataDescriptionContainer extends PureComponent<{
return ( return (
<> <>
<TimelineDataDescription <TimelineDataDescription
canSetCurrent={editable}
timeline={JSON.parse(val)} timeline={JSON.parse(val)}
onClick={(id) => { onClick={(id) => {
this.props.commit({ this.props.commit({

View File

@@ -28,6 +28,7 @@ type Timeline = {
}; };
type Props = { type Props = {
canSetCurrent?: boolean;
timeline: Timeline; timeline: Timeline;
onClick: (selected: string) => void; onClick: (selected: string) => void;
}; };
@@ -55,6 +56,7 @@ export default class TimelineDataDescription extends Component<Props, State> {
})); }));
return ( return (
<> <>
{this.props.canSetCurrent && (
<div> <div>
<Button <Button
onClick={() => this.props.onClick(this.state.selected)} onClick={() => this.props.onClick(this.state.selected)}
@@ -62,6 +64,7 @@ export default class TimelineDataDescription extends Component<Props, State> {
Set as current Set as current
</Button> </Button>
</div> </div>
)}
<div> <div>
<MarkerTimeline <MarkerTimeline
points={points} points={points}