aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/pdf/AnchorMenu.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2025-03-14 12:20:41 -0400
committerbobzel <zzzman@gmail.com>2025-03-14 12:20:41 -0400
commit45a9f5789fa6eaacca9a39cb96cc2a8e3ebe649c (patch)
treef4d098425f93dc63b9dcb3655bd6034930670e2a /src/client/views/pdf/AnchorMenu.tsx
parent4433afe837412c10a278e54ee8069cad992900a0 (diff)
simplified anchorMenu to just have an AskAI button .. then updated GPtPopup's summaryBox to have a flashcard option.
Diffstat (limited to 'src/client/views/pdf/AnchorMenu.tsx')
-rw-r--r--src/client/views/pdf/AnchorMenu.tsx26
1 files changed, 5 insertions, 21 deletions
diff --git a/src/client/views/pdf/AnchorMenu.tsx b/src/client/views/pdf/AnchorMenu.tsx
index 6ae659ac1..eb6516403 100644
--- a/src/client/views/pdf/AnchorMenu.tsx
+++ b/src/client/views/pdf/AnchorMenu.tsx
@@ -10,7 +10,6 @@ import { Doc, Opt } from '../../../fields/Doc';
import { SettingsManager } from '../../util/SettingsManager';
import { AntimodeMenu, AntimodeMenuProps } from '../AntimodeMenu';
import { LinkPopup } from '../linking/LinkPopup';
-import { ComparisonBox } from '../nodes/ComparisonBox';
import { DocumentView } from '../nodes/DocumentView';
import { RichTextMenu } from '../nodes/formattedText/RichTextMenu';
import './AnchorMenu.scss';
@@ -69,7 +68,6 @@ export class AnchorMenu extends AntimodeMenu<AntimodeMenuProps> {
public MakeTargetToggle: () => void = unimplementedFunction;
public ShowTargetTrail: () => void = unimplementedFunction;
public IsTargetToggler: () => boolean = returnFalse;
- public gptFlashcards: () => void = unimplementedFunction;
public makeLabels: () => void = unimplementedFunction;
public marqueeWidth = 0;
public marqueeHeight = 0;
@@ -94,22 +92,9 @@ export class AnchorMenu extends AntimodeMenu<AntimodeMenuProps> {
* Invokes the API with the selected text and stores it in the summarized text.
* @param e pointer down event
*/
- gptSummarize = () => GPTPopup.Instance.generateSummary(this._selectedText);
-
- /*
- * Transfers the flashcard text generated by GPT on flashcards and creates a collection out them.
- */
-
- transferToFlashcard = (text: string, x: number, y: number) => {
- ComparisonBox.createFlashcardDeck(text, 250, 200, 'data_front', 'data_back').then(
- action(newCol => {
- newCol.x = x;
- newCol.y = y;
- newCol.zIndex = 1000;
- this.addToCollection?.(newCol);
- this._loading = false;
- })
- );
+ gptAskAboutSelection = () => {
+ GPTPopup.Instance.askAIAboutSelection(this._selectedText);
+ AnchorMenu.Instance.fadeOut(true);
};
pointerDown = (e: React.PointerEvent) => {
@@ -188,14 +173,13 @@ export class AnchorMenu extends AntimodeMenu<AntimodeMenuProps> {
{/* GPT Summarize icon only shows up when text is highlighted, not on marquee selection */}
{this._selectedText && (
<IconButton
- tooltip="Summarize with AI" //
- onPointerDown={this.gptSummarize}
+ tooltip="Ask AI..." //
+ onPointerDown={this.gptAskAboutSelection}
icon={<FontAwesomeIcon icon="comment-dots" size="lg" />}
color={SettingsManager.userColor}
/>
)}
{/* Adds a create flashcards option to the anchor menu, which calls the gptFlashcard method. */}
- {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} />}
{this._selectedText && RichTextMenu.Instance?.createLinkButton()}
{AnchorMenu.Instance.OnAudio === unimplementedFunction ? null : (