2021-11-25 15:31:10 +00:00
|
|
|
/* Notes */
|
|
|
|
|
|
|
|
// This function is just a simple wrapper around lib/comparisonView.
|
|
|
|
// Most of the time, I'll want to edit that instead
|
2021-10-06 11:00:09 +00:00
|
|
|
|
|
|
|
/* Imports */
|
2021-11-25 15:31:10 +00:00
|
|
|
import React from "react";
|
2022-01-30 15:29:45 +00:00
|
|
|
import fs from "fs";
|
|
|
|
import path from "path";
|
|
|
|
import ComparisonView from "../lib/comparisonView.js";
|
2021-06-06 22:18:40 +00:00
|
|
|
|
2021-11-25 15:31:10 +00:00
|
|
|
/* Definitions */
|
2022-01-30 15:29:45 +00:00
|
|
|
const elementsDocument = "../data/listOfMoralGoods.json";
|
2021-06-07 14:01:15 +00:00
|
|
|
|
2021-06-10 21:52:33 +00:00
|
|
|
/* React components */
|
2021-06-07 11:16:28 +00:00
|
|
|
export async function getStaticProps() {
|
2022-01-30 15:29:45 +00:00
|
|
|
const directory = path.join(process.cwd(), "pages");
|
|
|
|
let listOfElementsForView = JSON.parse(
|
|
|
|
fs.readFileSync(path.join(directory, elementsDocument), "utf8")
|
|
|
|
);
|
2021-06-07 11:16:28 +00:00
|
|
|
return {
|
|
|
|
props: {
|
2022-01-30 15:29:45 +00:00
|
|
|
listOfElementsForView,
|
2021-06-07 11:16:28 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-06-10 21:52:33 +00:00
|
|
|
// Main react component
|
2021-11-25 15:31:10 +00:00
|
|
|
export default function Home({ listOfElementsForView }) {
|
2022-01-30 15:29:45 +00:00
|
|
|
return <ComparisonView listOfElementsForView={listOfElementsForView} />;
|
|
|
|
}
|
|
|
|
|