diff --git a/package.json b/package.json index b163b28..0e57ca6 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "test:e2e": "playwright test", "test:ci": "pnpm typecheck && pnpm test && pnpm test:e2e", "dist": "electron-vite build && electron-builder --mac", + "dist:local": "electron-vite build && electron-builder --mac --publish never", "dist:linux": "electron-vite build && electron-builder --linux", "dist:win": "electron-vite build && electron-builder --win", "dist:publish": "electron-vite build && electron-builder --mac --publish always", diff --git a/packages/renderer/src/components/layout/DockviewContainer.tsx b/packages/renderer/src/components/layout/DockviewContainer.tsx index 0c17358..234ce74 100644 --- a/packages/renderer/src/components/layout/DockviewContainer.tsx +++ b/packages/renderer/src/components/layout/DockviewContainer.tsx @@ -4,6 +4,7 @@ import { PlaceholderPane } from '../panes/PlaceholderPane' import { WelcomePane } from '../panes/WelcomePane' import { EditorPane } from '../panes/EditorPane' import { EditorTab } from '../panes/EditorTab' +import { EditorTabActions } from '../panes/EditorTabActions' import { AgentTab } from '../panes/AgentTab' import { TerminalPane } from '../panes/TerminalPane' import { MarkdownPreviewPane } from '../panes/MarkdownPreviewPane' @@ -61,6 +62,7 @@ export function DockviewContainer({ onApiReady }: Props) { onReady={handleReady} components={components} tabComponents={tabComponents} + rightHeaderActionsComponent={EditorTabActions} /> ) } diff --git a/packages/renderer/src/components/panes/EditorBreadcrumbBar.tsx b/packages/renderer/src/components/panes/EditorBreadcrumbBar.tsx new file mode 100644 index 0000000..a2a2462 --- /dev/null +++ b/packages/renderer/src/components/panes/EditorBreadcrumbBar.tsx @@ -0,0 +1,104 @@ +import { useMemo } from 'react' + +export type LspStatus = 'healthy' | 'starting' | 'down' | 'none' + +interface Props { + filePath: string + workspaceRoot?: string | null + // TODO: wire to real LSP status feed once LSP is implemented. + lspStatus?: LspStatus +} + +function relativeSegments(filePath: string, root?: string | null): string[] { + if (!filePath) return [] + let rel = filePath + const normalizedRoot = root?.replace(/\/+$/, '') + if ( + normalizedRoot + && (filePath === normalizedRoot || filePath.startsWith(`${normalizedRoot}/`)) + ) { + rel = filePath.slice(normalizedRoot.length) + } + return rel.split('/').filter(Boolean) +} + +const LSP_LABELS: Record = { + healthy: 'LSP', + starting: 'LSP starting', + down: 'LSP down', + none: 'No LSP', +} + +export function EditorBreadcrumbBar({ filePath, workspaceRoot, lspStatus = 'none' }: Props) { + const segments = useMemo( + () => relativeSegments(filePath, workspaceRoot ?? null), + [filePath, workspaceRoot], + ) + + return ( +
+
+ {/* Stub: outline / symbol list */} + + {/* Stub: in-file search */} + + {/* Stub: back / forward navigation */} + + +
+ + + +
+ {lspStatus !== 'none' && ( + + + {LSP_LABELS[lspStatus]} + + )} +
+
+ ) +} diff --git a/packages/renderer/src/components/panes/EditorPane.tsx b/packages/renderer/src/components/panes/EditorPane.tsx index 583ecd5..a2ee43d 100644 --- a/packages/renderer/src/components/panes/EditorPane.tsx +++ b/packages/renderer/src/components/panes/EditorPane.tsx @@ -25,7 +25,9 @@ import { useEditorStatus } from '../../hooks/useEditorStatus' import { useTheme } from '../../hooks/useTheme' import { showToast } from '../shared/Toast' import { diffCompartment, toggleInlineDiff } from '../../lib/editor/editorInlineDiff' +import { EditorBreadcrumbBar } from './EditorBreadcrumbBar' import '../../styles/inline-diff.css' +import '../../styles/editor-breadcrumb.css' interface EditorPaneParams { filePath: string @@ -433,8 +435,8 @@ export function EditorPane({ params, api }: IDockviewPanelProps { - const s = getDocumentSession(params.workspaceId, filePath) - api.setTitle(s?.isDirty ? '• ' + name : name) + // Tab dirty state is rendered by EditorTab; no need to prefix the title. + api.setTitle(name) } applyTitle() const unsub = onDocumentSessionChanged((wk, path) => { @@ -478,6 +480,7 @@ export function EditorPane({ params, api }: IDockviewPanelProps + {loading &&
Loading…
} {diffActive && (
) { - const handleClose = () => { - const filePath = props.params.filePath - const workspaceId = props.params.workspaceId + const { filePath, workspaceId } = props.params + const name = filePath?.split('/').pop() ?? filePath ?? 'untitled' + + const [dirty, setDirty] = useState(() => isDocumentDirty(workspaceId, filePath)) + + useEffect(() => { + setDirty(isDocumentDirty(workspaceId, filePath)) + return onDocumentSessionChanged((wk, path) => { + if (path === filePath && wk === (workspaceId ?? '')) { + setDirty(isDocumentDirty(workspaceId, filePath)) + } + }) + }, [filePath, workspaceId]) + + const handleClose = (e: React.MouseEvent) => { + e.stopPropagation() if (filePath && isDocumentDirty(workspaceId, filePath)) { if (!window.confirm('Discard unsaved changes?')) return } props.api.close() } - return + return ( +
+ + + + {name} + + {dirty && } + + +
+ ) } diff --git a/packages/renderer/src/components/panes/EditorTabActions.tsx b/packages/renderer/src/components/panes/EditorTabActions.tsx new file mode 100644 index 0000000..36d78a7 --- /dev/null +++ b/packages/renderer/src/components/panes/EditorTabActions.tsx @@ -0,0 +1,53 @@ +import type { IDockviewHeaderActionsProps } from 'dockview-react' +import { executeCommand } from '../../commands/CommandRegistry' + +/** + * Right-side actions rendered in every Dockview group header. + * Visual stubs — wire to real commands as they land. + */ +export function EditorTabActions(_props: IDockviewHeaderActionsProps) { + return ( +
+ + + +
+ ) +} diff --git a/packages/renderer/src/styles/dockview-theme.css b/packages/renderer/src/styles/dockview-theme.css index 8dac0c0..07b5525 100644 --- a/packages/renderer/src/styles/dockview-theme.css +++ b/packages/renderer/src/styles/dockview-theme.css @@ -16,20 +16,34 @@ --dv-group-view-background-color: var(--bg-base); } -/* Tighter tab bar */ +/* Tab bar */ .dockview-theme-aide .tabs-container { - height: 28px !important; + height: 32px !important; + padding: 4px 6px 0 6px !important; + gap: 2px !important; } .dockview-theme-aide .tab { - font-size: 10px !important; - padding: 0 8px !important; + font-size: 11px !important; + padding: 0 10px !important; min-width: 0 !important; + height: 28px !important; + border-radius: 8px 8px 0 0 !important; + margin-right: 2px !important; + transition: background-color 120ms ease; +} + +.dockview-theme-aide .dv-tab:hover { + background-color: var(--bg-hover) !important; } -/* Subtler active tab indicator */ +/* Active tab merges with editor body via matching background + soft top border */ .dockview-theme-aide .dv-tab.dv-active-tab { - font-weight: 450; + font-weight: 500; + background-color: var(--bg-base) !important; + border-top: 1px solid var(--border-subtle, var(--border-base)) !important; + border-left: 1px solid var(--border-subtle, var(--border-base)) !important; + border-right: 1px solid var(--border-subtle, var(--border-base)) !important; } /* ─── Close button overrides ───────────────────── */ diff --git a/packages/renderer/src/styles/editor-breadcrumb.css b/packages/renderer/src/styles/editor-breadcrumb.css new file mode 100644 index 0000000..2815e1d --- /dev/null +++ b/packages/renderer/src/styles/editor-breadcrumb.css @@ -0,0 +1,241 @@ +/* Per-tab breadcrumb bar shown above the CodeMirror host inside EditorPane. */ + +.editor-breadcrumb { + flex: 0 0 auto; + display: flex; + align-items: center; + gap: 8px; + height: 28px; + padding: 0 10px; + background: var(--bg-base); + border-bottom: 1px solid var(--border-subtle, var(--border-base)); + font-size: 11px; + color: var(--text-secondary); + user-select: none; +} + +.editor-breadcrumb__tools { + display: flex; + align-items: center; + gap: 2px; + flex: 0 0 auto; +} + +.editor-breadcrumb__icon-btn { + display: inline-flex; + align-items: center; + justify-content: center; + width: 20px; + height: 20px; + padding: 0; + border: none; + background: transparent; + color: var(--text-secondary); + border-radius: 4px; + cursor: pointer; +} + +.editor-breadcrumb__icon-btn:hover { + background: var(--bg-hover); + color: var(--text-primary); +} + +.editor-breadcrumb__path { + display: flex; + align-items: center; + flex: 1 1 auto; + min-width: 0; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + margin-left: 4px; +} + +.editor-breadcrumb__segment-wrap { + display: inline-flex; + align-items: center; + min-width: 0; +} + +.editor-breadcrumb__segment { + background: transparent; + border: none; + padding: 2px 4px; + font: inherit; + color: var(--text-secondary); + cursor: pointer; + border-radius: 3px; + max-width: 220px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.editor-breadcrumb__segment:hover { + background: var(--bg-hover); + color: var(--text-primary); +} + +.editor-breadcrumb__segment--last { + color: var(--text-primary); + font-weight: 500; +} + +.editor-breadcrumb__chevron { + color: var(--text-muted); + margin: 0 1px; + font-size: 12px; +} + +.editor-breadcrumb__right { + display: flex; + align-items: center; + flex: 0 0 auto; + margin-left: auto; +} + +.editor-breadcrumb__lsp { + display: inline-flex; + align-items: center; + gap: 5px; + padding: 2px 8px; + border-radius: 999px; + font-size: 10px; + font-weight: 500; + letter-spacing: 0.02em; + color: var(--text-secondary); + background: transparent; +} + +.editor-breadcrumb__lsp-dot { + width: 7px; + height: 7px; + border-radius: 50%; + background: currentcolor; + box-shadow: 0 0 6px currentcolor; +} + +.editor-breadcrumb__lsp--healthy { + color: var(--text-success, #98c379); +} +.editor-breadcrumb__lsp--starting { + color: var(--text-warning, #e5c07b); +} +.editor-breadcrumb__lsp--down { + color: var(--text-error, #e06c75); +} +.editor-breadcrumb__lsp--none { + color: var(--text-muted); +} + +/* ─── Tab styling (paired with dockview-theme.css overrides) ─────── */ + +.editor-tab { + display: inline-flex; + align-items: center; + gap: 6px; + height: 100%; + padding: 0 4px; + min-width: 0; +} + +.editor-tab__icon { + display: inline-flex; + flex: 0 0 auto; + width: 14px; + height: 14px; +} +.editor-tab__icon svg { + width: 14px; + height: 14px; +} + +.editor-tab__name { + flex: 1 1 auto; + min-width: 0; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.editor-tab__trailing { + position: relative; + flex: 0 0 auto; + display: inline-flex; + align-items: center; + justify-content: center; + width: 16px; + height: 16px; +} + +.editor-tab__dirty { + position: absolute; + inset: 0; + margin: auto; + width: 8px; + height: 8px; + border-radius: 50%; + background: var(--text-secondary); + pointer-events: none; + transition: opacity 120ms ease; +} + +.editor-tab:hover .editor-tab__dirty, +.dv-active-tab .editor-tab__dirty { + opacity: 0; +} + +.editor-tab__close { + display: inline-flex; + align-items: center; + justify-content: center; + width: 16px; + height: 16px; + padding: 0; + border: none; + background: transparent; + color: var(--text-muted); + border-radius: 3px; + cursor: pointer; + opacity: 0; + transition: opacity 120ms ease; +} + +.editor-tab:hover .editor-tab__close, +.dv-active-tab .editor-tab__close { + opacity: 1; +} + +.editor-tab__close:hover { + background: var(--bg-hover); + color: var(--text-primary); +} + +/* ─── Right-side tab strip actions ───────────────── */ + +.editor-tab-actions { + display: inline-flex; + align-items: center; + gap: 2px; + padding: 0 8px; + height: 100%; +} + +.editor-tab-actions__btn { + display: inline-flex; + align-items: center; + justify-content: center; + width: 22px; + height: 22px; + padding: 0; + border: none; + background: transparent; + color: var(--text-secondary); + border-radius: 4px; + cursor: pointer; +} + +.editor-tab-actions__btn:hover { + background: var(--bg-hover); + color: var(--text-primary); +}