mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-06-06 19:35:44 +02:00
default to new tab
This commit is contained in:
parent
501c384c59
commit
232f7793a1
2 changed files with 35 additions and 46 deletions
|
|
@ -2408,11 +2408,10 @@ function App() {
|
||||||
handleNewChatTab()
|
handleNewChatTab()
|
||||||
},
|
},
|
||||||
onSelectRun: (runIdToLoad) => {
|
onSelectRun: (runIdToLoad) => {
|
||||||
// If run is already open in a tab, switch to that tab
|
// If it's already the active tab's run, do nothing
|
||||||
const existingTab = openTabs.find(t => t.runId === runIdToLoad)
|
const activeTab = openTabs.find(t => t.id === activeTabId)
|
||||||
if (existingTab) {
|
if (activeTab?.runId === runIdToLoad) {
|
||||||
switchToTab(existingTab.id)
|
// Just ensure we're in chat view
|
||||||
// Also ensure we navigate to chat view
|
|
||||||
if (selectedPath || isGraphOpen || selectedBackgroundTask) {
|
if (selectedPath || isGraphOpen || selectedBackgroundTask) {
|
||||||
setSelectedPath(null)
|
setSelectedPath(null)
|
||||||
setIsGraphOpen(false)
|
setIsGraphOpen(false)
|
||||||
|
|
@ -2421,9 +2420,26 @@ function App() {
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// Update current tab's runId
|
// If already open in another tab, switch to it
|
||||||
setOpenTabs(prev => prev.map(t => t.id === activeTabId ? { ...t, runId: runIdToLoad } : t))
|
const existingTab = openTabs.find(t => t.runId === runIdToLoad)
|
||||||
void navigateToView({ type: 'chat', runId: runIdToLoad })
|
if (existingTab) {
|
||||||
|
switchToTab(existingTab.id)
|
||||||
|
if (selectedPath || isGraphOpen || selectedBackgroundTask) {
|
||||||
|
setSelectedPath(null)
|
||||||
|
setIsGraphOpen(false)
|
||||||
|
setExpandedFrom(null)
|
||||||
|
setSelectedBackgroundTask(null)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// Open in a new tab
|
||||||
|
openInNewTab(runIdToLoad)
|
||||||
|
if (selectedPath || isGraphOpen || selectedBackgroundTask) {
|
||||||
|
setSelectedPath(null)
|
||||||
|
setIsGraphOpen(false)
|
||||||
|
setExpandedFrom(null)
|
||||||
|
setSelectedBackgroundTask(null)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
onDeleteRun: async (runIdToDelete) => {
|
onDeleteRun: async (runIdToDelete) => {
|
||||||
try {
|
try {
|
||||||
|
|
@ -2446,16 +2462,6 @@ function App() {
|
||||||
console.error('Failed to delete run:', err)
|
console.error('Failed to delete run:', err)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onOpenInNewTab: (targetRunId) => {
|
|
||||||
openInNewTab(targetRunId)
|
|
||||||
// Ensure we're in chat view
|
|
||||||
if (selectedPath || isGraphOpen || selectedBackgroundTask) {
|
|
||||||
setSelectedPath(null)
|
|
||||||
setIsGraphOpen(false)
|
|
||||||
setExpandedFrom(null)
|
|
||||||
setSelectedBackgroundTask(null)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onSelectBackgroundTask: (taskName) => {
|
onSelectBackgroundTask: (taskName) => {
|
||||||
void navigateToView({ type: 'task', name: taskName })
|
void navigateToView({ type: 'task', name: taskName })
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ import {
|
||||||
ChevronsDownUp,
|
ChevronsDownUp,
|
||||||
ChevronsUpDown,
|
ChevronsUpDown,
|
||||||
Copy,
|
Copy,
|
||||||
ExternalLink,
|
|
||||||
FilePlus,
|
FilePlus,
|
||||||
FolderPlus,
|
FolderPlus,
|
||||||
AlertTriangle,
|
AlertTriangle,
|
||||||
|
|
@ -150,7 +149,6 @@ type TasksActions = {
|
||||||
onNewChat: () => void
|
onNewChat: () => void
|
||||||
onSelectRun: (runId: string) => void
|
onSelectRun: (runId: string) => void
|
||||||
onDeleteRun: (runId: string) => void
|
onDeleteRun: (runId: string) => void
|
||||||
onOpenInNewTab?: (runId: string) => void
|
|
||||||
onSelectBackgroundTask?: (taskName: string) => void
|
onSelectBackgroundTask?: (taskName: string) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1180,32 +1178,17 @@ function TasksSection({
|
||||||
</span>
|
</span>
|
||||||
) : null}
|
) : null}
|
||||||
{!processingRunIds?.has(run.id) && (
|
{!processingRunIds?.has(run.id) && (
|
||||||
<div className="shrink-0 hidden group-hover/chat-item:flex items-center gap-0.5">
|
<button
|
||||||
{actions?.onOpenInNewTab && (
|
type="button"
|
||||||
<button
|
className="shrink-0 hidden group-hover/chat-item:flex items-center justify-center text-muted-foreground hover:text-destructive transition-colors"
|
||||||
type="button"
|
onClick={(e) => {
|
||||||
className="flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors"
|
e.stopPropagation()
|
||||||
onClick={(e) => {
|
setPendingDeleteRunId(run.id)
|
||||||
e.stopPropagation()
|
}}
|
||||||
actions.onOpenInNewTab!(run.id)
|
aria-label="Delete chat"
|
||||||
}}
|
>
|
||||||
aria-label="Open in new tab"
|
<Trash2 className="size-3.5" />
|
||||||
>
|
</button>
|
||||||
<ExternalLink className="size-3.5" />
|
|
||||||
</button>
|
|
||||||
)}
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
className="flex items-center justify-center text-muted-foreground hover:text-destructive transition-colors"
|
|
||||||
onClick={(e) => {
|
|
||||||
e.stopPropagation()
|
|
||||||
setPendingDeleteRunId(run.id)
|
|
||||||
}}
|
|
||||||
aria-label="Delete chat"
|
|
||||||
>
|
|
||||||
<Trash2 className="size-3.5" />
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</SidebarMenuButton>
|
</SidebarMenuButton>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue