aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/smartdraw
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/smartdraw')
-rw-r--r--src/client/views/smartdraw/AnnotationPalette.tsx4
-rw-r--r--src/client/views/smartdraw/SmartDrawHandler.tsx23
2 files changed, 18 insertions, 9 deletions
diff --git a/src/client/views/smartdraw/AnnotationPalette.tsx b/src/client/views/smartdraw/AnnotationPalette.tsx
index 0c8dbf12d..4421547be 100644
--- a/src/client/views/smartdraw/AnnotationPalette.tsx
+++ b/src/client/views/smartdraw/AnnotationPalette.tsx
@@ -13,7 +13,7 @@ import { DocData } from '../../../fields/DocSymbols';
import { ImageCast } from '../../../fields/Types';
import { DocumentType } from '../../documents/DocumentTypes';
import { Docs } from '../../documents/Documents';
-import { makeUserTemplateImage } from '../../util/DropConverter';
+import { makeUserTemplateButtonOrImage } from '../../util/DropConverter';
import { SettingsManager } from '../../util/SettingsManager';
import { Transform } from '../../util/Transform';
import { undoBatch } from '../../util/UndoManager';
@@ -123,7 +123,7 @@ export class AnnotationPalette extends ObservableReactComponent<AnnotationPalett
const { clone } = await Doc.MakeClone(doc);
clone.title = doc.title;
const image = ImageCast(doc.icon, ImageCast(clone[Doc.LayoutFieldKey(clone)]))?.url?.href;
- Doc.AddDocToList(Doc.MyAnnos, 'data', makeUserTemplateImage(clone, image));
+ Doc.AddDocToList(Doc.MyAnnos, 'data', makeUserTemplateButtonOrImage(clone, image));
doc.savedAsAnno = true;
}
};
diff --git a/src/client/views/smartdraw/SmartDrawHandler.tsx b/src/client/views/smartdraw/SmartDrawHandler.tsx
index 6d1277a08..76bfe2a19 100644
--- a/src/client/views/smartdraw/SmartDrawHandler.tsx
+++ b/src/client/views/smartdraw/SmartDrawHandler.tsx
@@ -1,7 +1,7 @@
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { Slider, Switch } from '@mui/material';
import { Button, IconButton } from 'browndash-components';
-import { action, makeObservable, observable } from 'mobx';
+import { action, makeObservable, observable, runInAction } from 'mobx';
import { observer } from 'mobx-react';
import React from 'react';
import { AiOutlineSend } from 'react-icons/ai';
@@ -194,14 +194,21 @@ export class SmartDrawHandler extends ObservableReactComponent<object> {
this._canInteract = false;
if (this.ShowRegenerate) {
await this.regenerate();
- this._regenInput = '';
- this._showEditBox = false;
+ runInAction(() => {
+ this._regenInput = '';
+ this._showEditBox = false;
+ });
} else {
- this._showOptions = false;
+ runInAction(() => {
+ this._showOptions = false;
+ });
try {
await this.drawWithGPT({ X: this._pageX, Y: this._pageY }, this._userInput, this._complexity, this._size, this._autoColor);
this.hideSmartDrawHandler();
- this.ShowRegenerate = true;
+
+ runInAction(() => {
+ this.ShowRegenerate = true;
+ });
} catch (err) {
if (this._errorOccurredOnce) {
console.error('GPT call failed', err);
@@ -212,8 +219,10 @@ export class SmartDrawHandler extends ObservableReactComponent<object> {
}
}
}
- this._isLoading = false;
- this._canInteract = true;
+ runInAction(() => {
+ this._isLoading = false;
+ this._canInteract = true;
+ });
};
/**