// Dependencies import { forwardRef } from 'react' import { round } from 'shared/utils.mjs' import { getProps } from './utils.mjs' // Hooks import { useTranslation } from 'next-i18next' // Components import { Point } from './point.mjs' import { Snippet } from './snippet.mjs' import { Path, Tr, KeyTd, ValTd, Attributes, pointCoords } from './path.mjs' const partInfo = ({ partName, part, settings, update }) => { const { t } = useTranslation(['workbench']) return (
{t('partInfo')}
{t('name')}){partName}{t('width')}{round(part.width, 2)}mm{t('height')}{round(part.height, 2)}mm{t('topLeft')}{pointCoords(part.topLeft)}{t('bottomRight')}{pointCoords(part.bottomRight)}{t('attributes')}
{settings.only && settings.only.length > 0 ? ( ) : ( )}
) } const XrayPart = ({ partName, part, settings, showInfo, update }) => { const { topLeft, bottomRight } = part return ( showInfo(evt, partInfo({ partName, part, settings, update }))} /> ) } export const PartInner = forwardRef(({ partName, part, settings, showInfo, ui, update }, ref) => { const Grid = settings.paperless && !ui.skipGrid ? ( ) : null return ( {Grid} {ui.xray?.enabled && } {Object.keys(part.paths).map((pathName) => ( ))} {Object.keys(part.points).map((pointName) => ( ))} {Object.keys(part.snippets).map((snippetName) => ( ))} ) }) PartInner.displayName = 'PartInner' export const Part = ({ partName, part, settings, showInfo, ui, update }) => ( )