Initial feature commit.
This commit is contained in:
parent
b3a819800c
commit
3feec479f2
@ -3,15 +3,12 @@ import flamelinkApp from '../../utilities/flamelink.js';
|
||||
import FlameLinkCollectionComponentCreations from './FlameLinkCollectionComponentCreations';
|
||||
|
||||
class FlameLinkCollection extends Component {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
|
||||
this.state = {
|
||||
state = {
|
||||
schemaContent: '',
|
||||
}
|
||||
|
||||
flamelinkApp.content.get(global.schemaName)
|
||||
componentDidMount() {
|
||||
flamelinkApp.content.get(this.props.schemaName)
|
||||
.then(result => this.setState({
|
||||
schemaContent: result
|
||||
}))
|
||||
|
@ -15,16 +15,14 @@ const styles = theme => ({
|
||||
});
|
||||
|
||||
class FlameLinkCollectionStructure extends Component {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
global.mediaID = '';
|
||||
|
||||
this.state = {
|
||||
state = {
|
||||
schemaContent: '',
|
||||
}
|
||||
|
||||
flamelinkApp.content.get(global.schemaName)
|
||||
componentDidMount() {
|
||||
global.mediaID = '';
|
||||
|
||||
flamelinkApp.content.get(this.props.schemaName)
|
||||
.then(result => this.setState({
|
||||
schemaContent: result
|
||||
}))
|
||||
|
@ -26,8 +26,8 @@ class FlameLinkComponentCreations extends Component {
|
||||
return <FlameLinkStructure schemaData={this} field={this[num]} type={this[num].type} key={this[num].key} />
|
||||
}
|
||||
|
||||
createCollectionTypeSchemaComponents(schemaData){
|
||||
return <FlameLinkCollection schemaData={schemaData} />
|
||||
createCollectionTypeSchemaComponents = schemaData => {
|
||||
return <FlameLinkCollection schemaName={this.props.schemaName} schemaData={schemaData} />
|
||||
}
|
||||
|
||||
render() {
|
||||
|
@ -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 (
|
||||
<div>
|
||||
<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>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default About;
|
||||
About.propTypes = {
|
||||
classes: PropTypes.object.isRequired,
|
||||
};
|
||||
|
||||
export default withStyles(styles)(About);
|
||||
|
Loading…
x
Reference in New Issue
Block a user