From d074ce6bcdc3c08b293ee6ee2c18c841aba5e4bb Mon Sep 17 00:00:00 2001
From: bendera
Date: Mon, 12 Oct 2020 22:33:33 +0200
Subject: [PATCH 1/4] #132 Add sticky header option
---
package.json | 5 +++++
src/config.ts | 7 +++++++
src/gitGraphView.ts | 4 +++-
src/types.ts | 1 +
tests/config.test.ts | 2 ++
web/main.ts | 3 ++-
web/styles/main.css | 17 +++++++++++++++--
7 files changed, 35 insertions(+), 4 deletions(-)
diff --git a/package.json b/package.json
index 24abc04b..96309152 100644
--- a/package.json
+++ b/package.json
@@ -493,6 +493,11 @@
},
"description": "An object specifying the default visibility of the Date, Author & Commit columns. Example: {\"Date\": true, \"Author\": true, \"Commit\": true}"
},
+ "git-graph.stickyHeader": {
+ "type": "boolean",
+ "default": true,
+ "description": "Keeps the header visible when the view is scrolled"
+ },
"git-graph.dialog.addTag.pushToRemote": {
"type": "boolean",
"default": false,
diff --git a/src/config.ts b/src/config.ts
index d5dc870b..2a91f3fe 100644
--- a/src/config.ts
+++ b/src/config.ts
@@ -545,6 +545,13 @@ class Config {
return !!this.config.get('showStatusBarItem', true);
}
+ /**
+ * Get the value of the `git-graph.stickyHeader` Extension Setting.
+ */
+ get stickyHeader() {
+ return !!this.config.get('stickyHeader', true);
+ }
+
/**
* Get the value of the `git-graph.tabIconColourTheme` Extension Setting.
*/
diff --git a/src/gitGraphView.ts b/src/gitGraphView.ts
index 3fa92f21..b063331f 100644
--- a/src/gitGraphView.ts
+++ b/src/gitGraphView.ts
@@ -639,6 +639,7 @@ export class GitGraphView extends Disposable {
customPullRequestProviders: config.customPullRequestProviders,
dateFormat: config.dateFormat,
defaultColumnVisibility: config.defaultColumnVisibility,
+ stickyHeader: config.stickyHeader,
dialogDefaults: config.dialogDefaults,
enhancedAccessibility: config.enhancedAccessibility,
fetchAndPrune: config.fetchAndPrune,
@@ -681,9 +682,10 @@ export class GitGraphView extends Disposable {
${UNABLE_TO_FIND_GIT_MSG}
-
+
Repo:
Branches:
diff --git a/src/types.ts b/src/types.ts
index 70004b0d..9b74422f 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -260,6 +260,7 @@ export interface GitGraphViewConfig {
readonly showRemoteBranches: boolean;
readonly showStashes: boolean;
readonly showTags: boolean;
+ readonly stickyHeader: boolean;
}
export interface GitGraphViewGlobalState {
diff --git a/tests/config.test.ts b/tests/config.test.ts
index 18cb70cd..3563f904 100644
--- a/tests/config.test.ts
+++ b/tests/config.test.ts
@@ -2845,6 +2845,8 @@ describe('Config', () => {
describe('showStatusBarItem', testBooleanExtensionSetting('showStatusBarItem', 'showStatusBarItem', true));
+ describe('stickyHeader', testBooleanExtensionSetting('stickyHeader', 'stickyHeader', true));
+
describe('tabIconColourTheme', () => {
it('Should return TabIconColourTheme.Colour when the configuration value is "colour"', () => {
// Setup
diff --git a/web/main.ts b/web/main.ts
index 645ec57a..27f6a481 100644
--- a/web/main.ts
+++ b/web/main.ts
@@ -818,7 +818,8 @@ class GitGraphView {
markdown: this.config.markdown
});
- let html = '