summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--extension/react-app/src/components/DebugPanel.tsx2
-rw-r--r--extension/react-app/src/redux/slices/configSlice.ts8
-rw-r--r--extension/react-app/src/redux/store.ts1
-rw-r--r--extension/react-app/src/tabs/gui.tsx25
4 files changed, 29 insertions, 7 deletions
diff --git a/extension/react-app/src/components/DebugPanel.tsx b/extension/react-app/src/components/DebugPanel.tsx
index 94dbac9e..fffb6c6e 100644
--- a/extension/react-app/src/components/DebugPanel.tsx
+++ b/extension/react-app/src/components/DebugPanel.tsx
@@ -7,6 +7,7 @@ import {
setVscMachineId,
setSessionId,
setVscMediaUrl,
+ setDataSwitchOn,
} from "../redux/slices/configSlice";
import { setHighlightedCode } from "../redux/slices/miscSlice";
import { updateFileSystem } from "../redux/slices/debugContexSlice";
@@ -39,6 +40,7 @@ function DebugPanel(props: DebugPanelProps) {
dispatch(setVscMachineId(event.data.vscMachineId));
dispatch(setSessionId(event.data.sessionId));
dispatch(setVscMediaUrl(event.data.vscMediaUrl));
+ dispatch(setDataSwitchOn(event.data.dataSwitchOn));
break;
case "highlightedCode":
dispatch(setHighlightedCode(event.data.rangeInFile));
diff --git a/extension/react-app/src/redux/slices/configSlice.ts b/extension/react-app/src/redux/slices/configSlice.ts
index 229c9c5c..57c4f860 100644
--- a/extension/react-app/src/redux/slices/configSlice.ts
+++ b/extension/react-app/src/redux/slices/configSlice.ts
@@ -44,6 +44,13 @@ export const configSlice = createSlice({
...state,
vscMediaUrl: action.payload,
}),
+ setDataSwitchOn: (
+ state: RootStore["config"],
+ action: { type: string; payload: boolean }
+ ) => ({
+ ...state,
+ dataSwitchOn: action.payload,
+ })
},
});
@@ -53,5 +60,6 @@ export const {
setWorkspacePath,
setSessionId,
setVscMediaUrl,
+ setDataSwitchOn
} = configSlice.actions;
export default configSlice.reducer;
diff --git a/extension/react-app/src/redux/store.ts b/extension/react-app/src/redux/store.ts
index a5eef4ba..b6eb55b3 100644
--- a/extension/react-app/src/redux/store.ts
+++ b/extension/react-app/src/redux/store.ts
@@ -22,6 +22,7 @@ export interface RootStore {
sessionId: string | undefined;
sessionStarted: number | undefined;
vscMediaUrl: string | undefined;
+ dataSwitchOn: boolean | undefined;
};
chat: {
messages: ChatMessage[];
diff --git a/extension/react-app/src/tabs/gui.tsx b/extension/react-app/src/tabs/gui.tsx
index 8d21a457..292977c7 100644
--- a/extension/react-app/src/tabs/gui.tsx
+++ b/extension/react-app/src/tabs/gui.tsx
@@ -19,6 +19,7 @@ import { usePostHog } from "posthog-js/react";
import { useSelector } from "react-redux";
import { RootStore } from "../redux/store";
import LoadingCover from "../components/LoadingCover";
+import { postVscMessage } from "../vscode";
const TopGUIDiv = styled.div`
overflow: hidden;
@@ -54,6 +55,16 @@ function GUI(props: GUIProps) {
const vscMachineId = useSelector(
(state: RootStore) => state.config.vscMachineId
);
+ const [dataSwitchChecked, setDataSwitchChecked] = useState(false);
+ const dataSwitchOn = useSelector(
+ (state: RootStore) => state.config.dataSwitchOn
+ )
+
+ useEffect(() => {
+ if (typeof dataSwitchOn !== "undefined") {
+ setDataSwitchChecked(dataSwitchOn)
+ }
+ }, [dataSwitchOn])
const [usingFastModel, setUsingFastModel] = useState(false);
const [waitingForSteps, setWaitingForSteps] = useState(false);
@@ -61,7 +72,6 @@ function GUI(props: GUIProps) {
const [availableSlashCommands, setAvailableSlashCommands] = useState<
{ name: string; description: string }[]
>([]);
- const [dataSwitchChecked, setDataSwitchChecked] = useState(false);
const [showDataSharingInfo, setShowDataSharingInfo] = useState(false);
const [stepsOpen, setStepsOpen] = useState<boolean[]>([
true,
@@ -538,15 +548,15 @@ function GUI(props: GUIProps) {
}}
hidden={!showDataSharingInfo}
>
- By turning on this switch, you signal that you would contribute this
- software development data to a publicly accessible, open-source dataset
- in the future.
+ By turning on this switch, you will begin collecting accepted and
+ rejected suggestions in .continue/suggestions.json. This data is
+ stored locally on your machine and not sent anywhere.
<br />
<br />
<b>
{dataSwitchChecked
- ? "No data is being collected. In the future, you would be contributing data"
- : "No data is being collected. In the future, your data would not be shared"}
+ ? "👍 Data is being collected"
+ : "👎 No data is being collected"}
</b>
</div>
<Footer dataSwitchChecked={dataSwitchChecked}>
@@ -573,13 +583,14 @@ function GUI(props: GUIProps) {
vscMachineId: vscMachineId,
dataSwitchChecked: !dataSwitchChecked,
});
+ postVscMessage("toggleDataSwitch", {on: !dataSwitchChecked})
setDataSwitchChecked((prev) => !prev);
}}
onColor="#12887a"
checked={dataSwitchChecked}
/>
<span style={{ cursor: "help", fontSize: "14px" }}>
- Contribute Data
+ Collect Data
</span>
</div>
<HeaderButtonWithText