major tidy

This commit is contained in:
MrFry 2020-03-08 10:44:31 +01:00
parent 67b1fa2d37
commit c19f24de87
24 changed files with 339 additions and 17 deletions

View file

@ -4,7 +4,10 @@
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"dev": "next",
"build": "next build",
"start": "next start",
"export": "next build && next export"
},
"keywords": [],
"author": "",
@ -12,11 +15,7 @@
"dependencies": {
"next": "^9.2.2",
"react": "^16.13.0",
"react-dom": "^16.13.0"
},
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start"
"react-dom": "^16.13.0",
"unfetch": "^4.1.0"
}
}

View file

@ -1 +0,0 @@
export { default } from './AllQuestions'

View file

@ -1 +0,0 @@
export { default } from './Feedback'

View file

@ -1 +0,0 @@
export { default } from './HomeTab'

View file

@ -1 +0,0 @@
export { default } from './LoadingIndicator'

View file

@ -1 +0,0 @@
export { default } from './Manual'

View file

@ -1 +0,0 @@
export { default } from './Question'

View file

@ -1 +0,0 @@
export { default } from './Subject'

View file

@ -1 +0,0 @@
export { default } from './UserQuestions'

25
src/components/layout.js Normal file
View file

@ -0,0 +1,25 @@
export default function Layout (props) {
return (
<div>
<div className='sidebar'>
<div className='headercontainer'>
<span onClick={() => { console.log('CLOSE MENU') }} className='menuicon'>
<div />
<div />
<div />
</span>
<div className='sidebarheader' >
Frylabs
</div>
</div>
<a
className={'active'}
onClick={() => { console.log('a') }}
>aaaaaaaaaa</a>
</div>
<div>
{props.children}
</div>
</div>
)
}

4
src/constants.json Normal file
View file

@ -0,0 +1,4 @@
{
"serverUrl": "http://localhost:8080/",
"mobileWindowWidth": 700
}

223
src/defaultStyles.css Normal file
View file

@ -0,0 +1,223 @@
:root {
--text-color: #9999ff;
--bright-color: #f2f2f2;
--background-color: #212127;
--hoover-color: #202020;
}
body {
font: normal 14px Verdana;
color: #999999;
}
.link {
margin: 20px;
font-size: 20px;
}
.sidebarLink {
color: var(--text-color);
text-decoration: none;
}
.sidebar {
margin: 0;
padding: 0;
width: 200px;
background-color: #212127;
position: fixed;
height: 100%;
overflow: auto;
}
.sidebar a {
display: block;
color: black;
padding: 16px;
text-decoration: none;
color: var(--bright-color);
}
.sidebar a.active {
background-color: var(--text-color);
color: black;
}
.sidebar a:hover:not(.active) {
background-color: #555;
color: white;
}
div.content {
margin-left: 200px;
padding: 1px 16px;
}
.menuicon div {
height: 5px;
background-color: var(--bright-color);
margin: 0px 0;
display: none;
width: 30px;
}
.sidebarheader {
font-size: 40px;
color: var(--bright-color);
display: flex;
text-align: center;
}
.headercontainer {
display: flex;
flex-direction: row;
align-items: center;
flex-wrap: nowrap;
position: relative;
margin: 10px;
}
@media screen and (max-width: 700px) {
.sidebar {
width: 100%;
height: auto;
position: relative;
}
.sidebar a {float: left;}
div.content {margin-left: 0;}
}
@media screen and (max-width: 700px) {
.menuicon div {
display: block;
margin: 6px 0;
}
.sidebar a {
text-align: center;
float: none;
}
.menuicon {
display: inline;
}
.sidebaritemsconainer {
display: inline;
}
.sidebarheader {
position: absolute;
left: 50%;
top: 50%;
transform: translateX(-50%) translateY(-50%);
}
.codecontainer {
margin-left: 0px;
margin-right: 0px;
}
.sitedescription {
width: 100%;
margin: 0 auto;
}
}
.questionContainer {
margin: 10px;
}
.questionContainer:hover {
background-color: var(--hoover-color);
}
.question {
font-weight: bold;
font-size: 17px;
color: #ffffff;
}
.answer {
font-size: 15px;
}
.data {
font-size: 13px;
color: #a1a1a1;
}
.loadingindicator {
position: fixed;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
color: #fff;
font-size: 30px;
}
.uquestioncontainer {
margin: 5px;
}
.uquestioncontainer:hover {
background-color: var(--hoover-color);
}
.uquestionscontainer {
margin: 10px;
}
.uquestion {
font-weight: 'bold';
font-size: 16px;
color: #fff;
margin: 5px;
}
.uanswer {
margin: 5px;
}
.uquestionnumber {
color: #fff;
margin: 5px;
font-size: 20px;
}
.link {
margin: 10px;
}
.subjectSelector {
overflow: scroll;
height: 200px;
margin: 10px;
}
.subjItem {
font-size: 18px;
padding: 3px;
cursor: pointer;
}
.activeSubjItem {
background-color: var(--text-color);
color: black;
}
.searchBar {
margin: 10px;
width: 100%;
color: white;
background-color: #212127;
border: none;
font-size: 18px;
}
.subjItem:hover:not(.activeSubjItem) {
background-color: #555;
color: white;
}

21
src/pages/_app.js Normal file
View file

@ -0,0 +1,21 @@
// import App from 'next/app'
import '../defaultStyles.css'
function MyApp ({ Component, pageProps }) {
return <Component {...pageProps} />
}
// Only uncomment this method if you have blocking data requirements for
// every single page in your application. This disables the ability to
// perform automatic static optimization, causing every page in your app to
// be server-side rendered.
//
// MyApp.getInitialProps = async (appContext) => {
// // calls page's `getInitialProps` and fills `appProps.pageProps`
// const appProps = await App.getInitialProps(appContext);
//
// return { ...appProps }
// }
export default MyApp

22
src/pages/_document.js Normal file
View file

@ -0,0 +1,22 @@
import Document, { Html, Head, Main, NextScript } from 'next/document'
class MyDocument extends Document {
static async getInitialProps (ctx) {
const initialProps = await Document.getInitialProps(ctx)
return { ...initialProps }
}
render () {
return (
<Html>
<Head />
<body bgcolor='#212127'>
<Main />
<NextScript />
</body>
</Html>
)
}
}
export default MyDocument

35
src/pages/index.js Normal file
View file

@ -0,0 +1,35 @@
// 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'
import links from '../data/links.json'
// import constants from '../constants.json'
export default function Index (props) {
return (
<Layout>
<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>
</Layout>
)
}

View file

@ -1,8 +1,9 @@
import React, { PureComponent } from 'react'
import fetch from 'unfetch'
import LoadingIndicator from '../LoadingIndicator'
import LoadingIndicator from '../components/LoadingIndicator'
import constants from '../../constants.json'
import constants from '../constants.json'
class Manual extends PureComponent {
constructor (props) {