utility-function-extractor/packages/webpage-legacy/pages/openphil-2018-ai-risk.js
2022-06-19 19:25:55 -04:00

32 lines
830 B
JavaScript

/* 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";
import ComparisonView from "../lib/comparisonView.js";
/* Definitions */
const elementsDocument = "../data/listOfOpenPhil2018AIRiskGrants.json";
/* React components */
export async function getStaticProps() {
const directory = path.join(process.cwd(), "pages");
let listOfElementsForView = JSON.parse(
fs.readFileSync(path.join(directory, elementsDocument), "utf8")
);
return {
props: {
listOfElementsForView,
},
};
}
// Main react component
export default function Home({ listOfElementsForView }) {
return <ComparisonView listOfElementsForView={listOfElementsForView} />;
}