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 (
+
+ {env === 'PROD' && false &&
+
setShowDropdown(!showDropdown)} className="horizontal_container align-middle cursor-pointer"> + models-icon + {selectedOption} + down_arrow +
+ {showDropdown &&
+
    +
  • handleClick('Models')}> + models-icon + Models +
  • +
  • handleClick('Agents')}> + agents-icon + Agents +
  • +
+
} +
} +
+ {env === 'PROD' && false &&
}
project-icon diff --git a/gui/pages/_app.css b/gui/pages/_app.css index 479647a47..788de47a6 100644 --- a/gui/pages/_app.css +++ b/gui/pages/_app.css @@ -231,6 +231,18 @@ input[type="range"]::-moz-range-track { z-index: 10; } +.dropdown_container_models { + flex-direction: column; + align-items: flex-start; + border-radius: 8px; + background: #2E293F; + box-shadow: -2px 2px 24px rgba(0, 0, 0, 0.4); + position: absolute; + width: fit-content; + height: fit-content; + padding: 8px; +} + .dropdown_container { width: 150px; height: auto; @@ -771,6 +783,7 @@ p { .mt_74{margin-top: 74px;} .mt_80{margin-top: 80px;} .mt_90{margin-top: 90px;} +.mt_130{margin-top: 130px;} .mb_1{margin-bottom: 1px;} .mb_2{margin-bottom: 2px;} @@ -1907,4 +1920,24 @@ tr{ border-radius: 6px; } +.text_dropdown { + color: #FFFFFF; + font-family: Plus Jakarta Sans, sans-serif; + font-style: normal; + font-weight: 500; + line-height: normal; +} + +.text_dropdown_18 { + font-size: 18px; +} + +.vertical_divider { + background: transparent; + /*border-color: rgba(255, 255, 255, 0.08);*/ + border: 1.2px solid rgba(255, 255, 255, 0.08);; + height: 20px; + width: 0; +} + diff --git a/gui/public/images/agents_icon_dropdown.svg b/gui/public/images/agents_icon_dropdown.svg new file mode 100644 index 000000000..f4ebecc3a --- /dev/null +++ b/gui/public/images/agents_icon_dropdown.svg @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/gui/public/images/models_icon_dropdown.svg b/gui/public/images/models_icon_dropdown.svg new file mode 100644 index 000000000..232e168ad --- /dev/null +++ b/gui/public/images/models_icon_dropdown.svg @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file