From 645df1d00f953524c6da22103d26c38ae4331cd6 Mon Sep 17 00:00:00 2001 From: Skitty1238 <157652284+Skitty1238@users.noreply.github.com> Date: Wed, 4 Jun 2025 13:59:34 -0400 Subject: partial google calendar task integration + fix with dark mode colors for task nodes so that text is still visible --- src/client/apis/GoogleAuthenticationManager.tsx | 35 ++++++++----- src/client/views/MainViewModal.tsx | 2 +- src/client/views/nodes/TaskBox.scss | 11 +++- src/client/views/nodes/TaskBox.tsx | 69 ++++++++++++------------- 4 files changed, 64 insertions(+), 53 deletions(-) (limited to 'src/client') diff --git a/src/client/apis/GoogleAuthenticationManager.tsx b/src/client/apis/GoogleAuthenticationManager.tsx index 46581397d..1b1d6f734 100644 --- a/src/client/apis/GoogleAuthenticationManager.tsx +++ b/src/client/apis/GoogleAuthenticationManager.tsx @@ -1,4 +1,4 @@ -import { action, IReactionDisposer, observable, reaction, runInAction } from 'mobx'; +import { action, IReactionDisposer, makeObservable, observable, reaction, runInAction } from 'mobx'; import { observer } from 'mobx-react'; import * as React from 'react'; import { Opt } from '../../fields/Doc'; @@ -6,12 +6,13 @@ import { Networking } from '../Network'; import { ScriptingGlobals } from '../util/ScriptingGlobals'; import { MainViewModal } from '../views/MainViewModal'; import './GoogleAuthenticationManager.scss'; +import { ObservableReactComponent } from '../views/ObservableReactComponent'; const AuthenticationUrl = 'https://accounts.google.com/o/oauth2/v2/auth'; const prompt = 'Paste authorization code here...'; @observer -export class GoogleAuthenticationManager extends React.Component { +export class GoogleAuthenticationManager extends ObservableReactComponent { // eslint-disable-next-line no-use-before-define public static Instance: GoogleAuthenticationManager; private authenticationLink: Opt = undefined; @@ -23,6 +24,12 @@ export class GoogleAuthenticationManager extends React.Component { @observable private credentials: { user_info: { name: string; picture: string }; access_token: string } | undefined = undefined; private disposer: Opt; + constructor(props: object) { + super(props); + makeObservable(this); + GoogleAuthenticationManager.Instance = this; + } + private set isOpen(value: boolean) { runInAction(() => (this.openState = value)); } @@ -49,14 +56,15 @@ export class GoogleAuthenticationManager extends React.Component { () => this.authenticationCode, async authenticationCode => { if (authenticationCode && /\d{1}\/[\w-]{55}/.test(authenticationCode)) { + resolve(authenticationCode); this.disposer?.(); - const response2 = await Networking.PostToServer('/writeGoogleAccessToken', { authenticationCode }); - runInAction(() => { - this.success = true; - this.credentials = response2 as { user_info: { name: string; picture: string }; access_token: string }; - }); + // const response2 = await Networking.PostToServer('/writeGoogleAccessToken', { authenticationCode }); + // runInAction(() => { + // this.success = true; + // this.credentials = response2 as { user_info: { name: string; picture: string }; access_token: string }; + // }); + // resolve((response2 as { access_token: string }).access_token); this.resetState(); - resolve((response2 as { access_token: string }).access_token); } } ); @@ -109,11 +117,6 @@ export class GoogleAuthenticationManager extends React.Component { } }); - constructor(props: object) { - super(props); - GoogleAuthenticationManager.Instance = this; - } - private get renderPrompt() { return (
@@ -153,7 +156,11 @@ export class GoogleAuthenticationManager extends React.Component { } render() { - return (this.isOpen = false))} />; + return ( +
+ (this.isOpen = false))} /> +
+ ); } } diff --git a/src/client/views/MainViewModal.tsx b/src/client/views/MainViewModal.tsx index b05292c47..d7640dc72 100644 --- a/src/client/views/MainViewModal.tsx +++ b/src/client/views/MainViewModal.tsx @@ -41,7 +41,7 @@ export class MainViewModal extends React.Component { className="overlay" onClick={this.props?.closeOnExternalClick} style={{ - backgroundColor: isDark(SnappingManager.userColor) ? '#DFDFDF30' : '#32323230', + backgroundColor: isDark(SnappingManager.userColor ?? '') ? '#DFDFDF30' : '#32323230', ...(p.overlayStyle || {}), }} /> diff --git a/src/client/views/nodes/TaskBox.scss b/src/client/views/nodes/TaskBox.scss index 0fcc2f955..6ef0c6454 100644 --- a/src/client/views/nodes/TaskBox.scss +++ b/src/client/views/nodes/TaskBox.scss @@ -6,6 +6,15 @@ width: 100%; height: 100%; box-sizing: border-box; + + input, + textarea, + select, + button { + background-color: #fff !important; + color: #000 !important; + border-color: #ccc !important; + } } .task-manager-title { @@ -69,4 +78,4 @@ input[type="datetime-local"] { border: 1px solid #ccc; border-radius: 6px; box-sizing: border-box; -} +} \ No newline at end of file diff --git a/src/client/views/nodes/TaskBox.tsx b/src/client/views/nodes/TaskBox.tsx index 1c7aeeb82..3990356b9 100644 --- a/src/client/views/nodes/TaskBox.tsx +++ b/src/client/views/nodes/TaskBox.tsx @@ -270,43 +270,38 @@ export class TaskBox extends React.Component { )} {/** test button */} - - - - + ); } -- cgit v1.2.3-70-g09d2