hierarchical-estimates-visu.../pages/template.js

32 lines
791 B
JavaScript
Raw Normal View History

2022-06-17 17:44:08 +00:00
/* Notes */
// This function is just a simple wrapper around lib/comparisonView.
// Most of the time, I'll want to edit that instead
/* Imports */
import React from "react";
import fs from "fs";
import path from "path";
2022-06-18 18:39:54 +00:00
import { Homepage } from "../components/homepage.js";
2022-06-17 17:44:08 +00:00
/* Definitions */
2022-06-18 18:43:38 +00:00
const elementsDocument = "../data/listOfObjects.json";
2022-06-17 17:44:08 +00:00
/* React components */
export async function getStaticProps() {
const directory = path.join(process.cwd(), "pages");
2022-06-18 18:43:38 +00:00
let listOfElementsInit = JSON.parse(
2022-06-17 17:44:08 +00:00
fs.readFileSync(path.join(directory, elementsDocument), "utf8")
);
return {
props: {
2022-06-18 18:43:38 +00:00
listOfElementsInit,
2022-06-17 17:44:08 +00:00
},
};
}
// Main react component
2022-06-18 18:43:38 +00:00
export default function Home({ listOfElementsInit }) {
return <Homepage listOfElementsInit={listOfElementsInit} />;
2022-06-17 17:44:08 +00:00
}