Dealt with duplicate key error messages and galleries re-rendering when selecting teh quiz or galleries dropdowns
This commit is contained in:
parent
da80aeabfd
commit
848961dc25
|
@ -31,7 +31,7 @@ class FlameLinkCollectionGallery extends Component {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
global.mediaURLs = [];
|
global.mediaURLs = [];
|
||||||
global.mediaIDs = [];
|
//global.mediaIDs = [];
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
schemaDetails: '',
|
schemaDetails: '',
|
||||||
|
@ -60,25 +60,26 @@ class FlameLinkCollectionGallery extends Component {
|
||||||
|
|
||||||
getGalleryInfo(schemaDetails, schemaContent) {
|
getGalleryInfo(schemaDetails, schemaContent) {
|
||||||
var key;
|
var key;
|
||||||
var mediaNums = []
|
var mediaNums = [];
|
||||||
|
var mediaIDs = [];
|
||||||
|
|
||||||
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]);
|
mediaIDs.push(schemaContent[val1][key][val2]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (var val3 in global.mediaIDs) {
|
for (var val3 in mediaIDs) {
|
||||||
mediaNums.push(val3)
|
mediaNums.push(val3)
|
||||||
}
|
}
|
||||||
|
|
||||||
return mediaNums.map(this.createGallery);
|
return mediaNums.map(this.createGallery, mediaIDs);
|
||||||
}
|
}
|
||||||
|
|
||||||
createGallery = num => {
|
createGallery(num) {
|
||||||
return <FlameLinkCollectionGalleryContent num={num} key={global.mediaIDs[num]} />
|
return <FlameLinkCollectionGalleryContent mediaIDs={this} num={num} key={this[num]} />
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
@ -92,7 +93,7 @@ class FlameLinkCollectionGallery extends Component {
|
||||||
</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 key={Math.random()} />
|
<RenderGallery />
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
|
@ -12,7 +12,7 @@ class FlameLinkCollectionGalleryContent extends Component {
|
||||||
mediaURL: '',
|
mediaURL: '',
|
||||||
}
|
}
|
||||||
|
|
||||||
flamelinkApp.storage.getURL(global.mediaIDs[this.props.num])
|
flamelinkApp.storage.getURL(this.props.mediaIDs[this.props.num])
|
||||||
.then(url => this.setState({
|
.then(url => this.setState({
|
||||||
mediaURL: url
|
mediaURL: url
|
||||||
}))
|
}))
|
||||||
|
|
Loading…
Reference in New Issue