mirror of
https://gitlab.com/MrFry/qmining-page
synced 2025-04-01 20:23:44 +02:00
Feedback and test sender implement, minor fixes with links
This commit is contained in:
parent
8a1149d223
commit
c5d6518ceb
11 changed files with 154 additions and 89 deletions
|
@ -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>
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue