/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @format */ import type {UpdateTreeGenerationChangesetApplicationPayload} from './Models.js'; import React from 'react'; import { MarkerTimeline, Component, styled, FlexBox, ManagedDataInspector, Panel, colors, } from 'flipper'; const NoContent = styled(FlexBox)({ alignItems: 'center', justifyContent: 'center', flexGrow: 1, fontWeight: '500', color: colors.light30, }); type Props = {| changeSets: ?Array, eventUserInfo: ?Object, focusedChangeSet: ?UpdateTreeGenerationChangesetApplicationPayload, onFocusChangeSet: ( focusedChangeSet: ?UpdateTreeGenerationChangesetApplicationPayload, ) => void, selectedNodeInfo: ?Object, |}; export default class DetailsPanel extends Component { render() { const {changeSets, eventUserInfo} = this.props; const firstChangeSet = (changeSets || []).reduce( (min, cs) => Math.min(min, cs.timestamp), Infinity, ) || 0; return ( {eventUserInfo && ( )} {changeSets && changeSets.length > 0 ? ( ({ label: p.type === 'CHANGESET_GENERATED' ? 'Generated' : 'Rendered', time: Math.round((p.timestamp || 0) - firstChangeSet), color: p.type === 'CHANGESET_GENERATED' ? colors.lemon : colors.teal, key: p.identifier, }))} onClick={ids => this.props.onFocusChangeSet( changeSets.find(c => c.identifier === ids[0]), ) } selected={this.props.focusedChangeSet?.identifier} /> ) : ( No changes sets available )} {this.props.focusedChangeSet && ( )} {this.props.selectedNodeInfo && ( )} ); } }