Fixed startup issue.

This commit is contained in:
wildscotsmen 2018-11-25 13:19:43 -05:00
parent 73db7e5074
commit 95143d8034
1 changed files with 42 additions and 43 deletions

View File

@ -9,22 +9,22 @@ import "react-image-gallery/styles/css/image-gallery.css";
import '../css/FlameLink.css'; import '../css/FlameLink.css';
const styles = theme => ({ const styles = theme => ({
flamelinkItem: { flamelinkItem: {
marginRight: 20, marginRight: 20,
marginLeft: 20, marginLeft: 20,
marginTop: 20, marginTop: 20,
}, },
flamelinkGallery: { flamelinkGallery: {
marginRight: "auto", marginRight: "auto",
marginLeft: "auto", marginLeft: "auto",
}, },
flamelinkGalleryContainer: { flamelinkGalleryContainer: {
backgroundColor: 'black', backgroundColor: 'black',
marginTop: 20, marginTop: 20,
}, },
}); });
class FlameLinkCollectionGallery extends Component { class FlameLinkCollectionGallery extends Component {
constructor(props) { constructor(props) {
@ -39,62 +39,61 @@ class FlameLinkCollectionGallery extends Component {
schemaDescription: '', schemaDescription: '',
} }
flamelinkApp.schemas.getFields(this.props.galleryName, { fields: [ 'title', 'key', 'type', 'gridColumns', 'description', 'options'] }) flamelinkApp.schemas.getFields(this.props.galleryName, { fields: ['title', 'key', 'type', 'gridColumns', 'description', 'options'] })
.then(result => this.setState({ .then(result => this.setState({
schemaDetails: result schemaDetails: result
})) }))
flamelinkApp.content.get(this.props.galleryName) flamelinkApp.content.get(this.props.galleryName)
.then(result => this.setState({ .then(result => this.setState({
schemaContent: result schemaContent: result
})) }))
if(this.props.showTitle === false){ if (this.props.showTitle === false) {
} } else {
else{
flamelinkApp.schemas.get(this.props.galleryName) flamelinkApp.schemas.get(this.props.galleryName)
.then(result => this.setState({ .then(result => this.setState({
schemaDescription: result.title schemaDescription: result.title
})) }))
} }
} }
getGalleryInfo(schemaDetails, schemaContent){ getGalleryInfo(schemaDetails, schemaContent) {
var key; var key;
var mediaNums = [] var mediaNums = []
for (var val in schemaDetails){ for (var val in schemaDetails) {
key = schemaDetails[val].key key = schemaDetails[val].key
} }
for (var val1 in schemaContent){ for (var val1 in schemaContent) {
for (var val2 in schemaContent[val1][key]){ for (var val2 in schemaContent[val1][key]) {
global.mediaIDs.push(schemaContent[val1][key][val2]); global.mediaIDs.push(schemaContent[val1][key][val2]);
} }
} }
for (var val3 in global.mediaIDs){ for (var val3 in global.mediaIDs) {
mediaNums.push(val3) mediaNums.push(val3)
} }
return mediaNums.map(this.createGallery); return mediaNums.map(this.createGallery);
} }
createGallery(num){ createGallery(num) {
return <FlameLinkCollectionGalleryContent num={num} key={global.mediaIDs[num]}/> return <FlameLinkCollectionGalleryContent num={num} key={global.mediaIDs[num]} />
} }
render() { render() {
const { classes } = this.props; const { classes } = this.props;
return( return (
<Grid container> <Grid container>
{this.getGalleryInfo(this.state.schemaDetails, this.state.schemaContent)} {this.getGalleryInfo(this.state.schemaDetails, this.state.schemaContent)}
<Typography variant='display3' className={classes.flamelinkItem}> <Typography variant='display3' className={classes.flamelinkItem}>
{this.state.schemaDescription} {this.state.schemaDescription}
</Typography> </Typography>
<Grid container className={classes.flamelinkGalleryContainer}> <Grid container className={classes.flamelinkGalleryContainer}>
<Grid item lg={8} md={8} sm={12} xs={12} className={classes.flamelinkGallery} > <Grid item lg={8} md={8} sm={12} xs={12} className={classes.flamelinkGallery} >
<RenderGallery/> <RenderGallery key={Math.random()} />
</Grid>
</Grid> </Grid>
</Grid> </Grid>
</Grid>
); );
} }
} }