22// SPDX-License-Identifier: Apache-2.0
33
44import { Button } from "@/app/element/button" ;
5+ import { Tooltip } from "@/app/element/tooltip" ;
56import { modalsModel } from "@/app/store/modalmodel" ;
67import { WorkspaceLayoutModel } from "@/app/workspace/workspace-layout-model" ;
78import { deleteLayoutModelForTab } from "@/layout/index" ;
@@ -42,7 +43,7 @@ interface TabBarProps {
4243 workspace : Workspace ;
4344}
4445
45- const WaveAIButton = memo ( ( ) => {
46+ const WaveAIButton = memo ( ( { divRef } : { divRef ?: React . RefObject < HTMLDivElement > } ) => {
4647 const aiPanelOpen = useAtomValue ( WorkspaceLayoutModel . getInstance ( ) . panelVisibleAtom ) ;
4748 const hideAiButton = useAtomValue ( getSettingsKeyAtom ( "app:hideaibutton" ) ) ;
4849
@@ -56,14 +57,18 @@ const WaveAIButton = memo(() => {
5657 }
5758
5859 return (
59- < div
60- className = { `flex h-[26px] px-1.5 justify-end items-center rounded-md mr-1 box-border cursor-pointer bg-hover hover:bg-hoverbg transition-colors text-[12px] ${ aiPanelOpen ? "text-accent" : "text-secondary" } ` }
61- style = { { WebkitAppRegion : "no-drag" } as React . CSSProperties }
62- onClick = { onClick }
60+ < Tooltip
61+ content = "Toggle Wave AI Panel"
62+ placement = "bottom"
63+ hideOnClick
64+ divClassName = { `flex h-[26px] px-1.5 justify-end items-center rounded-md mr-1 box-border cursor-pointer bg-hover hover:bg-hoverbg transition-colors text-[12px] ${ aiPanelOpen ? "text-accent" : "text-secondary" } ` }
65+ divStyle = { { WebkitAppRegion : "no-drag" } as React . CSSProperties }
66+ divOnClick = { onClick }
67+ divRef = { divRef }
6368 >
6469 < i className = "fa fa-sparkles" />
6570 < span className = "font-bold ml-1 -top-px font-mono" > AI</ span >
66- </ div >
71+ </ Tooltip >
6772 ) ;
6873} ) ;
6974WaveAIButton . displayName = "WaveAIButton" ;
@@ -190,6 +195,7 @@ const TabBar = memo(({ workspace }: TabBarProps) => {
190195 const draggerLeftRef = useRef < HTMLDivElement > ( null ) ;
191196 const draggerRightRef = useRef < HTMLDivElement > ( null ) ;
192197 const workspaceSwitcherRef = useRef < HTMLDivElement > ( null ) ;
198+ const waveAIButtonRef = useRef < HTMLDivElement > ( null ) ;
193199 const appMenuButtonRef = useRef < HTMLDivElement > ( null ) ;
194200 const tabWidthRef = useRef < number > ( TabDefaultWidth ) ;
195201 const scrollableRef = useRef < boolean > ( false ) ;
@@ -251,6 +257,7 @@ const TabBar = memo(({ workspace }: TabBarProps) => {
251257 const configErrorWidth = configErrorButtonRef . current ?. getBoundingClientRect ( ) . width ?? 0 ;
252258 const appMenuButtonWidth = appMenuButtonRef . current ?. getBoundingClientRect ( ) . width ?? 0 ;
253259 const workspaceSwitcherWidth = workspaceSwitcherRef . current ?. getBoundingClientRect ( ) . width ?? 0 ;
260+ const waveAIButtonWidth = waveAIButtonRef . current ?. getBoundingClientRect ( ) . width ?? 0 ;
254261
255262 const nonTabElementsWidth =
256263 windowDragLeftWidth +
@@ -259,7 +266,8 @@ const TabBar = memo(({ workspace }: TabBarProps) => {
259266 updateStatusLabelWidth +
260267 configErrorWidth +
261268 appMenuButtonWidth +
262- workspaceSwitcherWidth ;
269+ workspaceSwitcherWidth +
270+ waveAIButtonWidth ;
263271 const spaceForTabs = tabbarWrapperWidth - nonTabElementsWidth ;
264272
265273 const numberOfTabs = tabIds . length ;
@@ -670,8 +678,16 @@ const TabBar = memo(({ workspace }: TabBarProps) => {
670678 < i className = "fa fa-ellipsis" />
671679 </ div >
672680 ) }
673- < WaveAIButton />
674- < WorkspaceSwitcher ref = { workspaceSwitcherRef } />
681+ < WaveAIButton divRef = { waveAIButtonRef } />
682+ < Tooltip
683+ content = "Workspace Switcher"
684+ placement = "bottom"
685+ hideOnClick
686+ divRef = { workspaceSwitcherRef }
687+ divClassName = "flex items-center h-full"
688+ >
689+ < WorkspaceSwitcher />
690+ </ Tooltip >
675691 < div className = "tab-bar" ref = { tabBarRef } data-overlayscrollbars-initialize >
676692 < div className = "tabs-wrapper" ref = { tabsWrapperRef } style = { { width : `${ tabsWrapperWidth } px` } } >
677693 { tabIds . map ( ( tabId , index ) => {
0 commit comments