import { Card, UncontrolledTooltip } from 'reactstrap'; import Moment from 'react-moment'; import React from 'react'; import PropTypes from 'prop-types'; import ExternalLink from '../utils/ExternalLink'; import './VisitsHeader.scss'; import { shortUrlDetailType } from './reducers/shortUrlDetail'; const propTypes = { shortUrlDetail: shortUrlDetailType, shortLink: PropTypes.string, }; export function VisitsHeader({ shortUrlDetail, shortLink }) { const { shortUrl, loading } = shortUrlDetail; const renderDate = () => ( {shortUrl.dateCreated} {shortUrl.dateCreated} ); return ( {shortUrl.visitsCount && Visits: {shortUrl.visitsCount}} Visit stats for {shortLink} {shortUrl.dateCreated && ( Created: {loading && Loading...} {!loading && renderDate()} )} Long URL: {loading && Loading...} {!loading && {shortUrl.longUrl}} ); } VisitsHeader.propTypes = propTypes;