import React from 'react' import Content from './Content' import Controls from './Controls' import { selectTypeFromPath } from '../../js/utilities' class SourceOverlay extends React.Component { constructor () { super() this.state = { idx: 0 } this.onShiftGallery = this.onShiftGallery.bind(this) } getTypeCounts (media) { return media.reduce( (acc, vl) => { acc[vl.type] += 1 return acc }, { Image: 0, Video: 0, Text: 0 } ) } onShiftGallery (shift) { // no more left if (this.state.idx === 0 && shift === -1) return // no more right if (this.state.idx === this.props.source.paths.length - 1 && shift === 1) return this.setState({ idx: this.state.idx + shift }) } render () { if (typeof (this.props.source) !== 'object') { return this.renderError() } const { url, title, paths, date, type } = this.props.source const shortenedTitle = title.substring(0, 100) return (
close

{shortenedTitle}

e.stopPropagation()}>
{/*
*/} {/* {title ?

{title}

: null} */} {/*
{desc}
*/} {/*
*/}
{type ?

Media type

: null} {type ?

perm_media{type}

: null}
{date ?

Date

: null} {date ?

today{date}

: null}
{url ?

Link

: null} {url ? linkLink to original URL : null}
) } } export default SourceOverlay