From 79f735308244b5ebdeea00b4c759d83cd88f9794 Mon Sep 17 00:00:00 2001
From: geireann <geireann.lindfield@gmail.com>
Date: Mon, 24 Oct 2022 14:22:24 -0400
Subject: added link to documentation from specific nodes

---
 src/client/views/nodes/DocumentView.tsx | 47 ++++++++++++++++++++++++++++++++-
 1 file changed, 46 insertions(+), 1 deletion(-)

(limited to 'src/client/views/nodes/DocumentView.tsx')

diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index 16b5809fa..d3858c25e 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -959,10 +959,55 @@ export class DocumentViewInternal extends DocComponent<DocumentViewInternalProps
 
             const help = cm.findByDescription('Help...');
             const helpItems: ContextMenuProps[] = help && 'subitems' in help ? help.subitems : [];
-            helpItems.push({ description: 'Show Fields ', event: () => this.props.addDocTab(Docs.Create.KVPDocument(this.props.Document, { _width: 300, _height: 300 }), 'add:right'), icon: 'layer-group' });
+            helpItems.push({ description: 'Show Metadata', event: () => this.props.addDocTab(Docs.Create.KVPDocument(this.props.Document, { _width: 300, _height: 300 }), 'add:right'), icon: 'layer-group' });
             !Doc.noviceMode && helpItems.push({ description: 'Text Shortcuts Ctrl+/', event: () => this.props.addDocTab(Docs.Create.PdfDocument('/assets/cheat-sheet.pdf', { _width: 300, _height: 300 }), 'add:right'), icon: 'keyboard' });
             !Doc.noviceMode && helpItems.push({ description: 'Print Document in Console', event: () => console.log(this.props.Document), icon: 'hand-point-right' });
             !Doc.noviceMode && helpItems.push({ description: 'Print DataDoc in Console', event: () => console.log(this.props.Document[DataSym]), icon: 'hand-point-right' });
+            
+            let documentationDescription: string | undefined = undefined;
+            let documentationLink: string | undefined = undefined;
+            console.log("type: ", this.props.Document.type);
+            switch(this.props.Document.type) {
+                case DocumentType.COL:
+                    documentationDescription = "See collection documentation";
+                    documentationLink = "https://brown-dash.github.io/Dash-Documentation/views/";
+                    break;
+                case DocumentType.PDF:
+                    documentationDescription = "See PDF node documentation";
+                    documentationLink = "https://brown-dash.github.io/Dash-Documentation/documents/pdf/";
+                    break;
+                case DocumentType.VID:
+                    documentationDescription = "See video node documentation";
+                    documentationLink = "https://brown-dash.github.io/Dash-Documentation/documents/tempMedia/video";
+                    break;
+                case DocumentType.AUDIO:
+                    documentationDescription = "See audio node documentation";
+                    documentationLink = "https://brown-dash.github.io/Dash-Documentation/documents/tempMedia/audio";
+                    break;
+                case DocumentType.WEB:
+                    documentationDescription = "See webpage node documentation";
+                    documentationLink = "https://brown-dash.github.io/Dash-Documentation/documents/webpage/";
+                    break;
+                case DocumentType.IMG:
+                    documentationDescription = "See image node documentation";
+                    documentationLink = "https://brown-dash.github.io/Dash-Documentation/documents/images/";
+                    break;
+                case DocumentType.RTF:
+                    documentationDescription = "See text node documentation";
+                    documentationLink = "https://brown-dash.github.io/Dash-Documentation/documents/text/";
+                    break;
+                default:
+                    break;
+            }
+
+            // Add link to help documentation
+            if (documentationDescription && documentationLink) {
+                console.log("add documentation item");
+                helpItems.push({ description: documentationDescription, event: () => {
+                    window.open(documentationLink, '_blank');
+                }, icon: 'book' })
+            };
+
             cm.addItem({ description: 'Help...', noexpand: true, subitems: helpItems, icon: 'question' });
         }
 
-- 
cgit v1.2.3-70-g09d2

