Feedback and test sender implement, minor fixes with links

This commit is contained in:
MrFry 2020-03-15 10:53:28 +01:00
parent 8a1149d223
commit c5d6518ceb
11 changed files with 154 additions and 89 deletions

View file

@ -1,9 +1,14 @@
// import App from 'next/app'
import '../defaultStyles.css'
import Layout from '../components/layout'
function MyApp ({ Component, pageProps }) {
return <Component {...pageProps} />
return (
<Layout>
<Component {...pageProps} />
</Layout>
)
}
// Only uncomment this method if you have blocking data requirements for

View file

@ -4,7 +4,6 @@ import fetch from 'unfetch'
import LoadingIndicator from '../components/LoadingIndicator.js'
import Subject from '../components/Subject.js'
import SubjectSelector from '../components/SubjectSelector.js'
import Layout from '../components/layout'
import constants from '../constants.json'
@ -30,37 +29,33 @@ export default function AllQuestions (props) {
})
return (
<Layout currPageName='allQuestions' >
<div>
<div>
<div>
<input
placeholder='Keresés...'
className='searchBar'
type='text'
value={searchTerm}
onChange={(e) => { setSearchTerm(e.target.value) }}
/>
</div>
<SubjectSelector
data={data}
activeSubjName={activeSubjName}
searchTerm={searchTerm}
onSubjSelect={(subjName) => { setActiveSubjName(subjName) }}
<input
placeholder='Keresés...'
className='searchBar'
type='text'
value={searchTerm}
onChange={(e) => { setSearchTerm(e.target.value) }}
/>
<hr />
<div>
<Subject
subj={currSubj}
/>
</div>
</div>
</Layout>
<SubjectSelector
data={data}
activeSubjName={activeSubjName}
searchTerm={searchTerm}
onSubjSelect={(subjName) => { setActiveSubjName(subjName) }}
/>
<hr />
<div>
<Subject
subj={currSubj}
/>
</div>
</div>
)
} else {
return (
<Layout currPageName='allQuestions' >
<LoadingIndicator />
</Layout>
<LoadingIndicator />
)
}
}

View file

@ -1,7 +1,24 @@
import constants from '../constants.json'
export default function Feedback (props) {
// TODO: textarea style to css
// TODO: response to user that msg is sucessfully sent
return (
<div>
hello Feedback
<form action={constants.serverUrl + 'postfeedback'} method='post'>
<div>Észrevételek: (közeledő teszt miatti kérdés-karbantartás, bug, feature vagy egyéb dolog, ami nyomja a lelked)</div>
<textarea
type='text'
name='message_field'
style={{
width: '100%',
boxSizing: 'border-box',
height: '400px'
}}
/>
<div>Rengeteg spam-et kapok, nyugodtan küldd el ezerszer, akkor hátha észreveszem a spam között :)</div>
<button>Küldés</button>
</form>
</div>
)
}

View file

@ -1,28 +1,31 @@
import React, { PureComponent } from 'react'
import links from './links.json'
import constants from '../constants.json'
// TODO: aludni
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>
)
return (<div>HAAAAAAAAAA</div>)
// return (
// <div>
// {Object.keys(links).map((key) => {
// const link = links[key]
// return (
// <div
// className='link'
// key={key}
// >
// <a
// href={constants.serverUrl + link.href}
// >
// {link.text}
// </a>
// </div>
// )
// })}
// </div>
// )
}
}

View file

@ -1,35 +1,60 @@
// TODO: css remove unnecesarry stuff
// TODO: resizing
// TODO: fetch data only once?
// TODO: move manual to this module instead of api
// TODO: feedback tab
// TODO: motd
import Layout from '../components/layout'
// TODO: aludni
// TODO: fetch only once
import React, { useState, useEffect } from 'react'
import fetch from 'unfetch'
import links from '../data/links.json'
// import constants from '../constants.json'
import constants from '../constants.json'
export default function Index (props) {
return (
<Layout currPageName='index'>
const [motd, setMotd] = useState('loading...')
useEffect(() => {
console.info('Fetching data')
fetch(`${constants.serverUrl}motd`)
.then((resp) => {
return resp.text()
})
.then((data) => {
setMotd(data)
})
}, [])
const renderMotd = () => {
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 className='motdHeader'>
MOTD:
</div>
<div
className='motd'
dangerouslySetInnerHTML={{ __html: motd }}
/>
</div>
</Layout>
)
}
return (
<div>
{renderMotd()}
{Object.keys(links).map((key) => {
let link = links[key]
return (
<div
className='link'
key={key}
>
<a
href={constants.serverUrl + link.href}
>
{link.text}
</a>
</div>
)
})}
</div>
)
}

View file

@ -1,10 +1,9 @@
import Layout from '../components/layout'
export default function Manual (props) {
return (
<Layout currPageName='manual' >
<div>
{renderMaual()}
</Layout>
</div>
)
}

View file

@ -1,7 +1,6 @@
import React, { useState, useEffect } from 'react'
import LoadingIndicator from '../components/LoadingIndicator'
import Layout from '../components/layout'
import constants from '../constants.json'
@ -40,17 +39,13 @@ export default function UserQuestions (props) {
}).reverse()
return (
<Layout currPageName='UserQuestions' >
<div className='uquestionscontainer'>
{questions}
</div>
</Layout>
<div className='uquestionscontainer'>
{questions}
</div>
)
} else {
return (
<Layout currPageName='UserQuestions' >
<LoadingIndicator />
</Layout>
<LoadingIndicator />
)
}
}