fix: Improve Connection Line Styling and Cleanup Unused Code in FlowPage Components (#4449)

 (ConnectionLineComponent/index.tsx): introduce accentColor variable to dynamically set stroke and accent color based on handleDragging color
♻️ (PageComponent/index.tsx): refactor code to remove unused variables zoomIn, zoomOut, fitView, and zoom to improve code readability and maintainability

Co-authored-by: Mike Fortman <michael.fortman@datastax.com>
This commit is contained in:
Cristhian Zanforlin Lousa 2024-11-07 12:53:40 -03:00 committed by GitHub
commit e63cace20a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 4 deletions

View file

@ -10,6 +10,7 @@ const ConnectionLineComponent = ({
}: ConnectionLineComponentProps): JSX.Element => {
const handleDragging = useFlowStore((state) => state.handleDragging);
const color = handleDragging?.color;
const accentColor = `hsl(var(--accent-${color}))`;
return (
<g>
@ -19,7 +20,7 @@ const ConnectionLineComponent = ({
strokeWidth={2}
className={`animated`}
style={{
stroke: handleDragging ? handleDragging.color : "",
stroke: handleDragging ? accentColor : "",
...connectionLineStyle,
}}
d={`M${fromX},${fromY} C ${fromX} ${toY} ${fromX} ${toY} ${toX},${toY}`}
@ -29,7 +30,7 @@ const ConnectionLineComponent = ({
cy={toY}
fill="#fff"
r={5}
stroke={color}
stroke={accentColor}
className=""
strokeWidth={1.5}
/>

View file

@ -125,8 +125,6 @@ export default function Page({ view }: { view?: boolean }): JSX.Element {
const [isHighlightingCursor, setIsHighlightingCursor] = useState(false);
const addComponent = useAddComponent();
const { zoomIn, zoomOut, fitView } = useReactFlow();
const { zoom } = useViewport();
useEffect(() => {
const handleVisibilityChange = () => {