Skip to content

Commit b5ced95

Browse files
committed
feat: editor workflow tabs, streamlined editor view, file reveal from chat
1 parent 075a0a0 commit b5ced95

5 files changed

Lines changed: 110 additions & 673 deletions

File tree

app/page.tsx

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { useLayout, usePanelResize } from '@/context/layout-context'
1313
import { useAppMode } from '@/context/app-mode-context'
1414
import { WorkspaceSidebar } from '@/components/workspace-sidebar'
1515
import { FloatingPanel } from '@/components/floating-panel'
16+
import { EditorTabs } from '@/components/editor-tabs'
1617
import { isTauri } from '@/lib/tauri'
1718
import {
1819
fetchFileContentsByName as fetchFileContents,
@@ -149,6 +150,8 @@ export default function EditorLayout() {
149150
)
150151
const showMobileBottomTabs = isMobile && !modeSpec.terminalCenter && keyboardOffset === 0
151152
const showMobileSidebarButton = isMobile && mode !== 'tui' && !usePrismShell
153+
const showWorkflowEditorTabs =
154+
!isMobile && !modeSpec.terminalCenter && activeView === 'workshop' && files.length > 0
152155
const mobileTerminalOffset = showMobileBottomTabs
153156
? 'calc(env(safe-area-inset-bottom) + 5.75rem)'
154157
: 'calc(env(safe-area-inset-bottom) + 0.5rem)'
@@ -345,16 +348,23 @@ export default function EditorLayout() {
345348
const { path, sha, content: providedContent } = detail ?? {}
346349
if (!path) return
347350

351+
const revealEditorFromChat = () => {
352+
if (activeView === 'chat') {
353+
layout.show('chat')
354+
}
355+
setView('editor')
356+
}
357+
348358
const existing = files.find((f) => f.path === path)
349359
if (existing) {
350360
setActiveFile(path)
351-
setView('editor')
361+
revealEditorFromChat()
352362
return
353363
}
354364

355365
if (providedContent != null) {
356366
openFile(path, providedContent, sha ?? '')
357-
setView('editor')
367+
revealEditorFromChat()
358368
return
359369
}
360370

@@ -372,7 +382,7 @@ export default function EditorLayout() {
372382
const content = await localReadFile(path)
373383
openFile(path, content, '')
374384
}
375-
setView('editor')
385+
revealEditorFromChat()
376386
} catch (err) {
377387
console.error('Failed to read local file:', path, err)
378388
}
@@ -389,13 +399,24 @@ export default function EditorLayout() {
389399
} else {
390400
openFile(path, result.content, result.sha ?? sha ?? '')
391401
}
392-
setView('editor')
402+
revealEditorFromChat()
393403
} catch (err) {
394404
console.error('Failed to open file:', path, err)
395405
}
396406
}
397407
})
398-
}, [repo, files, openFile, setActiveFile, setView, localMode, localReadFile, localReadFileBase64])
408+
}, [
409+
repo,
410+
files,
411+
openFile,
412+
setActiveFile,
413+
setView,
414+
activeView,
415+
layout,
416+
localMode,
417+
localReadFile,
418+
localReadFileBase64,
419+
])
399420

400421
// ─── Commit handler ────────────────────────────────────
401422
useEffect(() => {
@@ -680,6 +701,8 @@ export default function EditorLayout() {
680701
</div>
681702
)}
682703

704+
{showWorkflowEditorTabs && <EditorTabs onTabSelect={() => setView('editor')} />}
705+
683706
{/* Mode transition wrapper */}
684707
<AnimatePresence mode="wait" initial={false}>
685708
<motion.div

components/editor-tabs.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function getFileIcon(path: string) {
4646
return EXT_ICONS[ext] ?? { icon: 'lucide:file', color: 'var(--text-tertiary)' }
4747
}
4848

49-
export function EditorTabs() {
49+
export function EditorTabs({ onTabSelect }: { onTabSelect?: (path: string) => void }) {
5050
const { files, activeFile, setActiveFile, closeFile, reorderFiles } = useEditor()
5151
const [dragIndex, setDragIndex] = useState<number | null>(null)
5252
const [dropTarget, setDropTarget] = useState<number | null>(null)
@@ -105,7 +105,10 @@ export function EditorTabs() {
105105
}
106106
${isDragTarget ? 'border-l-2 border-l-[var(--brand)]' : 'border-l-0'}
107107
`}
108-
onClick={() => setActiveFile(file.path)}
108+
onClick={() => {
109+
setActiveFile(file.path)
110+
onTabSelect?.(file.path)
111+
}}
109112
>
110113
{/* Active indicator — bottom bar with gradient edges */}
111114
{isActive && (

0 commit comments

Comments
 (0)