Spaces:
Paused
Paused
dr-data
commited on
Commit
·
3b6dec6
1
Parent(s):
9e8594b
Fix remaining TypeScript and ESLint errors for successful build
Browse files
app/api/test-scenarios/route.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
import {
|
| 2 |
|
| 3 |
export async function POST() {
|
| 4 |
console.log('🧪 Testing the exact failing scenario...');
|
|
|
|
| 1 |
+
import { NextResponse } from "next/server";
|
| 2 |
|
| 3 |
export async function POST() {
|
| 4 |
console.log('🧪 Testing the exact failing scenario...');
|
components/editor/ask-ai/index.tsx
CHANGED
|
@@ -49,7 +49,7 @@ export function AskAI({
|
|
| 49 |
selectedElement?: HTMLElement | null;
|
| 50 |
setSelectedElement: React.Dispatch<React.SetStateAction<HTMLElement | null>>;
|
| 51 |
}) {
|
| 52 |
-
const [openrouterApiKey
|
| 53 |
const refThink = useRef<HTMLDivElement | null>(null);
|
| 54 |
const audio = useRef<HTMLAudioElement | null>(null);
|
| 55 |
|
|
|
|
| 49 |
selectedElement?: HTMLElement | null;
|
| 50 |
setSelectedElement: React.Dispatch<React.SetStateAction<HTMLElement | null>>;
|
| 51 |
}) {
|
| 52 |
+
const [openrouterApiKey] = useLocalStorage<string>("openrouter-api-key", "");
|
| 53 |
const refThink = useRef<HTMLDivElement | null>(null);
|
| 54 |
const audio = useRef<HTMLAudioElement | null>(null);
|
| 55 |
|
components/editor/preview/index-simplified.tsx
CHANGED
|
@@ -14,7 +14,6 @@ export const Preview = forwardRef<
|
|
| 14 |
isResizing: boolean;
|
| 15 |
isAiWorking: boolean;
|
| 16 |
device: "desktop" | "mobile";
|
| 17 |
-
currentTab: string;
|
| 18 |
iframeRef?: React.RefObject<HTMLIFrameElement | null>;
|
| 19 |
isEditableModeEnabled?: boolean;
|
| 20 |
onClickElement?: (element: HTMLElement) => void;
|
|
@@ -24,7 +23,6 @@ export const Preview = forwardRef<
|
|
| 24 |
isResizing,
|
| 25 |
isAiWorking,
|
| 26 |
device,
|
| 27 |
-
currentTab: _currentTab,
|
| 28 |
iframeRef,
|
| 29 |
isEditableModeEnabled,
|
| 30 |
onClickElement,
|
|
@@ -46,7 +44,7 @@ export const Preview = forwardRef<
|
|
| 46 |
htmlPreview: html.substring(0, 200) + '...',
|
| 47 |
displayHtmlLength: displayHtml.length
|
| 48 |
});
|
| 49 |
-
}, []);
|
| 50 |
|
| 51 |
// SIMPLIFIED: Reliable HTML update logic with optional smoothness
|
| 52 |
useEffect(() => {
|
|
|
|
| 14 |
isResizing: boolean;
|
| 15 |
isAiWorking: boolean;
|
| 16 |
device: "desktop" | "mobile";
|
|
|
|
| 17 |
iframeRef?: React.RefObject<HTMLIFrameElement | null>;
|
| 18 |
isEditableModeEnabled?: boolean;
|
| 19 |
onClickElement?: (element: HTMLElement) => void;
|
|
|
|
| 23 |
isResizing,
|
| 24 |
isAiWorking,
|
| 25 |
device,
|
|
|
|
| 26 |
iframeRef,
|
| 27 |
isEditableModeEnabled,
|
| 28 |
onClickElement,
|
|
|
|
| 44 |
htmlPreview: html.substring(0, 200) + '...',
|
| 45 |
displayHtmlLength: displayHtml.length
|
| 46 |
});
|
| 47 |
+
}, [html.length, displayHtml.length]);
|
| 48 |
|
| 49 |
// SIMPLIFIED: Reliable HTML update logic with optional smoothness
|
| 50 |
useEffect(() => {
|
components/editor/preview/index.tsx
CHANGED
|
@@ -128,7 +128,7 @@ export const Preview = forwardRef<
|
|
| 128 |
}
|
| 129 |
|
| 130 |
console.log('✅ Preview update completed');
|
| 131 |
-
}, [html, isAiWorking]);
|
| 132 |
|
| 133 |
// Enhanced smooth transitions via CSS injection
|
| 134 |
useEffect(() => {
|
|
@@ -139,7 +139,7 @@ export const Preview = forwardRef<
|
|
| 139 |
const doc = iframe.contentDocument;
|
| 140 |
if (!doc) return;
|
| 141 |
|
| 142 |
-
|
| 143 |
if (existingStyle) {
|
| 144 |
console.log('🎨 Smooth transitions already injected, updating...');
|
| 145 |
existingStyle.remove();
|
|
|
|
| 128 |
}
|
| 129 |
|
| 130 |
console.log('✅ Preview update completed');
|
| 131 |
+
}, [html, isAiWorking, displayHtml]);
|
| 132 |
|
| 133 |
// Enhanced smooth transitions via CSS injection
|
| 134 |
useEffect(() => {
|
|
|
|
| 139 |
const doc = iframe.contentDocument;
|
| 140 |
if (!doc) return;
|
| 141 |
|
| 142 |
+
const existingStyle = doc.getElementById('smooth-transitions');
|
| 143 |
if (existingStyle) {
|
| 144 |
console.log('🎨 Smooth transitions already injected, updating...');
|
| 145 |
existingStyle.remove();
|
components/openrouter-model-selector/index.tsx
CHANGED
|
@@ -11,14 +11,12 @@ import { Search, Loader2, RefreshCw, ExternalLink } from 'lucide-react';
|
|
| 11 |
interface OpenRouterModelSelectorProps {
|
| 12 |
selectedModel: string;
|
| 13 |
onModelSelect: (modelId: string) => void;
|
| 14 |
-
apiKey?: string;
|
| 15 |
disabled?: boolean;
|
| 16 |
}
|
| 17 |
|
| 18 |
export function OpenRouterModelSelector({
|
| 19 |
selectedModel,
|
| 20 |
onModelSelect,
|
| 21 |
-
apiKey: _apiKey,
|
| 22 |
disabled = false
|
| 23 |
}: OpenRouterModelSelectorProps) {
|
| 24 |
const [isOpen, setIsOpen] = useState(false);
|
|
|
|
| 11 |
interface OpenRouterModelSelectorProps {
|
| 12 |
selectedModel: string;
|
| 13 |
onModelSelect: (modelId: string) => void;
|
|
|
|
| 14 |
disabled?: boolean;
|
| 15 |
}
|
| 16 |
|
| 17 |
export function OpenRouterModelSelector({
|
| 18 |
selectedModel,
|
| 19 |
onModelSelect,
|
|
|
|
| 20 |
disabled = false
|
| 21 |
}: OpenRouterModelSelectorProps) {
|
| 22 |
const [isOpen, setIsOpen] = useState(false);
|