diff --git a/src/vs/workbench/contrib/void/browser/react/src/void-editor-widgets-tsx/VoidCommandBar.tsx b/src/vs/workbench/contrib/void/browser/react/src/void-editor-widgets-tsx/VoidCommandBar.tsx index 25d3d66a..dcf97f8e 100644 --- a/src/vs/workbench/contrib/void/browser/react/src/void-editor-widgets-tsx/VoidCommandBar.tsx +++ b/src/vs/workbench/contrib/void/browser/react/src/void-editor-widgets-tsx/VoidCommandBar.tsx @@ -12,7 +12,6 @@ import { ScrollType } from '../../../../../../../editor/common/editorCommon.js'; import { acceptAllBg, acceptBorder, buttonFontSize, buttonTextColor, rejectBg, rejectBorder } from '../../../../common/helpers/colors.js'; import { VoidCommandBarProps } from '../../../voidCommandBarService.js'; import { AcceptAllButtonWrapper, RejectAllButtonWrapper } from '../sidebar-tsx/SidebarChat.js'; -import { MoveDown, MoveLeft, MoveRight, MoveUp } from 'lucide-react'; export const VoidCommandBarMain = ({ uri, editor }: VoidCommandBarProps) => { const isDark = useIsDark() @@ -24,12 +23,16 @@ export const VoidCommandBarMain = ({ uri, editor }: VoidCommandBarProps) => { } + + const stepIdx = (currIdx: number | null, len: number, step: -1 | 1) => { if (len === 0) return null return ((currIdx ?? 0) + step + len) % len // for some reason, small negatives are kept negative. just add len to offset } -export const VoidCommandBar = ({ uri, editor }: VoidCommandBarProps) => { + + +const VoidCommandBar = ({ uri, editor }: VoidCommandBarProps) => { const accessor = useAccessor() const editCodeService = accessor.get('IEditCodeService') const editorService = accessor.get('ICodeEditorService') @@ -39,6 +42,11 @@ export const VoidCommandBar = ({ uri, editor }: VoidCommandBarProps) => { const voidModelService = accessor.get('IVoidModelService') const { stateOfURI: commandBarState, sortedURIs: sortedCommandBarURIs } = useCommandBarState() + + // useEffect(() => { + // console.log('MOUNTING!!!') + // }, []) + // latestUriIdx is used to remember place in leftRight const _latestValidUriIdxRef = useRef(null) @@ -103,7 +111,7 @@ export const VoidCommandBar = ({ uri, editor }: VoidCommandBarProps) => { const { model } = await voidModelService.getModelSafe(nextURI) if (model) { // switch to the URI - editorService.openCodeEditor({ resource: model.uri, options: { revealIfVisible: true } }, editor) + editorService.openCodeEditor({ resource: nextURI, options: { revealIfVisible: true } }, editor) } } @@ -111,6 +119,7 @@ export const VoidCommandBar = ({ uri, editor }: VoidCommandBarProps) => { const sortedDiffIds = uri ? commandBarState[uri.fsPath]?.sortedDiffIds ?? [] : [] const sortedDiffZoneIds = uri ? commandBarState[uri.fsPath]?.sortedDiffZoneIds ?? [] : [] + const isADiffInThisFile = sortedDiffIds.length !== 0 const isADiffZoneInThisFile = sortedDiffZoneIds.length !== 0 const isADiffZoneInAnyFile = sortedCommandBarURIs.length !== 0 @@ -124,7 +133,69 @@ export const VoidCommandBar = ({ uri, editor }: VoidCommandBarProps) => { const prevURIIdx = getNextUriIdx(-1) const upDownDisabled = prevDiffIdx === null || nextDiffIdx === null - const leftRightDisabled = prevURIIdx === null || nextURIIdx === null + const leftRightDisabled = prevURIIdx === null || nextURIIdx === null // || (sortedCommandBarURIs.length === 1 && isADiffZoneInThisFile) + + const upButton = + + const downButton = + + const leftButton = + + const rightButton = + + // accept/reject if current URI has changes const onAcceptAll = () => { @@ -138,120 +209,109 @@ export const VoidCommandBar = ({ uri, editor }: VoidCommandBarProps) => { metricsService.capture('Reject All', {}) } + if (!isADiffZoneInAnyFile) return null - // Triple colon button (menu) - const tripleColonButton = ( - + + // const rejectAllButton = + + const acceptAllButton = + + const rejectAllButton = + + const acceptRejectAllButtons =
+ {acceptAllButton} + {rejectAllButton} +
+ + // const closeCommandBar = useCallback(() => { + // commandService.executeCommand('void.hideCommandBar'); + // }, [commandService]); + + // const hideButton = + + const leftRightUpDownButtons =
+
+ {/* Changes in file */} +
+ {upButton} + {downButton} + + {isADiffInThisFile ? + `Diff ${(currDiffIdx ?? 0) + 1} of ${sortedDiffIds.length}` + : streamState === 'streaming' ? + 'No changes yet' + : `No changes` + } +
- - ) - return ( -
-
- {/* Diff Navigation Group */} -
- - - {isADiffInThisFile - ? `Diff ${(currDiffIdx ?? 0) + 1} of ${sortedDiffIds.length}` - : streamState === 'streaming' - ? 'No changes yet' - : 'No changes' - } - - -
- - {/* File Navigation Group */} -
- - - {currFileIdx !== null - ? `File ${currFileIdx + 1} of ${sortedCommandBarURIs.length}` - : `${sortedCommandBarURIs.length} file${sortedCommandBarURIs.length === 1 ? '' : 's'}` - } - - -
- - {/* Accept/Reject buttons - only shown when appropriate */} - {showAcceptRejectAll && ( -
- - -
- )} - - {/* Triple colon menu button */} - {tripleColonButton} + {/* Files */} +
+ {leftButton} + {/*
*/} + {rightButton} + {/*
*/} + + {currFileIdx !== null ? + `File ${currFileIdx + 1} of ${sortedCommandBarURIs.length}` + : `${sortedCommandBarURIs.length} file${sortedCommandBarURIs.length === 1 ? '' : 's'} changed` + } +
- ) +
+ + return
+ {showAcceptRejectAll && acceptRejectAllButtons} + {leftRightUpDownButtons} + +
}