Sidebar links changes, getstaticprops tries

This commit is contained in:
mrfry 2020-12-21 10:22:50 +01:00
parent a13fee6f84
commit c6ba225fd8
8 changed files with 2193 additions and 4508 deletions

6627
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -14,7 +14,7 @@
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"eslint-plugin-react": "^7.21.5", "eslint-plugin-react": "^7.21.5",
"next": "^9.2.2", "next": "^10.0.3",
"react": "^16.13.0", "react": "^16.13.0",
"react-dom": "^16.13.0", "react-dom": "^16.13.0",
"unfetch": "^4.1.0" "unfetch": "^4.1.0"

View file

@ -43,27 +43,30 @@ export default function Layout(props) {
<div className="sidebarheader">Frylabs</div> <div className="sidebarheader">Frylabs</div>
</div> </div>
{sidebarOpen ? ( {sidebarOpen ? (
<div id="sideBarLinks"> <>
{Object.keys(tabs).map((key) => { <div id="sideBarLinks">
const item = tabs[key] {Object.keys(tabs).map((key) => {
return ( const item = tabs[key]
<Link href={item.href} key={key}> return (
<a <Link href={item.href} key={key}>
onClick={closeSideBar} <a
className={href.includes(key) ? 'active' : undefined} onClick={closeSideBar}
id={item.id || undefined} className={href.includes(key) ? 'active' : undefined}
> id={item.id || undefined}
{item.text} >
</a> {item.text}
</Link> </a>
) </Link>
})} )
<Link href={`/donate`}> })}
<a className="donate" onClick={closeSideBar} target="_blank"> <Link href={`/donate`}>
Donate <a className="donate" onClick={closeSideBar} target="_blank">
</a> Donate
</Link> </a>
</div> </Link>
</div>
<div className="userInfo">User # TODO</div>
</>
) : null} ) : null}
</div> </div>
<div className="content">{props.children}</div> <div className="content">{props.children}</div>

View file

@ -12,7 +12,7 @@ export default function Sidebar(props) {
onClose() onClose()
}} }}
> >
{'>'} {''}
</div> </div>
<div className={styles.content}>{props.children}</div> <div className={styles.content}>{props.children}</div>
</div> </div>

View file

@ -12,12 +12,14 @@
} }
.closeBorder { .closeBorder {
padding: 5px; font-size: 14px;
padding: 2px;
cursor: pointer; cursor: pointer;
display: flex; display: flex;
flex-flow: column; flex-flow: column;
justify-content: center; justify-content: center;
color: white; color: white;
background-color: #222;
} }
.closeBorder:hover { .closeBorder:hover {

View file

@ -1,6 +1,6 @@
{ {
"siteUrl": "https://qmining.frylabs.net/", "siteUrl": "https://qmining.frylabs.net/",
"apiUrl": "http://localhost:8080/", "apiUrl": "https://api.frylabs.net/",
"mobileWindowWidth": 700, "mobileWindowWidth": 700,
"maxQuestionsToRender": 250 "maxQuestionsToRender": 250
} }

View file

@ -8,7 +8,7 @@
"text": "Összes kérdés TXT" "text": "Összes kérdés TXT"
}, },
"data": { "data": {
"href": "/data.json", "href": "/TODOalldata",
"text": "Összes kérdés JSON" "text": "Összes kérdés JSON"
}, },
"irc": { "irc": {

View file

@ -1,5 +1,6 @@
// import App from 'next/app' // import App from 'next/app'
import React from 'react'
import '../defaultStyles.css' import '../defaultStyles.css'
import Layout from '../components/layout' import Layout from '../components/layout'
import constants from '../constants.json' import constants from '../constants.json'
@ -57,6 +58,7 @@ function fetchData() {
} }
function MyApp({ Component, pageProps, router }) { function MyApp({ Component, pageProps, router }) {
console.log(pageProps)
return ( return (
<Layout route={router.route}> <Layout route={router.route}>
<Component {...pageProps} router={router} getData={fetchData} /> <Component {...pageProps} router={router} getData={fetchData} />
@ -64,6 +66,21 @@ function MyApp({ Component, pageProps, router }) {
) )
} }
export async function getStaticProps() {
console.log('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
const res = await fetch('https://stuff.frylabs.net/asd.json', {
credentials: 'include',
})
const resp = await res.json()
console.log('aaaaaaaaaaaaa', resp)
return {
props: {
msg: 'aaaaa',
fetched: resp,
},
}
}
// Only uncomment this method if you have blocking data requirements for // Only uncomment this method if you have blocking data requirements for
// every single page in your application. This disables the ability to // every single page in your application. This disables the ability to
// perform automatic static optimization, causing every page in your app to // perform automatic static optimization, causing every page in your app to