From c3e498c1d14044222636a7a24c4eff37cb827dd5 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Sun, 18 Jun 2023 18:29:20 -0700 Subject: data sharing toggle --- .../src/components/HeaderButtonWithText.tsx | 2 +- extension/react-app/src/tabs/gui.tsx | 68 +++++++++++++++++++--- 2 files changed, 60 insertions(+), 10 deletions(-) (limited to 'extension/react-app/src') 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); diff --git a/extension/react-app/src/tabs/gui.tsx b/extension/react-app/src/tabs/gui.tsx index 624d22d5..52318dca 100644 --- a/extension/react-app/src/tabs/gui.tsx +++ b/extension/react-app/src/tabs/gui.tsx @@ -1,11 +1,5 @@ import styled from "styled-components"; -import { - defaultBorderRadius, - vscBackground, - Loader, - MainTextInput, - HeaderButton, -} from "../components"; +import { defaultBorderRadius, Loader } from "../components"; import ContinueButton from "../components/ContinueButton"; import { useCallback, useEffect, useRef, useState } from "react"; import { History } from "../../../schema/History"; @@ -20,6 +14,7 @@ import { import ComboBox from "../components/ComboBox"; import TextDialog from "../components/TextDialog"; import HeaderButtonWithText from "../components/HeaderButtonWithText"; +import ReactSwitch from "react-switch"; const TopGUIDiv = styled.div` overflow: hidden; @@ -33,7 +28,7 @@ const UserInputQueueItem = styled.div` text-align: center; `; -const Footer = styled.footer` +const Footer = styled.footer<{ dataSwitchChecked: boolean }>` display: flex; flex-direction: row; gap: 8px; @@ -42,6 +37,8 @@ const Footer = styled.footer` align-items: center; margin-top: 8px; border-top: 0.1px solid gray; + background-color: ${(props) => + props.dataSwitchChecked ? "#12887a33" : "transparent"}; `; interface GUIProps { @@ -54,6 +51,8 @@ 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([]); const [history, setHistory] = useState(); // { @@ -390,7 +389,58 @@ function GUI(props: GUIProps) { /> -