diff --git a/ui/desktop/src/components/dashboard/DashboardWidget.tsx b/ui/desktop/src/components/dashboard/DashboardWidget.tsx index e89423c0bd63..6a3d06544d2d 100644 --- a/ui/desktop/src/components/dashboard/DashboardWidget.tsx +++ b/ui/desktop/src/components/dashboard/DashboardWidget.tsx @@ -3,6 +3,7 @@ import { CardContent, CardDescription } from '../ui/card'; import { WidgetData, WidgetType } from '../../types/dashboard'; import { Button } from '../ui/button'; import { ChatSmart } from '../icons/'; +import { useNavigate } from 'react-router-dom'; interface DashboardWidgetProps { widget: WidgetData; @@ -13,6 +14,7 @@ interface DashboardWidgetProps { export function DashboardWidget({ widget, onMouseDown, isDragging, onReset }: DashboardWidgetProps) { const [showSavedIndicator, setShowSavedIndicator] = useState(false); + const navigate = useNavigate(); // Show saved indicator when position changes (but not during dragging) useEffect(() => { @@ -25,6 +27,16 @@ export function DashboardWidget({ widget, onMouseDown, isDragging, onReset }: Da } }, [widget.position.x, widget.position.y, isDragging]); + const handleSessionClick = (sessionId: string) => { + // Navigate to sessions view with the selected session + navigate('/sessions', { state: { selectedSessionId: sessionId } }); + }; + + const handleSeeAllClick = () => { + // Navigate to sessions view (history space) + navigate('/sessions'); + }; + const renderWidgetContent = () => { switch (widget.type) { case WidgetType.TOTAL_SESSIONS: @@ -63,7 +75,8 @@ export function DashboardWidget({ widget, onMouseDown, isDragging, onReset }: Da @@ -72,7 +85,8 @@ export function DashboardWidget({ widget, onMouseDown, isDragging, onReset }: Da {widget.data?.recentSessions?.slice(0, 5).map((session: any) => (