diff options
| author | adamhrv <adam@ahprojects.com> | 2018-12-16 01:03:14 +0100 |
|---|---|---|
| committer | adamhrv <adam@ahprojects.com> | 2018-12-16 01:03:14 +0100 |
| commit | 10f467b64e3be528ac246d5cf664d675aca3e7f3 (patch) | |
| tree | 02face1862f185796c3ddd08a274940626e31ff9 /scraper/client/common/keyframe.component.js | |
| parent | a52dc6f8edc4e5d00e7c05e34c6c6fe6252ec2bd (diff) | |
| parent | f91c6d8e870bd3b2c69a130e4b1ed8f6be250b92 (diff) | |
Merge branch 'master' of github.com:adamhrv/megapixels_dev
Diffstat (limited to 'scraper/client/common/keyframe.component.js')
| -rw-r--r-- | scraper/client/common/keyframe.component.js | 118 |
1 files changed, 0 insertions, 118 deletions
diff --git a/scraper/client/common/keyframe.component.js b/scraper/client/common/keyframe.component.js deleted file mode 100644 index c77db3ac..00000000 --- a/scraper/client/common/keyframe.component.js +++ /dev/null @@ -1,118 +0,0 @@ -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 ( - <div className={(className || 'keyframe') + (isSaved ? ' isSaved' : '')}> - <div className="thumbnail"> - <PossiblyExternalLink to={to || keyframeUri(sha256, frame)} onClick={onClick}> - <img - alt={'Frame #' + frame} - src={imageUrl(verified, sha256, frame, size)} - width={width} - height={height} - onClick={onClick} - /> - {detectionList.map(({ labels, detections }, i) => ( - <DetectionBoxes - key={i} - labels={labels} - detections={detections} - width={width} - height={height} - /> - ))} - </PossiblyExternalLink> - {(reviewActions && (showSearchButton || showSaveButton)) && - <label className='searchButtons'> - {showSearchButton && - <Link - to={searchActions.publicUrl.searchByVerifiedFrame(verified, sha256, frame)} - className='btn' - > - Search - </Link> - } - {showSaveButton && (isSaved - ? <button - onClick={() => reviewActions.unsave({ hash: sha256, frame, verified })} - className={'btn btn-primary saved'} - > - {'Saved'} - </button> - : <button - onClick={() => reviewActions.save({ hash: sha256, frame, verified })} - className={'btn btn save'} - > - {'Save'} - </button> - )} - </label> - } - </div> - {(showHash || showFrame || showTimestamp || showScore) && - <label> - {showHash && - <small> - <Link to={searchActions.publicUrl.browse(sha256)}> - <span - title={sha256} - className={'sha256 ' + verify(verified)} - > - {'▶ '} - {sha256.substr(0, 6)} - </span> - </Link> - </small> - } - {showFrame && - <small> - <span>{'Frame #'}{frame}</span> - </small> - } - {showTimestamp && <small>{timestamp(frame, fps)}</small>} - {showScore && !!score && <small>{score}</small>} - </label> - } - {children} - </div> - ) -} - -const PossiblyExternalLink = props => { - if (props.onClick) { - return props.children - } - if (props.to.match(/^http/)) { - return <a href={props.to} target='_blank' rel='noopener noreferrer'>{props.children}</a> - } - return <Link {...props} /> -} |
