Skip to content

Drop in a screenshot and convert it to clean code (HTML/Tailwind/React/Vue)

Python

move constant to constants file

Abi Rajad741df41f639
diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx
index 64c2f7f1..23a5cdda 100644
--- a/frontend/src/App.tsx
+++ b/frontend/src/App.tsx
@@ -17,13 +17,14 @@ import { Textarea } from "@/components/ui/textarea";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "./components/ui/tabs";
import CodeMirror from "./components/CodeMirror";
import SettingsDialog from "./components/SettingsDialog";
-import { AppState, Settings, USER_CLOSE_WEB_SOCKET_CODE } from "./types";
+import { AppState, Settings } from "./types";
import { IS_RUNNING_ON_CLOUD } from "./config";
import { PicoBadge } from "./components/PicoBadge";
import { OnboardingNote } from "./components/OnboardingNote";
import { usePersistedState } from "./hooks/usePersistedState";
import { UrlInputSection } from "./components/UrlInputSection";
import TermsOfServiceDialog from "./components/TermsOfServiceDialog";
+import { USER_CLOSE_WEB_SOCKET_CODE } from "./constants";
function App() {
const [appState, setAppState] = useState<AppState>(AppState.INITIAL);
diff --git a/frontend/src/constants.ts b/frontend/src/constants.ts
new file mode 100644
index 00000000..a5da1894
--- /dev/null
+++ b/frontend/src/constants.ts
@@ -0,0 +1 @@
+export const USER_CLOSE_WEB_SOCKET_CODE = 4333;
diff --git a/frontend/src/generateCode.ts b/frontend/src/generateCode.ts
index 2083958e..2ad578fb 100644
--- a/frontend/src/generateCode.ts
+++ b/frontend/src/generateCode.ts
@@ -1,6 +1,6 @@
import toast from "react-hot-toast";
import { WS_BACKEND_URL } from "./config";
-import { USER_CLOSE_WEB_SOCKET_CODE } from "./types";
+import { USER_CLOSE_WEB_SOCKET_CODE } from "./constants";
const ERROR_MESSAGE =
"Error generating code. Check the Developer Console for details. Feel free to open a Github issue";
diff --git a/frontend/src/types.ts b/frontend/src/types.ts
index eec6ce1f..83f578e3 100644
--- a/frontend/src/types.ts
+++ b/frontend/src/types.ts
@@ -10,5 +10,3 @@ export enum AppState {
CODING = "CODING",
CODE_READY = "CODE_READY",
}
-
-export const USER_CLOSE_WEB_SOCKET_CODE = 4333;