diff --git a/src/plugins/artifact/artifactPlugin.js b/src/plugins/artifact/artifactPlugin.js new file mode 100644 index 0000000..1bdd6e9 --- /dev/null +++ b/src/plugins/artifact/artifactPlugin.js @@ -0,0 +1,18 @@ +// @flow + +export type ArtifactNodeID = string; +export type ArtifactNodePayload = {| + +name: string, +|}; + +export type NodePayload = ArtifactNodePayload; + +export type ArtifactEdgeID = {| + +src: string, + +dst: string, +|}; +export type ArtifactEdgePayload = {| + +weight: number, // non-negative +|}; + +export type EdgePayload = ArtifactEdgePayload; diff --git a/src/plugins/artifact/editor/App.js b/src/plugins/artifact/editor/App.js index 64b6c81..83c90ec 100644 --- a/src/plugins/artifact/editor/App.js +++ b/src/plugins/artifact/editor/App.js @@ -3,16 +3,35 @@ import React from "react"; import {StyleSheet, css} from "aphrodite/no-important"; +import {ArtifactList} from "./ArtifactList"; + type Props = {}; type State = {}; export default class App extends React.Component { render() { + function createSampleArtifact(name) { + const id = name.toLowerCase().replace(/[^a-z]/g, "-"); + return { + address: { + repositoryName: "sourcecred/devnull", + pluginName: "sourcecred/artifact-beta", + id, + }, + payload: {name}, + }; + } + const artifacts = [ + createSampleArtifact("Root"), + createSampleArtifact("Tooling"), + createSampleArtifact("Tests"), + ]; return (

Artifact editor

+
); } diff --git a/src/plugins/artifact/editor/ArtifactList.js b/src/plugins/artifact/editor/ArtifactList.js new file mode 100644 index 0000000..3be09a7 --- /dev/null +++ b/src/plugins/artifact/editor/ArtifactList.js @@ -0,0 +1,26 @@ +// @flow + +import React from "react"; + +import type {Node} from "../../../core/graph"; +import type {ArtifactNodePayload} from "../artifactPlugin"; + +type Props = { + artifacts: Node[], +}; +type State = {}; + +export class ArtifactList extends React.Component { + render() { + return ( +
+

Artifacts

+
    + {this.props.artifacts.map((x) => ( +
  • {x.payload.name}
  • + ))} +
+
+ ); + } +}