mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-06-03 19:25:19 +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 { useDebounce } from './hooks/use-debounce';
|
||||||
import { SidebarIcon } from '@/components/sidebar-icon';
|
import { SidebarIcon } from '@/components/sidebar-icon';
|
||||||
import { SidebarContentPanel } from '@/components/sidebar-content';
|
import { SidebarContentPanel } from '@/components/sidebar-content';
|
||||||
import { SidebarSectionProvider } from '@/contexts/sidebar-context';
|
import { SidebarSectionProvider, type ActiveSection } from '@/contexts/sidebar-context';
|
||||||
import {
|
import {
|
||||||
Conversation,
|
Conversation,
|
||||||
ConversationContent,
|
ConversationContent,
|
||||||
|
|
@ -538,6 +538,13 @@ function App() {
|
||||||
setExpandedPaths(newExpanded)
|
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
|
// Knowledge quick actions
|
||||||
const collectDirPaths = (nodes: TreeNode[]): string[] =>
|
const collectDirPaths = (nodes: TreeNode[]): string[] =>
|
||||||
nodes.flatMap(n => n.kind === 'dir' ? [n.path, ...(n.children ? collectDirPaths(n.children) : [])] : [])
|
nodes.flatMap(n => n.kind === 'dir' ? [n.path, ...(n.children ? collectDirPaths(n.children) : [])] : [])
|
||||||
|
|
@ -697,7 +704,7 @@ function App() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TooltipProvider delayDuration={0}>
|
<TooltipProvider delayDuration={0}>
|
||||||
<SidebarSectionProvider defaultSection="ask-ai">
|
<SidebarSectionProvider defaultSection="ask-ai" onSectionChange={handleSectionChange}>
|
||||||
<div className="flex min-h-svh w-full">
|
<div className="flex min-h-svh w-full">
|
||||||
{/* Icon sidebar - always visible, fixed position */}
|
{/* Icon sidebar - always visible, fixed position */}
|
||||||
<SidebarIcon />
|
<SidebarIcon />
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ export function MarkdownEditor({ content, onChange, placeholder = 'Start writing
|
||||||
}),
|
}),
|
||||||
Markdown.configure({
|
Markdown.configure({
|
||||||
html: false,
|
html: false,
|
||||||
|
breaks: true,
|
||||||
transformCopiedText: true,
|
transformCopiedText: true,
|
||||||
transformPastedText: true,
|
transformPastedText: true,
|
||||||
}),
|
}),
|
||||||
|
|
|
||||||
|
|
@ -21,19 +21,26 @@ export function useSidebarSection() {
|
||||||
|
|
||||||
export function SidebarSectionProvider({
|
export function SidebarSectionProvider({
|
||||||
defaultSection = "ask-ai",
|
defaultSection = "ask-ai",
|
||||||
|
onSectionChange,
|
||||||
children,
|
children,
|
||||||
}: {
|
}: {
|
||||||
defaultSection?: ActiveSection
|
defaultSection?: ActiveSection
|
||||||
|
onSectionChange?: (section: ActiveSection) => void
|
||||||
children: React.ReactNode
|
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>(
|
const contextValue = React.useMemo<SidebarSectionContextProps>(
|
||||||
() => ({
|
() => ({
|
||||||
activeSection,
|
activeSection,
|
||||||
setActiveSection,
|
setActiveSection,
|
||||||
}),
|
}),
|
||||||
[activeSection]
|
[activeSection, setActiveSection]
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue