From a39bec0dea93c83b5eef446543f991218ecc810c Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Sun, 18 Jun 2023 18:29:20 -0700 Subject: data sharing toggle --- extension/react-app/src/components/HeaderButtonWithText.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'extension/react-app/src/components') diff --git a/extension/react-app/src/components/HeaderButtonWithText.tsx b/extension/react-app/src/components/HeaderButtonWithText.tsx index f9483f0f..acaca9ce 100644 --- a/extension/react-app/src/components/HeaderButtonWithText.tsx +++ b/extension/react-app/src/components/HeaderButtonWithText.tsx @@ -12,7 +12,7 @@ const HeaderButtonWithText = (props: HeaderButtonWithTextProps) => { const [hover, setHover] = useState(false); return ( setHover(true)} onMouseLeave={() => { setHover(false); -- cgit v1.2.3-70-g09d2 From 8aa8e0b5c8402014b01f6ea6ce2e3d686f3c64b2 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Sun, 18 Jun 2023 18:55:14 -0700 Subject: posthog on data switch, fixed copy button --- extension/react-app/src/components/CodeBlock.tsx | 7 +++++-- extension/react-app/src/components/ComboBox.tsx | 9 +++++++++ extension/react-app/src/tabs/gui.tsx | 12 ++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) (limited to 'extension/react-app/src/components') diff --git a/extension/react-app/src/components/CodeBlock.tsx b/extension/react-app/src/components/CodeBlock.tsx index c4524a51..0aae0bbb 100644 --- a/extension/react-app/src/components/CodeBlock.tsx +++ b/extension/react-app/src/components/CodeBlock.tsx @@ -22,7 +22,7 @@ const StyledCopyButton = styled.button<{ visible: boolean }>` /* position: relative; */ float: right; border: none; - background-color: transparent; + background-color: ${secondaryDark}; cursor: pointer; padding: 0; /* margin: 4px; */ @@ -77,7 +77,10 @@ function CodeBlock(props: { language?: string; children: string }) { setHovered(false); }} > - + {props.children} ); diff --git a/extension/react-app/src/components/ComboBox.tsx b/extension/react-app/src/components/ComboBox.tsx index ddc9d5dc..8c1f80e0 100644 --- a/extension/react-app/src/components/ComboBox.tsx +++ b/extension/react-app/src/components/ComboBox.tsx @@ -116,6 +116,15 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => { disabled={props.disabled} placeholder="Type '/' to see available slash commands." {...getInputProps({ + onChange: (e) => { + const target = e.target as HTMLTextAreaElement; + // Update the height of the textarea to match the content, up to a max of 200px. + target.style.height = "auto"; + target.style.height = `${Math.min( + target.scrollHeight, + 200 + ).toString()}px`; + }, onKeyDown: (event) => { if (event.key === "Enter" && event.shiftKey) { // Prevent Downshift's default 'Enter' behavior. diff --git a/extension/react-app/src/tabs/gui.tsx b/extension/react-app/src/tabs/gui.tsx index 52318dca..eee2b1a0 100644 --- a/extension/react-app/src/tabs/gui.tsx +++ b/extension/react-app/src/tabs/gui.tsx @@ -15,6 +15,9 @@ import ComboBox from "../components/ComboBox"; import TextDialog from "../components/TextDialog"; import HeaderButtonWithText from "../components/HeaderButtonWithText"; import ReactSwitch from "react-switch"; +import { usePostHog } from "posthog-js/react"; +import { useSelector } from "react-redux"; +import { RootStore } from "../redux/store"; const TopGUIDiv = styled.div` overflow: hidden; @@ -46,6 +49,11 @@ interface GUIProps { } function GUI(props: GUIProps) { + const posthog = usePostHog(); + const vscMachineId = useSelector( + (state: RootStore) => state.config.vscMachineId + ); + const [waitingForSteps, setWaitingForSteps] = useState(false); const [userInputQueue, setUserInputQueue] = useState([]); const [availableSlashCommands, setAvailableSlashCommands] = useState< @@ -432,6 +440,10 @@ function GUI(props: GUIProps) { handleDiameter={20} width={40} onChange={() => { + posthog?.capture("data_switch_toggled", { + vscMachineId: vscMachineId, + dataSwitchChecked: !dataSwitchChecked, + }); setDataSwitchChecked((prev) => !prev); }} onColor="#12887a" -- cgit v1.2.3-70-g09d2