From 2438ff3fcc86d5c739190cd16c03efd06797b40a Mon Sep 17 00:00:00 2001 From: anika-ahluwalia Date: Tue, 4 Aug 2020 20:20:35 -0500 Subject: structure for new settings --- src/client/util/SettingsManager.tsx | 220 +++++++++++++++++++++++++++++------- 1 file changed, 182 insertions(+), 38 deletions(-) (limited to 'src/client/util/SettingsManager.tsx') diff --git a/src/client/util/SettingsManager.tsx b/src/client/util/SettingsManager.tsx index 6276fae96..9282559e2 100644 --- a/src/client/util/SettingsManager.tsx +++ b/src/client/util/SettingsManager.tsx @@ -15,6 +15,12 @@ import GroupManager from "./GroupManager"; import HypothesisAuthenticationManager from "../apis/HypothesisAuthenticationManager"; import GoogleAuthenticationManager from "../apis/GoogleAuthenticationManager"; import { DocServer } from "../DocServer"; +import { BoolCast } from "../../fields/Types"; +import { undoBatch } from "./UndoManager"; +import { ColorState, SketchPicker } from "react-color"; +const higflyout = require("@hig/flyout"); +export const { anchorPoints } = higflyout; +export const Flyout = higflyout.default; library.add(fa.faTimes); @@ -33,6 +39,9 @@ export default class SettingsManager extends React.Component<{}> { private new_password_ref = React.createRef(); private new_confirm_ref = React.createRef(); + + @observable private backgroundColor = "white"; + public open = action(() => { SelectionManager.DeselectAll(); this.isOpen = true; @@ -107,50 +116,183 @@ export default class SettingsManager extends React.Component<{}> { addStyleSheetRule(SettingsManager._settingsStyle, "lm_header", { background: "pink !important" }); } + @action + changeMode = (e: any) => { + if (e.currentTarget.value === "Novice") { + Doc.UserDoc().noviceMode = true; + } else { + Doc.UserDoc().noviceMode = false; + } + } + + @action @undoBatch + switchColor = (color: ColorState) => { + const val = String(color.hex); + this.backgroundColor = val; + return true; + } + private get settingsInterface() { - return ( -
-
-

settings

-
- -
+ + const oldSettings =
+
+

Settings

+
+ +
+
+
+
+ + + + + + +
-
-
- - - - - - - + {this.settingsContent === "password" ? +
+ + + + {this.errorText ?
{this.errorText}
: undefined} + {this.successText ?
{this.successText}
: undefined} + + forgot password? + +
+ : undefined} + {this.settingsContent === "data" ? +
+

WARNING:
+ THIS WILL ERASE ALL YOUR CURRENT DOCUMENTS STORED ON DASH. IF YOU WISH TO PROCEED, CLICK THE BUTTON BELOW.

+ +
+ : undefined} +
+ +
; + + + const passwordContent =
+
+ + + +
+
+ {this.errorText ?
{this.errorText}
: undefined} + {this.successText ?
{this.successText}
: undefined} + + forgot password? +
+
; + + const modesContent =
+ +
+ this.togglePlaygroundMode()))} + />
Playground Mode
+
+
; + + const accountsContent =
+ + + +
; + + const colorBox = ; + + const colorFlyout =
+ +
+
e.stopPropagation()} > +
- {this.settingsContent === "password" ? -
- - - - {this.errorText ?
{this.errorText}
: undefined} - {this.successText ?
{this.successText}
: undefined} - - forgot password? - -
- : undefined} - {this.settingsContent === "data" ? -
-

WARNING:
- THIS WILL ERASE ALL YOUR CURRENT DOCUMENTS STORED ON DASH. IF YOU WISH TO PROCEED, CLICK THE BUTTON BELOW.

- -
- : undefined}
+
+
; + const preferencesContent =
+
+
Background Color
{colorFlyout}
- ); +
+
Default Font
+ + +
+
; + + return (
+
+
Settings
+ +
+ +
+
+
+
+
Password
+
{passwordContent}
+
+
+
Modes
+
{modesContent}
+
+
+
Accounts
+
{accountsContent}
+
+
+
Preferences
+
{preferencesContent}
+
+
+
); } render() { @@ -160,6 +302,8 @@ export default class SettingsManager extends React.Component<{}> { isDisplayed={this.isOpen} interactive={true} closeOnExternalClick={this.close} + width={600} + height={340} /> ); } -- cgit v1.2.3-70-g09d2