Initial feature commit.

This commit is contained in:
wildscotsmen 2018-12-10 13:58:01 -05:00
parent b3a819800c
commit 3feec479f2
4 changed files with 180 additions and 156 deletions

View File

@ -3,15 +3,12 @@ import flamelinkApp from '../../utilities/flamelink.js';
import FlameLinkCollectionComponentCreations from './FlameLinkCollectionComponentCreations'; import FlameLinkCollectionComponentCreations from './FlameLinkCollectionComponentCreations';
class FlameLinkCollection extends Component { class FlameLinkCollection extends Component {
constructor() { state = {
super();
this.state = {
schemaContent: '', schemaContent: '',
} }
flamelinkApp.content.get(global.schemaName) componentDidMount() {
flamelinkApp.content.get(this.props.schemaName)
.then(result => this.setState({ .then(result => this.setState({
schemaContent: result schemaContent: result
})) }))

View File

@ -15,16 +15,14 @@ const styles = theme => ({
}); });
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
})) }))

View File

@ -26,8 +26,8 @@ class FlameLinkComponentCreations extends Component {
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() {

View File

@ -1,43 +1,72 @@
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(); researcherSchemaName: 'martenAbout',
developerSchemaName: 'martenAboutDev',
global.schemaName = 'martenAbout'; researcherSchemaDetails: '',
researcherSchemaType: '',
this.state = { developerSchemaDetails: '',
schemaDetails: '', developerSchemaType: ''
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
}))
} }
componentDidMount() { componentDidMount() {
document.title = 'Marten Tracker | About'; 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() { 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}>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);