@@ -7,6 +7,7 @@ import constants, {AppMode, Modes} from './constants';
77import { toMode } from './toMode' ;
88import { $time , currentRunTime , finishMovement , resetTraining } from './helpers' ;
99import { onClassifyFish } from './models/train' ;
10+ import { arrangeFish } from './models/pond' ;
1011import colors from './colors' ;
1112import aiBotClosed from '../../public/images/ai-bot/ai-bot-closed.png' ;
1213import counterIcon from '../../public/images/data.png' ;
@@ -22,7 +23,9 @@ import {
2223 faPause ,
2324 faBackward ,
2425 faForward ,
25- faEraser
26+ faEraser ,
27+ faCheck ,
28+ faBan
2629} from '@fortawesome/free-solid-svg-icons' ;
2730
2831const styles = {
@@ -42,6 +45,7 @@ const styles = {
4245 button : {
4346 cursor : 'pointer' ,
4447 backgroundColor : colors . white ,
48+ color : colors . grey ,
4549 borderRadius : 8 ,
4650 minWidth : 160 ,
4751 outline : 'none' ,
@@ -295,6 +299,30 @@ const styles = {
295299 transform : 'translateX(-45%)' ,
296300 pointerEvents : 'none'
297301 } ,
302+ recallContainer : {
303+ position : 'absolute' ,
304+ top : '4%' ,
305+ right : '2.25%' ,
306+ color : colors . white ,
307+ display : 'flex' ,
308+ alignItems : 'center' ,
309+ justifyContent : 'space-between'
310+ } ,
311+ recallIcon : {
312+ width : 30 ,
313+ height : 30 ,
314+ border : `5px solid ${ colors . white } ` ,
315+ borderRadius : 50 ,
316+ padding : 6 ,
317+ marginLeft : 8 ,
318+ backgroundColor : colors . lightGrey
319+ } ,
320+ bgRed : {
321+ backgroundColor : colors . red
322+ } ,
323+ bgGreen : {
324+ backgroundColor : colors . green
325+ } ,
298326 pill : {
299327 display : 'flex' ,
300328 alignItems : 'center'
@@ -855,12 +883,25 @@ let Predict = class Predict extends React.Component {
855883} ;
856884Predict = Radium ( Predict ) ;
857885
858- class Pond extends React . Component {
886+ let Pond = class Pond extends React . Component {
859887 constructor ( props ) {
860888 super ( props ) ;
861889 }
862890
863- onPondClick ( e ) {
891+ toggleRecall = ( ) => {
892+ const state = getState ( ) ;
893+ const showRecallFish = ! state . showRecallFish ;
894+ const fish = showRecallFish ? state . recallFish : state . pondFish ;
895+
896+ // Don't call arrangeFish if fish have already been arranged.
897+ if ( fish . length > 0 && ! fish [ 0 ] . getXY ( ) ) {
898+ arrangeFish ( fish ) ;
899+ }
900+
901+ setState ( { showRecallFish} ) ;
902+ } ;
903+
904+ onPondClick = e => {
864905 // Don't allow pond clicks if a Guide is currently showing.
865906 if ( getCurrentGuide ( ) ) {
866907 return ;
@@ -920,13 +961,32 @@ class Pond extends React.Component {
920961 playSound ( 'no' ) ;
921962 }
922963 }
923- }
964+ } ;
924965
925966 render ( ) {
926967 const state = getState ( ) ;
927968
928969 return (
929- < Body onClick = { e => this . onPondClick ( e ) } >
970+ < Body onClick = { this . onPondClick } >
971+ < div style = { styles . recallContainer } >
972+ Show
973+ < FontAwesomeIcon
974+ icon = { faCheck }
975+ style = { {
976+ ...styles . recallIcon ,
977+ ...( ! state . showRecallFish ? styles . bgGreen : { } )
978+ } }
979+ onClick = { this . toggleRecall }
980+ />
981+ < FontAwesomeIcon
982+ icon = { faBan }
983+ style = { {
984+ ...styles . recallIcon ,
985+ ...( state . showRecallFish ? styles . bgRed : { } )
986+ } }
987+ onClick = { this . toggleRecall }
988+ />
989+ </ div >
930990 < img style = { styles . pondBot } src = { aiBotClosed } />
931991 { state . canSkipPond && (
932992 < div >
@@ -971,7 +1031,8 @@ class Pond extends React.Component {
9711031 </ Body >
9721032 ) ;
9731033 }
974- }
1034+ } ;
1035+ Pond = Radium ( Pond ) ;
9751036
9761037class Guide extends React . Component {
9771038 onShowing ( ) {
0 commit comments