From 04669ffeb163688c7aefd7b5face7998252abdca Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Mon, 10 Mar 2025 18:02:07 -0400
Subject: removed label creation from text's anchor menu.  removed label
 creation from pdfs.

---
 src/client/views/pdf/AnchorMenu.tsx | 53 +++----------------------------------
 1 file changed, 3 insertions(+), 50 deletions(-)

(limited to 'src/client/views/pdf/AnchorMenu.tsx')

diff --git a/src/client/views/pdf/AnchorMenu.tsx b/src/client/views/pdf/AnchorMenu.tsx
index 9aa8fe649..eaaeb8d97 100644
--- a/src/client/views/pdf/AnchorMenu.tsx
+++ b/src/client/views/pdf/AnchorMenu.tsx
@@ -1,24 +1,19 @@
 import { ColorPicker, Group, IconButton, Popup, Size, Toggle, ToggleType, Type } from '@dash/components';
 import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
-import { IReactionDisposer, ObservableMap, action, computed, makeObservable, observable, reaction, runInAction } from 'mobx';
+import { IReactionDisposer, ObservableMap, action, computed, makeObservable, observable, reaction } from 'mobx';
 import { observer } from 'mobx-react';
 import * as React from 'react';
 import { ColorResult } from 'react-color';
-import ReactLoading from 'react-loading';
 import { ClientUtils, returnFalse, setupMoveUpEvents } from '../../../ClientUtils';
 import { emptyFunction, unimplementedFunction } from '../../../Utils';
 import { Doc, Opt } from '../../../fields/Doc';
-import { DocData } from '../../../fields/DocSymbols';
 import { SettingsManager } from '../../util/SettingsManager';
-import { undoBatch } from '../../util/UndoManager';
 import { AntimodeMenu, AntimodeMenuProps } from '../AntimodeMenu';
 import { LinkPopup } from '../linking/LinkPopup';
 import { ComparisonBox } from '../nodes/ComparisonBox';
 import { DocumentView } from '../nodes/DocumentView';
-import { DrawingOptions, SmartDrawHandler } from '../smartdraw/SmartDrawHandler';
 import './AnchorMenu.scss';
 import { GPTPopup } from './GPTPopup/GPTPopup';
-import { RichTextMenu } from '../nodes/formattedText/RichTextMenu';
 
 @observer
 export class AnchorMenu extends AntimodeMenu<AntimodeMenuProps> {
@@ -116,39 +111,6 @@ export class AnchorMenu extends AntimodeMenu<AntimodeMenuProps> {
         );
     };
 
-    /**
-     * Creates a GPT drawing based on selected text.
-     */
-    gptDraw = (e: React.PointerEvent) => {
-        try {
-            SmartDrawHandler.Instance.AddDrawing = this.createDrawingAnnotation;
-            runInAction(() => (this._isLoading = true));
-            SmartDrawHandler.Instance.drawWithGPT({ X: e.clientX, Y: e.clientY }, this._selectedText, 5, 100, true)?.then(
-                action(() => {
-                    this._isLoading = false;
-                })
-            );
-        } catch (err) {
-            console.error(err);
-        }
-    };
-
-    /**
-     * Defines how a GPT drawing should be added to the current document.
-     */
-    @undoBatch
-    createDrawingAnnotation = action((drawing: Doc, opts: DrawingOptions, gptRes: string) => {
-        this.AddDrawingAnnotation(drawing);
-        const docData = drawing[DocData];
-        docData.title = opts.text?.match(/^(.*?)~~~.*$/)?.[1] || opts.text;
-        docData.ai_drawing_input = opts.text;
-        docData.ai_drawing_complexity = opts.complexity;
-        docData.ai_drawing_colored = opts.autoColor;
-        docData.ai_drawing_size = opts.size;
-        docData.ai_drawing_data = gptRes;
-        docData.ai = 'gpt';
-    });
-
     pointerDown = (e: React.PointerEvent) => {
         setupMoveUpEvents(
             this,
@@ -232,17 +194,8 @@ export class AnchorMenu extends AntimodeMenu<AntimodeMenuProps> {
                         />
                     )}
                     {/* Adds a create flashcards option to the anchor menu, which calls the gptFlashcard method. */}
-                    <IconButton tooltip="Create flashcards" onPointerDown={this.gptFlashcards} icon={<FontAwesomeIcon icon="layer-group" size="lg" />} color={SettingsManager.userColor} />
-                    <IconButton tooltip="Create labels" onPointerDown={this.makeLabels} icon={<FontAwesomeIcon icon="tag" size="lg" />} color={SettingsManager.userColor} />
-                    {this._selectedText && (
-                        <IconButton
-                            tooltip="Create drawing"
-                            onPointerDown={e => this.gptDraw(e)}
-                            icon={this._isLoading ? <ReactLoading type="spin" color={SettingsManager.userVariantColor} width={16} height={20} /> : <FontAwesomeIcon icon="paintbrush" size="lg" />}
-                            color={SettingsManager.userColor}
-                        />
-                    )}
-                    {this._selectedText && RichTextMenu.Instance?.createLinkButton()}
+                    {this.gptFlashcards === unimplementedFunction ? null : <IconButton tooltip="Create flashcards" onPointerDown={this.gptFlashcards} icon={<FontAwesomeIcon icon="layer-group" size="lg" />} color={SettingsManager.userColor} />}
+                    {this.makeLabels === unimplementedFunction ? null : <IconButton tooltip="Create labels" onPointerDown={this.makeLabels} icon={<FontAwesomeIcon icon="tag" size="lg" />} color={SettingsManager.userColor} />}
                     {AnchorMenu.Instance.OnAudio === unimplementedFunction ? null : (
                         <IconButton
                             tooltip="Click to Record Annotation" //
-- 
cgit v1.2.3-70-g09d2

