import React from 'react';
import { PartLabel } from './primitives';
import type {
MachinePartDefinition,
ProceduralMachineSceneProps,
} from './types';
export function getPartVisualProps(
partId: string,
props: ProceduralMachineSceneProps,
): {
selected: boolean;
highlighted: boolean;
visible: boolean;
opacity: number;
wireframe: boolean;
} {
return {
selected: props.selectedPartId === partId,
highlighted:
props.hoveredPartId === partId || Boolean(props.highlightedPartIds?.includes(partId)),
visible: props.partState?.[partId]?.visible !== false,
opacity: props.partState?.[partId]?.opacity ?? 1,
wireframe: Boolean(props.wireframe),
};
}
export function PartLabels({
parts,
visible,
}: {
parts: MachinePartDefinition[];
visible?: boolean;
}): JSX.Element | null {
if (!visible) return null;
return (
<>
{parts
.filter((part) => part.labelPosition)
.map((part) => (
))}
>
);
}
export function EngineeringBaseplate({
width = 5,
depth = 3,
}: {
width?: number;
depth?: number;
}): JSX.Element {
return (
);
}