diff --git a/nx-dev/feature-doc-viewer/src/lib/doc-viewer.tsx b/nx-dev/feature-doc-viewer/src/lib/doc-viewer.tsx index b0d96fa98361b..cdf07da4738b7 100644 --- a/nx-dev/feature-doc-viewer/src/lib/doc-viewer.tsx +++ b/nx-dev/feature-doc-viewer/src/lib/doc-viewer.tsx @@ -8,9 +8,11 @@ import { renderMarkdown } from '@nx/nx-dev/ui-markdoc'; import { NextSeo } from 'next-seo'; import { useRouter } from 'next/router'; import { cx } from '@nx/nx-dev/ui-primitives'; -import { useRef } from 'react'; +import { useRef, useState } from 'react'; import { collectHeadings, TableOfContents } from './table-of-contents'; import { RelatedDocumentsSection } from './related-documents-section'; +import { sendCustomEvent } from '@nx/nx-dev/feature-analytics'; +import { FeedbackDialog } from '@nx/nx-dev/feature-feedback'; export function DocViewer({ document, @@ -51,6 +53,17 @@ export function DocViewer({ return splits[splits.length - 1]; } + const [showFeedback, setShowFeedback] = useState(false); + + function submitIdeaFeedback(feedback: string) { + // sanitize the feedback from the user script tags/other malicious code + const sanitizedFeedback = feedback.replace(/(<([^>]+)>)/gi, ''); + + sendCustomEvent('feedback', 'feedback', 'idea', undefined, { + feedback: sanitizedFeedback, + }); + } + return ( <>