Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

Commit

Permalink
Merge branch 'master' into Dokumenations-Anzeige-Schoen-Machen
Browse files Browse the repository at this point in the history
  • Loading branch information
paul0314 authored Jun 4, 2021
2 parents 2107e4e + 90005ad commit bcd921f
Show file tree
Hide file tree
Showing 18 changed files with 128,277 additions and 126 deletions.
18 changes: 18 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
image: node

pages:
stage: deploy
cache:
paths:
- node_modules/
script:
- npm install
- npm run build
- rm -rf client/source
- cp build/index.html build/404.html
- mv build client/source
artifacts:
paths:
- client/source
only:
- master
4 changes: 4 additions & 0 deletions client/src/Components/App/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@
height: 40vmin;
pointer-events: none;
}

.class-node:hover, .function-node:hover, .module-node:hover {
cursor: pointer;
}
3 changes: 1 addition & 2 deletions client/src/Components/App/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {useState} from 'react';
import React from 'react';
import './App.css';
import ParameterView from "../ParameterView/ParameterView";
import TreeView from "../TreeView/TreeView";
Expand All @@ -8,7 +8,6 @@ function App() {

return (
<div className="App">

<TreeView setParameters={setParameters}/>
<ParameterView inputParameters={parameters}/>
</div>
Expand Down
29 changes: 0 additions & 29 deletions client/src/Components/Tree/ClassNode.js

This file was deleted.

63 changes: 63 additions & 0 deletions client/src/Components/Tree/ClassNode.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import React, {useState} from "react";
import PythonClass from "../../model/PythonClass";
import classNames from "classnames";
import FunctionNode from "./FunctionNode";
import {isEmptyList} from "../../Utility/listOperations";

type ClassNodeProps = {
pythonClass: PythonClass,
selection: string,
setSelection: (newValue: string) => void,
moduleName: string
}

const ClassNode = ({pythonClass, selection, setSelection, moduleName}: ClassNodeProps) => {
const [childVisible, setChildVisibility] = useState(false);

const hasMethods = isEmptyList(pythonClass.methods);

const fullQualifiedName = moduleName + "." + pythonClass.name;

const cssClasses = classNames(
"pl-3rem", "tree-view-row",
{
"selected": selection === fullQualifiedName,
}
);

return (
<div className="class-node">
<div className={cssClasses}
onClick={() => {
setSelection(fullQualifiedName)
setChildVisibility(!childVisible);
console.log(pythonClass.name + " has been selected.");
}}>
{ hasMethods && <span className="indicator visibility-indicator">{ childVisible ? "▼" : "▶" }</span>}
<span className="indicator">
𝒞
</span>
{ " " }
<span>
{pythonClass.name}
</span>
</div>
{
hasMethods && childVisible &&
<>
{pythonClass.methods.map(method => (
<FunctionNode parentFullQualifiedName={fullQualifiedName}
key={method.name}
pythonFunction={method}
selection={selection}
setSelection={setSelection}
isMethod={true}
/>
))}
</>
}
</div>
)
};

export default ClassNode;
17 changes: 0 additions & 17 deletions client/src/Components/Tree/FunctionNode.js

This file was deleted.

47 changes: 47 additions & 0 deletions client/src/Components/Tree/FunctionNode.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import React from "react";
import PythonFunction from "../../model/PythonFunction";
import classNames from "classnames";

type FunctionNodeProps = {
pythonFunction: PythonFunction,
selection: string,
setSelection: (newValue: string) => void,
isMethod?: boolean,
/** A parent of a Python class can be a class or a Python module. */
parentFullQualifiedName: string
}

const FunctionNode = ({pythonFunction, selection, setSelection, parentFullQualifiedName, isMethod=false}:FunctionNodeProps) => {

const fullQualifiedName = parentFullQualifiedName + "." + pythonFunction.name;

const cssClasses = classNames(
"tree-view-row",
{
"pl-3-5rem": !isMethod,
"pl-5rem": isMethod,
"selected": selection === fullQualifiedName,
}
);

return (
<div className="function-node">
<div className={cssClasses}
onClick={() => {
setSelection(fullQualifiedName);
console.log(fullQualifiedName + " has been selected.");
console.log(pythonFunction.parameters);
}}>
<span className="indicator">
𝑓
</span>
{ " " }
<span>
{pythonFunction.name}
</span>
</div>
</div>
);
};

export default FunctionNode;
41 changes: 0 additions & 41 deletions client/src/Components/Tree/ModuleNode.js

This file was deleted.

79 changes: 79 additions & 0 deletions client/src/Components/Tree/ModuleNode.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import React, {useState} from "react";
import ClassNode from "./ClassNode";
import FunctionNode from "./FunctionNode";
import {isEmptyList} from "../../Utility/listOperations";
import classNames from "classnames";
import PythonModule from "../../model/PythonModule";

type ModuleNodeProps = {
pythonModule: PythonModule,
selection: string,
setSelection: (newValue: string) => void,
}

const ModuleNode = ({pythonModule, selection, setSelection}: ModuleNodeProps) => {
const [childVisible, setChildVisibility] = useState(false);

let hasClasses = isEmptyList(pythonModule.classes);
let hasFunctions = isEmptyList(pythonModule.functions);

const cssClasses = classNames(
"tree-view-row",
{
"pl-2rem": !(hasClasses || hasFunctions),
"pl-1-5rem": (hasClasses || hasFunctions),
"selected": selection === pythonModule.name,
}
);

return (
<div className="module-node">
<div className={cssClasses}
onClick={() => {
setSelection(pythonModule.name)
setChildVisibility(!childVisible)
console.log(pythonModule.name + " has been selected.");
}}>
{ (hasClasses || hasFunctions) &&
<span className="indicator visibility-indicator">{ childVisible ? "▼" : "▶" }</span>
}
<span className="indicator">
</span>
{ " " }
<span>
{ pythonModule.name }
</span>
</div>
<div>
{
hasClasses && childVisible &&
<div>
{pythonModule.classes.map(moduleClass => (
<ClassNode key={moduleClass.name}
pythonClass={moduleClass}
selection={selection}
setSelection={setSelection}
moduleName={pythonModule.name}
/>
))}
</div>
}
{
hasFunctions && childVisible &&
<div>
{pythonModule.functions.map(moduleFunction => (
<FunctionNode parentFullQualifiedName={pythonModule.name}
key={moduleFunction.name}
pythonFunction={moduleFunction}
selection={selection}
setSelection={setSelection}/>
))}
</div>
}
</div>
</div>
)
};

export default ModuleNode;
17 changes: 0 additions & 17 deletions client/src/Components/Tree/Tree.js

This file was deleted.

25 changes: 25 additions & 0 deletions client/src/Components/Tree/Tree.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React, {useState} from 'react'
import ModuleNode from "./ModuleNode";
import PythonPackage from "../../model/PythonPackage";

type TreeProps = {
pythonPackage: PythonPackage,
}

const Tree = ({pythonPackage}: TreeProps) => {

const [selection, setSelection ] = useState("");

return (
<div className="tree">
{pythonPackage.modules.map(module => (
<ModuleNode key={module.name}
pythonModule={module}
selection={selection}
setSelection={setSelection}/>
))}
</div>
);
}

export default Tree;
18 changes: 0 additions & 18 deletions client/src/Components/TreeView/TreeView.js

This file was deleted.

Loading

0 comments on commit bcd921f

Please sign in to comment.