import React from 'react';
import type { BoxModel } from './types';
function buildShapePoints(coordinates: [number, number][]): string {
return coordinates.map(([x, y]) => `${x},${y}`).join(' ');
}
function buildPathD(coordinates: [number, number][]): string {
return coordinates
.map(([x, y], index) => {
if (index === 0) {
return `M ${x},${y}`;
}
return `L ${x},${y}`;
})
.join(' ');
}
function Arrowhead({
type,
x,
y,
}: {
type: 'dependency' | 'dependent';
x: number;
y: number;
}) {
return (
);
}
function Line({
type,
originX,
originY,
originYOffset = 0,
destinationX,
destinationY,
destinationYOffset = 0,
}: {
type: 'dependency' | 'dependent';
originX: number;
originY: number;
originYOffset?: number;
destinationX: number;
destinationY: number;
destinationYOffset?: number;
}) {
const coordinates: [number, number][] =
type === 'dependency'
? [
[originX, originY],
[originX, originY + originYOffset],
[destinationX, originY + originYOffset],
[destinationX, destinationY],
]
: [
[originX, originY],
[originX, destinationY - destinationYOffset],
[destinationX, destinationY - destinationYOffset],
[destinationX, destinationY],
];
return (
);
}
function LineStart({
type,
x,
y,
}: {
type: 'dependency' | 'dependent';
x: number;
y: number;
}) {
return (
);
}
export default function Connections({ activeBox }: { activeBox: BoxModel }) {
return (
);
}