aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/SettingsManager.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/util/SettingsManager.tsx')
-rw-r--r--src/client/util/SettingsManager.tsx32
1 files changed, 27 insertions, 5 deletions
diff --git a/src/client/util/SettingsManager.tsx b/src/client/util/SettingsManager.tsx
index 9888cce48..90d59aa51 100644
--- a/src/client/util/SettingsManager.tsx
+++ b/src/client/util/SettingsManager.tsx
@@ -11,8 +11,12 @@ import { Networking } from "../Network";
import { CurrentUserUtils } from "./CurrentUserUtils";
import { Utils } from "../../Utils";
import { Doc } from "../../fields/Doc";
+import GroupManager from "./GroupManager";
+import HypothesisAuthenticationManager from "../apis/HypothesisAuthenticationManager";
+import GoogleAuthenticationManager from "../apis/GoogleAuthenticationManager";
+import { togglePlaygroundMode } from "../../fields/util";
-library.add(fa.faWindowClose);
+library.add(fa.faTimes);
@observer
export default class SettingsManager extends React.Component<{}> {
@@ -23,6 +27,7 @@ export default class SettingsManager extends React.Component<{}> {
@observable private settingsContent = "password";
@observable private errorText = "";
@observable private successText = "";
+ @observable private playgroundMode = false;
private curr_password_ref = React.createRef<HTMLInputElement>();
private new_password_ref = React.createRef<HTMLInputElement>();
private new_confirm_ref = React.createRef<HTMLInputElement>();
@@ -83,6 +88,20 @@ export default class SettingsManager extends React.Component<{}> {
noviceToggle = (event: any) => {
Doc.UserDoc().noviceMode = !Doc.UserDoc().noviceMode;
}
+ @action
+ googleAuthorize = (event: any) => {
+ GoogleAuthenticationManager.Instance.fetchOrGenerateAccessToken(true);
+ }
+ @action
+ hypothesisAuthorize = (event: any) => {
+ HypothesisAuthenticationManager.Instance.fetchAccessToken(true);
+ }
+
+ @action
+ togglePlaygroundMode = () => {
+ togglePlaygroundMode();
+ this.playgroundMode = !this.playgroundMode;
+ }
private get settingsInterface() {
return (
@@ -90,13 +109,17 @@ export default class SettingsManager extends React.Component<{}> {
<div className="settings-heading">
<h1>settings</h1>
<div className={"close-button"} onClick={this.close}>
- <FontAwesomeIcon icon={fa.faWindowClose} size={"lg"} />
+ <FontAwesomeIcon icon={fa.faTimes} color="black" size={"lg"} />
</div>
</div>
<div className="settings-body">
<div className="settings-type">
<button onClick={this.onClick} value="password">reset password</button>
- <button onClick={this.noviceToggle} value="data">{`toggle ${Doc.UserDoc().noviceMode ? "developer" : "novice"} mode`}</button>
+ <button onClick={this.noviceToggle} value="data">{`Set ${Doc.UserDoc().noviceMode ? "developer" : "novice"} mode`}</button>
+ <button onClick={this.togglePlaygroundMode}>{`${this.playgroundMode ? "Disable" : "Enable"} playground mode`}</button>
+ <button onClick={this.googleAuthorize} value="data">{`Link to Google`}</button>
+ <button onClick={this.hypothesisAuthorize} value="data">{`Link to Hypothes.is`}</button>
+ <button onClick={() => GroupManager.Instance.open()}>Manage groups</button>
<button onClick={() => window.location.assign(Utils.prepend("/logout"))}>
{CurrentUserUtils.GuestWorkspace ? "Exit" : "Log Out"}
</button>
@@ -132,8 +155,7 @@ export default class SettingsManager extends React.Component<{}> {
contents={this.settingsInterface}
isDisplayed={this.isOpen}
interactive={true}
- dialogueBoxDisplayedOpacity={this.dialogueBoxOpacity}
- overlayDisplayedOpacity={this.overlayOpacity}
+ closeOnExternalClick={this.close}
/>
);
}