Drop in a screenshot and convert it to clean code (HTML/Tailwind/React/Vue)
Python
Show alternative instructions when user pastes a Figma URL (#571)
Abi Raja4181c9dfbd10
diff --git a/frontend/src/components/unified-input/tabs/UrlTab.tsx b/frontend/src/components/unified-input/tabs/UrlTab.tsxindex d231dc63..e5d70fe7 100644--- a/frontend/src/components/unified-input/tabs/UrlTab.tsx+++ b/frontend/src/components/unified-input/tabs/UrlTab.tsx@@ -17,6 +17,10 @@ interface Props {setStack: (stack: Stack) => void;}+function isFigmaUrl(url: string): boolean {+ return /^https?:\/\/([\w.-]*\.)?figma\.com\//i.test(url.trim());+}+function UrlTab({ doCreate, screenshotOneApiKey, stack, setStack }: Props) {const [isLoading, setIsLoading] = useState(false);const [referenceUrl, setReferenceUrl] = useState("");@@ -44,6 +48,14 @@ function UrlTab({ doCreate, screenshotOneApiKey, stack, setStack }: Props) {return;}+ if (isFigmaUrl(trimmedReferenceUrl)) {+ toast.error(+ "Direct Figma import is not supported. Please take a screenshot of your Figma design or export the artboards as images, then use the Upload tab.",+ { duration: 6000 },+ );+ return;+ }+try {setIsLoading(true);const response = await fetch(`${HTTP_BACKEND_URL}/api/screenshot`, {@@ -110,6 +122,13 @@ function UrlTab({ doCreate, screenshotOneApiKey, stack, setStack }: Props) {className="w-full"data-testid="url-input"/>+ {isFigmaUrl(referenceUrl) && (+ <p className="text-xs text-amber-600 dark:text-amber-400">+ Direct Figma import is not supported. Take a screenshot of your+ design or export the artboards as images, then use the Upload+ tab.+ </p>+ )}<OutputSettingsSection stack={stack} setStack={setStack} /><Button