From 95482baba0f4396188006f21c36e05f7a55fe4ea Mon Sep 17 00:00:00 2001 From: namansleeps <122260931+namansleeps@users.noreply.github.com> Date: Fri, 6 Oct 2023 18:05:31 +0530 Subject: [PATCH] Models dropdown (#1321) --- gui/pages/Dashboard/TopBar.js | 39 +++++++++++++++++++++- gui/pages/_app.css | 33 ++++++++++++++++++ gui/public/images/agents_icon_dropdown.svg | 9 +++++ gui/public/images/models_icon_dropdown.svg | 9 +++++ 4 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 gui/public/images/agents_icon_dropdown.svg create mode 100644 gui/public/images/models_icon_dropdown.svg diff --git a/gui/pages/Dashboard/TopBar.js b/gui/pages/Dashboard/TopBar.js index 8ab9ac69d..fbd232dc4 100644 --- a/gui/pages/Dashboard/TopBar.js +++ b/gui/pages/Dashboard/TopBar.js @@ -10,6 +10,9 @@ import Cookies from 'js-cookie'; export default function TopBar({selectedProject, userName, env}) { const [dropdown, setDropdown] = useState(false); const router = useRouter(); + const [showDropdown, setShowDropdown] = useState(false) + const [selectedImagePath, setSelectedImagePath] = useState('/images/agents_icon_dropdown.svg') + const [selectedOption, setSelectedOption] = useState('Agents') const logoutUser = () => { setDropdown(false); @@ -19,14 +22,48 @@ export default function TopBar({selectedProject, userName, env}) { } getUserClick('Logged Out',{}) localStorage.removeItem('accessToken'); - Cookies.remove('accessToken'); + Cookies.set('accessToken', '', { expires: new Date(0), domain: '.superagi.com', path: '/' }); refreshUrl(); router.reload(); }; + function handleClick (option) { + if (option === 'Models') { + setSelectedImagePath("/images/models_icon_dropdown.svg") + setSelectedOption('Models') + window.location.href = 'https://models.superagi.com' + } else { + setSelectedImagePath("/images/agents_icon_dropdown.svg") + setSelectedOption('Agents') + } + setShowDropdown(false) + } + return (