Skip to content

Commit f1f7bb6

Browse files
committed
move hash to help
1 parent 7c39302 commit f1f7bb6

File tree

6 files changed

+28
-28
lines changed

6 files changed

+28
-28
lines changed

frontend/webEditor/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
node_modules
22
dist
3-
src/settings/hash.json
3+
src/helpUi/hash.json

frontend/webEditor/scripts/fetchHash.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ let hash = 'unknown'
55
try {
66
hash = execSync('git rev-parse HEAD').toString().trim()
77
} catch (e) {
8-
// eslint-disable-next-line no-console
8+
// eslint-disable-next-line no-console, no-undef
99
console.warn('Could not retrieve git hash:', e)
1010
}
11-
const filePath = 'src/settings/hash.json'
11+
const filePath = 'src/helpUi/hash.json'
1212
const fileContent = JSON.stringify({ hash })
1313
writeFileSync(filePath, fileContent)

frontend/webEditor/src/helpUi/helpUi.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,11 @@
1414
vertical-align: text-top;
1515
margin-right: 4px;
1616
}
17+
18+
#hashHolder {
19+
font-size: small;
20+
margin-top: 4px;
21+
display: flex;
22+
gap: 2px;
23+
}
1724
}

frontend/webEditor/src/helpUi/helpUi.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { injectable } from "inversify";
22
import "./helpUi.css";
33
import { AccordionUiExtension } from "../accordionUiExtension";
4+
import hashJson from "./hash.json";
45

56
@injectable()
67
export class HelpUI extends AccordionUiExtension {
@@ -35,9 +36,26 @@ export class HelpUI extends AccordionUiExtension {
3536
<p><kbd>Esc</kbd>: Disable current creation tool</p>
3637
<p>Toggle Creation Tool: Refer to key in the tool palette</p>
3738
`;
39+
40+
contentElement.appendChild(this.buildCommitHash());
3841
}
3942
protected initializeHeaderContent(headerElement: HTMLElement) {
4043
headerElement.classList.add("help-accordion-icon");
4144
headerElement.innerText = "Keyboard Shortcuts | Help";
4245
}
46+
47+
private buildCommitHash(): HTMLElement {
48+
const holder = document.createElement("div");
49+
holder.id = "hashHolder";
50+
holder.innerHTML = "Commit:";
51+
52+
const link = document.createElement("a");
53+
link.innerHTML = hashJson.hash.substring(0, 6);
54+
link.href = `https://github.com/DataFlowAnalysis/OnlineEditor/tree/${hashJson.hash}`;
55+
link.id = "hash";
56+
link.target = "_blank";
57+
58+
holder.appendChild(link);
59+
return holder;
60+
}
4361
}

frontend/webEditor/src/settings/SettingsUi.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { HideEdgeNames, SETTINGS, SimplifyNodeNames } from "./Settings";
66
import { EditorModeController } from "./editorMode";
77
import { Theme, ThemeManager } from "./Theme";
88
import { ShownLabels, ShownLabelsValue } from "./ShownLabels";
9-
import hashJson from './hash.json'
109

1110
@injectable()
1211
export class SettingsUI extends AccordionUiExtension {
@@ -43,29 +42,13 @@ export class SettingsUI extends AccordionUiExtension {
4342
this.addBooleanSwitch(grid, "Hide Edge Names", this.hideEdgeNames);
4443
this.addBooleanSwitch(grid, "Simplify Node Names", this.simplifyNodeNames);
4544
this.addSwitch(grid, "Read Only", this.editorModeController, { true: "view", false: "edit" });
46-
contentElement.appendChild(this.buildCommitHash())
4745
}
4846

4947
protected initializeHeaderContent(headerElement: HTMLElement): void {
5048
headerElement.classList.add("settings-accordion-icon");
5149
headerElement.innerText = "Settings";
5250
}
5351

54-
private buildCommitHash(): HTMLElement {
55-
const holder = document.createElement('div')
56-
holder.id = 'hashHolder'
57-
holder.innerHTML = 'Commit:'
58-
59-
const link = document.createElement('a')
60-
link.innerHTML = hashJson.hash.substring(0, 6)
61-
link.href = `https://github.com/DataFlowAnalysis/OnlineEditor/tree/${hashJson.hash}`
62-
link.id = 'hash'
63-
link.target = '_blank'
64-
65-
holder.appendChild(link)
66-
return holder
67-
}
68-
6952
private addBooleanSwitch(container: HTMLElement, title: string, value: SettingsValue<boolean>): void {
7053
this.addSwitch<boolean>(container, title, value, { true: true, false: false });
7154
}

frontend/webEditor/src/settings/settingsUi.css

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,3 @@ input:checked + .slider:before {
108108
.slider.round:before {
109109
border-radius: 50%;
110110
}
111-
112-
.settings-ui #hashHolder {
113-
font-size: small;
114-
margin-top: 8px;
115-
display: flex;
116-
gap: 2px;
117-
}
118-

0 commit comments

Comments
 (0)