diff --git a/CHANGELOG.md b/CHANGELOG.md index cd4dfb4b70a5e..116404bf555be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p - Adds new ability to search for a GitLab MR in the _Launchpad_ — closes [#3788](https://github.com/gitkraken/vscode-gitlens/issues/3788) - Adds go to home view button to the commit graph title section — closes [#3873](https://github.com/gitkraken/vscode-gitlens/issues/3873) - Adds a _Contributors_ section to comparison results in the views +- Adds a new Hidden Branches dropdown next to the Branch Visibility dropdown in the graph toolbar — closes [#3101](https://github.com/gitkraken/vscode-gitlens/issues/3101) ### Changed diff --git a/src/webviews/apps/plus/graph/GraphWrapper.tsx b/src/webviews/apps/plus/graph/GraphWrapper.tsx index 27516ce951dcb..b9b25c881bdc0 100644 --- a/src/webviews/apps/plus/graph/GraphWrapper.tsx +++ b/src/webviews/apps/plus/graph/GraphWrapper.tsx @@ -100,6 +100,19 @@ import type { GraphMinimapDaySelectedEventDetail } from './minimap/minimap'; import { GlGraphMinimapContainer } from './minimap/minimap-container.react'; import { GlGraphSideBar } from './sidebar/sidebar.react'; +function getRemoteIcon(type: string | number) { + switch (type) { + case 'head': + return 'vm'; + case 'remote': + return 'cloud'; + case 'tag': + return 'tag'; + default: + return ''; + } +} + export interface GraphWrapperProps { nonce?: string; state: State; @@ -873,7 +886,25 @@ export function GraphWrapper({ onChangeColumns?.(graphColumnsConfig); }; + // dirty trick to avoid mutations on the GraphContainer side + const fixedExcludeRefsById = useMemo(() => ({ ...excludeRefsById }), [excludeRefsById]); const handleOnToggleRefsVisibilityClick = (_event: any, refs: GraphRefOptData[], visible: boolean) => { + if (!visible) { + document.getElementById('hiddenRefs')?.animate( + [ + { offset: 0, background: 'transparent' }, + { + offset: 0.4, + background: 'var(--vscode-statusBarItem-warningBackground)', + }, + { offset: 1, background: 'transparent' }, + ], + { + duration: 1000, + iterations: !Object.keys(fixedExcludeRefsById ?? {}).length ? 2 : 1, + }, + ); + } onChangeRefsVisibility?.(refs, visible); }; @@ -1347,6 +1378,60 @@ export function GraphWrapper({ Current Branch +
+ + + + Hidden Branches / Tags + +
+ Hidden Branches / Tags + {excludeRefsById && + Object.keys(excludeRefsById).length && + [...Object.values(excludeRefsById), null].map(ref => + ref ? ( + { + handleOnToggleRefsVisibilityClick(event, [ref], true); + }} + className="flex-gap" + > + + {ref.name} + + ) : ( + // One more weird case. If I render it outside the listed items, the dropdown is hidden after click on the last item + { + handleOnToggleRefsVisibilityClick( + event, + Object.values(excludeRefsById ?? {}), + true, + ); + }} + > + Show All + + ), + )} +
+
+