@@ -100,6 +100,19 @@ import type { GraphMinimapDaySelectedEventDetail } from './minimap/minimap';
100100import { GlGraphMinimapContainer } from './minimap/minimap-container.react' ;
101101import { GlGraphSideBar } from './sidebar/sidebar.react' ;
102102
103+ function getRemoteIcon ( type : string | number ) {
104+ switch ( type ) {
105+ case 'head' :
106+ return 'vm' ;
107+ case 'remote' :
108+ return 'cloud' ;
109+ case 'tag' :
110+ return 'tag' ;
111+ default :
112+ return '' ;
113+ }
114+ }
115+
103116export interface GraphWrapperProps {
104117 nonce ?: string ;
105118 state : State ;
@@ -873,7 +886,25 @@ export function GraphWrapper({
873886 onChangeColumns ?.( graphColumnsConfig ) ;
874887 } ;
875888
889+ // dirty trick to avoid mutations on the GraphContainer side
890+ const fixedExcludeRefsById = useMemo ( ( ) => ( { ...excludeRefsById } ) , [ excludeRefsById ] ) ;
876891 const handleOnToggleRefsVisibilityClick = ( _event : any , refs : GraphRefOptData [ ] , visible : boolean ) => {
892+ if ( ! visible ) {
893+ document . getElementById ( 'test' ) ?. animate (
894+ [
895+ { offset : 0 , background : 'transparent' } ,
896+ {
897+ offset : 0.4 ,
898+ background : 'var(--vscode-statusBarItem-warningBackground)' ,
899+ } ,
900+ { offset : 1 , background : 'transparent' } ,
901+ ] ,
902+ {
903+ duration : 1000 ,
904+ iterations : ! Object . keys ( fixedExcludeRefsById ?? { } ) . length ? 2 : 1 ,
905+ } ,
906+ ) ;
907+ }
877908 onChangeRefsVisibility ?.( refs , visible ) ;
878909 } ;
879910
@@ -1347,6 +1378,57 @@ export function GraphWrapper({
13471378 < SlOption value = "current" > Current Branch</ SlOption >
13481379 </ SlSelect >
13491380 </ GlTooltip >
1381+ < div className = { `shrink ${ ! Object . values ( excludeRefsById ?? { } ) . length && 'hidden' } ` } >
1382+ < GlPopover
1383+ className = "popover"
1384+ placement = "bottom-start"
1385+ trigger = "click focus"
1386+ arrow = { false }
1387+ distance = { 0 }
1388+ >
1389+ < GlTooltip placement = "top" slot = "anchor" >
1390+ < button type = "button" id = "test" className = "action-button" >
1391+ < CodeIcon icon = { `eye` } />
1392+ { Object . values ( excludeRefsById ?? { } ) . length }
1393+ < CodeIcon
1394+ className = "action-button__more"
1395+ icon = "chevron-down"
1396+ aria-hidden = "true"
1397+ />
1398+ </ button >
1399+ < span slot = "content" > Hidden branches</ span >
1400+ </ GlTooltip >
1401+ < div slot = "content" >
1402+ < MenuLabel > Hidden branches</ MenuLabel >
1403+ { Object . values ( excludeRefsById ?? { } ) . map ( ref => (
1404+ < MenuItem
1405+ // key prop is skipped intentionally. It allows me to not hide the dropdown after click (I don't know why)
1406+ onClick = { event => {
1407+ handleOnToggleRefsVisibilityClick ( event , [ ref ] , true ) ;
1408+ } }
1409+ className = "flex-gap"
1410+ >
1411+ < CodeIcon icon = { getRemoteIcon ( ref . type ) } > </ CodeIcon >
1412+ < span > { ref . name } </ span >
1413+ </ MenuItem >
1414+ ) ) }
1415+ { /* One more weird case. If I render it unconditionally, the dropdown is not hidden after click */ }
1416+ { Boolean ( Object . values ( excludeRefsById ?? { } ) . length ) && (
1417+ < MenuItem
1418+ onClick = { event => {
1419+ handleOnToggleRefsVisibilityClick (
1420+ event ,
1421+ Object . values ( excludeRefsById ?? { } ) ,
1422+ true ,
1423+ ) ;
1424+ } }
1425+ >
1426+ Show all
1427+ </ MenuItem >
1428+ ) }
1429+ </ div >
1430+ </ GlPopover >
1431+ </ div >
13501432 < GlPopover
13511433 className = "popover"
13521434 placement = "bottom-start"
0 commit comments