Skip to content
Snippets Groups Projects
Commit ebe272fd authored by Maximilian Giller's avatar Maximilian Giller
Browse files

Did some type refactoring

parent c2882877
No related branches found
No related tags found
1 merge request!2Implemented editor in the react framework
Pipeline #56555 failed
......@@ -10,24 +10,20 @@ import { GraphRenderer } from "./graphrenderer";
import { SpaceSelect } from "./spaceselect";
import "./editor.css";
export class Editor extends React.PureComponent<
InferType<typeof Editor.propTypes>,
InferType<typeof Editor.stateTypes>
> {
static propTypes = {};
static stateTypes = {
state: State,
graph: Graph,
renderer: PropTypes.any,
};
type propTypes = any;
type stateTypes = {
state: State;
graph: Graph;
renderer: any;
};
export class Editor extends React.PureComponent<propTypes, stateTypes> {
// TODO: Not a long term solution!
public static globalState: State;
public static globalGraph: Graph;
public static globalRenderer: any;
constructor(props: InferType<typeof Editor.propTypes>) {
constructor(props: propTypes) {
super(props);
this.loadGraph = this.loadGraph.bind(this);
......
import React from "react";
import { ReactNode } from "react";
import ReactForceGraph2d from "react-force-graph-2d";
import { GraphData } from "../structures/graph/graph";
import "./graphrenderer.css";
type propTypes = {
graphData: { nodes: []; links: [] };
graphData: GraphData;
};
export class GraphRenderer extends React.Component<propTypes> {
......
......@@ -8,7 +8,7 @@ import { GraphElement } from "./graphelement";
const GRAPH_PARAMS = [...GLOBAL_PARAMS];
const GRAPH_DATA_PARAMS = ["nodes", "links", "types"];
type GraphData = { nodes: Node[]; links: Link[]; types: NodeType[] };
export type GraphData = { nodes: Node[]; links: Link[]; types: NodeType[] };
export class Graph extends ManagedData {
public data: GraphData;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment