import {Fragment} from 'react'; import {css} from '@emotion/react'; import styled from '@emotion/styled'; import DateTime from 'sentry/components/dateTime'; import {Body, Header, Hovercard} from 'sentry/components/hovercard'; import TimeSince from 'sentry/components/timeSince'; import Version from 'sentry/components/version'; import VersionHoverCard from 'sentry/components/versionHoverCard'; import {t} from 'sentry/locale'; import space from 'sentry/styles/space'; import {Organization, Release} from 'sentry/types'; import {defined, toTitleCase} from 'sentry/utils'; type RelaxedDateType = React.ComponentProps['date']; type Props = { date: RelaxedDateType; dateGlobal: RelaxedDateType; hasRelease: boolean; organization: Organization; projectId: string; projectSlug: string; title: string; environment?: string; release?: Release; }; function SeenInfo({ date, dateGlobal, environment, release, organization, projectSlug, projectId, }: Props) { return ( {t('Any Environment')} {environment && ( {toTitleCase(environment)} {date ? ( ) : ( {t('N/A')} )} )} } body={ date ? ( ) : ( {t('N/A for %s', environment)} ) } position="top" > {date ? ( ) : dateGlobal && environment === '' ? ( ) : ( {t('N/A')} )} {defined(release) && ( {t('in release ')} )} ); } const dateTimeCss = p => css` color: ${p.theme.gray300}; font-size: ${p.theme.fontSizeMedium}; display: flex; justify-content: center; `; const HovercardWrapper = styled('div')` display: flex; align-items: baseline; `; const DateWrapper = styled('div')` margin-bottom: 0; ${p => p.theme.overflowEllipsis}; `; const StyledDateTime = styled(DateTime)` ${dateTimeCss}; `; const NoEnvironment = styled('div')` ${dateTimeCss}; `; const NoDateTime = styled('span')` margin-right: ${space(0.5)}; `; const TooltipWrapper = styled('span')` margin-right: ${space(0.25)}; svg { margin-right: ${space(0.5)}; position: relative; top: 1px; } `; const TimeSinceWrapper = styled('div')` margin-bottom: ${space(0.5)}; display: flex; justify-content: space-between; `; const StyledTimeSince = styled(TimeSince)` font-size: ${p => p.theme.fontSizeMedium}; line-height: 1.2; `; const StyledHovercard = styled(Hovercard)` width: 250px; ${Header} { font-weight: normal; border-bottom: 1px solid ${p => p.theme.innerBorder}; } ${Body} { padding: ${space(1.5)}; } `; export default SeenInfo;