import { UncontrolledTooltip } from 'reactstrap'; import Moment from 'react-moment'; import React from 'react'; import PropTypes from 'prop-types'; import { ExternalLink } from 'react-external-link'; import { shortUrlDetailType } from './reducers/shortUrlDetail'; import { shortUrlVisitsType } from './reducers/shortUrlVisits'; import VisitsHeader from './VisitsHeader'; import './ShortUrlVisitsHeader.scss'; const propTypes = { shortUrlDetail: shortUrlDetailType.isRequired, shortUrlVisits: shortUrlVisitsType.isRequired, goBack: PropTypes.func.isRequired, }; const ShortUrlVisitsHeader = ({ shortUrlDetail, shortUrlVisits, goBack }) => { const { shortUrl, loading } = shortUrlDetail; const { visits } = shortUrlVisits; const shortLink = shortUrl && shortUrl.shortUrl ? shortUrl.shortUrl : ''; const longLink = shortUrl && shortUrl.longUrl ? shortUrl.longUrl : ''; const renderDate = () => !shortUrl ? Loading... : ( {shortUrl.dateCreated} {shortUrl.dateCreated} ); const visitsStatsTitle = ( Visits for ); return ( Created: {renderDate()} Long URL:{' '} {loading && Loading...} {!loading && } ); }; ShortUrlVisitsHeader.propTypes = propTypes; export default ShortUrlVisitsHeader;