11import React from 'react' ;
2- import PropTypes from 'prop-types' ;
32import { makeStyles } from '@material-ui/core/styles' ;
43import Box from '@material-ui/core/Box' ;
54import Collapse from '@material-ui/core/Collapse' ;
@@ -31,10 +30,16 @@ function getAnimalAge(epochTime) {
3130 return moment ( ) . diff ( dateOfBirth , 'years' ) ;
3231}
3332
33+ function showAnimalAge ( epochTime ) {
34+ const age = getAnimalAge ( epochTime )
35+ return ( age === 1 ) ? `${ age } year` : `${ age } years`
36+ }
37+
3438function Row ( props ) {
3539 const [ open , setOpen ] = React . useState ( false ) ;
3640 const classes = useRowStyles ( ) ;
3741 const { row, events } = props ;
42+ const photo = row . Photos [ 0 ]
3843 return (
3944 < React . Fragment >
4045 < TableRow className = { classes . root } >
@@ -48,8 +53,8 @@ function Row(props) {
4853 </ TableCell >
4954 < TableCell align = "center" > { row . Type } </ TableCell >
5055 < TableCell align = "center" > { row . Breed } </ TableCell >
51- < TableCell align = "center" > { getAnimalAge ( row . DOBUnixTime ) } </ TableCell >
52- < TableCell align = "center" > { < img src = { row . Photos [ 0 ] } alt = "animal" style = { { "maxWidth" : "100px" } } /> } </ TableCell >
56+ < TableCell align = "center" > { showAnimalAge ( row . DOBUnixTime ) } </ TableCell >
57+ < TableCell align = "center" > { < img src = { photo } alt = "animal" style = { { "maxWidth" : "100px" } } /> } </ TableCell >
5358 </ TableRow >
5459 < TableRow >
5560 < TableCell style = { { paddingBottom : 0 , paddingTop : 0 } } colSpan = { 6 } >
@@ -62,7 +67,7 @@ function Row(props) {
6267 < TableHead >
6368 < TableRow >
6469 < TableCell align = "center" > Subtype</ TableCell >
65- < TableCell align = "center" > Time </ TableCell >
70+ < TableCell align = "center" > Date </ TableCell >
6671 < TableCell align = "center" > Type</ TableCell >
6772 < TableCell align = "center" > User</ TableCell >
6873 </ TableRow >
0 commit comments