mirror of
https://gitlab.com/MrFry/qmining-page
synced 2026-04-28 19:27:36 +02:00
Feedback and test sender implement, minor fixes with links
This commit is contained in:
+49
-24
@@ -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>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user