From 3feec479f2eeb82a05c908ec8071df9310680b70 Mon Sep 17 00:00:00 2001 From: wildscotsmen Date: Mon, 10 Dec 2018 13:58:01 -0500 Subject: [PATCH 01/21] Initial feature commit. --- .../flamelink/FlameLinkCollection.js | 47 +++-- .../flamelink/FlameLinkCollectionStructure.js | 180 +++++++++--------- .../flamelink/FlameLinkComponentCreations.js | 28 +-- src/pages/About.js | 81 +++++--- 4 files changed, 180 insertions(+), 156 deletions(-) diff --git a/src/components/flamelink/FlameLinkCollection.js b/src/components/flamelink/FlameLinkCollection.js index afc8312..5ede9a0 100644 --- a/src/components/flamelink/FlameLinkCollection.js +++ b/src/components/flamelink/FlameLinkCollection.js @@ -1,52 +1,49 @@ -import React, { Component} from 'react'; +import React, { Component } from 'react'; import flamelinkApp from '../../utilities/flamelink.js'; import FlameLinkCollectionComponentCreations from './FlameLinkCollectionComponentCreations'; class FlameLinkCollection extends Component { - constructor() { - super(); - + state = { + schemaContent: '', + } - this.state = { - schemaContent: '', - } + componentDidMount() { + flamelinkApp.content.get(this.props.schemaName) + .then(result => this.setState({ + schemaContent: result + })) + } - flamelinkApp.content.get(global.schemaName) - .then(result => this.setState({ - schemaContent: result - })) - } - - getCollectionContent(schemaData){ + getCollectionContent(schemaData) { var arr2 = []; var collectionInfo = [schemaData, this.state.schemaContent]; - for (var val in this.state.schemaContent){ + for (var val in this.state.schemaContent) { arr2[this.state.schemaContent[val]['order']] = val; } return arr2.map(this.getCollectionComponentInfo, collectionInfo); } - getCollectionComponentInfo(num){ + getCollectionComponentInfo(num) { var arr3 = []; - for (var val in this[0]){ + for (var val in this[0]) { arr3.push(val); } return } countProperties(obj) { - var count = 0; + var count = 0; - for(var prop in obj) { - if(obj.hasOwnProperty(prop)) - ++count; + for (var prop in obj) { + if (obj.hasOwnProperty(prop)) + ++count; + } + + return count; } - return count; -} - render() { - return( + return (
{this.getCollectionContent(this.props.schemaData)}
diff --git a/src/components/flamelink/FlameLinkCollectionStructure.js b/src/components/flamelink/FlameLinkCollectionStructure.js index bed944f..2b5c4a2 100644 --- a/src/components/flamelink/FlameLinkCollectionStructure.js +++ b/src/components/flamelink/FlameLinkCollectionStructure.js @@ -1,4 +1,4 @@ -import React, { Component} from 'react'; +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'; @@ -7,102 +7,100 @@ import FlameLinkImage from './FlameLinkImage'; import FlameLinkFieldSet from './FlameLinkFieldSet'; const styles = theme => ({ - flamelinkItem: { - paddingRight: 20, - paddingLeft: 20, - paddingTop: 20, - }, - }); + flamelinkItem: { + paddingRight: 20, + paddingLeft: 20, + paddingTop: 20, + }, +}); class FlameLinkCollectionStructure extends Component { - constructor() { - super(); - + state = { + schemaContent: '', + } + + componentDidMount() { global.mediaID = ''; - this.state = { - schemaContent: '', + flamelinkApp.content.get(this.props.schemaName) + .then(result => this.setState({ + schemaContent: result + })) + } + + getContent(content, field, key, type, description) { + if (type === 'text') { + if (description === 'h1') { + return ( + + {content[key]} + + ) + } + if (description === 'h2') { + return ( + + {content[key]} + + ) + } + if (description === 'h3') { + return ( + + {content[key]} + + ) + } + if (description === 'h4') { + return ( + + {content[key]} + + ) + } + if (description === 'h5') { + return ( + + {content[key]} + + ) + } + if (description === 'h6') { + return ( + + {content[key]} + + ) + } + else { + return ( + + {content[key]} + + ) + } } - - flamelinkApp.content.get(global.schemaName) - .then(result => this.setState({ - schemaContent: result - })) - } - - getContent(content, field, key, type, description){ - if (type === 'text'){ - if(description === 'h1'){ - return ( - - {content[key]} - - ) - } - if(description === 'h2'){ - return ( - - {content[key]} - - ) - } - if(description === 'h3'){ - return ( - - {content[key]} - - ) - } - if(description === 'h4'){ - return ( - - {content[key]} - - ) - } - if(description === 'h5'){ - return ( - - {content[key]} - - ) - } - if(description === 'h6'){ - return ( - - {content[key]} - - ) - } - else{ - return ( - - {content[key]} - - ) - } + if (type === 'textarea') { + return ( + + {content[key]} + + ) + } + if (type === 'media') { + for (var val in content[key]) { + global.mediaID = content[key][val]; + return } - if(type === 'textarea'){ - return ( - - {content[key]} - - ) + } + if (type === 'fieldset') { + if (content === '') { + return } - if (type === 'media'){ - for (var val in content[key]){ - global.mediaID = content[key][val]; - return - } - } - if (type === 'fieldset'){ - if(content === ''){ - return - } - else{ - return - } + else { + return } + } } render() { @@ -112,9 +110,9 @@ class FlameLinkCollectionStructure extends Component { const md = this.props.field.gridColumns.md; const sm = this.props.field.gridColumns.sm; const xs = this.props.field.gridColumns.xs; - return( + return ( - {this.getContent(this.props.schemaContent, this.props.field, this.props.field.key, this.props.type, this.props.field.description)} + {this.getContent(this.props.schemaContent, this.props.field, this.props.field.key, this.props.type, this.props.field.description)} ); } diff --git a/src/components/flamelink/FlameLinkComponentCreations.js b/src/components/flamelink/FlameLinkComponentCreations.js index 88ae4bf..d50d05d 100644 --- a/src/components/flamelink/FlameLinkComponentCreations.js +++ b/src/components/flamelink/FlameLinkComponentCreations.js @@ -1,40 +1,40 @@ -import React, { Component} from 'react'; +import React, { Component } from 'react'; import FlameLinkStructure from './FlameLinkStructure'; import FlameLinkCollection from './FlameLinkCollection'; import Grid from '@material-ui/core/Grid'; class FlameLinkComponentCreations extends Component { - - getSchemaFieldData(schemaData, schemaType){ + + getSchemaFieldData(schemaData, schemaType) { var arr = []; - for (var val in schemaData){ + for (var val in schemaData) { arr.push(val); } - if(schemaType === 'single'){ + if (schemaType === 'single') { return arr.map(this.createSingleTypeSchemaComponents, schemaData); } - if(schemaType === 'collection'){ + if (schemaType === 'collection') { return this.createCollectionTypeSchemaComponents(schemaData); } - else{ + else { return } } - createSingleTypeSchemaComponents(num){ + createSingleTypeSchemaComponents(num) { return } - createCollectionTypeSchemaComponents(schemaData){ - return + createCollectionTypeSchemaComponents = schemaData => { + return } render() { - return( - - {this.getSchemaFieldData(this.props.schemaDetails, this.props.schemaType)} - + return ( + + {this.getSchemaFieldData(this.props.schemaDetails, this.props.schemaType)} + ); } } diff --git a/src/pages/About.js b/src/pages/About.js index 88d18da..f565d2e 100644 --- a/src/pages/About.js +++ b/src/pages/About.js @@ -1,43 +1,72 @@ import React, { Component, Fragment } from 'react'; import FlameLinkComponentCreations from '../components/flamelink/FlameLinkComponentCreations'; import flamelinkApp from '../utilities/flamelink.js'; +import PropTypes from 'prop-types'; +import { Typography } from '@material-ui/core'; +import { withStyles } from '@material-ui/core/styles'; + +const styles = theme => ({ + header: { + paddingRight: 20, + paddingLeft: 20, + paddingTop: 20, + }, +}); class About extends Component { - constructor() { - super(); - - global.schemaName = 'martenAbout'; - - this.state = { - schemaDetails: '', - schemaType: '', - } - - flamelinkApp.schemas.getFields(global.schemaName, { fields: [ 'title', 'key', 'type', 'gridColumns', 'description', 'options' ] }) - .then(result => this.setState({ - schemaDetails: result - })) - - flamelinkApp.schemas.get(global.schemaName) - .then(result => this.setState({ - schemaType: result.type - })) + state = { + researcherSchemaName: 'martenAbout', + developerSchemaName: 'martenAboutDev', + researcherSchemaDetails: '', + researcherSchemaType: '', + developerSchemaDetails: '', + developerSchemaType: '' } componentDidMount() { document.title = 'Marten Tracker | About'; + + + // Pulling in schema details for researchers + flamelinkApp.schemas.getFields(this.state.researcherSchemaName, { fields: ['title', 'key', 'type', 'gridColumns', 'description', 'options'] }) + .then(result => this.setState({ + researcherSchemaDetails: result + })) + + flamelinkApp.schemas.get(this.state.researcherSchemaName) + .then(result => this.setState({ + researcherSchemaType: result.type + })) + + + // Pulling in schema details for developers + flamelinkApp.schemas.getFields(this.state.developerSchemaName, { fields: ['title', 'key', 'type', 'gridColumns', 'description', 'options'] }) + .then(result => this.setState({ + developerSchemaDetails: result + })) + + flamelinkApp.schemas.get(this.state.developerSchemaName) + .then(result => this.setState({ + developerSchemaType: result.type + })) } render() { - + const { classes } = this.props; + return ( -
- - - -
+ + Researchers + + Developers + + ); } } -export default About; +About.propTypes = { + classes: PropTypes.object.isRequired, +}; + +export default withStyles(styles)(About); From bcb411546751806e84f1a9b36bdd49a7b19a8030 Mon Sep 17 00:00:00 2001 From: wildscotsmen Date: Mon, 10 Dec 2018 15:33:49 -0500 Subject: [PATCH 02/21] Fixed quiz answers. --- src/quiz/advancedQuiz.js | 2 +- src/quiz/intermediateQuiz.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/quiz/advancedQuiz.js b/src/quiz/advancedQuiz.js index a57db95..2d5e32a 100644 --- a/src/quiz/advancedQuiz.js +++ b/src/quiz/advancedQuiz.js @@ -111,7 +111,7 @@ const advancedQuiz = { "Eastern gray squirrel", "Red squirrel" ], - "correctAnswer": "1" + "correctAnswer": "3" }, { "question": What animal is this?

, diff --git a/src/quiz/intermediateQuiz.js b/src/quiz/intermediateQuiz.js index 348465a..436eeba 100644 --- a/src/quiz/intermediateQuiz.js +++ b/src/quiz/intermediateQuiz.js @@ -100,7 +100,7 @@ const intermediateQuiz = { "Common Grackle", "Common Raven" ], - "correctAnswer": "1" + "correctAnswer": "4" }, { "question": What animal is this?

, From df5052a9172af32927db84ff407ec6b90ab49cf5 Mon Sep 17 00:00:00 2001 From: ajmaley Date: Mon, 10 Dec 2018 16:09:30 -0500 Subject: [PATCH 03/21] Fixed collection bug issue. Bug was caused by ordering assumption I made. --- package-lock.json | 14 ++++----- package.json | 2 +- .../flamelink/FlameLinkCollection.js | 31 ++++++++++++------- src/pages/About.js | 2 +- 4 files changed, 29 insertions(+), 20 deletions(-) diff --git a/package-lock.json b/package-lock.json index 130377c..7f64291 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5679,7 +5679,7 @@ }, "core-js": { "version": "2.5.5", - "resolved": "http://registry.npmjs.org/core-js/-/core-js-2.5.5.tgz", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.5.tgz", "integrity": "sha1-sU3ek2xkDAV5prUMq8wTLdYSfjs=" }, "firebase": { @@ -12513,9 +12513,9 @@ } }, "react-cookie": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/react-cookie/-/react-cookie-3.0.7.tgz", - "integrity": "sha512-c4lGOqIPC54kUocE7kbuqZNeIdXtZGzXQMA7BSWhaJ/5tWeoW5fJ7mF/pR+rU5fYDF9kktTHCIbovwSsNYblOg==", + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/react-cookie/-/react-cookie-3.0.8.tgz", + "integrity": "sha512-Gdop2Cf2pBFA0r4L9l5DRghKsPVMNKRM3x2aeyJ4JSaENpWWPP4v9LJvvtxXs3AboOGCuMj19oUw04Z9cVQQTg==", "requires": { "@types/hoist-non-react-statics": "^3.0.1", "hoist-non-react-statics": "^3.0.0", @@ -12523,9 +12523,9 @@ }, "dependencies": { "hoist-non-react-statics": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.2.0.tgz", - "integrity": "sha512-3IascCRfaEkbmHjJnUxWSspIUE1okLPjGTMVXW8zraUo1t3yg1BadKAxAGILHwgoBzmMnzrgeeaDGBvpuPz6dA==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.2.1.tgz", + "integrity": "sha512-TFsu3TV3YLY+zFTZDrN8L2DTFanObwmBLpWvJs1qfUuEQ5bTAdFcwfx2T/bsCXfM9QHSLvjfP+nihEl0yvozxw==", "requires": { "react-is": "^16.3.2" } diff --git a/package.json b/package.json index af07e07..90499fb 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "material-ui-icons": "^1.0.0-beta.36", "moment": "^2.22.2", "react": "^16.5.1", - "react-cookie": "^3.0.7", + "react-cookie": "^3.0.8", "react-dom": "^16.5.1", "react-image-gallery": "^0.8.12", "react-quiz-component": "0.2.0", diff --git a/src/components/flamelink/FlameLinkCollection.js b/src/components/flamelink/FlameLinkCollection.js index 5ede9a0..228839c 100644 --- a/src/components/flamelink/FlameLinkCollection.js +++ b/src/components/flamelink/FlameLinkCollection.js @@ -1,24 +1,32 @@ import React, { Component } from 'react'; import flamelinkApp from '../../utilities/flamelink.js'; +import Grid from '@material-ui/core/Grid'; import FlameLinkCollectionComponentCreations from './FlameLinkCollectionComponentCreations'; class FlameLinkCollection extends Component { - state = { - schemaContent: '', - } + constructor(props) { + super(props); + + this.state = { + schemaContent: '', + } - componentDidMount() { flamelinkApp.content.get(this.props.schemaName) - .then(result => this.setState({ - schemaContent: result - })) - } + .then(result => this.setState({ + schemaContent: result + })) + } getCollectionContent(schemaData) { var arr2 = []; var collectionInfo = [schemaData, this.state.schemaContent]; for (var val in this.state.schemaContent) { - arr2[this.state.schemaContent[val]['order']] = val; + if ( this.state.schemaContent[val].hasOwnProperty('order') ) { + arr2[this.state.schemaContent[val]['order']] = val; + } + else{ + arr2.push(val); + } } return arr2.map(this.getCollectionComponentInfo, collectionInfo); } @@ -28,6 +36,7 @@ class FlameLinkCollection extends Component { for (var val in this[0]) { arr3.push(val); } + return } @@ -44,9 +53,9 @@ class FlameLinkCollection extends Component { render() { return ( -
+ {this.getCollectionContent(this.props.schemaData)} -
+ ); } } diff --git a/src/pages/About.js b/src/pages/About.js index f565d2e..801b3c7 100644 --- a/src/pages/About.js +++ b/src/pages/About.js @@ -16,7 +16,7 @@ const styles = theme => ({ class About extends Component { state = { researcherSchemaName: 'martenAbout', - developerSchemaName: 'martenAboutDev', + developerSchemaName: 'martenAboutDevelopers', researcherSchemaDetails: '', researcherSchemaType: '', developerSchemaDetails: '', From 37eba8454acc78ff9564f780322f2f48c4d80f71 Mon Sep 17 00:00:00 2001 From: WildScotsmen Date: Mon, 10 Dec 2018 16:57:13 -0500 Subject: [PATCH 04/21] Added summary. --- package-lock.json | 2 +- src/pages/About.js | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 7f64291..ae2271d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5679,7 +5679,7 @@ }, "core-js": { "version": "2.5.5", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.5.tgz", + "resolved": "http://registry.npmjs.org/core-js/-/core-js-2.5.5.tgz", "integrity": "sha1-sU3ek2xkDAV5prUMq8wTLdYSfjs=" }, "firebase": { diff --git a/src/pages/About.js b/src/pages/About.js index 801b3c7..7010f52 100644 --- a/src/pages/About.js +++ b/src/pages/About.js @@ -15,8 +15,11 @@ const styles = theme => ({ class About extends Component { state = { + summarySchemaName: 'martenAboutSummary', researcherSchemaName: 'martenAbout', developerSchemaName: 'martenAboutDevelopers', + summarySchemaDetails: '', + summarySchemaType: '', researcherSchemaDetails: '', researcherSchemaType: '', developerSchemaDetails: '', @@ -25,6 +28,18 @@ class About extends Component { componentDidMount() { document.title = 'Marten Tracker | About'; + + + // Pulling in schema details for summary + flamelinkApp.schemas.getFields(this.state.summarySchemaName, { fields: ['title', 'key', 'type', 'gridColumns', 'description', 'options'] }) + .then(result => this.setState({ + summarySchemaDetails: result + })) + + flamelinkApp.schemas.get(this.state.summarySchemaName) + .then(result => this.setState({ + summarySchemaType: result.type + })) // Pulling in schema details for researchers @@ -56,6 +71,8 @@ class About extends Component { return ( + Introduction + Researchers Developers From d879236e672da7cfc16ddf3c91af26781f8a9d23 Mon Sep 17 00:00:00 2001 From: WildScotsmen Date: Mon, 10 Dec 2018 17:25:42 -0500 Subject: [PATCH 05/21] Added paper to collections. --- .../FlameLinkCollectionComponentCreations.js | 35 +++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/src/components/flamelink/FlameLinkCollectionComponentCreations.js b/src/components/flamelink/FlameLinkCollectionComponentCreations.js index 1611c80..587913d 100644 --- a/src/components/flamelink/FlameLinkCollectionComponentCreations.js +++ b/src/components/flamelink/FlameLinkCollectionComponentCreations.js @@ -1,25 +1,48 @@ -import React, { Component} from 'react'; +import React, { Component } from 'react'; import Grid from '@material-ui/core/Grid'; import FlameLinkCollectionStructure from './FlameLinkCollectionStructure'; +import PropTypes from 'prop-types'; +import { withStyles } from '@material-ui/core/styles'; +import Paper from '@material-ui/core/Paper'; + +const styles = theme => ({ + root: { + ...theme.mixins.gutters(), + margin: theme.spacing.unit * 2, + paddingTop: theme.spacing.unit * 2, + paddingBottom: theme.spacing.unit * 2, + width: '100%' + }, +}); class FlameLinkCollectionComponentCreations extends Component { - createCollectionEntries(schemaData, schemaContent, arr){ + createCollectionEntries(schemaData, schemaContent, arr) { var collectionInfo = [schemaData, schemaContent]; return arr.map(this.createCollectionComponents, collectionInfo); } - createCollectionComponents(num){ - return + createCollectionComponents(num) { + return ( + + ); } render() { - return( + const { classes } = this.props; + + return ( + {this.createCollectionEntries(this.props.schemaData, this.props.schemaContent, this.props.arr)} + ); } } -export default FlameLinkCollectionComponentCreations; \ No newline at end of file +FlameLinkCollectionComponentCreations.propTypes = { + classes: PropTypes.object.isRequired, +}; + +export default withStyles(styles)(FlameLinkCollectionComponentCreations); \ No newline at end of file From ce2a1e8727d334a49a20c14f6fc162a604c976c6 Mon Sep 17 00:00:00 2001 From: Al Duncanson Date: Mon, 10 Dec 2018 21:50:46 -0500 Subject: [PATCH 06/21] small fixes and icons --- public/index.html | 1 - public/map-icons/cage.png | Bin 11968 -> 75097 bytes public/map-icons/other-icon.png | Bin 3765 -> 64816 bytes public/map-icons/paws.png | Bin 4215 -> 98829 bytes public/map-icons/photo-icon.png | Bin 23334 -> 93295 bytes public/map-icons/tire-icon.png | Bin 73969 -> 435665 bytes src/components/SightingMap.js | 4 +-- src/components/list/ViewSightings.js | 2 +- src/css/App.css | 39 +++++++++++++++++---------- 9 files changed, 28 insertions(+), 18 deletions(-) diff --git a/public/index.html b/public/index.html index d8401c9..d18ff7c 100644 --- a/public/index.html +++ b/public/index.html @@ -40,7 +40,6 @@ You need to enable JavaScript to run this app.
-