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()
|
||||
},
|
||||
onSelectRun: (runIdToLoad) => {
|
||||
// If run is already open in a tab, switch to that tab
|
||||
const existingTab = openTabs.find(t => t.runId === runIdToLoad)
|
||||
if (existingTab) {
|
||||
switchToTab(existingTab.id)
|
||||
// Also ensure we navigate to chat view
|
||||
// If it's already the active tab's run, do nothing
|
||||
const activeTab = openTabs.find(t => t.id === activeTabId)
|
||||
if (activeTab?.runId === runIdToLoad) {
|
||||
// Just ensure we're in chat view
|
||||
if (selectedPath || isGraphOpen || selectedBackgroundTask) {
|
||||
setSelectedPath(null)
|
||||
setIsGraphOpen(false)
|
||||
|
|
@ -2421,9 +2420,26 @@ function App() {
|
|||
}
|
||||
return
|
||||
}
|
||||
// Update current tab's runId
|
||||
setOpenTabs(prev => prev.map(t => t.id === activeTabId ? { ...t, runId: runIdToLoad } : t))
|
||||
void navigateToView({ type: 'chat', runId: runIdToLoad })
|
||||
// If already open in another tab, switch to it
|
||||
const existingTab = openTabs.find(t => t.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) => {
|
||||
try {
|
||||
|
|
@ -2446,16 +2462,6 @@ function App() {
|
|||
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) => {
|
||||
void navigateToView({ type: 'task', name: taskName })
|
||||
},
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import {
|
|||
ChevronsDownUp,
|
||||
ChevronsUpDown,
|
||||
Copy,
|
||||
ExternalLink,
|
||||
FilePlus,
|
||||
FolderPlus,
|
||||
AlertTriangle,
|
||||
|
|
@ -150,7 +149,6 @@ type TasksActions = {
|
|||
onNewChat: () => void
|
||||
onSelectRun: (runId: string) => void
|
||||
onDeleteRun: (runId: string) => void
|
||||
onOpenInNewTab?: (runId: string) => void
|
||||
onSelectBackgroundTask?: (taskName: string) => void
|
||||
}
|
||||
|
||||
|
|
@ -1180,32 +1178,17 @@ function TasksSection({
|
|||
</span>
|
||||
) : null}
|
||||
{!processingRunIds?.has(run.id) && (
|
||||
<div className="shrink-0 hidden group-hover/chat-item:flex items-center gap-0.5">
|
||||
{actions?.onOpenInNewTab && (
|
||||
<button
|
||||
type="button"
|
||||
className="flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
actions.onOpenInNewTab!(run.id)
|
||||
}}
|
||||
aria-label="Open in new tab"
|
||||
>
|
||||
<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>
|
||||
<button
|
||||
type="button"
|
||||
className="shrink-0 hidden group-hover/chat-item: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>
|
||||
</SidebarMenuButton>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue