From 0f920fb867f06976e6ca182dcdd0623cbf2a2f19 Mon Sep 17 00:00:00 2001 From: Andrew Pareles Date: Sat, 7 Dec 2024 17:20:02 -0800 Subject: [PATCH] remove void Widget inputs for now --- .../react/src/sidebar-tsx/SidebarSettings.tsx | 62 ++++--- .../browser/react/src/sidebar-tsx/inputs.tsx | 168 +++++++++--------- 2 files changed, 114 insertions(+), 116 deletions(-) diff --git a/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarSettings.tsx b/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarSettings.tsx index 0dadf12b..565a9db5 100644 --- a/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarSettings.tsx +++ b/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarSettings.tsx @@ -5,7 +5,6 @@ import React, { useCallback, useEffect, useRef, useState } from 'react'; import { useConfigState, useService } from '../util/services.js'; -import { VoidSelectBox, VoidInputBox } from './inputs.js'; import { HistoryInputBox } from '../../../../../../../base/browser/ui/inputbox/inputBox.js'; import { SelectBox } from '../../../../../../../base/browser/ui/selectBox/selectBox.js'; import { ConfigState, IVoidConfigStateService } from '../../../registerConfig.js'; @@ -53,41 +52,40 @@ const SettingOfFieldAndParam = ({ field, param, configState, configStateService - const inputElement = enumArr === undefined ? // string - () - // updateState(e.target.value)} - // /> + // () + updateState(e.target.value)} + /> : // enum - () - // () + // () + () return
diff --git a/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/inputs.tsx b/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/inputs.tsx index 877d9d52..fc2e0559 100644 --- a/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/inputs.tsx +++ b/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/inputs.tsx @@ -1,104 +1,104 @@ -import React, { useEffect, useRef } from 'react'; -import { useService } from '../util/services.js'; -import { HistoryInputBox, InputBox } from '../../../../../../../base/browser/ui/inputbox/inputBox.js'; -import { defaultInputBoxStyles } from '../../../../../../../platform/theme/browser/defaultStyles.js'; -import { SelectBox, unthemedSelectBoxStyles } from '../../../../../../../base/browser/ui/selectBox/selectBox.js'; +// import React, { useEffect, useRef } from 'react'; +// import { useService } from '../util/services.js'; +// import { HistoryInputBox, InputBox } from '../../../../../../../base/browser/ui/inputbox/inputBox.js'; +// import { defaultInputBoxStyles } from '../../../../../../../platform/theme/browser/defaultStyles.js'; +// import { SelectBox, unthemedSelectBoxStyles } from '../../../../../../../base/browser/ui/selectBox/selectBox.js'; -export const VoidInputBox = ({ onChangeText, initVal, placeholder, inputBoxRef, multiline }: { - onChangeText: (value: string) => void; - placeholder: string; - inputBoxRef: React.MutableRefObject; - multiline: boolean; - initVal: string; -}) => { - const contextViewProvider = useService('contextViewService'); +// export const VoidInputBox = ({ onChangeText, initVal, placeholder, inputBoxRef, multiline }: { +// onChangeText: (value: string) => void; +// placeholder: string; +// inputBoxRef: React.MutableRefObject; +// multiline: boolean; +// initVal: string; +// }) => { +// const contextViewProvider = useService('contextViewService'); - const containerRef = useRef(null); +// const containerRef = useRef(null); - useEffect(() => { - if (!containerRef.current) return; +// useEffect(() => { +// if (!containerRef.current) return; - // create and mount the HistoryInputBox - inputBoxRef.current = new InputBox( - containerRef.current, - contextViewProvider, - { - inputBoxStyles: { - ...defaultInputBoxStyles, - inputBackground: 'transparent', - }, - placeholder, - flexibleHeight: multiline, - flexibleMaxHeight: 500, - flexibleWidth: false, +// // create and mount the HistoryInputBox +// inputBoxRef.current = new InputBox( +// containerRef.current, +// contextViewProvider, +// { +// inputBoxStyles: { +// ...defaultInputBoxStyles, +// inputBackground: 'transparent', +// }, +// placeholder, +// flexibleHeight: multiline, +// flexibleMaxHeight: 500, +// flexibleWidth: false, - } - ); - inputBoxRef.current.value = initVal; +// } +// ); +// inputBoxRef.current.value = initVal; - inputBoxRef.current.onDidChange((newStr) => { - console.log('CHANGE TEXT on inputbox', newStr) - onChangeText(newStr) - }) +// inputBoxRef.current.onDidChange((newStr) => { +// console.log('CHANGE TEXT on inputbox', newStr) +// onChangeText(newStr) +// }) - // cleanup - return () => { - if (inputBoxRef.current) { - inputBoxRef.current.dispose(); - if (containerRef.current) { - while (containerRef.current.firstChild) { - containerRef.current.removeChild(containerRef.current.firstChild); - } - } - inputBoxRef.current = null; - } - }; - }, [inputBoxRef, contextViewProvider, placeholder, multiline, initVal, onChangeText]); // Empty dependency array since we only want to mount/unmount once +// // cleanup +// return () => { +// if (inputBoxRef.current) { +// inputBoxRef.current.dispose(); +// if (containerRef.current) { +// while (containerRef.current.firstChild) { +// containerRef.current.removeChild(containerRef.current.firstChild); +// } +// } +// inputBoxRef.current = null; +// } +// }; +// }, [inputBoxRef, contextViewProvider, placeholder, multiline, initVal, onChangeText]); - return
; -}; +// return
; +// }; -export const VoidSelectBox = ({ onChangeSelection, initVal, selectBoxRef, options }: { - onChangeSelection: (value: string) => void; - initVal: string; - selectBoxRef: React.MutableRefObject; - options: readonly string[]; +// export const VoidSelectBox = ({ onChangeSelection, initVal, selectBoxRef, options }: { +// onChangeSelection: (value: string) => void; +// initVal: string; +// selectBoxRef: React.MutableRefObject; +// options: readonly string[]; -}) => { - const containerRef = useRef(null); - const contextViewProvider = useService('contextViewService'); +// }) => { +// const containerRef = useRef(null); +// const contextViewProvider = useService('contextViewService'); - useEffect(() => { - if (!containerRef.current) return; +// useEffect(() => { +// if (!containerRef.current) return; - const defaultIndex = options.indexOf(initVal); +// const defaultIndex = options.indexOf(initVal); - selectBoxRef.current = new SelectBox( - options.map(opt => ({ text: opt })), - defaultIndex, - contextViewProvider, - unthemedSelectBoxStyles - ); +// selectBoxRef.current = new SelectBox( +// options.map(opt => ({ text: opt })), +// defaultIndex, +// contextViewProvider, +// unthemedSelectBoxStyles +// ); - selectBoxRef.current.render(containerRef.current); +// selectBoxRef.current.render(containerRef.current); - selectBoxRef.current.onDidSelect(e => { onChangeSelection(e.selected); }); +// selectBoxRef.current.onDidSelect(e => { onChangeSelection(e.selected); }); - // cleanup - return () => { - if (selectBoxRef.current) { - selectBoxRef.current.dispose(); - if (containerRef.current) { - while (containerRef.current.firstChild) { - containerRef.current.removeChild(containerRef.current.firstChild); - } - } - } - }; - }, [options, initVal, onChangeSelection, contextViewProvider, selectBoxRef]); +// // cleanup +// return () => { +// if (selectBoxRef.current) { +// selectBoxRef.current.dispose(); +// if (containerRef.current) { +// while (containerRef.current.firstChild) { +// containerRef.current.removeChild(containerRef.current.firstChild); +// } +// } +// } +// }; +// }, [options, initVal, onChangeSelection, contextViewProvider, selectBoxRef]); - return
; -}; +// return
; +// };