import React from 'react'; import Moment from 'react-moment'; import { connect } from 'react-redux'; import { ButtonDropdown, DropdownItem, DropdownMenu, DropdownToggle } from 'reactstrap'; import { isEmpty } from 'ramda'; import pieChartIcon from '@fortawesome/fontawesome-free-solid/faChartPie'; import pictureIcon from '@fortawesome/fontawesome-free-solid/faImage'; import qrIcon from '@fortawesome/fontawesome-free-solid/faQrcode'; import copyIcon from '@fortawesome/fontawesome-free-solid/faCopy'; import menuIcon from '@fortawesome/fontawesome-free-solid/faEllipsisV'; import FontAwesomeIcon from '@fortawesome/react-fontawesome'; import Tag from '../utils/Tag'; import { listShortUrls } from './reducers/shortUrlsList'; import './ShortUrlsList.scss'; export class ShortUrlsList extends React.Component { componentDidMount() { const { match } = this.props; this.props.listShortUrls(match.params.serverId, { ...this.props.shortUrlsListParams, page: match.params.page }); } render() { return ( {this.renderShortUrls()}
Created at Short URL Original URL Tags Visits  
); } renderShortUrls() { const { shortUrlsList, selectedServer } = this.props; if (isEmpty(shortUrlsList)) { return Loading...; } return shortUrlsList.map(shortUrl => ( )); } static renderTags(tags) { if (isEmpty(tags)) { return No tags; } return tags.map(tag => ); } } class Row extends React.Component { state = { displayMenu: false }; render() { const { shortUrl, selectedServer } = this.props; return ( this.setState({ displayMenu: true })} onMouseLeave={() => this.setState({ displayMenu: false })} > {shortUrl.dateCreated} {`${selectedServer.url}/${shortUrl.shortCode}`} {shortUrl.originalUrl} {ShortUrlsList.renderTags(shortUrl.tags)} {shortUrl.visitsCount} ) } } class RowMenu extends React.Component { state = { isOpen: false }; toggle = () => this.setState({ isOpen: ! this.state.isOpen }); render () { const determineClass = () => { const baseClass = 'short-urls-list__dropdown-toggle'; return ! this.props.display ? `${baseClass} short-urls-list__dropdown-toggle--hidden` : baseClass; }; return (     Visit Stats  Preview  QR code  Copy to clipboard ); } } export default connect(state => ({ selectedServer: state.selectedServer, shortUrlsListParams: state.shortUrlsListParams, }), { listShortUrls })(ShortUrlsList);