Multiple style fixes, added top bar to layout

This commit is contained in:
mrfry 2021-05-26 18:36:57 +02:00
parent 53d955808a
commit 3a67f2a1aa
11 changed files with 314 additions and 351 deletions

View file

@ -1,5 +1,3 @@
// import App from 'next/app'
import React, { useState, useEffect } from 'react'
import Layout from '../components/layout'
@ -10,7 +8,7 @@ import constants from '../constants.json'
function MyApp({ Component, pageProps, router }) {
const [userId, setUserId] = useState()
const [motd, setMotd] = useState()
const [userSpecificMotd, setUserSpecificMotd] = useState()
const [unreads, setUnreads] = useState()
const getGlobalProps = () => {
fetch(`${constants.apiUrl}infos?motd=true`, {
@ -22,9 +20,21 @@ function MyApp({ Component, pageProps, router }) {
return resp.json()
})
.then((data) => {
setUserId(data.uid)
setMotd(data.motd)
setUserSpecificMotd(data.userSpecificMotd)
fetch(`${constants.apiUrl}hasNewMsg?userid=${data.uid}`, {
credentials: 'include',
Accept: 'application/json',
'Content-Type': 'application/json',
})
.then((resp) => {
return resp.json()
})
.then((hasNewMsg) => {
const res = { ...data, ...hasNewMsg }
setUserId(res.uid)
setMotd(res.motd)
setUnreads(res.unreads)
})
})
}
@ -33,9 +43,9 @@ function MyApp({ Component, pageProps, router }) {
}, [])
const globalData = {
userId,
motd,
userSpecificMotd,
userId: userId,
motd: motd,
unreads: unreads,
}
return (

View file

@ -1,4 +1,5 @@
import Document, { Html, Head, Main, NextScript } from 'next/document'
import React from 'react'
class MyDocument extends Document {
static async getInitialProps(ctx) {
@ -9,7 +10,12 @@ class MyDocument extends Document {
render() {
return (
<Html>
<Head />
<Head>
<meta
name="viewport"
content="initial-scale=0.6, width=device-width"
/>
</Head>
<body bgcolor="#222426">
<Main />
<NextScript />

View file

@ -301,13 +301,10 @@ export default function Index({ globalData }) {
const renderMotd = () => {
if (motd) {
return (
<div className={styles.motd_body}>
<div className={styles.motd}>
<div className={styles.title}>MOTD</div>
{motd ? (
<div
className={styles.motd}
dangerouslySetInnerHTML={{ __html: motd }}
/>
<div dangerouslySetInnerHTML={{ __html: motd }} />
) : (
<div>...</div>
)}
@ -324,7 +321,6 @@ export default function Index({ globalData }) {
<title>Qmining | Frylabs.net</title>
</Head>
{renderMotd()}
{/*{userSpecificMotd && renderUserSpecificMotd()} */}
<Sleep />
{renderNews()}
</div>

View file

@ -5,7 +5,16 @@
.motd {
text-align: center;
font-size: 20px;
margin: 5px;
border: 2px dashed var(--text-color);
padding-top: 13px;
padding-bottom: 15px;
padding-left: 5px;
padding-right: 5px;
margin-top: 18px;
margin-bottom: 30px;
margin-left: 5px;
margin-right: 5px;
}
.itemContainer {
@ -22,19 +31,6 @@
text-align: justify;
}
.motd_body {
border: 2px dashed var(--text-color);
padding-top: 13px;
padding-bottom: 15px;
padding-left: 5px;
padding-right: 5px;
margin-top: 18px;
margin-bottom: 30px;
margin-left: 5px;
margin-right: 5px;
font-size: 8px;
}
.title {
color: var(--text-color);
font-size: 32px;