fix(chat): inject preview inline in chat tab + resizable note list panel

This commit is contained in:
2026-05-03 01:05:23 +02:00
parent afa8043fd5
commit 82db722735
3 changed files with 142 additions and 2 deletions

View File

@@ -756,6 +756,27 @@ export function NotesTabsView({
const selected = items.find((n) => n.id === selectedId) ?? null
const colorKey = selected ? getColorKey(selected) : 'default'
// Resizable left panel (180px min, 420px max, default 256px)
const [listPanelWidth, setListPanelWidth] = useState(256)
const isDraggingRef = useRef(false)
const handleResizeStart = (e: React.MouseEvent) => {
e.preventDefault()
isDraggingRef.current = true
const startX = e.clientX
const startW = listPanelWidth
const onMove = (ev: MouseEvent) => {
if (!isDraggingRef.current) return
setListPanelWidth(Math.min(420, Math.max(180, startW + (ev.clientX - startX))))
}
const onUp = () => {
isDraggingRef.current = false
window.removeEventListener('mousemove', onMove)
window.removeEventListener('mouseup', onUp)
}
window.addEventListener('mousemove', onMove)
window.addEventListener('mouseup', onUp)
}
const handleCreateNote = (noteType: NoteType = 'richtext') => {
startCreating(async () => {
try {
@@ -815,8 +836,8 @@ export function NotesTabsView({
style={{ height: 'max(360px, min(85vh, calc(100vh - 9rem)))' }}
data-testid="notes-grid-tabs"
>
{/* ── Left panel: note list ── */}
<div className="flex w-80 shrink-0 flex-col border-r border-border/60 bg-background">
{/* ── Left panel: note list — resizable ── */}
<div className="flex shrink-0 flex-col border-r border-border/60 bg-background" style={{ width: listPanelWidth }}>
{/* Header */}
<div className="flex items-center justify-between border-b border-border/60 bg-background/95 px-4 py-3.5">
@@ -941,6 +962,15 @@ export function NotesTabsView({
</div>
</div>
{/* Resize handle */}
<div
onMouseDown={handleResizeStart}
className="w-1 shrink-0 cursor-col-resize bg-border/40 hover:bg-primary/40 transition-colors active:bg-primary/60 relative group"
title="Redimensionner"
>
<div className="absolute inset-y-0 -left-1 -right-1 group-hover:bg-primary/10 transition-colors" />
</div>
{/* ── Right content panel ── */}
{selected ? (
<div className="flex min-w-0 flex-1 overflow-hidden">