From 2ce35e434377de85fd4192150f2672778b3091c1 Mon Sep 17 00:00:00 2001 From: Rob <12145726+rihp@users.noreply.github.com> Date: Thu, 31 Aug 2023 14:22:52 +0200 Subject: [PATCH] chore: make disclaimer optional --- apps/browser/src/components/Chat/Chat.css | 14 +++++++++++++- apps/browser/src/components/Chat/Chat.tsx | 23 ++++++++++++++++++----- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/apps/browser/src/components/Chat/Chat.css b/apps/browser/src/components/Chat/Chat.css index ef33c0ea..420bb591 100644 --- a/apps/browser/src/components/Chat/Chat.css +++ b/apps/browser/src/components/Chat/Chat.css @@ -21,10 +21,15 @@ border-radius: 10px 10px 0 0; border: 2px solid red; display: flex; - justify-content: space-between; + justify-content: space-around; align-items: center; } +.ButtonWrapper { + display: flex; + gap: 10px; +} + .CloseDisclaimer { cursor: pointer; padding: 10px 20px; @@ -32,6 +37,13 @@ color: red; } +.CloseWithoutTracking { + cursor: pointer; + padding: 10px 20px; + font-weight: bold; + color: white; +} + .Chat__Export { cursor: pointer; font-size: 24px; diff --git a/apps/browser/src/components/Chat/Chat.tsx b/apps/browser/src/components/Chat/Chat.tsx index 94f585d9..b000d11e 100644 --- a/apps/browser/src/components/Chat/Chat.tsx +++ b/apps/browser/src/components/Chat/Chat.tsx @@ -37,6 +37,7 @@ const Chat: React.FC = ({ evo, onMessage, messages, goalEnded }: Chat ); const [stopped, setStopped] = useState(false); const [showDisclaimer, setShowDisclaimer] = useState(true); + const [trackUser, setTrackUser] = useState(false); const pausedRef = useRef(paused); @@ -104,8 +105,15 @@ const Chat: React.FC = ({ evo, onMessage, messages, goalEnded }: Chat return () => clearTimeout(timer); }, [evoRunning, evoItr]); + const handleCloseDisclaimer = () => { setShowDisclaimer(false); + setTrackUser(true); // User accepted disclaimer, enable tracking + }; + + const handleCloseWithoutTracking = () => { + setShowDisclaimer(false); + setTrackUser(false); // User did not accept disclaimer, disable tracking }; const handleSend = async () => { @@ -116,7 +124,10 @@ const Chat: React.FC = ({ evo, onMessage, messages, goalEnded }: Chat setSending(true); setMessage(""); setEvoRunning(true); - trackMessageSent(message); // Google Analytics Event tracker + + if (trackUser) { // Only track if user accepted the disclaimer + trackMessageSent(message); + } }; const handlePause = async () => { @@ -178,12 +189,14 @@ const Chat: React.FC = ({ evo, onMessage, messages, goalEnded }: Chat
{showDisclaimer && ( -
- 🧠 Disclaimer: In order to improve Evo, all inputs to the agent through this UI will be tracked so don't share any sensitive information or private keys. - Agree and Continue +
+ 🧠 Disclaimer: In order to improve Evo, all inputs to the agent through this UI will be tracked, so don't share any sensitive information or private keys. +
+ Agree + Disagree +
)} -