diff --git a/src/workspaces/officerdev/src/apps/Widgets/WidgetPanel.tsx b/src/workspaces/officerdev/src/apps/Widgets/WidgetPanel.tsx index 491b92f6..abb7b600 100644 --- a/src/workspaces/officerdev/src/apps/Widgets/WidgetPanel.tsx +++ b/src/workspaces/officerdev/src/apps/Widgets/WidgetPanel.tsx @@ -6,6 +6,7 @@ import { useAuth } from 'hooks/useAuth'; import { Plus, X, RefreshCw } from 'lucide-react'; import { useWidgetRegistry } from '../../WidgetRegistry'; import { WidgetPicker } from './WidgetPicker'; +import { useTranslation } from '../../locales'; type Position = { x: number; y: number }; // percentages (0–100) @@ -102,20 +103,23 @@ const DraggableWidget = ({ instance, panelRef, onMove, onRemove }: DraggableWidg [instance.position, panelRef], ); - const endDrag = useCallback( - (ev: ReactPointerEvent) => { - if (!dragRef.current) return; - dragRef.current = null; - containerRef.current?.releasePointerCapture(ev.pointerId); - }, - [], - ); + const endDrag = useCallback((ev: ReactPointerEvent) => { + if (!dragRef.current) return; + dragRef.current = null; + containerRef.current?.releasePointerCapture(ev.pointerId); + }, []); const onPointerMove = useCallback( (ev: ReactPointerEvent) => { if (!dragRef.current) return; const panelRect = panelRef.current?.getBoundingClientRect(); - if (panelRect && (ev.clientX < panelRect.left || ev.clientX > panelRect.right || ev.clientY < panelRect.top || ev.clientY > panelRect.bottom)) { + if ( + panelRect && + (ev.clientX < panelRect.left || + ev.clientX > panelRect.right || + ev.clientY < panelRect.top || + ev.clientY > panelRect.bottom) + ) { endDrag(ev); return; } @@ -165,6 +169,7 @@ const DraggableWidget = ({ instance, panelRef, onMove, onRemove }: DraggableWidg // --- WidgetPanel --- export const WidgetPanel = ({ panelId }: { panelId: string }) => { + const { t } = useTranslation(); const [config, setConfig] = useWidgetPanelState(panelId); const [instances, setInstances] = useState(config.instances); const [showPicker, setShowPicker] = useState(false); @@ -220,7 +225,9 @@ export const WidgetPanel = ({ panelId }: { panelId: string }) => { /> ))} -
+
{showPicker && (
@@ -229,7 +236,7 @@ export const WidgetPanel = ({ panelId }: { panelId: string }) => {