From 7f8cea1a3b5aa261144abe20ca0d7129be1fb1f5 Mon Sep 17 00:00:00 2001 From: anika-ahluwalia Date: Tue, 4 Aug 2020 22:53:44 -0500 Subject: finishing touches on settings --- src/client/util/CurrentUserUtils.ts | 1 + src/client/util/SettingsManager.scss | 71 +++++++------------------- src/client/util/SettingsManager.tsx | 98 ++++++++++++------------------------ src/client/views/MainView.tsx | 4 ++ 4 files changed, 54 insertions(+), 120 deletions(-) (limited to 'src') diff --git a/src/client/util/CurrentUserUtils.ts b/src/client/util/CurrentUserUtils.ts index 8023df8b4..95e02b5fd 100644 --- a/src/client/util/CurrentUserUtils.ts +++ b/src/client/util/CurrentUserUtils.ts @@ -890,6 +890,7 @@ export class CurrentUserUtils { doc.fontFamily = StrCast(doc.fontFamily, "Arial"); doc.fontColor = StrCast(doc.fontColor, "black"); doc.fontHighlight = StrCast(doc.fontHighlight, ""); + doc.defaultColor = StrCast(doc.defaultColor, "white"); doc["constants-snapThreshold"] = NumCast(doc["constants-snapThreshold"], 10); // doc["constants-dragThreshold"] = NumCast(doc["constants-dragThreshold"], 4); // Utils.DRAG_THRESHOLD = NumCast(doc["constants-dragThreshold"]); diff --git a/src/client/util/SettingsManager.scss b/src/client/util/SettingsManager.scss index 075879198..2a4a4241c 100644 --- a/src/client/util/SettingsManager.scss +++ b/src/client/util/SettingsManager.scss @@ -93,6 +93,10 @@ margin-right: 65px; color: black; border-radius: 5px; + + &:hover{ + cursor: pointer; + } } .modes-playground { @@ -100,6 +104,9 @@ .playground-check { margin-right: 5px; + &:hover{ + cursor: pointer; + } } .playground-text { @@ -112,6 +119,10 @@ margin-top: 2px; margin-right: 25px; + &:hover{ + cursor: pointer; + } + .colorFlyout-button { width: 20px; height: 20px; @@ -151,6 +162,9 @@ font-size: 9; margin-right: 6; border-radius: 5px; + &:hover{ + cursor: pointer; + } } .size-select { @@ -158,6 +172,9 @@ color: black; font-size: 9; border-radius: 5px; + &:hover{ + cursor: pointer; + } } } } @@ -190,10 +207,6 @@ cursor: pointer; } - // .settings-heading { - // letter-spacing: .5em; - // } - .settings-content { background: #e4e4e4; border-radius: 6px; @@ -206,56 +219,6 @@ margin-bottom: 10px; } - // .settings-body { - // display: flex; - // justify-content: space-between; - // margin-top: -10; - - // .settings-type { - // display: flex; - // flex-direction: column; - // flex-basis: 45%; - - // } - - // .settings-content { - // background: whitesmoke; - // border-radius: 6px; - - // // padding-left: 1em; - // // padding-right: 1em; - // // display: flex; - // // flex-direction: column; - // // flex-basis: 70%; - // // justify-content: space-around; - // // text-align: left; - - // ::placeholder { - // color: $intermediate-color; - // } - - // input { - // border-radius: 5px; - // border: none; - // padding: 4px; - // min-width: 100%; - // margin: 2px 0; - // } - - // .error-text { - // color: #C40233; - // } - - // .success-text { - // color: #009F6B; - // } - - // p { - // padding: 0 0 .1em .2em; - // } - - // } - // } .error-text { color: #C40233; diff --git a/src/client/util/SettingsManager.tsx b/src/client/util/SettingsManager.tsx index 9282559e2..a12cc2cb6 100644 --- a/src/client/util/SettingsManager.tsx +++ b/src/client/util/SettingsManager.tsx @@ -1,4 +1,4 @@ -import { observable, runInAction, action } from "mobx"; +import { observable, runInAction, action, computed } from "mobx"; import * as React from "react"; import MainViewModal from "../views/MainViewModal"; import { observer } from "mobx-react"; @@ -15,7 +15,7 @@ import GroupManager from "./GroupManager"; import HypothesisAuthenticationManager from "../apis/HypothesisAuthenticationManager"; import GoogleAuthenticationManager from "../apis/GoogleAuthenticationManager"; import { DocServer } from "../DocServer"; -import { BoolCast } from "../../fields/Types"; +import { BoolCast, StrCast, NumCast } from "../../fields/Types"; import { undoBatch } from "./UndoManager"; import { ColorState, SketchPicker } from "react-color"; const higflyout = require("@hig/flyout"); @@ -40,7 +40,7 @@ export default class SettingsManager extends React.Component<{}> { private new_confirm_ref = React.createRef(); - @observable private backgroundColor = "white"; + @computed get backgroundColor() { return Doc.UserDoc().defaultColor; } public open = action(() => { SelectionManager.DeselectAll(); @@ -125,57 +125,25 @@ export default class SettingsManager extends React.Component<{}> { } } + @action + changeFontFamily = (e: any) => { + Doc.UserDoc().fontFamily = e.currentTarget.value; + } + + @action + changeFontSize = (e: any) => { + Doc.UserDoc().fontSize = e.currentTarget.value; + } + @action @undoBatch switchColor = (color: ColorState) => { const val = String(color.hex); - this.backgroundColor = val; + Doc.UserDoc().defaultColor = val; return true; } private get settingsInterface() { - 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 =
@@ -220,20 +188,23 @@ export default class SettingsManager extends React.Component<{}> { presetColors={['#D0021B', '#F5A623', '#F8E71C', '#8B572A', '#7ED321', '#417505', '#9013FE', '#4A90E2', '#50E3C2', '#B8E986', '#000000', '#4A4A4A', '#9B9B9B', '#FFFFFF', '#f1efeb', 'transparent']} - color={this.backgroundColor} />; + color={StrCast(this.backgroundColor)} />; const colorFlyout =
-
e.stopPropagation()} > - +
; + const fontFamilies: string[] = ["Times New Roman", "Arial", "Georgia", "Comic Sans MS", "Tahoma", "Impact", "Crimson Text"]; + const fontSizes: number[] = [7, 8, 9, 10, 12, 14, 16, 18, 20, 24, 32, 48, 72]; + const preferencesContent =
Background Color
{colorFlyout} @@ -241,25 +212,20 @@ export default class SettingsManager extends React.Component<{}> {
Default Font
; diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx index e9b9be49d..bbf36a04f 100644 --- a/src/client/views/MainView.tsx +++ b/src/client/views/MainView.tsx @@ -313,6 +313,10 @@ export class MainView extends React.Component { defaultBackgroundColors = (doc: Opt) => { if (this.panelContent === doc?.title) return "lightgrey"; + + if (doc?.type === DocumentType.COL) { + return StrCast(Doc.UserDoc().defaultColor); + } if (this.darkScheme) { switch (doc?.type) { case DocumentType.FONTICON: return "white"; -- cgit v1.2.3-70-g09d2