Skip to content

feat: Introduce Import from Figma using MCP Functionality #2129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 22 commits into
base: main
Choose a base branch
from

Conversation

iNerdStack
Copy link
Contributor

@iNerdStack iNerdStack commented Jun 9, 2025

Description

This PR introduces import from Figma using MCP, it connects with Figma desktop SSE service.
Adds new context option for import from figma in AI chat

Related Issues

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Release
  • Refactor
  • Other (please describe):

Testing

Screenshots (if applicable)

Additional Notes


Important

Introduces Figma import functionality using MCP, adding UI components, API routes, and context management for Figma designs.

  • Behavior:
    • Adds FigmaInput component to action-buttons.tsx for importing Figma designs.
    • Connects to Figma desktop SSE service for design data retrieval.
    • Supports importing from Figma URL and current selection.
  • API:
    • Introduces figmaRouter in figma.ts for handling Figma-related API requests.
    • Implements getDesignFromUrl and getCurrentSelection procedures.
  • Context Management:
    • Updates ChatContext in context.ts to include Figma context handling.
    • Adds addFigmaContext and removeFigmaContext methods.
  • Models:
    • Adds FigmaMessageContext to context.ts for managing Figma data.
  • UI:
    • Adds FigmaLogo icon to icons/index.tsx.

This description was created by Ellipsis for 871408c. You can customize this summary. It will automatically update as commits are pushed.

Copy link

vercel bot commented Jun 9, 2025

@iNerdStack is attempting to deploy a commit to the Onlook Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Caution

Changes requested ❌

Reviewed everything up to 871408c in 3 minutes and 12 seconds. Click for details.
  • Reviewed 1023 lines of code in 10 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. apps/web/client/src/app/project/[id]/_components/right-panel/chat-tab/chat-input/figma-input.tsx:139
  • Draft comment:
    The clipboard URL validation uses a simple 'includes("figma.com")' check; consider using a more robust URL validation or proper URL parsing to ensure the pasted value is a valid Figma URL.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50% The simple check is just for the clipboard paste feature. The actual URL validation will happen server-side when the URL is used. The clipboard check is just a UX feature to give immediate feedback. A more complex validation here would be unnecessary since the real validation happens later. The current approach is reasonable for this use case. The comment has a point that the validation could be more robust. Malicious URLs containing "figma.com" somewhere could potentially pass this check. The risk is very low since this is just initial feedback - the actual URL will be validated server-side before any real processing happens. The simple check is appropriate for this UX-focused clipboard feature. The comment should be deleted. The simple URL check is appropriate for this UX feature since proper validation happens server-side. Making it more complex would be overengineering.
2. apps/web/client/src/server/api/routers/figma.ts:177
  • Draft comment:
    Similarly, in waitForMCPResponse, using an AbortController for the SSE fetch could improve cancellation and timeout handling.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 30% vs. threshold = 50% The current implementation already has a working timeout mechanism with cleanup. While AbortController could provide a more modern way to handle cancellation, the existing solution with reader.cancel() is functionally complete and clear. The suggestion is more of a style preference than a critical improvement. The current code handles both timeout and cleanup effectively. AbortController is indeed a more modern API that could simplify the code slightly. The current implementation could potentially leak resources if cleanup isn't called in all edge cases. The current implementation already has thorough cleanup handling in all code paths - normal completion, timeout, and error cases. The benefit of switching to AbortController would be minimal. While using AbortController is a valid suggestion, the current implementation is already robust and clear. The suggested change would be more of a style refactor than a meaningful improvement.

Workflow ID: wflow_EQdWNpPe84awAH5g

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

iNerdStack and others added 18 commits June 10, 2025 00:13
onlook-dev#2118)

* feat: Enable line breaks in text editor without splitBlock - Add hard_break node to ProseMirror schema for <br> tag support - Implement smart Enter key handler with context-aware behavior - Add bidirectional content conversion between newlines and <br> tags - Update text editor component with proper multi-line support - Fix TypeScript errors and optimize code structure - Resolves onlook-dev#2065 as alternative to PR onlook-dev#2083

* fix: Clean up code duplication and template literal issue

* add newline

* refactor and few addition

* writing to the code added
…v#2148)

* fix: fixed loading hydration error for contributor section
* Avoid redundant sandbox indexing

* fix tooltip
* fix: prevent browser shortcuts override
* fix: text-highlighting fixed on selected texts

* fix: selecting an element will also open the file and highlight that portion of code

* fix: adding await on call
@drfarrell drfarrell requested a review from Kitenite June 15, 2025 01:08
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.

6 participants