Home page and pw request page refactor

This commit is contained in:
mrfry 2020-11-17 12:48:05 +01:00
parent f159b9379c
commit 0ea9ecb5a3
6 changed files with 191 additions and 212 deletions

View file

@ -11,7 +11,7 @@ import styles from './index.module.css'
import links from '../data/links.json'
import constants from '../constants.json'
export default function Index(props) {
export default function Index({ router }) {
const [motd, setMotd] = useState('loading...')
const [userSpecificMotd, setUserSpecificMotd] = useState('loading...')
const [news, setNews] = useState(null)
@ -100,7 +100,14 @@ export default function Index(props) {
})
.reverse()
return <div className={styles.questionscontainer}>{questions}</div>
return (
<div>
<div className={styles.title}>News</div>
<hr />
<hr />
<div className={styles.questionscontainer}>{questions}</div>
</div>
)
} else {
return <LoadingIndicator />
}
@ -109,7 +116,9 @@ export default function Index(props) {
const renderMotd = () => {
return (
<div>
<div className={styles.motdHeader}>MOTD:</div>
<div className={styles.title}>MOTD</div>
<hr />
<hr />
<div
className={styles.motd}
dangerouslySetInnerHTML={{ __html: motd }}
@ -134,20 +143,26 @@ export default function Index(props) {
return (
<div>
{renderMotd()}
{userSpecificMotd && renderUserSpecificMotd()}
<center>
<div className={styles.buttonContainer}>
{Object.keys(links).map((key) => {
let link = links[key]
return (
<span className="link" key={key}>
<a href={link.href}>
<div className={styles.button}>{link.text}</div>
</a>
</span>
<div
className={styles.button}
key={key}
onClick={() => {
router.push(link.href)
}}
>
{link.text}
</div>
)
})}
</center>
</div>
<hr />
{renderMotd()}
{userSpecificMotd && renderUserSpecificMotd()}
<hr />
<Sleep />
{renderNews()}
</div>