diff --git a/gui/src/pages/config/ContinueFeaturesMenu.tsx b/gui/src/pages/config/ContinueFeaturesMenu.tsx new file mode 100644 index 000000000..63b7d503e --- /dev/null +++ b/gui/src/pages/config/ContinueFeaturesMenu.tsx @@ -0,0 +1,48 @@ +import { SharedConfigSchema } from "core/config/sharedConfig"; +import { HubSessionInfo } from "core/control-plane/AuthTypes"; +import { useContext } from "react"; +import ToggleSwitch from "../../components/gui/Switch"; +import { useAuth } from "../../context/Auth"; +import { IdeMessengerContext } from "../../context/IdeMessenger"; + +interface ContinueFeaturesMenuProps { + optInContinueFeature: boolean; + handleUpdate: (sharedConfig: SharedConfigSchema) => void; +} + +export function ContinueFeaturesMenu({ + optInContinueFeature, + handleUpdate, +}: ContinueFeaturesMenuProps) { + const ideMessenger = useContext(IdeMessengerContext); + const { session } = useAuth(); + + const handleOptInToggle = (value: boolean) => { + handleUpdate({ + optInContinueFeature: value, + }); + // Send message to VSCode extension with the email + const continueEmail = (session as HubSessionInfo)?.account?.id ?? null; + if (continueEmail) { + ideMessenger.post("optInContinueFeature", { + email: continueEmail, + optIn: value, + }); + } + }; + + return ( +
+
+ 🚧 CHECKPOINT CHARLIE 🚧 +
+
+ handleOptInToggle(!optInContinueFeature)} + text="Opt In to Special Feature" + /> +
+
+ ); +}