@@ -5,6 +5,7 @@ import PersonaSelector from '~/components/PersonaSelector'
55import ModelRefreshButton from '~/components/ModelRefreshButton'
66import FunTitle from '~/components/FunTitle'
77import KeyboardTooltip from '~/components/KeyboardToolTip'
8+ import { twMerge } from 'tailwind-merge'
89
910import Bars3 from '~/icons/Bars3'
1011import Search from '~/icons/Search'
@@ -14,37 +15,55 @@ import Create from '~/icons/Create'
1415
1516import { settingStore } from '~/core/setting/SettingStore'
1617import { chatStore } from '~/core/chat/ChatStore'
18+ import { Divider } from '@heroui/react'
1719
1820const Navbar = ( ) => {
21+ const isSidebarOpen = settingStore . setting . isSidebarOpen
22+
1923 return (
20- < div className = "navbar mb-2 flex h-auto min-h-0 flex-row justify-between gap-3 bg-base-300 p-1 md:mb-0 md:flex-col md:p-0" >
21- < div className = "ml-2 hidden items-center pr-2 md:flex md:text-xl" >
22- < KeyboardTooltip
23- command = "$mod+B"
24- placement = "bottom"
25- showArrow = { false }
26- className = "-mt-2"
27- title = "Toggle Sidebar"
28- >
29- < button
30- className = "absolute left-2 text-base-content/30 transition-colors duration-100 ease-in-out hover:text-base-content/80"
31- onClick = { ( ) => settingStore . toggleSideBar ( ) }
24+ < div className = "mb-2 flex h-auto min-h-0 flex-row justify-between gap-3 p-1 md:mb-0 md:flex-col md:p-0" >
25+ < div className = " hidden items-center md:flex md:text-xl" >
26+ { isSidebarOpen && (
27+ < KeyboardTooltip
28+ command = "$mod+B"
29+ placement = "bottom"
30+ showArrow = { false }
31+ className = "-mt-2"
32+ title = "Toggle Sidebar"
3233 >
33- < ShrinkHorizontal />
34- </ button >
35- </ KeyboardTooltip >
34+ < button
35+ className = "absolute left-2 text-base-content/30 transition-colors duration-100 ease-in-out hover:text-base-content/80"
36+ onClick = { ( ) => settingStore . toggleSideBar ( ) }
37+ >
38+ < ShrinkHorizontal />
39+ </ button >
40+ </ KeyboardTooltip >
41+ ) }
3642
37- < FunTitle className = "md:text-xl" />
43+ < FunTitle className = "w-full text-balance text-center md:text-xl" allowFun = { isSidebarOpen } />
3844 </ div >
3945
40- < div className = "w-full max-w-[600px] flex-row gap-2 md:flex md:flex-1" >
41- < ModelSelector />
42- < ModelRefreshButton />
43- </ div >
46+ { isSidebarOpen ? (
47+ < >
48+ < div className = "w-full max-w-[600px] flex-row gap-2 md:flex md:flex-1" >
49+ < ModelSelector />
50+ < ModelRefreshButton />
51+ </ div >
4452
45- < PersonaSelector />
53+ < PersonaSelector />
54+ </ >
55+ ) : (
56+ < Divider className = "bg-base-content/15" />
57+ ) }
4658
47- < div className = "flex w-fit flex-row gap-2 md:w-full md:justify-evenly" >
59+ < div
60+ className = { twMerge (
61+ 'flex w-fit gap-2 md:w-full ' ,
62+ settingStore . setting . isSidebarOpen
63+ ? 'flex-row md:justify-evenly'
64+ : 'flex-col items-center' ,
65+ ) }
66+ >
4867 < KeyboardTooltip
4968 command = "$mod+Shift+O"
5069 placement = "bottom"
@@ -79,7 +98,7 @@ const Navbar = () => {
7998 command = "$mod+/"
8099 placement = "bottom"
81100 showArrow = { false }
82- className = "- mt-2 "
101+ className = "mt-auto "
83102 title = "Settings"
84103 >
85104 < NavLink
0 commit comments