From 665bb67e33fd094f14a7e8aade5947b3ddb213fc Mon Sep 17 00:00:00 2001 From: William Chargin Date: Thu, 1 Nov 2018 13:30:36 -0700 Subject: [PATCH] homepage: add prototypes listing (#983) Test Plan: Apply the following patch: ```diff diff --git a/src/homepage/routeData.js b/src/homepage/routeData.js index 32d3eb65..aac7fc9a 100644 --- a/src/homepage/routeData.js +++ b/src/homepage/routeData.js @@ -38,7 +38,10 @@ const routeData /*: $ReadOnlyArray */ = [ path: "/prototypes/", contents: { type: "PAGE", - component: () => require("./PrototypesPage").default([]), + component: () => + require("./PrototypesPage").default([ + {owner: "sourcecred", name: "example-github"}, + ]), }, title: "SourceCred prototypes", navTitle: null, // for now ``` Then, load and see that there is an entry in the list, and that it links to . Note that clicking the link raises a console error because there is no such route. wchargin-branch: homepage-prototypes-page --- src/homepage/PrototypesPage.js | 39 ++++++++++++++++++++++++++++++++++ src/homepage/routeData.js | 9 ++++++++ 2 files changed, 48 insertions(+) create mode 100644 src/homepage/PrototypesPage.js diff --git a/src/homepage/PrototypesPage.js b/src/homepage/PrototypesPage.js new file mode 100644 index 0000000..07037be --- /dev/null +++ b/src/homepage/PrototypesPage.js @@ -0,0 +1,39 @@ +// @flow + +import stringify from "json-stable-stringify"; +import React, {type ComponentType} from "react"; + +import type {RepoIdRegistry} from "../explorer/repoIdRegistry"; +import Link from "../webutil/Link"; +import type {Assets} from "../webutil/assets"; + +export default function makePrototypesPage( + registry: RepoIdRegistry +): ComponentType<{|+assets: Assets|}> { + return class PrototypesPage extends React.Component<{|+assets: Assets|}> { + render() { + return ( +
+

Select a project:

+
    + {registry.map((x) => ( +
  • + + {`${x.owner}/${x.name}`} + +
  • + ))} +
+
+ ); + } + }; +} diff --git a/src/homepage/routeData.js b/src/homepage/routeData.js index 0ed964c..32d3eb6 100644 --- a/src/homepage/routeData.js +++ b/src/homepage/routeData.js @@ -34,6 +34,15 @@ const routeData /*: $ReadOnlyArray */ = [ title: "SourceCred", navTitle: "Home", }, + { + path: "/prototypes/", + contents: { + type: "PAGE", + component: () => require("./PrototypesPage").default([]), + }, + title: "SourceCred prototypes", + navTitle: null, // for now + }, { path: "/prototype/", contents: {