Skip to content

Commit 95482ba

Browse files
authored
Models dropdown (#1321)
1 parent 09d4766 commit 95482ba

File tree

4 files changed

+89
-1
lines changed

4 files changed

+89
-1
lines changed

gui/pages/Dashboard/TopBar.js

+38-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ import Cookies from 'js-cookie';
1010
export default function TopBar({selectedProject, userName, env}) {
1111
const [dropdown, setDropdown] = useState(false);
1212
const router = useRouter();
13+
const [showDropdown, setShowDropdown] = useState(false)
14+
const [selectedImagePath, setSelectedImagePath] = useState('/images/agents_icon_dropdown.svg')
15+
const [selectedOption, setSelectedOption] = useState('Agents')
1316

1417
const logoutUser = () => {
1518
setDropdown(false);
@@ -19,14 +22,48 @@ export default function TopBar({selectedProject, userName, env}) {
1922
}
2023
getUserClick('Logged Out',{})
2124
localStorage.removeItem('accessToken');
22-
Cookies.remove('accessToken');
25+
Cookies.set('accessToken', '', { expires: new Date(0), domain: '.superagi.com', path: '/' });
2326
refreshUrl();
2427
router.reload();
2528
};
2629

30+
function handleClick (option) {
31+
if (option === 'Models') {
32+
setSelectedImagePath("/images/models_icon_dropdown.svg")
33+
setSelectedOption('Models')
34+
window.location.href = 'https://models.superagi.com'
35+
} else {
36+
setSelectedImagePath("/images/agents_icon_dropdown.svg")
37+
setSelectedOption('Agents')
38+
}
39+
setShowDropdown(false)
40+
}
41+
2742
return (
2843
<div className="top_bar">
2944
<div className="top_left">
45+
<div className="top_bar_section cursor_default">
46+
{env === 'PROD' && false && <div className="horizontal_container">
47+
<div onClick={() => setShowDropdown(!showDropdown)} className="horizontal_container align-middle cursor-pointer">
48+
<Image className="mr_8" width={20} height={20} src={selectedImagePath} alt="models-icon" />
49+
<span className="text_dropdown text_dropdown_18">{selectedOption}</span>
50+
<Image className="ml_8" width={14} height={14} src="/images/arrow_down.svg" alt="down_arrow" />
51+
</div>
52+
{showDropdown && <div className="dropdown_container_models mt_130">
53+
<ul className="padding_0 margin_0">
54+
<li className="dropdown_item text_dropdown_15" onClick={() => handleClick('Models')}>
55+
<Image className="mr_8" width={20} height={20} src="/images/models_icon_dropdown.svg" alt="models-icon" />
56+
<span className="text_dropdown">Models</span>
57+
</li>
58+
<li className="dropdown_item text_dropdown_15" onClick={() => handleClick('Agents')}>
59+
<Image className="mr_8" width={20} height={20} src="/images/agents_icon_dropdown.svg" alt="agents-icon" />
60+
<span className="text_dropdown">Agents</span>
61+
</li>
62+
</ul>
63+
</div>}
64+
</div>}
65+
</div>
66+
{env === 'PROD' && false && <div className="vertical_divider ml_12 mr_20 responsiveness" />}
3067
<div className="top_bar_section top_bar_input cursor_default">
3168
<div className="horizontal_container">
3269
<Image width={14} height={14} src="/images/project.svg" alt="project-icon"/>

gui/pages/_app.css

+33
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,18 @@ input[type="range"]::-moz-range-track {
231231
z-index: 10;
232232
}
233233

234+
.dropdown_container_models {
235+
flex-direction: column;
236+
align-items: flex-start;
237+
border-radius: 8px;
238+
background: #2E293F;
239+
box-shadow: -2px 2px 24px rgba(0, 0, 0, 0.4);
240+
position: absolute;
241+
width: fit-content;
242+
height: fit-content;
243+
padding: 8px;
244+
}
245+
234246
.dropdown_container {
235247
width: 150px;
236248
height: auto;
@@ -771,6 +783,7 @@ p {
771783
.mt_74{margin-top: 74px;}
772784
.mt_80{margin-top: 80px;}
773785
.mt_90{margin-top: 90px;}
786+
.mt_130{margin-top: 130px;}
774787

775788
.mb_1{margin-bottom: 1px;}
776789
.mb_2{margin-bottom: 2px;}
@@ -1907,4 +1920,24 @@ tr{
19071920
border-radius: 6px;
19081921
}
19091922

1923+
.text_dropdown {
1924+
color: #FFFFFF;
1925+
font-family: Plus Jakarta Sans, sans-serif;
1926+
font-style: normal;
1927+
font-weight: 500;
1928+
line-height: normal;
1929+
}
1930+
1931+
.text_dropdown_18 {
1932+
font-size: 18px;
1933+
}
1934+
1935+
.vertical_divider {
1936+
background: transparent;
1937+
/*border-color: rgba(255, 255, 255, 0.08);*/
1938+
border: 1.2px solid rgba(255, 255, 255, 0.08);;
1939+
height: 20px;
1940+
width: 0;
1941+
}
1942+
19101943

Loading
Loading

0 commit comments

Comments
 (0)