Move plugin choice from explorer to homepage (#979)
The explorer no longer ships with a set of default plugins. (This made an inappropriate dependency from explorer/ to plugins/, and complicated explorer's contract as a generic component.) Instead, the homepage module is responsible for choosing the plugins to display on the homepage. Test plan: `yarn test --full` passes, and `yarn start` reveals a functioning homepage and prototype.
This commit is contained in:
parent
de861d104a
commit
244c01d764
|
@ -8,7 +8,6 @@ import CheckedLocalStore from "../webutil/checkedLocalStore";
|
|||
import BrowserLocalStore from "../webutil/browserLocalStore";
|
||||
import Link from "../webutil/Link";
|
||||
|
||||
import {defaultStaticAdapters} from "./adapters/defaultPlugins";
|
||||
import {PagerankTable} from "./pagerankTable/Table";
|
||||
import type {WeightedTypes} from "../analysis/weights";
|
||||
import {defaultWeightsForAdapterSet} from "./weights/weights";
|
||||
|
@ -22,7 +21,10 @@ import {
|
|||
} from "./state";
|
||||
import {StaticAdapterSet} from "./adapters/adapterSet";
|
||||
|
||||
export default class AppPage extends React.Component<{|+assets: Assets|}> {
|
||||
export class AppPage extends React.Component<{|
|
||||
+assets: Assets,
|
||||
+adapters: StaticAdapterSet,
|
||||
|}> {
|
||||
static _LOCAL_STORE = new CheckedLocalStore(
|
||||
new BrowserLocalStore({
|
||||
version: "2",
|
||||
|
@ -35,7 +37,7 @@ export default class AppPage extends React.Component<{|+assets: Assets|}> {
|
|||
return (
|
||||
<App
|
||||
assets={this.props.assets}
|
||||
adapters={defaultStaticAdapters()}
|
||||
adapters={this.props.adapters}
|
||||
localStore={AppPage._LOCAL_STORE}
|
||||
/>
|
||||
);
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
// @flow
|
||||
|
||||
import {StaticAdapterSet} from "./adapterSet";
|
||||
import {StaticAppAdapter as GithubAdapter} from "../../plugins/github/appAdapter";
|
||||
import {StaticAppAdapter as GitAdapter} from "../../plugins/git/appAdapter";
|
||||
import {GithubGitGateway} from "../../plugins/github/githubGitGateway";
|
||||
|
||||
export function defaultStaticAdapters(): StaticAdapterSet {
|
||||
return new StaticAdapterSet([
|
||||
new GithubAdapter(),
|
||||
new GitAdapter(new GithubGitGateway()),
|
||||
]);
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
// @flow
|
||||
|
||||
import React from "react";
|
||||
|
||||
import type {Assets} from "../webutil/assets";
|
||||
import {StaticAdapterSet} from "../explorer/adapters/adapterSet";
|
||||
import {StaticAppAdapter as GithubAdapter} from "../plugins/github/appAdapter";
|
||||
import {StaticAppAdapter as GitAdapter} from "../plugins/git/appAdapter";
|
||||
import {GithubGitGateway} from "../plugins/github/githubGitGateway";
|
||||
import {AppPage} from "../explorer/App";
|
||||
|
||||
function homepageStaticAdapters(): StaticAdapterSet {
|
||||
return new StaticAdapterSet([
|
||||
new GithubAdapter(),
|
||||
new GitAdapter(new GithubGitGateway()),
|
||||
]);
|
||||
}
|
||||
|
||||
export default class HomepageExplorer extends React.Component<{|
|
||||
+assets: Assets,
|
||||
|}> {
|
||||
render() {
|
||||
return (
|
||||
<AppPage assets={this.props.assets} adapters={homepageStaticAdapters()} />
|
||||
);
|
||||
}
|
||||
}
|
|
@ -38,7 +38,7 @@ const routeData /*: $ReadOnlyArray<RouteDatum> */ = [
|
|||
path: "/prototype/",
|
||||
contents: {
|
||||
type: "PAGE",
|
||||
component: () => require("../explorer/App").default,
|
||||
component: () => require("./homepageExplorer").default,
|
||||
},
|
||||
title: "SourceCred prototype",
|
||||
navTitle: "Prototype",
|
||||
|
|
Loading…
Reference in New Issue