/** * 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 { styled, colors, ManagedTable, TableBodyRow, FlexCenter, LoadingIndicator, Button, Glyph, } from 'flipper'; import {parseURIParameters, stripQueryParameters} from '../util/uri'; import React from 'react'; import {theme} from 'flipper-plugin'; const BOX_HEIGHT = 240; type Props = { isBookmarked: boolean; uri: string | null; className: string | null; onNavigate: (query: string) => void; onFavorite: (query: string) => void; screenshot: string | null; date: Date | null; }; const ScreenshotContainer = styled.div({ width: 200, minWidth: 200, overflow: 'hidden', borderLeft: `1px ${colors.blueGreyTint90} solid`, position: 'relative', height: '100%', borderRadius: 10, img: { width: '100%', }, }); const NoData = styled.div({ color: colors.light30, fontSize: 14, position: 'relative', }); const NavigationDataContainer = styled.div({ alignItems: 'flex-start', flexGrow: 1, position: 'relative', }); const Footer = styled.div({ width: '100%', padding: '10px', borderTop: `1px ${colors.blueGreyTint90} solid`, display: 'flex', alignItems: 'center', }); const Seperator = styled.div({ flexGrow: 1, }); const TimeContainer = styled.div({ color: colors.light30, fontSize: 14, }); const NavigationInfoBoxContainer = styled.div({ display: 'flex', height: BOX_HEIGHT, borderRadius: 10, flexGrow: 1, position: 'relative', marginBottom: 10, backgroundColor: theme.backgroundDefault, boxShadow: '1px 1px 5px rgba(0,0,0,0.1)', }); const Header = styled.div({ fontSize: 18, fontWeight: 500, userSelect: 'text', cursor: 'text', padding: 10, borderBottom: `1px ${colors.blueGreyTint90} solid`, display: 'flex', }); const ClassNameContainer = styled.div({ color: colors.light30, }); const ParametersContainer = styled.div({ height: 150, '&>*': { height: 150, marginBottom: 20, }, }); const NoParamters = styled(FlexCenter)({ fontSize: 18, color: colors.light10, }); const TimelineCircle = styled.div({ width: 18, height: 18, top: 11, left: -33, backgroundColor: theme.backgroundWash, border: `4px solid ${colors.highlight}`, borderRadius: '50%', position: 'absolute', }); const TimelineMiniCircle = styled.div({ width: 12, height: 12, top: 1, left: -30, borderRadius: '50%', backgroundColor: theme.textColorActive, position: 'absolute', }); const buildParameterTable = (parameters: Map) => { const tableRows: Array = []; let idx = 0; parameters.forEach((parameter_value, parameter) => { tableRows.push({ key: idx.toString(), columns: { parameter: { value: parameter, }, value: { value: parameter_value, }, }, }); idx++; }); return ( ); }; export default (props: Props) => { const { uri, isBookmarked, className, screenshot, onNavigate, onFavorite, date, } = props; if (uri == null && className == null) { return ( <> Unknown Navigation Event ); } else { const parameters = uri != null ? parseURIParameters(uri) : null; return (
{uri != null ? stripQueryParameters(uri) : ''} {className != null ? ( <>   {className != null ? className : ''} ) : null}
{parameters != null && parameters.size > 0 ? ( buildParameterTable(parameters) ) : ( No Parameters for this Event )}
{uri != null ? ( <> ) : null} {date != null ? date.toTimeString() : ''}
{uri != null || className != null ? ( {screenshot != null ? ( ) : ( )} ) : null}
); } };