From ce47a46c2066cb14c933084ce5d58744ed7884a2 Mon Sep 17 00:00:00 2001 From: BorysLevytskyi Date: Fri, 12 May 2023 15:47:29 +0200 Subject: [PATCH] Commit --- src/index.css | 4 +++ src/shell/AppState.ts | 12 +++++++++ src/shell/components/AppRoot.tsx | 9 ++++--- src/shell/components/SettingsPane.css | 28 +++++++++++++++++++ src/shell/components/SettingsPane.tsx | 39 +++++++++++++++++++++++++++ 5 files changed, 89 insertions(+), 3 deletions(-) create mode 100644 src/shell/components/SettingsPane.css create mode 100644 src/shell/components/SettingsPane.tsx diff --git a/src/index.css b/src/index.css index d0c1cb5..2708944 100644 --- a/src/index.css +++ b/src/index.css @@ -75,6 +75,10 @@ a.hashLink { font-size: 1.1em;} button { border: none; text-decoration: underline;} +.settings-button { + margin-left: -20px; +} + .undo button { opacity: 0.4; padding: 0; diff --git a/src/shell/AppState.ts b/src/shell/AppState.ts index bcf7a82..9df00a9 100644 --- a/src/shell/AppState.ts +++ b/src/shell/AppState.ts @@ -34,6 +34,8 @@ export default class AppState { env: string; pageVisitsCount: number; donationClicked: boolean; + showSettings: boolean = false; + annotateTypes: boolean = false; constructor(persistData : PersistedAppData, env: string) { this.commandResults = []; @@ -92,6 +94,16 @@ export default class AppState { this.triggerChanged(); } + toggleShowSettins() { + this.showSettings = !this.showSettings; + this.triggerChanged(); + } + + toggleAnnotateTypes() { + this.annotateTypes = !this.annotateTypes; + this.triggerChanged(); + } + registerVisit() { this.pageVisitsCount++; this.triggerChanged(); diff --git a/src/shell/components/AppRoot.tsx b/src/shell/components/AppRoot.tsx index 692e8c0..c1c8a3a 100644 --- a/src/shell/components/AppRoot.tsx +++ b/src/shell/components/AppRoot.tsx @@ -8,6 +8,9 @@ import DebugIndicators from './DebugIndicators'; import hash from '../../core/hash'; import TopLinks from './TopLinks'; import Toggle from './Toggle'; +import SettingsPane from './SettingsPane'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import { faGear } from '@fortawesome/free-solid-svg-icons'; type AppRootProps = { @@ -64,11 +67,11 @@ export default class AppRoot extends React.Component
cmd.execute(input)} /> - - this.toggleEmphasizeBytes()} title="Toggle Emphasize Bytes" /> + +
- + {this.props.appState.showSettings ? : null}
{this.getResultViews()}
diff --git a/src/shell/components/SettingsPane.css b/src/shell/components/SettingsPane.css new file mode 100644 index 0000000..b9415c0 --- /dev/null +++ b/src/shell/components/SettingsPane.css @@ -0,0 +1,28 @@ +.settings-container { + padding: 20px; + display: inline-block; +} + +.settings-container h3 { + +} + +.settings-container button { + text-decoration: none; +} + +.settings-container button svg { + margin-right: 3px; +} + +.settings-container .description { + font-size: 0.85em; + padding: 0; + margin: 0; + padding-left: 30px; + opacity: 0.8; +} + +.settings-container .setting { + margin-bottom: 10px; +} \ No newline at end of file diff --git a/src/shell/components/SettingsPane.tsx b/src/shell/components/SettingsPane.tsx new file mode 100644 index 0000000..3deabcb --- /dev/null +++ b/src/shell/components/SettingsPane.tsx @@ -0,0 +1,39 @@ +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import './SettingsPane.css'; +import { faToggleOff, faToggleOn } from '@fortawesome/free-solid-svg-icons'; +import { useState } from 'react'; +import { type } from 'os'; +import AppState from '../AppState'; + +type SettingsPaneProps = { + appState : AppState +} + +function SettingsPane(props : SettingsPaneProps) { + + const {appState} = props; + + return
+
+

Settings

+
+ +

+ {appState.emphasizeBytes ? "This setting is on" : "This settings is of"} +

+
+
+ +

+ {appState.annotateTypes ? "Bit size is shown next to each number" : "Do not show what data types BitwiseCmd uses to represent every nubmer in the results section"} +

+
+
+
+} + +export default SettingsPane; \ No newline at end of file