TimelineDataDescription optional properties
Summary: Make properties optional. Additionally, only show them if found. Reviewed By: mweststrate Differential Revision: D43948493 fbshipit-source-id: 0aa77a725663b456f069c717b4ea051008516c9e
This commit is contained in:
committed by
Facebook GitHub Bot
parent
b4f6f9f008
commit
d669fd08e5
@@ -19,7 +19,7 @@ type TimePoint = {
|
|||||||
display: string;
|
display: string;
|
||||||
color: string;
|
color: string;
|
||||||
key: string;
|
key: string;
|
||||||
properties: {[key: string]: string};
|
properties?: {[key: string]: string};
|
||||||
};
|
};
|
||||||
|
|
||||||
type Timeline = {
|
type Timeline = {
|
||||||
@@ -54,6 +54,10 @@ export class TimelineDataDescription extends Component<Props, State> {
|
|||||||
value.color,
|
value.color,
|
||||||
key: value.key,
|
key: value.key,
|
||||||
}));
|
}));
|
||||||
|
const properties = this.props.timeline.time.find(
|
||||||
|
(value) => value.key === this.state.selected,
|
||||||
|
)?.properties;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{this.props.canSetCurrent && (
|
{this.props.canSetCurrent && (
|
||||||
@@ -73,15 +77,7 @@ export class TimelineDataDescription extends Component<Props, State> {
|
|||||||
selected={this.state.selected}
|
selected={this.state.selected}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
{properties && <DataInspector data={properties} />}
|
||||||
<DataInspector
|
|
||||||
data={
|
|
||||||
this.props.timeline.time.find(
|
|
||||||
(value) => value.key === this.state.selected,
|
|
||||||
)?.properties ?? {}
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user