mirror of
https://gitlab.com/MrFry/qmining-page
synced 2025-04-01 20:23:44 +02:00
major tidy
This commit is contained in:
parent
67b1fa2d37
commit
c19f24de87
24 changed files with 339 additions and 17 deletions
|
@ -1,99 +0,0 @@
|
|||
import React, { PureComponent } from 'react'
|
||||
|
||||
import LoadingIndicator from '../LoadingIndicator'
|
||||
import Subject from '../../components/Subject'
|
||||
|
||||
import constants from '../../constants.json'
|
||||
|
||||
class AllQuestions extends PureComponent {
|
||||
constructor (props) {
|
||||
super(props)
|
||||
|
||||
this.state = {
|
||||
loaded: false,
|
||||
activeSubjName: '',
|
||||
searchTerm: ''
|
||||
}
|
||||
|
||||
console.info('Fetching data')
|
||||
fetch(`${constants.serverUrl}data.json`) // eslint-disable-line
|
||||
.then((resp) => {
|
||||
return resp.json()
|
||||
})
|
||||
.then((data) => {
|
||||
this.data = data
|
||||
this.setState({
|
||||
loaded: true
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
onSubjSelect (name) {
|
||||
this.setState({
|
||||
activeSubjName: name
|
||||
})
|
||||
}
|
||||
|
||||
searchBarOnChange (e) {
|
||||
let text = e.target.value
|
||||
this.setState({
|
||||
searchTerm: text
|
||||
})
|
||||
}
|
||||
|
||||
render () {
|
||||
const { loaded, activeSubjName, searchTerm } = this.state
|
||||
|
||||
if (loaded) {
|
||||
let currSubj = this.data.Subjects.find((subj) => {
|
||||
return subj.Name === activeSubjName
|
||||
})
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div>
|
||||
<input
|
||||
placeholder='Keresés...'
|
||||
className='searchBar'
|
||||
type='text'
|
||||
value={searchTerm}
|
||||
onChange={this.searchBarOnChange.bind(this)}
|
||||
/>
|
||||
</div>
|
||||
<div className='subjectSelector'>
|
||||
{this.data.Subjects.map((subj, i) => {
|
||||
if (!subj.Name.toLowerCase().includes(searchTerm.toLowerCase())) {
|
||||
return null
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
className={activeSubjName === subj.Name
|
||||
? 'subjItem activeSubjItem'
|
||||
: 'subjItem'
|
||||
}
|
||||
key={i}
|
||||
onClick={() => this.onSubjSelect(subj.Name)}
|
||||
>
|
||||
{subj.Name}
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
<hr />
|
||||
<div>
|
||||
<Subject
|
||||
subj={currSubj}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
} else {
|
||||
return (
|
||||
<LoadingIndicator />
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default AllQuestions
|
|
@ -1 +0,0 @@
|
|||
export { default } from './AllQuestions'
|
|
@ -1,13 +0,0 @@
|
|||
import React, { PureComponent } from 'react'
|
||||
|
||||
class Feedback extends PureComponent {
|
||||
render () {
|
||||
return (
|
||||
<div>
|
||||
hello Feedback
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default Feedback
|
|
@ -1 +0,0 @@
|
|||
export { default } from './Feedback'
|
|
@ -1,29 +0,0 @@
|
|||
import React, { PureComponent } from 'react'
|
||||
|
||||
import links from './links.json'
|
||||
|
||||
class HomeTab extends PureComponent {
|
||||
render () {
|
||||
return (
|
||||
<div>
|
||||
{Object.keys(links).map((key) => {
|
||||
let link = links[key]
|
||||
return (
|
||||
<div
|
||||
className='link'
|
||||
key={key}
|
||||
>
|
||||
<a
|
||||
href={link.href}
|
||||
>
|
||||
{link.text}
|
||||
</a>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default HomeTab
|
|
@ -1 +0,0 @@
|
|||
export { default } from './HomeTab'
|
|
@ -1,18 +0,0 @@
|
|||
{
|
||||
"install": {
|
||||
"href": "/install",
|
||||
"text": "Install"
|
||||
},
|
||||
"server": {
|
||||
"href": "/servergit",
|
||||
"text": "Szerver repó"
|
||||
},
|
||||
"client": {
|
||||
"href": "/scriptgit",
|
||||
"text": "Script git"
|
||||
},
|
||||
"classes": {
|
||||
"href": "/classesgit",
|
||||
"text": "Classes git"
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
export { default } from './LoadingIndicator'
|
|
@ -1,48 +0,0 @@
|
|||
import React, { PureComponent } from 'react'
|
||||
|
||||
import LoadingIndicator from '../LoadingIndicator'
|
||||
|
||||
import constants from '../../constants.json'
|
||||
|
||||
class Manual extends PureComponent {
|
||||
constructor (props) {
|
||||
super(props)
|
||||
|
||||
this.state = {
|
||||
loaded: false
|
||||
}
|
||||
|
||||
console.info('Fetching manual')
|
||||
fetch(`${constants.serverUrl}manual`) // eslint-disable-line
|
||||
.then((resp) => {
|
||||
return resp.text()
|
||||
})
|
||||
.then((data) => {
|
||||
this.manual = {
|
||||
__html: data
|
||||
}
|
||||
|
||||
this.setState({
|
||||
loaded: true
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
render () {
|
||||
const { loaded } = this.state
|
||||
|
||||
if (loaded) {
|
||||
return (
|
||||
<div>
|
||||
<div dangerouslySetInnerHTML={this.manual} />
|
||||
</div>
|
||||
)
|
||||
} else {
|
||||
return (
|
||||
<LoadingIndicator />
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default Manual
|
|
@ -1 +0,0 @@
|
|||
export { default } from './Manual'
|
|
@ -1 +0,0 @@
|
|||
export { default } from './Question'
|
|
@ -1 +0,0 @@
|
|||
export { default } from './Subject'
|
|
@ -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
|
|
@ -1 +0,0 @@
|
|||
export { default } from './UserQuestions'
|
25
src/components/layout.js
Normal file
25
src/components/layout.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
export default function Layout (props) {
|
||||
return (
|
||||
<div>
|
||||
<div className='sidebar'>
|
||||
<div className='headercontainer'>
|
||||
<span onClick={() => { console.log('CLOSE MENU') }} className='menuicon'>
|
||||
<div />
|
||||
<div />
|
||||
<div />
|
||||
</span>
|
||||
<div className='sidebarheader' >
|
||||
Frylabs
|
||||
</div>
|
||||
</div>
|
||||
<a
|
||||
className={'active'}
|
||||
onClick={() => { console.log('a') }}
|
||||
>aaaaaaaaaa</a>
|
||||
</div>
|
||||
<div>
|
||||
{props.children}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue