Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions ui/desktop/src/components/dashboard/DashboardWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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(() => {
Expand All @@ -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:
Expand Down Expand Up @@ -63,7 +75,8 @@ export function DashboardWidget({ widget, onMouseDown, isDragging, onReset }: Da
<Button
variant="ghost"
size="sm"
className="text-xs text-text-muted flex items-center gap-1 !px-0 hover:bg-transparent hover:underline hover:text-text-default"
onClick={handleSeeAllClick}
className="text-xs text-text-muted flex items-center gap-1 !px-0 hover:bg-transparent hover:underline hover:text-text-default pointer-events-auto"
>
See all
</Button>
Expand All @@ -72,7 +85,8 @@ export function DashboardWidget({ widget, onMouseDown, isDragging, onReset }: Da
{widget.data?.recentSessions?.slice(0, 5).map((session: any) => (
<div
key={session.id}
className="flex items-center justify-between text-xs py-1 px-1 rounded-md hover:bg-background-muted/50 cursor-pointer transition-colors"
onClick={() => handleSessionClick(session.id)}
className="flex items-center justify-between text-xs py-1 px-1 rounded-md hover:bg-background-muted/50 cursor-pointer transition-colors pointer-events-auto"
>
<div className="flex items-center space-x-2 min-w-0">
<ChatSmart className="h-3 w-3 text-text-muted flex-shrink-0" />
Expand Down