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

Commit

Permalink
Merge pull request #44 from lars-reimann/Nicht-anklickbare-Nodes-im-T…
Browse files Browse the repository at this point in the history
…reeView-kenntlich-machen

Mache nicht anklickbare Nodes im Tree-View kenntlich.
  • Loading branch information
paul0314 authored Jun 17, 2021
2 parents 36b827f + c95f9e7 commit a0d5986
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
2 changes: 2 additions & 0 deletions client/src/Components/Tree/ClassNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ const ClassNode = ({pythonClass, selection, setSelection, moduleName, setParamet
const cssClasses = classNames(
"pl-3rem", "tree-view-row",
{
"text-muted": !hasMethods,
"cursor-na":!hasMethods,
"selected": selection === fullQualifiedName,
}
);
Expand Down
7 changes: 6 additions & 1 deletion client/src/Components/Tree/FunctionNode.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from "react";
import PythonFunction from "../../model/PythonFunction";
import classNames from "classnames";
import {isEmptyList} from "../../Utility/listOperations";

type FunctionNodeProps = {
pythonFunction: PythonFunction,
Expand All @@ -16,12 +17,16 @@ const FunctionNode = ({pythonFunction, selection, setSelection, setParameters, p

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

const hasParameters = isEmptyList(pythonFunction.parameters);

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

Expand Down
7 changes: 4 additions & 3 deletions client/src/Components/Tree/ModuleNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,20 @@ const ModuleNode = ({pythonModule, selection, setSelection, setParameters}: Modu
const cssClasses = classNames(
"tree-view-row",
{
"text-muted": !(hasClasses || hasFunctions),
"cursor-na":!(hasClasses || hasFunctions),
"pl-2rem": !(hasClasses || hasFunctions),
"pl-1-5rem": (hasClasses || hasFunctions),
"selected": selection === pythonModule.name,
"selected": (selection === pythonModule.name) && (hasClasses || hasFunctions),
}
);

return (
<div className="module-node">
<div className={cssClasses}
onClick={() => {
setSelection(pythonModule.name)
setSelection(pythonModule.name)
setChildVisibility(!childVisible)
console.log(pythonModule.name + " has been selected.");
}}>
{ (hasClasses || hasFunctions) &&
<span className="indicator visibility-indicator">{ childVisible ? "▼" : "▶" }</span>
Expand Down
4 changes: 4 additions & 0 deletions client/src/Components/TreeView/tree-view.css
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,7 @@
background-color: cornflowerblue;
color: white;
}

.cursor-na {
cursor: not-allowed;
}

0 comments on commit a0d5986

Please sign in to comment.