Skip to content

Commit

Permalink
ADD button to go to 'current' commit.
Browse files Browse the repository at this point in the history
TODO: improve icon, sync with similar features in other GUI items
  • Loading branch information
QrackEE committed Jan 12, 2023
1 parent 46d129c commit 88e9b09
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/gitGraphView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,7 @@ export class GitGraphView extends Disposable {
<span id="repoControl"><span class="unselectable">Repo: </span><div id="repoDropdown" class="dropdown"></div></span>
<span id="branchControl"><span class="unselectable">Branches: </span><div id="branchDropdown" class="dropdown"></div></span>
<label id="showRemoteBranchesControl"><input type="checkbox" id="showRemoteBranchesCheckbox" tabindex="-1"><span class="customCheckbox"></span>Show Remote Branches</label>
<div id="currentBtn" title="Current"></div>
<div id="findBtn" title="Find"></div>
<div id="terminalBtn" title="Open a Terminal for this Repository"></div>
<div id="settingsBtn" title="Repository Settings"></div>
Expand Down
8 changes: 7 additions & 1 deletion web/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,13 @@ class GitGraphView {
this.requestLoadRepoInfoAndCommits(false, false);
}

const fetchBtn = document.getElementById('fetchBtn')!, findBtn = document.getElementById('findBtn')!, settingsBtn = document.getElementById('settingsBtn')!, terminalBtn = document.getElementById('terminalBtn')!;
const currentBtn = document.getElementById('currentBtn')!, fetchBtn = document.getElementById('fetchBtn')!, findBtn = document.getElementById('findBtn')!, settingsBtn = document.getElementById('settingsBtn')!, terminalBtn = document.getElementById('terminalBtn')!;
currentBtn.innerHTML = SVG_ICONS.current;
currentBtn.addEventListener('click', () => {
if (this.commitHead) {
this.scrollToCommit(this.commitHead, true, true);
}
});
fetchBtn.title = 'Fetch' + (this.config.fetchAndPrune ? ' & Prune' : '') + ' from Remote(s)';
fetchBtn.innerHTML = SVG_ICONS.download;
fetchBtn.addEventListener('click', () => this.fetchFromRemotesAction());
Expand Down
18 changes: 12 additions & 6 deletions web/styles/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ body.tagLabelsRightAligned .gitRef.tag{
max-width:40vw;
}

#findBtn, #terminalBtn, #settingsBtn, #fetchBtn, #refreshBtn{
#currentBtn, #findBtn, #terminalBtn, #settingsBtn, #fetchBtn, #refreshBtn{
position:absolute;
top:50%;
width:20px;
Expand All @@ -822,6 +822,9 @@ body.tagLabelsRightAligned .gitRef.tag{
-webkit-user-select:none;
user-select:none;
}
#currentBtn{
right:130px;
}
#findBtn{
right:100px;
}
Expand All @@ -841,25 +844,25 @@ body.tagLabelsRightAligned .gitRef.tag{
#refreshBtn.refreshing{
cursor:default;
}
#findBtn svg, #terminalBtn svg, #settingsBtn svg, #fetchBtn svg, #refreshBtn svg{
#currentBtn svg, #findBtn svg, #terminalBtn svg, #settingsBtn svg, #fetchBtn svg, #refreshBtn svg{
position:absolute;
fill:var(--vscode-editor-foreground);
opacity:0.8;
stroke:var(--vscode-editor-foreground);
stroke-opacity:0.5;
stroke-width:0;
}
#findBtn svg, #terminalBtn svg{
#currentBtn svg, #findBtn svg, #terminalBtn svg{
stroke-width:0.5px;
}
#findBtn:hover svg, #terminalBtn:hover svg, #settingsBtn:hover svg, #fetchBtn:hover svg, #refreshBtn:hover svg{
#currentBtn:hover svg, #findBtn:hover svg, #terminalBtn:hover svg, #settingsBtn:hover svg, #fetchBtn:hover svg, #refreshBtn:hover svg{
opacity:1;
stroke-width:0.5px;
}
#findBtn:hover svg, #terminalBtn:hover svg{
#currentBtn:hover svg, #findBtn:hover svg, #terminalBtn:hover svg{
stroke-width:1px;
}
#findBtn svg, #terminalBtn svg, #settingsBtn svg, #fetchBtn svg{
#currentBtn svg, #findBtn svg, #terminalBtn svg, #settingsBtn svg, #fetchBtn svg{
left:1px;
top:1px;
width:18px !important;
Expand All @@ -882,6 +885,9 @@ body.tagLabelsRightAligned .gitRef.tag{
#controls.fetchSupported{
padding-right:162px;
}
#controls.fetchSupported #currentBtn{
right:160px;
}
#controls.fetchSupported #findBtn{
right:130px;
}
Expand Down
1 change: 1 addition & 0 deletions web/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const SVG_ICONS = {
check: '<svg xmlns="http://www.w3.org/2000/svg" width="12" height="16" viewBox="0 0 12 16"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5L12 5z"></path></svg>',
commit: '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="16" viewBox="0 0 14 16"><path fill-rule="evenodd" d="M10.86 7c-.45-1.72-2-3-3.86-3-1.86 0-3.41 1.28-3.86 3H0v2h3.14c.45 1.72 2 3 3.86 3 1.86 0 3.41-1.28 3.86-3H14V7h-3.14zM7 10.2c-1.22 0-2.2-.98-2.2-2.2 0-1.22.98-2.2 2.2-2.2 1.22 0 2.2.98 2.2 2.2 0 1.22-.98 2.2-2.2 2.2z"/></svg>',
copy: '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="16" viewBox="0 0 14 16"><path fill-rule="evenodd" d="M2 13h4v1H2v-1zm5-6H2v1h5V7zm2 3V8l-3 3 3 3v-2h5v-2H9zM4.5 9H2v1h2.5V9zM2 12h2.5v-1H2v1zm9 1h1v2c-.02.28-.11.52-.3.7-.19.18-.42.28-.7.3H1c-.55 0-1-.45-1-1V4c0-.55.45-1 1-1h3c0-1.11.89-2 2-2 1.11 0 2 .89 2 2h3c.55 0 1 .45 1 1v5h-1V6H1v9h10v-2zM2 5h8c0-.55-.45-1-1-1H8c-.55 0-1-.45-1-1s-.45-1-1-1-1 .45-1 1-.45 1-1 1H3c-.55 0-1 .45-1 1z"/></svg>',
current: '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="16" viewBox="0 0 14 16"> <path d="M 8.5793251,3.9709273 C 5.7393555,3.9722573 3.3857785,6.1732278 3.1943505,9.0067388 H 4.7680416 C 4.9548119,7.0413876 6.6051194,5.5401404 8.5793251,5.5397007 10.693557,5.5401531 12.407367,7.2539644 12.407817,9.3681961 12.408725,11.483388 10.694517,13.198699 8.5793251,13.199151 6.603404,13.198471 4.9524361,11.694493 4.7680416,9.727194 H 3.1943505 c 0.188959,2.835453 2.5432332,5.039225 5.3849746,5.04073 2.9812129,-0.0014 5.3972349,-2.418515 5.3972659,-5.3997279 -0.0014,-2.980253 -2.417013,-5.3958792 -5.3972659,-5.3972688 z m 0,3.1375466 c -0.8665744,3.13e-5 -1.655905,0.5013756 -2.0285866,1.2884596 0.4371757,0.1661687 0.9045642,0.3506253 1.2589529,0.4991552 0.3227657,0.135276 0.9442147,0.3573058 0.9442147,0.4745662 0,0.1172591 -0.621449,0.3368301 -0.9442147,0.4721071 -0.3543887,0.14853 -0.8217772,0.332987 -1.2589529,0.499155 0.3726816,0.787084 1.1620121,1.288429 2.0285866,1.28846 1.2398219,-0.0012 2.2444269,-1.012386 2.2449659,-2.2597221 8.1e-4,-1.2482965 -1.0041896,-2.2610032 -2.2449659,-2.262181 z M 5.579476,8.4313581 c -0.052649,0.00816 -0.07526,0.1152306 0,0.159828 L 6.4769718,9.1223068 H 2.3625859 L 1.8806431,8.3507087 H 0.01849445 l 0.752421,1.0199462 -0.752421,1.0199461 H 1.8806431 L 2.3650449,9.6165442 H 2.6825055 6.4794307 L 5.579476,10.150124 c -0.07526,0.0446 -0.052649,0.15167 0,0.159828 0.2360449,0.03657 1.406845,-0.369239 2.0900586,-0.614723 0.2586305,-0.092928 0.7573385,-0.244023 0.7573385,-0.3245741 0,-0.080552 -0.498708,-0.2316459 -0.7573385,-0.3245738 C 6.986321,8.8005973 5.815521,8.3947939 5.579476,8.4313581 Z" /></svg>',
download: '<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 -0.5 16 16.5"><path fill-rule="evenodd" d="M9 12h2l-3 3-3-3h2V7h2v5zm3-8c0-.44-.91-3-4.5-3C5.08 1 3 2.92 3 5 1.02 5 0 6.52 0 8c0 1.53 1 3 3 3h3V9.7H3C1.38 9.7 1.3 8.28 1.3 8c0-.17.05-1.7 1.7-1.7h1.3V5c0-1.39 1.56-2.7 3.2-2.7 2.55 0 3.13 1.55 3.2 1.8v1.2H12c.81 0 2.7.22 2.7 2.2 0 2.09-2.25 2.2-2.7 2.2h-2V11h2c2.08 0 4-1.16 4-3.5C16 5.06 14.08 4 12 4z"/></svg>',
eyeOpen: '<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M8.06 2C3 2 0 8 0 8s3 6 8.06 6C13 14 16 8 16 8s-3-6-7.94-6zM8 12c-2.2 0-4-1.78-4-4 0-2.2 1.8-4 4-4 2.22 0 4 1.8 4 4 0 2.22-1.78 4-4 4zm2-4c0 1.11-.89 2-2 2-1.11 0-2-.89-2-2 0-1.11.89-2 2-2 1.11 0 2 .89 2 2z"/></svg>',
eyeClosed: '<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 -1 16 16"><path fill-rule="evenodd" d="M14.822.854a.5.5 0 1 0-.707-.708l-2.11 2.11C10.89 1.483 9.565.926 8.06.926c-5.06 0-8.06 6-8.06 6s1.162 2.323 3.258 4.078l-2.064 2.065a.5.5 0 1 0 .707.707L14.822.854zM4.86 9.403L6.292 7.97A1.999 1.999 0 0 1 6 6.925c0-1.11.89-2 2-2 .384 0 .741.106 1.045.292l1.433-1.433A3.98 3.98 0 0 0 8 2.925c-2.2 0-4 1.8-4 4 0 .938.321 1.798.859 2.478zm7.005-3.514l1.993-1.992A14.873 14.873 0 0 1 16 6.925s-3 6-7.94 6a6.609 6.609 0 0 1-2.661-.57l1.565-1.566c.33.089.678.136 1.036.136 2.22 0 4-1.78 4-4 0-.358-.047-.705-.136-1.036zM9.338 8.415l.152-.151a1.996 1.996 0 0 1-.152.151z"/></svg>',
Expand Down

0 comments on commit 88e9b09

Please sign in to comment.