major tidy

This commit is contained in:
MrFry 2020-03-08 10:44:31 +01:00
parent 67b1fa2d37
commit c19f24de87
24 changed files with 339 additions and 17 deletions

View file

@ -1,65 +0,0 @@
import React, { PureComponent } from 'react'
import LoadingIndicator from '../LoadingIndicator'
import constants from '../../constants.json'
class UserQuestions extends PureComponent {
constructor (props) {
super(props)
this.state = {
loaded: false
}
console.info('Fetching qa.json')
fetch(`${constants.serverUrl}qa.json`) // eslint-disable-line
.then((resp) => {
return resp.json()
})
.then((data) => {
this.qa = data
this.setState({
loaded: true
})
})
}
render () {
const { loaded } = this.state
if (loaded) {
let questions = Object.keys(this.qa).map((key, i) => {
let q = this.qa[key]
return (
<div key={key} className='uquestioncontainer'>
<div >
<div className='uquestionnumber'>
{key}:
</div>
<div className='uquestion'>
{q.q}
</div>
</div>
<div className='uanswer'>
{q.a}
</div>
</div>
)
}).reverse()
return (
<div className='uquestionscontainer'>
{questions}
</div>
)
} else {
return (
<LoadingIndicator />
)
}
}
}
export default UserQuestions