diff --git a/components/app-layout.tsx b/components/app-layout.tsx index 7f54bad..2dc156a 100644 --- a/components/app-layout.tsx +++ b/components/app-layout.tsx @@ -3,7 +3,6 @@ import { useState, useEffect, createContext, useContext, useCallback } from 'react' import { TaskSidebar } from '@/components/task-sidebar' import { Task } from '@/lib/db/schema' -import { useRouter } from 'next/navigation' import { Button } from '@/components/ui/button' import { Card, CardContent } from '@/components/ui/card' import { Plus, Trash2 } from 'lucide-react' @@ -107,7 +106,6 @@ export function AppLayout({ children, initialSidebarWidth, initialSidebarOpen, i const [isResizing, setIsResizing] = useState(false) const [isDesktop, setIsDesktop] = useState(!initialIsMobile) const [hasMounted, setHasMounted] = useState(false) - const router = useRouter() // Update sidebar width and save to cookie const updateSidebarWidth = (newWidth: number) => { @@ -210,14 +208,6 @@ export function AppLayout({ children, initialSidebarWidth, initialSidebarOpen, i } } - const handleTaskSelect = (task: Task) => { - router.push(`/tasks/${task.id}`) - // Close sidebar when navigating on mobile (don't save to cookie) - if (!isDesktop) { - updateSidebarOpen(false, false) - } - } - const addTaskOptimistically = (taskData: { prompt: string repoUrl: string @@ -347,11 +337,7 @@ export function AppLayout({ children, initialSidebarWidth, initialSidebarOpen, i width: `${sidebarWidth}px`, }} > - {isLoading ? ( - - ) : ( - - )} + {isLoading ? : } diff --git a/components/task-sidebar.tsx b/components/task-sidebar.tsx index 18211fc..9b72d1f 100644 --- a/components/task-sidebar.tsx +++ b/components/task-sidebar.tsx @@ -75,7 +75,6 @@ const AGENT_MODELS = { interface TaskSidebarProps { tasks: Task[] - onTaskSelect: (task: Task) => void width?: number } @@ -89,7 +88,7 @@ interface RepoInfo { lastUsed: Date } -export function TaskSidebar({ tasks, onTaskSelect, width = 288 }: TaskSidebarProps) { +export function TaskSidebar({ tasks, width = 288 }: TaskSidebarProps) { const pathname = usePathname() const { refreshTasks, toggleSidebar } = useTasks() const session = useAtomValue(sessionAtom) @@ -100,15 +99,8 @@ export function TaskSidebar({ tasks, onTaskSelect, width = 288 }: TaskSidebarPro const [deleteStopped, setDeleteStopped] = useState(true) const [activeTab, setActiveTab] = useState('tasks') - // Close sidebar on mobile when navigating - const handleNewTaskClick = () => { - if (typeof window !== 'undefined' && window.innerWidth < 1024) { - toggleSidebar() - } - } - - // Close sidebar on mobile when selecting a repo - const handleRepoClick = () => { + // Close sidebar on mobile when clicking any link + const handleLinkClick = () => { if (typeof window !== 'undefined' && window.innerWidth < 1024) { toggleSidebar() } @@ -265,7 +257,7 @@ export function TaskSidebar({ tasks, onTaskSelect, width = 288 }: TaskSidebarPro > - + @@ -336,7 +328,7 @@ export function TaskSidebar({ tasks, onTaskSelect, width = 288 }: TaskSidebarPro > - + @@ -363,7 +355,7 @@ export function TaskSidebar({ tasks, onTaskSelect, width = 288 }: TaskSidebarPro onTaskSelect(task)} + onClick={handleLinkClick} className={cn('block rounded-lg', isActive && 'ring-1 ring-primary/50 ring-offset-0')} > = 1 && ( - + View All Tasks @@ -473,7 +465,7 @@ export function TaskSidebar({ tasks, onTaskSelect, width = 288 }: TaskSidebarPro