diff --git a/app/components/layout.js b/app/components/layout.js
new file mode 100644
index 0000000..a06e29e
--- /dev/null
+++ b/app/components/layout.js
@@ -0,0 +1,13 @@
+import Head from 'next/head'
+
+export default function Layout({ children }) {
+ return (
+ <>
+
+ Warframe Center
+
+
+ {children}
+ >
+ )
+}
diff --git a/app/next.config.js b/app/next.config.js
index ba2dce6..b626ded 100644
--- a/app/next.config.js
+++ b/app/next.config.js
@@ -1,9 +1,9 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
- webpack: (config, { webpack }) => {
- return config
- },
+ // webpack: (config, { webpack }) => {
+ // return config
+ // },
}
module.exports = nextConfig
diff --git a/app/pages/_app.js b/app/pages/_app.js
index 7d02c4c..23da805 100644
--- a/app/pages/_app.js
+++ b/app/pages/_app.js
@@ -1,7 +1,12 @@
import '../styles/global.scss'
+import Layout from '../components/layout'
function MyApp({ Component, pageProps }) {
- return
+ return (
+
+
+
+ )
}
export default MyApp
diff --git a/app/pages/home/ItemRow.js b/app/pages/home/ItemRow.js
new file mode 100644
index 0000000..ca503bf
--- /dev/null
+++ b/app/pages/home/ItemRow.js
@@ -0,0 +1,18 @@
+import React from "react"
+
+export default class ItemRow extends React.Component {
+ constructor ({ scanResult }) {
+ super()
+ this.scanResult = scanResult
+ }
+
+ render () {
+ return (
+
+ | {this.scanResult.name} |
+ {this.scanResult.partsPrice} |
+ {this.scanResult.setPrice} |
+
+ )
+ }
+}
\ No newline at end of file
diff --git a/app/pages/home/Table.js b/app/pages/home/Table.js
new file mode 100644
index 0000000..55c1866
--- /dev/null
+++ b/app/pages/home/Table.js
@@ -0,0 +1,25 @@
+import React from "react"
+import ItemRow from './ItemRow'
+
+export default class Table extends React.Component {
+ constructor ({ scanResults }) {
+ super()
+ this.scanResults = scanResults
+ }
+
+ render () {
+ return (
+
+
+
+ {this.scanResults.map((scanResult) =>
+
+ )}
+
+
+ )
+ }
+}
diff --git a/app/pages/home/index.js b/app/pages/home/index.js
new file mode 100644
index 0000000..0761289
--- /dev/null
+++ b/app/pages/home/index.js
@@ -0,0 +1,39 @@
+import React from "react"
+import dbConnect from '../../lib/dbConnect'
+import { models } from 'shared-stuff'
+import Table from './Table'
+
+export default class Home extends React.Component {
+ constructor ({ scanResults }) {
+ super()
+ this.scanResults = scanResults
+ }
+
+ render () {
+ return (
+
+ )
+ }
+}
+
+export async function getServerSideProps() {
+ try {
+ await dbConnect()
+ const scanResults = await models.ScanResult.find({})
+
+ return {
+ props: {
+ scanResults: JSON.parse(JSON.stringify(scanResults))
+ },
+ }
+ } catch (e) {
+ console.error(e)
+ return {
+ props: {},
+ }
+ }
+}
diff --git a/app/pages/index.js b/app/pages/index.js
index 3549469..e3bcf5f 100644
--- a/app/pages/index.js
+++ b/app/pages/index.js
@@ -1,46 +1,4 @@
-import Head from 'next/head'
-import dbConnect from '../lib/dbConnect'
-import { models } from 'shared-stuff'
+import home from './home'
-export default function Home({ scanResults }) {
- return (
-
-
-
Warframe Center
-
-
-
-
-
- {scanResults.map((scanResult) => (
- -
-
{scanResult.name}
-
- ))}
-
-
-
-
-
- )
-}
-
-export async function getServerSideProps(context) {
- try {
- await dbConnect()
- const scanResults = await models.ScanResult.find({})
-
- return {
- props: {
- scanResults: JSON.parse(JSON.stringify(scanResults))
- },
- }
- } catch (e) {
- console.error(e)
- return {
- props: {},
- }
- }
-}
+export default home.Home
+export const getServerSideProps = home.getServerSideProps
diff --git a/gather/package.json b/gather/package.json
index 36382b4..b80663f 100644
--- a/gather/package.json
+++ b/gather/package.json
@@ -4,7 +4,7 @@
"description": "The background job that collects data and stores it in a DB",
"main": "index.js",
"scripts": {
- "test": "echo \"Error: no test specified\" && exit 1"
+ "start": "node src/index.js"
},
"author": "Anatoly Kopyl",
"license": "ISC",