From 20324bbba7963105d3876656087c501adca91b2c Mon Sep 17 00:00:00 2001 From: "coderabbitai[bot]" <136622811+coderabbitai[bot]@users.noreply.github.com> Date: Tue, 1 Jul 2025 05:05:15 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20Add=20docstrings=20to=20`11-proj?= =?UTF-8?q?ect-header`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Docstrings generation was requested by @devdezzies. * https://github.com/devdezzies/neocode/pull/10#issuecomment-3021754114 The following files were modified: * `src/app/layout.tsx` * `src/modules/projects/ui/components/message-card.tsx` * `src/modules/projects/ui/components/message-loading.tsx` * `src/modules/projects/ui/components/messages-container.tsx` * `src/modules/projects/ui/components/project-header.tsx` * `src/modules/projects/ui/views/project-view.tsx` --- src/app/layout.tsx | 7 +++++++ src/modules/projects/ui/components/message-card.tsx | 5 +++++ src/modules/projects/ui/components/message-loading.tsx | 5 +++++ .../projects/ui/components/messages-container.tsx | 9 +++++++++ src/modules/projects/ui/components/project-header.tsx | 7 +++++++ src/modules/projects/ui/views/project-view.tsx | 7 +++++++ 6 files changed, 40 insertions(+) diff --git a/src/app/layout.tsx b/src/app/layout.tsx index f751c78..febd1f5 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -20,6 +20,13 @@ export const metadata: Metadata = { description: "Generated by create next app", }; +/** + * Root layout component that sets up global providers, fonts, theming, and notification support for the application. + * + * Wraps all pages with tRPC client context, applies Geist fonts, manages theme switching based on system preferences, and includes toast notification support. + * + * @param children - The content to be rendered within the layout + */ export default function RootLayout({ children, }: Readonly<{ diff --git a/src/modules/projects/ui/components/message-card.tsx b/src/modules/projects/ui/components/message-card.tsx index a0a4c12..1ff0265 100644 --- a/src/modules/projects/ui/components/message-card.tsx +++ b/src/modules/projects/ui/components/message-card.tsx @@ -114,6 +114,11 @@ const UserMessage = ({ content }: UserMessageProps) => { ) } +/** + * Renders a chat message card, displaying either an assistant or user message based on the role. + * + * Selects the appropriate message component and passes relevant props for rendering, including content, optional fragment, timestamp, and interaction handlers. + */ export default function MessageCard({ content, role, fragment, createdAt, isActiveFragment, onFragmentClick, type }: MessageProps) { diff --git a/src/modules/projects/ui/components/message-loading.tsx b/src/modules/projects/ui/components/message-loading.tsx index cd5a00f..0b36488 100644 --- a/src/modules/projects/ui/components/message-loading.tsx +++ b/src/modules/projects/ui/components/message-loading.tsx @@ -33,6 +33,11 @@ const ShimmerMessages = () => { ); } +/** + * Displays a loading UI with a logo, label, and animated cycling status messages. + * + * Renders a vertically stacked container featuring a small logo and the label "Neo" at the top, followed by a dynamic message area that cycles through loading messages to indicate ongoing processing. + */ export default function MessageLoading() { return (
diff --git a/src/modules/projects/ui/components/messages-container.tsx b/src/modules/projects/ui/components/messages-container.tsx index 0bb6b3d..204e03a 100644 --- a/src/modules/projects/ui/components/messages-container.tsx +++ b/src/modules/projects/ui/components/messages-container.tsx @@ -8,6 +8,15 @@ import { useEffect, useRef } from "react"; import { Fragment } from "@/generated/prisma"; import MessageLoading from "./message-loading"; +/** + * Displays and manages the message list for a given project, supporting fragment selection and automatic updates. + * + * Fetches messages for the specified project, highlights the active fragment, and allows users to select message fragments. Automatically scrolls to the latest message and periodically refreshes the message list. Renders a loading indicator if the last message is from the user and provides a form for submitting new messages. + * + * @param projectId - The identifier of the project whose messages are displayed. + * @param activeFragment - The currently active message fragment, or null if none is selected. + * @param setActiveFragment - Function to update the active fragment. + */ export default function MessagesContainer({ projectId, activeFragment, diff --git a/src/modules/projects/ui/components/project-header.tsx b/src/modules/projects/ui/components/project-header.tsx index 961b3ca..bfa357a 100644 --- a/src/modules/projects/ui/components/project-header.tsx +++ b/src/modules/projects/ui/components/project-header.tsx @@ -7,6 +7,13 @@ import { useTheme } from "next-themes"; import Image from "next/image"; import Link from "next/link"; +/** + * Renders a project header with a dropdown menu for navigation and theme selection. + * + * Displays the project name and logo, provides a link back to the dashboard, and allows users to switch between light, dark, and system appearance themes. + * + * @param projectId - The unique identifier of the project to display in the header + */ export default function ProjectHeader({ projectId }: { projectId: string }) { const trpc = useTRPC(); const { data: project } = useSuspenseQuery( diff --git a/src/modules/projects/ui/views/project-view.tsx b/src/modules/projects/ui/views/project-view.tsx index 590f398..c91cbb0 100644 --- a/src/modules/projects/ui/views/project-view.tsx +++ b/src/modules/projects/ui/views/project-view.tsx @@ -16,6 +16,13 @@ interface Props { projectId: string } +/** + * Displays a project workspace with a resizable two-panel layout, including project details, messages, and a placeholder for web preview. + * + * The left panel shows project information and messages, supporting fragment selection and asynchronous loading. The right panel is reserved for a future web preview feature. + * + * @param projectId - The unique identifier of the project to display + */ export default function ProjectView({ projectId }: Props) { const [activeFragment, setActiveFragment] = useState(null);