-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix button color changes when option selected * fix makeDecision implementation to not remove decsendants of the recently opened node * update react flow minor version * add new CustomBaseEdge which reflects react flow version 12's BaseEdge * use my custom edge in DecisionEdge * conditionally render edge label * 0.8.0 * set children edges as undecided when nodes are removed this is a temporary fix that we'll need to expand on as it does not fix edges recursively * remove old isNumeric utility function
- Loading branch information
1 parent
c3259ff
commit 15420e4
Showing
9 changed files
with
124 additions
and
59 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import '@testing-library/jest-dom'; | ||
import { cleanup, render, screen } from '@testing-library/react'; | ||
import { CustomBaseEdge } from 'components/Tree/Edges/CustomBaseEdge'; | ||
import { afterEach, describe, expect, test } from 'vitest'; | ||
|
||
afterEach(() => cleanup()); | ||
|
||
describe('Custom Base Edge', () => { | ||
test('renders', () => { | ||
render(<CustomBaseEdge path={''} />); | ||
expect(screen.getByTestId('edgePath')).toBeInTheDocument(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import cc from 'classcat'; | ||
import { BaseEdgeProps } from 'reactflow'; | ||
|
||
interface MyBaseEdgeProps extends BaseEdgeProps { | ||
className?: string; | ||
} | ||
|
||
/** | ||
* This component is copied from the React Flow library paired down/modified to include | ||
* a className prop that allows us to apply a class to the edge. It reflects | ||
* the changes to BaseEdge in the React Flow library version 12 (not released at the time of | ||
* writing this code). When this project migrates to React Flow version 12, this file should | ||
* be removed and our custom edges should be updated to use the v12 BaseEdge. | ||
* https://github.com/xyflow/xyflow/blob/c318288703292d9faf03e3f6e31bfba82c540b2c/packages/react/src/components/Edges/BaseEdge.tsx#L7 | ||
*/ | ||
export function CustomBaseEdge({ | ||
id, | ||
path, | ||
style, | ||
markerEnd, | ||
markerStart, | ||
className, | ||
}: MyBaseEdgeProps) { | ||
return ( | ||
<> | ||
<path | ||
id={id} | ||
style={style} | ||
d={path} | ||
fill="none" | ||
className={cc(['react-flow__edge-path', className])} | ||
markerEnd={markerEnd} | ||
markerStart={markerStart} | ||
data-testid="edgePath" | ||
/> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters