From 3e3d6efe6d99a17ec42a921eb170a4b84e03634f Mon Sep 17 00:00:00 2001 From: "coderabbitai[bot]" <136622811+coderabbitai[bot]@users.noreply.github.com> Date: Wed, 2 Apr 2025 00:26:19 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20Add=20docstrings=20to=20`main`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Docstrings generation was requested by @Shubham-Khichi. * https://github.com/cyberagiinc/DevDocs/pull/45#issuecomment-2770371540 The following files were modified: * `app/page.tsx` --- app/page.tsx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/app/page.tsx b/app/page.tsx index aa93745..60f9248 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -12,6 +12,17 @@ import { saveMarkdown, loadMarkdown } from '@/lib/storage' import { useToast } from "@/components/ui/use-toast" import { DiscoveredPage } from '@/lib/types' +/** + * Renders the main interface for the DevDocs application. + * + * This component provides the entry point for users to discover, crawl, and extract documentation + * from a specified URL. It validates user input, triggers API requests via Next.js API routes + * to retrieve and crawl pages, and manages state to display processing status, discovered pages, + * extracted markdown content, and related statistics. Child components handle URL input, + * status display, subdomain listing, markdown output, stored files, and configuration settings. + * + * @returns The rendered Home component as JSX. + */ export default function Home() { const [url, setUrl] = useState('') const [isProcessing, setIsProcessing] = useState(false) @@ -168,11 +179,10 @@ export default function Home() { })) ) - // Make a direct request to the backend API instead of using the crawlPages function - const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || process.env.BACKEND_URL || 'http://localhost:24125' - console.log('Making direct request to backend:', `${backendUrl}/api/crawl`) + // Use the Next.js API route instead of direct backend request + console.log('Making request to Next.js API route: /api/crawl') - const response = await fetch(`${backendUrl}/api/crawl`, { + const response = await fetch(`/api/crawl`, { method: 'POST', headers: { 'Content-Type': 'application/json',