From 4cd2469968ab1cace4b9105f23e18b3a73b5a851 Mon Sep 17 00:00:00 2001 From: David Glymph Date: Tue, 1 Aug 2023 16:23:26 -0400 Subject: [PATCH 1/8] GPT sidebar button with enabled/disabled badge --- src/pages/answer/leftDrawer/LeftDrawer.jsx | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/pages/answer/leftDrawer/LeftDrawer.jsx b/src/pages/answer/leftDrawer/LeftDrawer.jsx index e9ee883a..2d1b91a7 100644 --- a/src/pages/answer/leftDrawer/LeftDrawer.jsx +++ b/src/pages/answer/leftDrawer/LeftDrawer.jsx @@ -8,6 +8,8 @@ import ListItemIcon from '@material-ui/core/ListItemIcon'; import ListItemText from '@material-ui/core/ListItemText'; import Checkbox from '@material-ui/core/Checkbox'; import IconButton from '@material-ui/core/IconButton'; +import { Assistant } from '@material-ui/icons'; +import { Badge, makeStyles } from '@material-ui/core'; import { useAuth0 } from '@auth0/auth0-react'; @@ -20,6 +22,15 @@ import ConfirmDialog from '~/components/ConfirmDialog'; import './leftDrawer.css'; +const badgeStyles = makeStyles({ + colorPrimary: { + backgroundColor: '#2dd04a', + }, + colorError: { + backgroundColor: '#ff4a4a', + }, +}); + /** * Main Drawer component on answer page * @param {function} onUpload - function to call when user uploads their own message @@ -159,6 +170,25 @@ export default function LeftDrawer({ + console.log('clicked GPT')} + button + > + + + + + + + + + Date: Tue, 1 Aug 2023 21:29:31 -0400 Subject: [PATCH 2/8] add gpt context --- src/App.jsx | 81 ++++++++++++---------- src/context/gpt.js | 5 ++ src/pages/answer/leftDrawer/LeftDrawer.jsx | 8 ++- src/stores/useGPT.js | 10 +++ 4 files changed, 63 insertions(+), 41 deletions(-) create mode 100644 src/context/gpt.js create mode 100644 src/stores/useGPT.js diff --git a/src/App.jsx b/src/App.jsx index 72f2bda2..e8b98567 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -24,12 +24,15 @@ import API from '~/API'; import AlertContext from '~/context/alert'; import BiolinkContext from '~/context/biolink'; +import GPTContext from '~/context/gpt'; import useBiolinkModel from '~/stores/useBiolinkModel'; +import useGPT from '~/stores/useGPT'; export default function App() { const [alert, setAlert] = useState({}); const biolink = useBiolinkModel(); + const gpt = useGPT(); function simpleSetAlert(severity, msg) { setAlert({ severity, msg }); @@ -60,44 +63,46 @@ export default function App() { > - - - simpleSetAlert(alert.severity, '')} - /> -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - -
-