diff options
-rw-r--r-- | src/client/util/SettingsManager.scss | 73 | ||||
-rw-r--r-- | src/client/util/SettingsManager.tsx | 83 | ||||
-rw-r--r-- | src/client/views/MainView.scss | 16 | ||||
-rw-r--r-- | src/client/views/MainView.tsx | 5 | ||||
-rw-r--r-- | src/server/index.ts | 10 |
5 files changed, 187 insertions, 0 deletions
diff --git a/src/client/util/SettingsManager.scss b/src/client/util/SettingsManager.scss new file mode 100644 index 000000000..cd9d2569a --- /dev/null +++ b/src/client/util/SettingsManager.scss @@ -0,0 +1,73 @@ +@import "../views/globalCssVariables"; + +.settings-interface { + display: flex; + flex-direction: column; + + .settings-body { + display: flex; + flex-direction: row; + + .settings-type { + display: flex; + flex-direction: column; + flex-basis: 30%; + } + + .settings-content { + padding-left: 1em; + display: flex; + justify-content: space-between; + } + } + + .focus-span { + text-decoration: underline; + } +p { + text-align: left; + padding: 0; + margin: 0 0 20px 0; +} + + h1 { + color: $dark-color; + text-transform: uppercase; + letter-spacing: 2px; + font-size: 75%; + } + + .close-button { + position: absolute; + right: 1em; + top: 1em; + } + + .container { + display: block; + position: relative; + margin-top: 10px; + margin-bottom: 10px; + font-size: 22px; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + width: 700px; + min-width: 700px; + max-width: 700px; + text-align: left; + font-style: normal; + font-size: 15; + font-weight: normal; + padding: 0; + + .padding { + padding: 0 0 0 20px; + color: black; + } + + + + } +}
\ No newline at end of file diff --git a/src/client/util/SettingsManager.tsx b/src/client/util/SettingsManager.tsx new file mode 100644 index 000000000..76f4bb964 --- /dev/null +++ b/src/client/util/SettingsManager.tsx @@ -0,0 +1,83 @@ +import { observable, runInAction, action } from "mobx"; +import * as React from "react"; +import MainViewModal from "../views/MainViewModal"; +import { observer } from "mobx-react"; +import { library } from '@fortawesome/fontawesome-svg-core'; +import * as fa from '@fortawesome/free-solid-svg-icons'; +import { SelectionManager } from "./SelectionManager"; +import "./SettingsManager.scss"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { Identified } from "../Network"; + +library.add(fa.faWindowClose); + +@observer +export default class SettingsManager extends React.Component<{}> { + public static Instance: SettingsManager; + @observable private isOpen = false; + @observable private dialogueBoxOpacity = 1; + @observable private overlayOpacity = 0.4; + private curr_password_ref = React.createRef<HTMLInputElement>(); + + public open = action(() => { + SelectionManager.DeselectAll(); + this.isOpen = true; + }); + + public close = action(() => { + this.isOpen = false; + }); + + constructor(props: {}) { + super(props); + SettingsManager.Instance = this; + } + + private dispatchRequest = async () => { + const curr_pass = this.curr_password_ref.current!.value; + const { error: resultError, ...others } = await Identified.PostToServer('/internalResetPassword', { curr_pass }); + if (resultError) { + // we failed + console.log(resultError); + } + console.log(others); + // do stuff with response + } + + private get settingsInterface() { + return ( + <div className={"settings-interface"}> + <div className="settings-heading"> + <h1>settings</h1> + <div className={"close-button"} onClick={this.close}> + <FontAwesomeIcon icon={fa.faWindowClose} size={"lg"} /> + </div> + </div> + <div className="settings-body"> + <div className="settings-type"> + <p>changeable settings</p> + <p>static data</p> + </div> + <div className="settings-content"> + <input ref={this.curr_password_ref}></input> + this changes with what you select! + </div> + </div> + + </div> + ); + } + + render() { + return ( + <MainViewModal + contents={this.settingsInterface} + isDisplayed={this.isOpen} + interactive={true} + dialogueBoxDisplayedOpacity={this.dialogueBoxOpacity} + overlayDisplayedOpacity={this.overlayOpacity} + /> + ); + } + +}
\ No newline at end of file diff --git a/src/client/views/MainView.scss b/src/client/views/MainView.scss index 0ee30f117..87820abff 100644 --- a/src/client/views/MainView.scss +++ b/src/client/views/MainView.scss @@ -50,6 +50,18 @@ overflow: hidden; } + +.mainView-settings { + position: absolute; + left: 0; + bottom: 0; + font-size: 8px; +} + +.mainView-settings:hover { + transform: none !important; +} + .mainView-logout { position: absolute; right: 0; @@ -57,6 +69,10 @@ font-size: 8px; } +.mainView-logout:hover { + transform: none !important; +} + .mainView-libraryFlyout { height: 100%; position: absolute; diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx index 162d0c08a..d45aebe30 100644 --- a/src/client/views/MainView.tsx +++ b/src/client/views/MainView.tsx @@ -40,6 +40,7 @@ import MarqueeOptionsMenu from './collections/collectionFreeForm/MarqueeOptionsM import InkSelectDecorations from './InkSelectDecorations'; import { Scripting } from '../util/Scripting'; import { AudioBox } from './nodes/AudioBox'; +import SettingsManager from '../util/SettingsManager'; @observer export class MainView extends React.Component { @@ -412,6 +413,9 @@ export class MainView extends React.Component { zoomToScale={emptyFunction} getScale={returnOne}> </DocumentView> + <button className="mainView-settings" key="settings" onClick={() => SettingsManager.Instance.open()}> + Settings + </button> <button className="mainView-logout" key="logout" onClick={() => window.location.assign(Utils.prepend(RouteStore.logout))}> {CurrentUserUtils.GuestWorkspace ? "Exit" : "Log Out"} </button> @@ -507,6 +511,7 @@ export class MainView extends React.Component { return (<div id="mainView-container"> <DictationOverlay /> <SharingManager /> + <SettingsManager /> <GoogleAuthenticationManager /> <DocumentDecorations /> <InkSelectDecorations /> diff --git a/src/server/index.ts b/src/server/index.ts index ddd909479..d96bd4d9a 100644 --- a/src/server/index.ts +++ b/src/server/index.ts @@ -668,6 +668,16 @@ addSecureRoute({ onRejection: (_req, res) => res.send(JSON.stringify({ id: "__guest__", email: "" })) }); +addSecureRoute({ + method: Method.POST, + subscribers: '/internalResetPassword', + onValidation: (user, _req, res) => { + // user password auth + // new pass same + // do extra stuff + } +}); + const ServicesApiKeyMap = new Map<string, string | undefined>([ ["face", process.env.FACE], ["vision", process.env.VISION], |