From b65fe208c0189e8dcbb7176d19806ad196fdc849 Mon Sep 17 00:00:00 2001 From: Tom Butcher Date: Sun, 8 Nov 2026 23:40:40 +0000 Subject: [PATCH] Enhance ControlPrinter and ObjectInfo Components for Slicer Integration - Updated ControlPrinter to conditionally manage hyperlink visibility based on slicer integration, improving user experience. - Refactored ObjectInfo to handle hyperlink display logic more flexibly, ensuring consistent behavior across components. - Modified PrinterQueue to accept a showHyperlink prop, allowing for better control over hyperlink rendering in queue items. - Enhanced SpotlightTooltip to prevent action rendering on slicer routes, optimizing performance and user interaction. --- .../Production/Printers/ControlPrinter.jsx | 26 +++++++++---------- .../Dashboard/common/ObjectInfo.jsx | 2 +- .../Dashboard/common/PrinterQueue.jsx | 13 +++++++--- .../Dashboard/common/SpotlightTooltip.jsx | 10 ++++--- 4 files changed, 30 insertions(+), 21 deletions(-) diff --git a/src/components/Dashboard/Production/Printers/ControlPrinter.jsx b/src/components/Dashboard/Production/Printers/ControlPrinter.jsx index 61075a15..2f619c4e 100644 --- a/src/components/Dashboard/Production/Printers/ControlPrinter.jsx +++ b/src/components/Dashboard/Production/Printers/ControlPrinter.jsx @@ -133,6 +133,10 @@ const ControlPrinter = ({ slicerIntegration = false }) => { ) useDashboardObjectTools(currentObjectTools) + const objectInfoHyperlinkProps = slicerIntegration + ? { showHyperlink: false, objectPropertyProps: { showHyperlink: false } } + : {} + const actions = { edit: () => { objectFormRef?.current.startEditing() @@ -291,7 +295,10 @@ const ControlPrinter = ({ slicerIntegration = false }) => { edit: false, info: !slicerIntegration, control: !slicerIntegration, - newPrinterProfile: !slicerIntegration + newPrinterProfile: !slicerIntegration, + list: !slicerIntegration, + duplicate: !slicerIntegration, + delete: !slicerIntegration }} objectData={objectFormState.objectData} /> @@ -399,6 +406,7 @@ const ControlPrinter = ({ slicerIntegration = false }) => { }) => { return ( { pendingSlicerUploads: false, name: !slicerIntegration }} - objectPropertyProps={{ - showHyperlink: !slicerIntegration - }} objectData={printerObjectData} type='printer' labelWidth='120px' @@ -460,6 +465,7 @@ const ControlPrinter = ({ slicerIntegration = false }) => { currentSubJob={ objectFormState.objectData?.currentSubJob } + showHyperlink={!slicerIntegration} /> @@ -484,17 +490,14 @@ const ControlPrinter = ({ slicerIntegration = false }) => { }) => { return ( @@ -531,9 +534,9 @@ const ControlPrinter = ({ slicerIntegration = false }) => { }) => { return ( { job: false, printer: false }} - objectPropertyProps={{ - showHyperlink: !slicerIntegration - }} objectData={subJobObjectData} type='subJob' /> @@ -602,9 +602,9 @@ const ControlPrinter = ({ slicerIntegration = false }) => { }) => { return ( item.required === required) } - if (showHyperlink) { + if (showHyperlink !== undefined) { objectPropertyProps = { ...objectPropertyProps, showHyperlink } } // Filter items based on visibleProperties diff --git a/src/components/Dashboard/common/PrinterQueue.jsx b/src/components/Dashboard/common/PrinterQueue.jsx index 3d34fff2..c79fb7dd 100644 --- a/src/components/Dashboard/common/PrinterQueue.jsx +++ b/src/components/Dashboard/common/PrinterQueue.jsx @@ -17,7 +17,7 @@ const toObject = (item) => { return item } -const PrinterQueue = ({ queue, currentSubJob }) => { +const PrinterQueue = ({ queue, currentSubJob, showHyperlink = true }) => { const queueItems = Array.isArray(queue) ? queue.map(toObject).filter(Boolean) : [] @@ -52,7 +52,13 @@ const PrinterQueue = ({ queue, currentSubJob }) => { className='printerQueue' size='small' items={items.map((item) => ({ - title: + title: ( + + ) }))} /> ) @@ -60,7 +66,8 @@ const PrinterQueue = ({ queue, currentSubJob }) => { PrinterQueue.propTypes = { queue: PropTypes.array, - currentSubJob: PropTypes.oneOfType([PropTypes.object, PropTypes.string]) + currentSubJob: PropTypes.oneOfType([PropTypes.object, PropTypes.string]), + showHyperlink: PropTypes.bool } export default PrinterQueue diff --git a/src/components/Dashboard/common/SpotlightTooltip.jsx b/src/components/Dashboard/common/SpotlightTooltip.jsx index 1b0f52dd..69588d8d 100644 --- a/src/components/Dashboard/common/SpotlightTooltip.jsx +++ b/src/components/Dashboard/common/SpotlightTooltip.jsx @@ -9,6 +9,7 @@ import { useCallback, useMemo } from 'react' +import { useLocation } from 'react-router-dom' import { AuthContext } from '../context/AuthContext' import { useActions } from '../context/ActionsContext' import InfoCircleIcon from '../../Icons/InfoCircleIcon' @@ -32,6 +33,7 @@ const SpotlightTooltip = ({ query, type }) => { const [spotlightData, setSpotlightData] = useState(null) const [loading, setLoading] = useState(true) const [initialized, setInitialized] = useState(false) + const isSlicerRoute = useLocation().pathname === '/slicer' const { token, userProfile } = useContext(AuthContext) const { callAction } = useActions() @@ -40,10 +42,10 @@ const SpotlightTooltip = ({ query, type }) => { const model = getModelByName(type) const modelProperties = model.properties || [] - const rowActions = useMemo( - () => model.actions?.filter((action) => action.row == true) || [], - [model] - ) + const rowActions = useMemo(() => { + if (isSlicerRoute) return [] + return model.actions?.filter((action) => action.row == true) || [] + }, [isSlicerRoute, model]) const renderActions = useCallback( (objectData, actionsDisabled = false) => {