From d8119c8773ea95ea19925b2230aee0a2d35a4e2b Mon Sep 17 00:00:00 2001 From: wildscotsmen Date: Sat, 1 Dec 2018 19:56:09 -0500 Subject: [PATCH] Fixed minor bug with theme swap and restructured components folder. --- src/components/Main.js | 4 +- .../{ => flamelink}/FlameLinkCollection.js | 2 +- .../FlameLinkCollectionComponentCreations.js | 0 .../FlameLinkCollectionGallery.js | 4 +- .../FlameLinkCollectionGalleryContent.js | 4 +- .../FlameLinkCollectionStructure.js | 2 +- .../FlameLinkComponentCreations.js | 0 .../{ => flamelink}/FlameLinkFieldSet.js | 0 .../FlameLinkFieldSetContent.js | 0 .../{ => flamelink}/FlameLinkImage.js | 4 +- .../{ => flamelink}/FlameLinkStructure.js | 2 +- .../{ => flamelink}/RenderGallery.js | 2 +- src/components/{ => forms}/ContactForm.js | 2 +- src/components/{ => forms}/ReportForm.js | 4 +- src/components/{ => forms}/ReportMap.js | 0 src/components/{ => list}/SightingDetail.js | 0 .../{ => list}/SightingDetailMap.js | 0 src/components/{ => list}/ViewSightings.js | 40 ++++++++++++++----- src/pages/About.js | 2 +- src/pages/Contact.js | 2 +- src/pages/Home.js | 4 +- src/pages/Info.js | 2 +- src/pages/Report.js | 2 +- src/pages/SightingList.js | 4 +- 24 files changed, 52 insertions(+), 34 deletions(-) rename src/components/{ => flamelink}/FlameLinkCollection.js (94%) rename src/components/{ => flamelink}/FlameLinkCollectionComponentCreations.js (100%) rename src/components/{ => flamelink}/FlameLinkCollectionGallery.js (96%) rename src/components/{ => flamelink}/FlameLinkCollectionGalleryContent.js (84%) rename src/components/{ => flamelink}/FlameLinkCollectionStructure.js (98%) rename src/components/{ => flamelink}/FlameLinkComponentCreations.js (100%) rename src/components/{ => flamelink}/FlameLinkFieldSet.js (100%) rename src/components/{ => flamelink}/FlameLinkFieldSetContent.js (100%) rename src/components/{ => flamelink}/FlameLinkImage.js (84%) rename src/components/{ => flamelink}/FlameLinkStructure.js (97%) rename src/components/{ => flamelink}/RenderGallery.js (93%) rename src/components/{ => forms}/ContactForm.js (99%) rename src/components/{ => forms}/ReportForm.js (99%) rename src/components/{ => forms}/ReportMap.js (100%) rename src/components/{ => list}/SightingDetail.js (100%) rename src/components/{ => list}/SightingDetailMap.js (100%) rename src/components/{ => list}/ViewSightings.js (65%) diff --git a/src/components/Main.js b/src/components/Main.js index 15700cf..9e4a7b1 100644 --- a/src/components/Main.js +++ b/src/components/Main.js @@ -32,7 +32,7 @@ import CssBaseline from '@material-ui/core/CssBaseline'; import ExpandLess from '@material-ui/icons/ExpandLess'; import ExpandMore from '@material-ui/icons/ExpandMore'; import Collapse from '@material-ui/core/Collapse'; -import FlameLinkCollectionGallery from '../components/FlameLinkCollectionGallery'; +import FlameLinkCollectionGallery from '../components/flamelink/FlameLinkCollectionGallery'; import { MuiThemeProvider, createMuiTheme } from '@material-ui/core/styles'; import Switch from '@material-ui/core/Switch'; @@ -278,7 +278,7 @@ class ResponsiveDrawer extends React.Component { {this.state.key === 'Home' && } {this.state.key === 'Report' && } {this.state.key === 'Map' && } - {this.state.key === 'List' && } + {this.state.key === 'List' && } {this.state.key === 'About' && } {this.state.key === 'Contact' && } {this.state.key === 'Easy-Quiz' && } diff --git a/src/components/FlameLinkCollection.js b/src/components/flamelink/FlameLinkCollection.js similarity index 94% rename from src/components/FlameLinkCollection.js rename to src/components/flamelink/FlameLinkCollection.js index ab1f13e..c563e35 100644 --- a/src/components/FlameLinkCollection.js +++ b/src/components/flamelink/FlameLinkCollection.js @@ -1,5 +1,5 @@ import React, { Component} from 'react'; -import flamelinkApp from '../flamelink.js'; +import flamelinkApp from '../../flamelink.js'; import FlameLinkCollectionComponentCreations from './FlameLinkCollectionComponentCreations'; class FlameLinkCollection extends Component { diff --git a/src/components/FlameLinkCollectionComponentCreations.js b/src/components/flamelink/FlameLinkCollectionComponentCreations.js similarity index 100% rename from src/components/FlameLinkCollectionComponentCreations.js rename to src/components/flamelink/FlameLinkCollectionComponentCreations.js diff --git a/src/components/FlameLinkCollectionGallery.js b/src/components/flamelink/FlameLinkCollectionGallery.js similarity index 96% rename from src/components/FlameLinkCollectionGallery.js rename to src/components/flamelink/FlameLinkCollectionGallery.js index 77860ea..2c0ca3c 100644 --- a/src/components/FlameLinkCollectionGallery.js +++ b/src/components/flamelink/FlameLinkCollectionGallery.js @@ -3,10 +3,10 @@ import Typography from '@material-ui/core/Typography'; import Grid from '@material-ui/core/Grid'; import { withStyles } from '@material-ui/core/styles'; import RenderGallery from './RenderGallery'; -import flamelinkApp from '../flamelink.js'; +import flamelinkApp from '../../flamelink.js'; import FlameLinkCollectionGalleryContent from './FlameLinkCollectionGalleryContent'; import "react-image-gallery/styles/css/image-gallery.css"; -import '../css/FlameLink.css'; +import '../../css/FlameLink.css'; const styles = theme => ({ flamelinkItem: { diff --git a/src/components/FlameLinkCollectionGalleryContent.js b/src/components/flamelink/FlameLinkCollectionGalleryContent.js similarity index 84% rename from src/components/FlameLinkCollectionGalleryContent.js rename to src/components/flamelink/FlameLinkCollectionGalleryContent.js index ceeba0f..0ed6a0f 100644 --- a/src/components/FlameLinkCollectionGalleryContent.js +++ b/src/components/flamelink/FlameLinkCollectionGalleryContent.js @@ -1,6 +1,6 @@ import { Component } from 'react'; -import flamelinkApp from '../flamelink.js'; -import '../css/FlameLink.css'; +import flamelinkApp from '../../flamelink.js'; +import '../../css/FlameLink.css'; class FlameLinkCollectionGalleryContent extends Component { constructor(props) { diff --git a/src/components/FlameLinkCollectionStructure.js b/src/components/flamelink/FlameLinkCollectionStructure.js similarity index 98% rename from src/components/FlameLinkCollectionStructure.js rename to src/components/flamelink/FlameLinkCollectionStructure.js index 95aadca..3404394 100644 --- a/src/components/FlameLinkCollectionStructure.js +++ b/src/components/flamelink/FlameLinkCollectionStructure.js @@ -2,7 +2,7 @@ import React, { Component} from 'react'; import Grid from '@material-ui/core/Grid'; import Typography from '@material-ui/core/Typography'; import { withStyles } from '@material-ui/core/styles'; -import flamelinkApp from '../flamelink.js'; +import flamelinkApp from '../../flamelink.js'; import FlameLinkImage from './FlameLinkImage'; import FlameLinkFieldSet from './FlameLinkFieldSet'; diff --git a/src/components/FlameLinkComponentCreations.js b/src/components/flamelink/FlameLinkComponentCreations.js similarity index 100% rename from src/components/FlameLinkComponentCreations.js rename to src/components/flamelink/FlameLinkComponentCreations.js diff --git a/src/components/FlameLinkFieldSet.js b/src/components/flamelink/FlameLinkFieldSet.js similarity index 100% rename from src/components/FlameLinkFieldSet.js rename to src/components/flamelink/FlameLinkFieldSet.js diff --git a/src/components/FlameLinkFieldSetContent.js b/src/components/flamelink/FlameLinkFieldSetContent.js similarity index 100% rename from src/components/FlameLinkFieldSetContent.js rename to src/components/flamelink/FlameLinkFieldSetContent.js diff --git a/src/components/FlameLinkImage.js b/src/components/flamelink/FlameLinkImage.js similarity index 84% rename from src/components/FlameLinkImage.js rename to src/components/flamelink/FlameLinkImage.js index acad0e6..d33657a 100644 --- a/src/components/FlameLinkImage.js +++ b/src/components/flamelink/FlameLinkImage.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import Typography from '@material-ui/core/Typography'; -import flamelinkApp from '../flamelink.js'; -import '../css/FlameLink.css'; +import flamelinkApp from '../../flamelink.js'; +import '../../css/FlameLink.css'; class FlameLinkImage extends Component { constructor() { diff --git a/src/components/FlameLinkStructure.js b/src/components/flamelink/FlameLinkStructure.js similarity index 97% rename from src/components/FlameLinkStructure.js rename to src/components/flamelink/FlameLinkStructure.js index 93e391d..7f37792 100644 --- a/src/components/FlameLinkStructure.js +++ b/src/components/flamelink/FlameLinkStructure.js @@ -2,7 +2,7 @@ import React, { Component} from 'react'; import Grid from '@material-ui/core/Grid'; import Typography from '@material-ui/core/Typography'; import { withStyles } from '@material-ui/core/styles'; -import flamelinkApp from '../flamelink.js'; +import flamelinkApp from '../../flamelink.js'; import FlameLinkImage from './FlameLinkImage'; import FlameLinkFieldSet from './FlameLinkFieldSet'; diff --git a/src/components/RenderGallery.js b/src/components/flamelink/RenderGallery.js similarity index 93% rename from src/components/RenderGallery.js rename to src/components/flamelink/RenderGallery.js index ce87837..840dc29 100644 --- a/src/components/RenderGallery.js +++ b/src/components/flamelink/RenderGallery.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import ImageGallery from 'react-image-gallery'; import "react-image-gallery/styles/css/image-gallery.css"; -import '../css/FlameLink.css'; +import '../../css/FlameLink.css'; class RenderGallery extends Component { constructor() { diff --git a/src/components/ContactForm.js b/src/components/forms/ContactForm.js similarity index 99% rename from src/components/ContactForm.js rename to src/components/forms/ContactForm.js index b009805..12677e5 100644 --- a/src/components/ContactForm.js +++ b/src/components/forms/ContactForm.js @@ -1,7 +1,7 @@ import React, { Fragment } from 'react'; import PropTypes from 'prop-types'; import Grid from '@material-ui/core/Grid'; -import emailjs from '../emailjs.js' +import emailjs from '../../emailjs.js' import { withStyles } from '@material-ui/core/styles'; import TextField from '@material-ui/core/TextField'; import CheckCircleIcon from '@material-ui/icons/CheckCircle'; diff --git a/src/components/ReportForm.js b/src/components/forms/ReportForm.js similarity index 99% rename from src/components/ReportForm.js rename to src/components/forms/ReportForm.js index 9057b89..9966aa1 100644 --- a/src/components/ReportForm.js +++ b/src/components/forms/ReportForm.js @@ -9,8 +9,8 @@ import Snackbar from '@material-ui/core/Snackbar'; import IconButton from '@material-ui/core/IconButton'; import CloseIcon from '@material-ui/icons/Close'; import Button from '@material-ui/core/Button'; -import firebase from '../firebase.js'; -import GoogleMap from '../components/ReportMap'; +import firebase from '../../firebase.js'; +import GoogleMap from './ReportMap'; import Modal from '@material-ui/core/Modal'; import Typography from '@material-ui/core/Typography'; diff --git a/src/components/ReportMap.js b/src/components/forms/ReportMap.js similarity index 100% rename from src/components/ReportMap.js rename to src/components/forms/ReportMap.js diff --git a/src/components/SightingDetail.js b/src/components/list/SightingDetail.js similarity index 100% rename from src/components/SightingDetail.js rename to src/components/list/SightingDetail.js diff --git a/src/components/SightingDetailMap.js b/src/components/list/SightingDetailMap.js similarity index 100% rename from src/components/SightingDetailMap.js rename to src/components/list/SightingDetailMap.js diff --git a/src/components/ViewSightings.js b/src/components/list/ViewSightings.js similarity index 65% rename from src/components/ViewSightings.js rename to src/components/list/ViewSightings.js index ec5d3c2..2caa73b 100644 --- a/src/components/ViewSightings.js +++ b/src/components/list/ViewSightings.js @@ -1,6 +1,6 @@ import React, { Component, Fragment } from 'react'; import Grid from '@material-ui/core/Grid'; -import firebase from '../firebase.js'; +import firebase from '../../firebase.js'; import List from '@material-ui/core/List'; import ListItem from '@material-ui/core/ListItem'; import ListItemText from '@material-ui/core/ListItemText'; @@ -64,6 +64,24 @@ class ViewSightings extends Component { clicked: false }; + componentDidUpdate(props) { + if (this.props.themeName !== props.themeName) { + this.setState({ + selectedSighting: { + id: null, + lat: null, + lng: null, + desc: null, + type: null, + confidence: null, + date: null, + time: null + }, + clicked: false + }); + } + } + render() { return ( @@ -71,20 +89,20 @@ class ViewSightings extends Component { - { - this.state.sightings.map((sighting) => { - return ( - this.getDetail(sighting.id, sighting.lat, sighting.lng, sighting.desc, sighting.type, sighting.confidence, sighting.date, sighting.time)}> - - - ); - }) - } + { + this.state.sightings.map((sighting) => { + return ( + this.getDetail(sighting.id, sighting.lat, sighting.lng, sighting.desc, sighting.type, sighting.confidence, sighting.date, sighting.time)}> + + + ); + }) + } - {this.state.clicked === true && } + {this.state.clicked === true && } diff --git a/src/pages/About.js b/src/pages/About.js index 9b46421..aed4944 100644 --- a/src/pages/About.js +++ b/src/pages/About.js @@ -1,5 +1,5 @@ import React, { Component, Fragment } from 'react'; -import FlameLinkComponentCreations from '../components/FlameLinkComponentCreations'; +import FlameLinkComponentCreations from '../components/flamelink/FlameLinkComponentCreations'; import flamelinkApp from '../flamelink.js'; class About extends Component { diff --git a/src/pages/Contact.js b/src/pages/Contact.js index 20d4407..377c05f 100644 --- a/src/pages/Contact.js +++ b/src/pages/Contact.js @@ -1,5 +1,5 @@ import React, { Component } from 'react'; -import ContactForm from '../components/ContactForm.js' +import ContactForm from '../components/forms/ContactForm.js' class Contact extends Component { componentDidMount() { diff --git a/src/pages/Home.js b/src/pages/Home.js index 53844f9..666bcb2 100644 --- a/src/pages/Home.js +++ b/src/pages/Home.js @@ -1,6 +1,6 @@ import React, { Component } from 'react'; -import FlameLinkComponentCreations from '../components/FlameLinkComponentCreations'; -import FlameLinkCollectionGallery from '../components/FlameLinkCollectionGallery'; +import FlameLinkComponentCreations from '../components/flamelink/FlameLinkComponentCreations'; +import FlameLinkCollectionGallery from '../components/flamelink/FlameLinkCollectionGallery'; import flamelinkApp from '../flamelink'; import Grid from '@material-ui/core/Grid'; diff --git a/src/pages/Info.js b/src/pages/Info.js index c058d29..5ce36b5 100644 --- a/src/pages/Info.js +++ b/src/pages/Info.js @@ -1,5 +1,5 @@ import React, { Component, Fragment } from 'react'; -import FlameLinkComponentCreations from '../components/FlameLinkComponentCreations'; +import FlameLinkComponentCreations from '../components/flamelink/FlameLinkComponentCreations'; import flamelinkApp from '../flamelink.js'; class Info extends Component { diff --git a/src/pages/Report.js b/src/pages/Report.js index 3989544..e822766 100644 --- a/src/pages/Report.js +++ b/src/pages/Report.js @@ -1,5 +1,5 @@ import React, { Component } from 'react'; -import ReportForm from '../components/ReportForm'; +import ReportForm from '../components/forms/ReportForm'; class Report extends Component { componentDidMount() { diff --git a/src/pages/SightingList.js b/src/pages/SightingList.js index 8fb460d..accad13 100644 --- a/src/pages/SightingList.js +++ b/src/pages/SightingList.js @@ -1,5 +1,5 @@ import React, { Component } from 'react'; -import ViewSightings from '../components/ViewSightings.js'; +import ViewSightings from '../components/list/ViewSightings.js'; class Sighting extends Component { componentDidMount() { @@ -8,7 +8,7 @@ class Sighting extends Component { render() { return ( - + ); } }