mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-04-30 02:46:25 +02:00
TipTap improvements
This commit is contained in:
parent
23ae0d8be0
commit
31e6eed96f
3 changed files with 19 additions and 4 deletions
|
|
@ -11,7 +11,7 @@ import { MarkdownEditor } from './components/markdown-editor';
|
|||
import { useDebounce } from './hooks/use-debounce';
|
||||
import { SidebarIcon } from '@/components/sidebar-icon';
|
||||
import { SidebarContentPanel } from '@/components/sidebar-content';
|
||||
import { SidebarSectionProvider } from '@/contexts/sidebar-context';
|
||||
import { SidebarSectionProvider, type ActiveSection } from '@/contexts/sidebar-context';
|
||||
import {
|
||||
Conversation,
|
||||
ConversationContent,
|
||||
|
|
@ -538,6 +538,13 @@ function App() {
|
|||
setExpandedPaths(newExpanded)
|
||||
}
|
||||
|
||||
// Handle sidebar section changes - switch to chat view for ask-ai and agents
|
||||
const handleSectionChange = useCallback((section: ActiveSection) => {
|
||||
if (section === 'ask-ai' || section === 'agents') {
|
||||
setSelectedPath(null)
|
||||
}
|
||||
}, [])
|
||||
|
||||
// Knowledge quick actions
|
||||
const collectDirPaths = (nodes: TreeNode[]): string[] =>
|
||||
nodes.flatMap(n => n.kind === 'dir' ? [n.path, ...(n.children ? collectDirPaths(n.children) : [])] : [])
|
||||
|
|
@ -697,7 +704,7 @@ function App() {
|
|||
|
||||
return (
|
||||
<TooltipProvider delayDuration={0}>
|
||||
<SidebarSectionProvider defaultSection="ask-ai">
|
||||
<SidebarSectionProvider defaultSection="ask-ai" onSectionChange={handleSectionChange}>
|
||||
<div className="flex min-h-svh w-full">
|
||||
{/* Icon sidebar - always visible, fixed position */}
|
||||
<SidebarIcon />
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ export function MarkdownEditor({ content, onChange, placeholder = 'Start writing
|
|||
}),
|
||||
Markdown.configure({
|
||||
html: false,
|
||||
breaks: true,
|
||||
transformCopiedText: true,
|
||||
transformPastedText: true,
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -21,19 +21,26 @@ export function useSidebarSection() {
|
|||
|
||||
export function SidebarSectionProvider({
|
||||
defaultSection = "ask-ai",
|
||||
onSectionChange,
|
||||
children,
|
||||
}: {
|
||||
defaultSection?: ActiveSection
|
||||
onSectionChange?: (section: ActiveSection) => void
|
||||
children: React.ReactNode
|
||||
}) {
|
||||
const [activeSection, setActiveSection] = React.useState<ActiveSection>(defaultSection)
|
||||
const [activeSection, setActiveSectionState] = React.useState<ActiveSection>(defaultSection)
|
||||
|
||||
const setActiveSection = React.useCallback((section: ActiveSection) => {
|
||||
setActiveSectionState(section)
|
||||
onSectionChange?.(section)
|
||||
}, [onSectionChange])
|
||||
|
||||
const contextValue = React.useMemo<SidebarSectionContextProps>(
|
||||
() => ({
|
||||
activeSection,
|
||||
setActiveSection,
|
||||
}),
|
||||
[activeSection]
|
||||
[activeSection, setActiveSection]
|
||||
)
|
||||
|
||||
return (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue