Skip to content

Commit a4444b3

Browse files
authored
Merge pull request #338 from CodeForPhilly/front-end-cleanup
Front end cleanup
2 parents 42028df + 428155e commit a4444b3

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

src/client/src/pages/DataView360/View/View360.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import {
88
Button,
99
Grid,
1010
Backdrop,
11-
CircularProgress, Box, Typography
11+
CircularProgress,
12+
Typography
1213
} from '@material-ui/core';
1314

1415
import _ from 'lodash';

src/client/src/pages/DataView360/View/components/CollapsibleTable.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React from 'react';
2-
import PropTypes from 'prop-types';
32
import { makeStyles } from '@material-ui/core/styles';
43
import Box from '@material-ui/core/Box';
54
import 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+
3438
function 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>

src/client/src/pages/DataView360/View/components/VolunteerActivity.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React, { Component } from 'react';
22
import {
33
Paper,
4-
Typography,
54
Table,
65
TableContainer,
76
TableHead,
@@ -11,11 +10,8 @@ import {
1110
Container,
1211
} from '@material-ui/core';
1312
import { withStyles } from '@material-ui/core/styles';
14-
import _ from 'lodash';
1513
import moment from 'moment';
16-
import Grid from "@material-ui/core/Grid";
1714
import EmojiPeopleIcon from '@material-ui/icons/EmojiPeople';
18-
import TimelineIcon from '@material-ui/icons/Timeline';
1915
import DataTableHeader from './DataTableHeader';
2016

2117
const customStyles = theme => ({

0 commit comments

Comments
 (0)