Merge branch 'dev' of github.com:LDataCentric/reactFlow into dev

This commit is contained in:
Lucas Oliveira 2023-02-19 23:28:47 -03:00
commit 35759c7248
7 changed files with 31 additions and 23 deletions

View file

@ -1,9 +0,0 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import App from './App';
test('renders learn react link', () => {
render(<App />);
const linkElement = screen.getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});

View file

@ -86,10 +86,10 @@ export default function App() {
const userNavigation = [
{ name: "Your Projects", href: "/" },
{
name: "Account settings",
href: "http://localhost:4455/.ory/kratos/public/self-service/settings/browser",
},
// {
// name: "Account settings",
// href: "http://localhost:4455/.ory/kratos/public/self-service/settings/browser",
// },
{ name: "Sign out", href: "/" },
];

View file

@ -8,7 +8,7 @@ import {
} from "../../utils";
import ParameterComponent from "./components/parameterComponent";
import { typesContext } from "../../contexts/typesContext";
import { useContext, useEffect } from "react";
import { useContext } from "react";
export default function GenericNode({ data }) {
const {types} = useContext(typesContext);
@ -49,6 +49,7 @@ export default function GenericNode({ data }) {
data={data}
color={
nodeColors[types[data.node.template[t].type]] ??
nodeColors[types[data.node.template[t].type]] ??
"black"
}

View file

@ -15,8 +15,4 @@ root.render(
</BrowserRouter>
</ContextWrapper>
);
// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();

View file

@ -24,7 +24,6 @@ const ConnectionLineComponent = ({
fromNode={},
connectionLineStyle = {} // provide a default value for connectionLineStyle
}) => {
// console.log(fromNode)
return (
<g>
<path

View file

@ -40,6 +40,31 @@ export default function ExtraSidebar() {
});
}, []);
useEffect(() => {
if(data){
setTypes(
Object.keys(data).reduce(
(acc, curr) => {
Object.keys(data[curr]).forEach((c) => {
acc[c] = curr;
data[curr][c].base_classes?.forEach((b) => {
acc[b] = curr;
});
});
// console.log(acc);
return acc;
},
{
str: "advanced",
bool: "advanced",
chatOutput: "chat",
chatInput: "chat",
}
)
);
}
}, [data, setTypes])
function onDragStart(event: React.DragEvent<any>, data) {
event.dataTransfer.effectAllowed = "move";
event.dataTransfer.setData("json", JSON.stringify(data));

View file

@ -1,5 +1 @@
// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom';