import { Card, UncontrolledTooltip } from 'reactstrap'; import Moment from 'react-moment'; import React from 'react'; import ExternalLink from '../utils/ExternalLink'; import './VisitsHeader.scss'; import { shortUrlDetailType } from './reducers/shortUrlDetail'; import { shortUrlVisitsType } from './reducers/shortUrlVisits'; const propTypes = { shortUrlDetail: shortUrlDetailType.isRequired, shortUrlVisits: shortUrlVisitsType.isRequired, }; export function VisitsHeader({ shortUrlDetail, shortUrlVisits }) { const { shortUrl, loading } = shortUrlDetail; const { visits } = shortUrlVisits; const shortLink = shortUrl && shortUrl.shortUrl ? shortUrl.shortUrl : ''; const longLink = shortUrl && shortUrl.longUrl ? shortUrl.longUrl : ''; const renderDate = () => ( {shortUrl.dateCreated} {shortUrl.dateCreated} ); return (

Visits: {visits.length} Visit stats for


{shortUrl.dateCreated && (
Created:   {renderDate()}
)}
Long URL:   {loading && Loading...} {!loading && }
); } VisitsHeader.propTypes = propTypes;