From 6f73686ec4dc3e01ae3eacc0150aa59eafea0325 Mon Sep 17 00:00:00 2001
From: eleanor-park <eleanor_park@brown.edu>
Date: Tue, 27 Aug 2024 16:22:33 -0400
Subject: pulling from master

---
 src/client/views/smartdraw/AnnotationPalette.tsx | 13 +++++++++++++
 1 file changed, 13 insertions(+)

(limited to 'src/client/views/smartdraw/AnnotationPalette.tsx')

diff --git a/src/client/views/smartdraw/AnnotationPalette.tsx b/src/client/views/smartdraw/AnnotationPalette.tsx
index 7e4d46204..7f00fa2f2 100644
--- a/src/client/views/smartdraw/AnnotationPalette.tsx
+++ b/src/client/views/smartdraw/AnnotationPalette.tsx
@@ -107,6 +107,10 @@ export class AnnotationPalette extends ObservableReactComponent<AnnotationPalett
         this._props.Document[DocData].data = undefined;
     };
 
+    /**
+     * Adds a doc to the annotation palette. Gets a snapshot of the document to use as a preview in the palette. When this
+     * preview is dragged onto a parent document, a copy of that document is added as an annotation.
+     */
     public static addToPalette = async (doc: Doc) => {
         if (!doc.savedAsAnno) {
             const clone = await Doc.MakeClone(doc);
@@ -129,6 +133,10 @@ export class AnnotationPalette extends ObservableReactComponent<AnnotationPalett
         return undefined;
     }
 
+    /**
+     * Calls the draw with GPT functions in SmartDrawHandler to allow users to generate drawings straight from
+     * the annotation palette.
+     */
     @undoBatch
     generateDrawings = action(async () => {
         this._isLoading = true;
@@ -159,6 +167,11 @@ export class AnnotationPalette extends ObservableReactComponent<AnnotationPalett
         Doc.AddDocToList(this._props.Document, 'data', drawing);
     };
 
+    /**
+     * Saves the currently showing, newly generated drawing to the annotation palette and sets the metadata.
+     * AddToPalette() is generically used to add any document to the palette, while this defines the behavior for when a user
+     * presses the "save drawing" button.
+     */
     saveDrawing = async () => {
         const cIndex: number = this._props.Document.carousel_index as number;
         const focusedDrawing = DocListCast(this._props.Document.data)[cIndex];
-- 
cgit v1.2.3-70-g09d2

