Merge pull request #68 from alDuncanson/feature/developers-in-about
Feature/developers in about
This commit is contained in:
		
						commit
						fa84b6ce71
					
				
							
								
								
									
										12
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										12
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							@ -12513,9 +12513,9 @@
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "react-cookie": {
 | 
					    "react-cookie": {
 | 
				
			||||||
      "version": "3.0.7",
 | 
					      "version": "3.0.8",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/react-cookie/-/react-cookie-3.0.7.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/react-cookie/-/react-cookie-3.0.8.tgz",
 | 
				
			||||||
      "integrity": "sha512-c4lGOqIPC54kUocE7kbuqZNeIdXtZGzXQMA7BSWhaJ/5tWeoW5fJ7mF/pR+rU5fYDF9kktTHCIbovwSsNYblOg==",
 | 
					      "integrity": "sha512-Gdop2Cf2pBFA0r4L9l5DRghKsPVMNKRM3x2aeyJ4JSaENpWWPP4v9LJvvtxXs3AboOGCuMj19oUw04Z9cVQQTg==",
 | 
				
			||||||
      "requires": {
 | 
					      "requires": {
 | 
				
			||||||
        "@types/hoist-non-react-statics": "^3.0.1",
 | 
					        "@types/hoist-non-react-statics": "^3.0.1",
 | 
				
			||||||
        "hoist-non-react-statics": "^3.0.0",
 | 
					        "hoist-non-react-statics": "^3.0.0",
 | 
				
			||||||
@ -12523,9 +12523,9 @@
 | 
				
			|||||||
      },
 | 
					      },
 | 
				
			||||||
      "dependencies": {
 | 
					      "dependencies": {
 | 
				
			||||||
        "hoist-non-react-statics": {
 | 
					        "hoist-non-react-statics": {
 | 
				
			||||||
          "version": "3.2.0",
 | 
					          "version": "3.2.1",
 | 
				
			||||||
          "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.2.0.tgz",
 | 
					          "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.2.1.tgz",
 | 
				
			||||||
          "integrity": "sha512-3IascCRfaEkbmHjJnUxWSspIUE1okLPjGTMVXW8zraUo1t3yg1BadKAxAGILHwgoBzmMnzrgeeaDGBvpuPz6dA==",
 | 
					          "integrity": "sha512-TFsu3TV3YLY+zFTZDrN8L2DTFanObwmBLpWvJs1qfUuEQ5bTAdFcwfx2T/bsCXfM9QHSLvjfP+nihEl0yvozxw==",
 | 
				
			||||||
          "requires": {
 | 
					          "requires": {
 | 
				
			||||||
            "react-is": "^16.3.2"
 | 
					            "react-is": "^16.3.2"
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
 | 
				
			|||||||
@ -17,7 +17,7 @@
 | 
				
			|||||||
    "material-ui-icons": "^1.0.0-beta.36",
 | 
					    "material-ui-icons": "^1.0.0-beta.36",
 | 
				
			||||||
    "moment": "^2.22.2",
 | 
					    "moment": "^2.22.2",
 | 
				
			||||||
    "react": "^16.5.1",
 | 
					    "react": "^16.5.1",
 | 
				
			||||||
    "react-cookie": "^3.0.7",
 | 
					    "react-cookie": "^3.0.8",
 | 
				
			||||||
    "react-dom": "^16.5.1",
 | 
					    "react-dom": "^16.5.1",
 | 
				
			||||||
    "react-image-gallery": "^0.8.12",
 | 
					    "react-image-gallery": "^0.8.12",
 | 
				
			||||||
    "react-quiz-component": "0.2.0",
 | 
					    "react-quiz-component": "0.2.0",
 | 
				
			||||||
 | 
				
			|||||||
@ -1,55 +1,61 @@
 | 
				
			|||||||
import React, { Component} from 'react';
 | 
					import React, { Component } from 'react';
 | 
				
			||||||
import flamelinkApp from '../../utilities/flamelink.js';
 | 
					import flamelinkApp from '../../utilities/flamelink.js';
 | 
				
			||||||
 | 
					import Grid from '@material-ui/core/Grid';
 | 
				
			||||||
import FlameLinkCollectionComponentCreations from './FlameLinkCollectionComponentCreations';
 | 
					import FlameLinkCollectionComponentCreations from './FlameLinkCollectionComponentCreations';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class FlameLinkCollection extends Component {
 | 
					class FlameLinkCollection extends Component {
 | 
				
			||||||
    constructor() {
 | 
					    constructor(props) {
 | 
				
			||||||
        super();
 | 
					        super(props);
 | 
				
			||||||
        
 | 
					 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        this.state = {
 | 
					        this.state = {
 | 
				
			||||||
          schemaContent: '',
 | 
					          schemaContent: '',
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        flamelinkApp.content.get(global.schemaName)
 | 
					        flamelinkApp.content.get(this.props.schemaName)
 | 
				
			||||||
        .then(result => this.setState({
 | 
					        .then(result => this.setState({
 | 
				
			||||||
          schemaContent: result
 | 
					          schemaContent: result
 | 
				
			||||||
        }))
 | 
					        }))
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    getCollectionContent(schemaData){
 | 
					    getCollectionContent(schemaData) {
 | 
				
			||||||
        var arr2 = [];
 | 
					        var arr2 = [];
 | 
				
			||||||
        var collectionInfo = [schemaData, this.state.schemaContent];
 | 
					        var collectionInfo = [schemaData, this.state.schemaContent];
 | 
				
			||||||
        for (var val in this.state.schemaContent){
 | 
					        for (var val in this.state.schemaContent) {
 | 
				
			||||||
 | 
					            if ( this.state.schemaContent[val].hasOwnProperty('order') ) {   
 | 
				
			||||||
                arr2[this.state.schemaContent[val]['order']] = val;
 | 
					                arr2[this.state.schemaContent[val]['order']] = val;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					            else{
 | 
				
			||||||
 | 
					                arr2.push(val);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        return arr2.map(this.getCollectionComponentInfo, collectionInfo);
 | 
					        return arr2.map(this.getCollectionComponentInfo, collectionInfo);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    getCollectionComponentInfo(num){
 | 
					    getCollectionComponentInfo(num) {
 | 
				
			||||||
        var arr3 = [];
 | 
					        var arr3 = [];
 | 
				
			||||||
        for (var val in this[0]){
 | 
					        for (var val in this[0]) {
 | 
				
			||||||
            arr3.push(val);
 | 
					            arr3.push(val);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
        return <FlameLinkCollectionComponentCreations schemaData={this[0]} schemaContent={this[1][num]} arr={arr3} key={num} />
 | 
					        return <FlameLinkCollectionComponentCreations schemaData={this[0]} schemaContent={this[1][num]} arr={arr3} key={num} />
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    countProperties(obj) {
 | 
					    countProperties(obj) {
 | 
				
			||||||
        var count = 0;
 | 
					        var count = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for(var prop in obj) {
 | 
					        for (var prop in obj) {
 | 
				
			||||||
        if(obj.hasOwnProperty(prop))
 | 
					            if (obj.hasOwnProperty(prop))
 | 
				
			||||||
                ++count;
 | 
					                ++count;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return count;
 | 
					        return count;
 | 
				
			||||||
}
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    render() {
 | 
					    render() {
 | 
				
			||||||
        return(
 | 
					        return (
 | 
				
			||||||
            <div>
 | 
					            <Grid container>
 | 
				
			||||||
                {this.getCollectionContent(this.props.schemaData)}
 | 
					                {this.getCollectionContent(this.props.schemaData)}
 | 
				
			||||||
            </div>
 | 
					            </Grid>
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,25 +1,48 @@
 | 
				
			|||||||
import React, { Component} from 'react';
 | 
					import React, { Component } from 'react';
 | 
				
			||||||
import Grid from '@material-ui/core/Grid';
 | 
					import Grid from '@material-ui/core/Grid';
 | 
				
			||||||
import FlameLinkCollectionStructure from './FlameLinkCollectionStructure';
 | 
					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 {
 | 
					class FlameLinkCollectionComponentCreations extends Component {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    createCollectionEntries(schemaData, schemaContent, arr){
 | 
					    createCollectionEntries(schemaData, schemaContent, arr) {
 | 
				
			||||||
        var collectionInfo = [schemaData, schemaContent];
 | 
					        var collectionInfo = [schemaData, schemaContent];
 | 
				
			||||||
        return arr.map(this.createCollectionComponents, collectionInfo);
 | 
					        return arr.map(this.createCollectionComponents, collectionInfo);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    createCollectionComponents(num){
 | 
					    createCollectionComponents(num) {
 | 
				
			||||||
        return <FlameLinkCollectionStructure schemaData={this[0]} schemaContent={this[1]} field={this[0][num]} type={this[0][num].type} key={this[0][num].key} />
 | 
					        return (
 | 
				
			||||||
 | 
					            <FlameLinkCollectionStructure schemaData={this[0]} schemaContent={this[1]} field={this[0][num]} type={this[0][num].type} key={this[0][num].key} />
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    render() {
 | 
					    render() {
 | 
				
			||||||
        return(
 | 
					        const { classes } = this.props;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return (
 | 
				
			||||||
 | 
					            <Paper className={classes.root} elevation={4}>
 | 
				
			||||||
                <Grid container>
 | 
					                <Grid container>
 | 
				
			||||||
                    {this.createCollectionEntries(this.props.schemaData, this.props.schemaContent, this.props.arr)}
 | 
					                    {this.createCollectionEntries(this.props.schemaData, this.props.schemaContent, this.props.arr)}
 | 
				
			||||||
                </Grid>
 | 
					                </Grid>
 | 
				
			||||||
 | 
					            </Paper>
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default FlameLinkCollectionComponentCreations;
 | 
					FlameLinkCollectionComponentCreations.propTypes = {
 | 
				
			||||||
 | 
					    classes: PropTypes.object.isRequired,
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export default withStyles(styles)(FlameLinkCollectionComponentCreations);
 | 
				
			||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
import React, { Component} from 'react';
 | 
					import React, { Component } from 'react';
 | 
				
			||||||
import Grid from '@material-ui/core/Grid';
 | 
					import Grid from '@material-ui/core/Grid';
 | 
				
			||||||
import Typography from '@material-ui/core/Typography';
 | 
					import Typography from '@material-ui/core/Typography';
 | 
				
			||||||
import { withStyles } from '@material-ui/core/styles';
 | 
					import { withStyles } from '@material-ui/core/styles';
 | 
				
			||||||
@ -12,69 +12,67 @@ const styles = theme => ({
 | 
				
			|||||||
        paddingLeft: 20,
 | 
					        paddingLeft: 20,
 | 
				
			||||||
        paddingTop: 20,
 | 
					        paddingTop: 20,
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    });
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class FlameLinkCollectionStructure extends Component {
 | 
					class FlameLinkCollectionStructure extends Component {
 | 
				
			||||||
    constructor() {
 | 
					    state = {
 | 
				
			||||||
        super();
 | 
					 | 
				
			||||||
        
 | 
					 | 
				
			||||||
        global.mediaID = '';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        this.state = {
 | 
					 | 
				
			||||||
        schemaContent: '',
 | 
					        schemaContent: '',
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        flamelinkApp.content.get(global.schemaName)
 | 
					    componentDidMount() {
 | 
				
			||||||
 | 
					        global.mediaID = '';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        flamelinkApp.content.get(this.props.schemaName)
 | 
				
			||||||
            .then(result => this.setState({
 | 
					            .then(result => this.setState({
 | 
				
			||||||
                schemaContent: result
 | 
					                schemaContent: result
 | 
				
			||||||
            }))
 | 
					            }))
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    getContent(content, field, key, type, description){
 | 
					    getContent(content, field, key, type, description) {
 | 
				
			||||||
        if (type === 'text'){
 | 
					        if (type === 'text') {
 | 
				
			||||||
                if(description === 'h1'){
 | 
					            if (description === 'h1') {
 | 
				
			||||||
                return (
 | 
					                return (
 | 
				
			||||||
                    <Typography variant='display4' id={key}>
 | 
					                    <Typography variant='display4' id={key}>
 | 
				
			||||||
                        {content[key]}
 | 
					                        {content[key]}
 | 
				
			||||||
                    </Typography>
 | 
					                    </Typography>
 | 
				
			||||||
                )
 | 
					                )
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
                if(description === 'h2'){
 | 
					            if (description === 'h2') {
 | 
				
			||||||
                return (
 | 
					                return (
 | 
				
			||||||
                    <Typography variant='display3' id={key}>
 | 
					                    <Typography variant='display3' id={key}>
 | 
				
			||||||
                        {content[key]}
 | 
					                        {content[key]}
 | 
				
			||||||
                    </Typography>
 | 
					                    </Typography>
 | 
				
			||||||
                )
 | 
					                )
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
                if(description === 'h3'){
 | 
					            if (description === 'h3') {
 | 
				
			||||||
                return (
 | 
					                return (
 | 
				
			||||||
                    <Typography variant='display2' id={key}>
 | 
					                    <Typography variant='display2' id={key}>
 | 
				
			||||||
                        {content[key]}
 | 
					                        {content[key]}
 | 
				
			||||||
                    </Typography>
 | 
					                    </Typography>
 | 
				
			||||||
                )
 | 
					                )
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
                if(description === 'h4'){
 | 
					            if (description === 'h4') {
 | 
				
			||||||
                return (
 | 
					                return (
 | 
				
			||||||
                    <Typography variant='display1' id={key}>
 | 
					                    <Typography variant='display1' id={key}>
 | 
				
			||||||
                        {content[key]}
 | 
					                        {content[key]}
 | 
				
			||||||
                    </Typography>
 | 
					                    </Typography>
 | 
				
			||||||
                )
 | 
					                )
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
                if(description === 'h5'){
 | 
					            if (description === 'h5') {
 | 
				
			||||||
                return (
 | 
					                return (
 | 
				
			||||||
                    <Typography variant='headline' id={key}>
 | 
					                    <Typography variant='headline' id={key}>
 | 
				
			||||||
                        {content[key]}
 | 
					                        {content[key]}
 | 
				
			||||||
                    </Typography>
 | 
					                    </Typography>
 | 
				
			||||||
                )
 | 
					                )
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
                if(description === 'h6'){
 | 
					            if (description === 'h6') {
 | 
				
			||||||
                return (
 | 
					                return (
 | 
				
			||||||
                    <Typography variant='title' id={key}>
 | 
					                    <Typography variant='title' id={key}>
 | 
				
			||||||
                        {content[key]}
 | 
					                        {content[key]}
 | 
				
			||||||
                    </Typography>
 | 
					                    </Typography>
 | 
				
			||||||
                )
 | 
					                )
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
                else{
 | 
					            else {
 | 
				
			||||||
                return (
 | 
					                return (
 | 
				
			||||||
                    <Typography variant='body2' component="p" id={key}>
 | 
					                    <Typography variant='body2' component="p" id={key}>
 | 
				
			||||||
                        {content[key]}
 | 
					                        {content[key]}
 | 
				
			||||||
@ -82,25 +80,25 @@ class FlameLinkCollectionStructure extends Component {
 | 
				
			|||||||
                )
 | 
					                )
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
            if(type === 'textarea'){
 | 
					        if (type === 'textarea') {
 | 
				
			||||||
            return (
 | 
					            return (
 | 
				
			||||||
                <Typography variant='body2' component="p" id={key}>
 | 
					                <Typography variant='body2' component="p" id={key}>
 | 
				
			||||||
                    {content[key]}
 | 
					                    {content[key]}
 | 
				
			||||||
                </Typography>
 | 
					                </Typography>
 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
            if (type === 'media'){
 | 
					        if (type === 'media') {
 | 
				
			||||||
                for (var val in content[key]){
 | 
					            for (var val in content[key]) {
 | 
				
			||||||
                global.mediaID = content[key][val];
 | 
					                global.mediaID = content[key][val];
 | 
				
			||||||
                    return <FlameLinkImage/>
 | 
					                return <FlameLinkImage />
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
            if (type === 'fieldset'){
 | 
					        if (type === 'fieldset') {
 | 
				
			||||||
                if(content === ''){
 | 
					            if (content === '') {
 | 
				
			||||||
                return
 | 
					                return
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
                else{
 | 
					            else {
 | 
				
			||||||
                    return <FlameLinkFieldSet field={content[key]} field2={field.options}/>
 | 
					                return <FlameLinkFieldSet field={content[key]} field2={field.options} />
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -112,7 +110,7 @@ class FlameLinkCollectionStructure extends Component {
 | 
				
			|||||||
        const md = this.props.field.gridColumns.md;
 | 
					        const md = this.props.field.gridColumns.md;
 | 
				
			||||||
        const sm = this.props.field.gridColumns.sm;
 | 
					        const sm = this.props.field.gridColumns.sm;
 | 
				
			||||||
        const xs = this.props.field.gridColumns.xs;
 | 
					        const xs = this.props.field.gridColumns.xs;
 | 
				
			||||||
        return(
 | 
					        return (
 | 
				
			||||||
            <Grid item lg={lg} md={md} sm={sm} xs={xs} className={classes.flamelinkItem}>
 | 
					            <Grid item lg={lg} md={md} sm={sm} xs={xs} className={classes.flamelinkItem}>
 | 
				
			||||||
                {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)}
 | 
				
			||||||
            </Grid>
 | 
					            </Grid>
 | 
				
			||||||
 | 
				
			|||||||
@ -1,37 +1,37 @@
 | 
				
			|||||||
import React, { Component} from 'react';
 | 
					import React, { Component } from 'react';
 | 
				
			||||||
import FlameLinkStructure from './FlameLinkStructure';
 | 
					import FlameLinkStructure from './FlameLinkStructure';
 | 
				
			||||||
import FlameLinkCollection from './FlameLinkCollection';
 | 
					import FlameLinkCollection from './FlameLinkCollection';
 | 
				
			||||||
import Grid from '@material-ui/core/Grid';
 | 
					import Grid from '@material-ui/core/Grid';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class FlameLinkComponentCreations extends Component {
 | 
					class FlameLinkComponentCreations extends Component {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    getSchemaFieldData(schemaData, schemaType){
 | 
					    getSchemaFieldData(schemaData, schemaType) {
 | 
				
			||||||
        var arr = [];
 | 
					        var arr = [];
 | 
				
			||||||
        for (var val in schemaData){
 | 
					        for (var val in schemaData) {
 | 
				
			||||||
            arr.push(val);
 | 
					            arr.push(val);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if(schemaType === 'single'){
 | 
					        if (schemaType === 'single') {
 | 
				
			||||||
            return arr.map(this.createSingleTypeSchemaComponents, schemaData);
 | 
					            return arr.map(this.createSingleTypeSchemaComponents, schemaData);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if(schemaType === 'collection'){
 | 
					        if (schemaType === 'collection') {
 | 
				
			||||||
            return this.createCollectionTypeSchemaComponents(schemaData);
 | 
					            return this.createCollectionTypeSchemaComponents(schemaData);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        else{
 | 
					        else {
 | 
				
			||||||
            return
 | 
					            return
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    createSingleTypeSchemaComponents(num){
 | 
					    createSingleTypeSchemaComponents(num) {
 | 
				
			||||||
        return <FlameLinkStructure schemaData={this} field={this[num]} type={this[num].type} key={this[num].key} />
 | 
					        return <FlameLinkStructure schemaData={this} field={this[num]} type={this[num].type} key={this[num].key} />
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    createCollectionTypeSchemaComponents(schemaData){  
 | 
					    createCollectionTypeSchemaComponents = schemaData => {
 | 
				
			||||||
        return <FlameLinkCollection schemaData={schemaData} />
 | 
					        return <FlameLinkCollection schemaName={this.props.schemaName} schemaData={schemaData} />
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    render() {
 | 
					    render() {
 | 
				
			||||||
        return(
 | 
					        return (
 | 
				
			||||||
            <Grid container>
 | 
					            <Grid container>
 | 
				
			||||||
                {this.getSchemaFieldData(this.props.schemaDetails, this.props.schemaType)}
 | 
					                {this.getSchemaFieldData(this.props.schemaDetails, this.props.schemaType)}
 | 
				
			||||||
            </Grid>
 | 
					            </Grid>
 | 
				
			||||||
 | 
				
			|||||||
@ -1,43 +1,89 @@
 | 
				
			|||||||
import React, { Component, Fragment } from 'react';
 | 
					import React, { Component, Fragment } from 'react';
 | 
				
			||||||
import FlameLinkComponentCreations from '../components/flamelink/FlameLinkComponentCreations';
 | 
					import FlameLinkComponentCreations from '../components/flamelink/FlameLinkComponentCreations';
 | 
				
			||||||
import flamelinkApp from '../utilities/flamelink.js';
 | 
					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 {
 | 
					class About extends Component {
 | 
				
			||||||
    constructor() {
 | 
					    state = {
 | 
				
			||||||
        super();
 | 
					        summarySchemaName: 'martenAboutSummary',
 | 
				
			||||||
 | 
					        researcherSchemaName: 'martenAbout',
 | 
				
			||||||
        global.schemaName = 'martenAbout';
 | 
					        developerSchemaName: 'martenAboutDevelopers',
 | 
				
			||||||
 | 
					        summarySchemaDetails: '',
 | 
				
			||||||
        this.state = {
 | 
					        summarySchemaType: '',
 | 
				
			||||||
          schemaDetails: '',
 | 
					        researcherSchemaDetails: '',
 | 
				
			||||||
          schemaType: '',
 | 
					        researcherSchemaType: '',
 | 
				
			||||||
        }
 | 
					        developerSchemaDetails: '',
 | 
				
			||||||
 | 
					        developerSchemaType: ''
 | 
				
			||||||
        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
 | 
					 | 
				
			||||||
        }))
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    componentDidMount() {
 | 
					    componentDidMount() {
 | 
				
			||||||
        document.title = 'Marten Tracker | About';
 | 
					        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
 | 
				
			||||||
 | 
					        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() {
 | 
					    render() {
 | 
				
			||||||
 | 
					        const { classes } = this.props;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return (
 | 
					        return (
 | 
				
			||||||
            <div>
 | 
					 | 
				
			||||||
            <Fragment>
 | 
					            <Fragment>
 | 
				
			||||||
                    <FlameLinkComponentCreations schemaDetails = {this.state.schemaDetails} schemaType = {this.state.schemaType}/>
 | 
					                <Typography variant="display1" className={classes.header}>Introduction</Typography>
 | 
				
			||||||
 | 
					                <FlameLinkComponentCreations schemaDetails={this.state.summarySchemaDetails} schemaType={this.state.summarySchemaType} schemaName={this.state.summarySchemaName} />
 | 
				
			||||||
 | 
					                <Typography variant="display1" className={classes.header}>Researchers</Typography>
 | 
				
			||||||
 | 
					                <FlameLinkComponentCreations schemaDetails={this.state.researcherSchemaDetails} schemaType={this.state.researcherSchemaType} schemaName={this.state.researcherSchemaName} />
 | 
				
			||||||
 | 
					                <Typography variant="display1" className={classes.header}>Developers</Typography>
 | 
				
			||||||
 | 
					                <FlameLinkComponentCreations schemaDetails={this.state.developerSchemaDetails} schemaType={this.state.developerSchemaType} schemaName={this.state.developerSchemaName} />
 | 
				
			||||||
            </Fragment>
 | 
					            </Fragment>
 | 
				
			||||||
            </div>
 | 
					 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default About;
 | 
					About.propTypes = {
 | 
				
			||||||
 | 
					    classes: PropTypes.object.isRequired,
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export default withStyles(styles)(About);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user