Skip to content

Conversation

@visherj
Copy link
Contributor

@visherj visherj commented Jun 2, 2025

This pull request introduces significant updates to the design description editor, enhances form handling with react-hook-form and zod, and refactors the text editor implementation. Additionally, it includes dependency updates and file restructuring for improved modularity and maintainability.

Design Description Editor Updates:

  • Replaced the previous TextEditor implementation with a new modular design description editor, introducing DescriptionProvider for centralized state management.
  • Added new components like ContentControl for toggling between Markdown and HTML modes, and DropdownToolbar for secondary toolbar functionality.

Form Handling Enhancements:

  • Integrated react-hook-form with zodResolver for schema validation in DesignForm and DesignDetailsPage. This replaces manual state management for form fields like description and tags.
  • Updated tags field in designUpdateSchema to use an array of objects for better structure and validation.

Refactoring and File Restructuring:

  • Removed the old TextEditor and related components (header-control.tsx, control-button.tsx) and relocated/refactored them under features/design-description-editor.
  • Simplified imports and file paths for better organization.

Dependency Updates:

  • Added new TipTap extensions (blockquote, table, table-cell, etc.) and prosemirror-markdown for enhanced text editing capabilities.

Code Cleanup:

  • Removed unused description state and related logic in DesignForm and DesignDetailsPage.

@jklewa jklewa requested a review from Copilot June 2, 2025 15:37

This comment was marked as outdated.

@jklewa jklewa linked an issue Jun 7, 2025 that may be closed by this pull request
@jklewa jklewa requested a review from Copilot June 24, 2025 01:40
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR overhauls the text editor by centralizing its state in a context, adding Markdown serialization, enriching the toolbar with new controls, and wiring it into the design forms with updated schema support.

  • Introduce DescriptionProvider and context for editor state and Markdown/HTML toggling
  • Add CustomMarkdownSerializer, table‐insertion extensions, and new toolbar components
  • Update design create/update forms to consume the context and refine tags schema

Reviewed Changes

Copilot reviewed 19 out of 20 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/app/globals.css Rename editor comment and add ProseMirror table/blockquote styles
src/app/features/design-description-editor/extensions/md-serializer.tsx Add custom Markdown serializer for editor content
src/app/features/design-description-editor/extensions/custom-tab-table.tsx Implement Tab‐key behavior to exit tables
src/app/features/design-description-editor/context/description-context.tsx Create DescriptionProvider for editor state
src/app/features/design-description-editor/components/toolbar.tsx Refactor toolbar to use context and add new controls
src/app/features/design-description-editor/components/table-control.tsx Provide dropdown for table operations
src/app/features/design-description-editor/components/link-control.tsx Refactor link control to use context
src/app/features/design-description-editor/components/header-control.tsx Refactor header control to use context
src/app/features/design-description-editor/components/editor.tsx Wire editor content into React Hook Form with context
src/app/features/design-description-editor/components/dropdown-toolbar.tsx Add secondary controls dropdown
src/app/features/design-description-editor/components/control-button.tsx Change to default export and adjust styling
src/app/features/design-description-editor/components/content-control.tsx Add Markdown/HTML toggle control
src/app/design/[designID]/page.tsx Integrate context into update form and refine schema usage
src/app/components/design/types.ts Change tags from string to structured array in Zod schema
src/app/components/design/design-form.tsx Integrate enhanced editor into create form
package.json Add new Tiptap and ProseMirror Markdown dependencies
electron/main.ts Remove unused session import

import { LinkIcon } from "lucide-react";
import { ControlButton } from "./control-button";
import ControlButton from "@/src/app/features/design-description-editor/components/control-button";
import log from "electron-log/renderer";
Copy link

Copilot AI Jun 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The log import from electron-log/renderer is unused in this component and may cause bundling issues in a Next.js environment; please remove it.

Suggested change
import log from "electron-log/renderer";

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,31 @@
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/src/app/components/ui/dropdown-menu"
import { Button } from '../../../components/ui/button'
Copy link

Copilot AI Jun 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This relative import path is inconsistent with other UI imports and may not resolve correctly; consider changing to an absolute import like @/src/app/components/ui/button.

Suggested change
import { Button } from '../../../components/ui/button'
import { Button } from '@/src/app/components/ui/button'

Copilot uses AI. Check for mistakes.
{errors.tags && <p className="text-red-500 text-sm">Tags are required</p>}
</div>
<div>
<label className="block text-sm font-medium mb-1">Tags</label>
Copy link

Copilot AI Jun 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Tags field appears twice in the edit form—once at this location and again just below. Please remove the redundant block to avoid duplicate inputs.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Design Description Editor

2 participants