mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-05-28 19:05:31 +02:00
knowledge retains state
This commit is contained in:
parent
4f3453a65b
commit
bea8a904eb
1 changed files with 15 additions and 3 deletions
|
|
@ -617,6 +617,7 @@ function App() {
|
||||||
const [graphStatus, setGraphStatus] = useState<'idle' | 'loading' | 'ready' | 'error'>('idle')
|
const [graphStatus, setGraphStatus] = useState<'idle' | 'loading' | 'ready' | 'error'>('idle')
|
||||||
const [graphError, setGraphError] = useState<string | null>(null)
|
const [graphError, setGraphError] = useState<string | null>(null)
|
||||||
const [isChatSidebarOpen, setIsChatSidebarOpen] = useState(true)
|
const [isChatSidebarOpen, setIsChatSidebarOpen] = useState(true)
|
||||||
|
const [activeSection, setActiveSection] = useState<ActiveSection>('tasks')
|
||||||
const isMac = typeof navigator !== 'undefined' && navigator.platform.toLowerCase().includes('mac')
|
const isMac = typeof navigator !== 'undefined' && navigator.platform.toLowerCase().includes('mac')
|
||||||
const collapsedLeftPaddingPx =
|
const collapsedLeftPaddingPx =
|
||||||
(isMac ? MACOS_TRAFFIC_LIGHTS_RESERVED_PX : 0) +
|
(isMac ? MACOS_TRAFFIC_LIGHTS_RESERVED_PX : 0) +
|
||||||
|
|
@ -2019,13 +2020,24 @@ function App() {
|
||||||
|
|
||||||
// Handle sidebar section changes - switch to chat view for tasks
|
// Handle sidebar section changes - switch to chat view for tasks
|
||||||
const handleSectionChange = useCallback((section: ActiveSection) => {
|
const handleSectionChange = useCallback((section: ActiveSection) => {
|
||||||
|
setActiveSection(section)
|
||||||
if (section === 'tasks') {
|
if (section === 'tasks') {
|
||||||
if (selectedBackgroundTask) return
|
if (selectedBackgroundTask) return
|
||||||
if (selectedPath || isGraphOpen) {
|
if (selectedPath || isGraphOpen) {
|
||||||
void navigateToView({ type: 'chat', runId })
|
void navigateToView({ type: 'chat', runId })
|
||||||
}
|
}
|
||||||
|
} else if (section === 'knowledge') {
|
||||||
|
// Restore the active file tab if one exists
|
||||||
|
const activeTab = fileTabs.find(t => t.id === activeFileTabId)
|
||||||
|
if (activeTab) {
|
||||||
|
void navigateToView({ type: 'file', path: activeTab.path })
|
||||||
|
} else if (fileTabs.length > 0) {
|
||||||
|
const tab = fileTabs[0]
|
||||||
|
setActiveFileTabId(tab.id)
|
||||||
|
void navigateToView({ type: 'file', path: tab.path })
|
||||||
}
|
}
|
||||||
}, [isGraphOpen, navigateToView, runId, selectedBackgroundTask, selectedPath])
|
}
|
||||||
|
}, [isGraphOpen, navigateToView, runId, selectedBackgroundTask, selectedPath, fileTabs, activeFileTabId])
|
||||||
|
|
||||||
// Knowledge quick actions
|
// Knowledge quick actions
|
||||||
const knowledgeFiles = React.useMemo(() => {
|
const knowledgeFiles = React.useMemo(() => {
|
||||||
|
|
@ -2536,7 +2548,7 @@ function App() {
|
||||||
canNavigateForward={canNavigateForward}
|
canNavigateForward={canNavigateForward}
|
||||||
collapsedLeftPaddingPx={collapsedLeftPaddingPx}
|
collapsedLeftPaddingPx={collapsedLeftPaddingPx}
|
||||||
>
|
>
|
||||||
{selectedPath && fileTabs.length > 1 ? (
|
{activeSection === 'knowledge' && fileTabs.length > 1 ? (
|
||||||
<TabBar
|
<TabBar
|
||||||
tabs={fileTabs}
|
tabs={fileTabs}
|
||||||
activeTabId={activeFileTabId ?? ''}
|
activeTabId={activeFileTabId ?? ''}
|
||||||
|
|
@ -2545,7 +2557,7 @@ function App() {
|
||||||
onSwitchTab={switchFileTab}
|
onSwitchTab={switchFileTab}
|
||||||
onCloseTab={closeFileTab}
|
onCloseTab={closeFileTab}
|
||||||
/>
|
/>
|
||||||
) : !selectedPath && !isGraphOpen && !selectedBackgroundTask && chatTabs.length > 1 ? (
|
) : activeSection === 'tasks' && chatTabs.length > 1 ? (
|
||||||
<TabBar
|
<TabBar
|
||||||
tabs={chatTabs}
|
tabs={chatTabs}
|
||||||
activeTabId={activeChatTabId}
|
activeTabId={activeChatTabId}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue