import React from 'react'
import { Link } from 'react-router-dom'
import { imageUrl, timestamp, keyframeUri, widths, verify } from '../util'
import { DetectionBoxes } from '.'
import * as searchActions from '../search/search.actions'
export default function Keyframe({
verified,
sha256,
frame,
score,
isSaved,
fps = 25,
size = 'th',
className,
showHash,
showFrame,
showTimestamp,
showScore,
showSearchButton,
showSaveButton,
to,
children,
detectionList = [],
aspectRatio = 1.777,
onClick,
reviewActions,
}) {
if (!sha256) return null
const width = widths[size]
const height = Math.round(width / aspectRatio)
return (
{detectionList.map(({ labels, detections }, i) => (
))}
{(reviewActions && (showSearchButton || showSaveButton)) &&
}
{(showHash || showFrame || showTimestamp || showScore) &&
}
{children}
)
}
const PossiblyExternalLink = props => {
if (props.onClick) {
return props.children
}
if (props.to.match(/^http/)) {
return {props.children}
}
return
}