π₯ Make videos programmatically with React
Add SettingsModal and OpenAI API key input
ASchwad2e83db9c76fc
diff --git a/bun.lock b/bun.lockindex 11fb55b79e..0e69f466c9 100644--- a/bun.lock+++ b/bun.lock@@ -1415,7 +1415,9 @@"@ai-sdk/react": "^2.0.104","@babel/standalone": "^7.28.5","@monaco-editor/react": "^4.7.0",+ "@radix-ui/react-dialog": "^1.1.15","@radix-ui/react-select": "^2.2.6",+ "@radix-ui/react-tooltip": "^1.2.8","@remotion/bundler": "workspace:*","@remotion/cli": "workspace:*","@remotion/google-fonts": "workspace:*",@@ -3279,6 +3281,8 @@"@radix-ui/react-toggle": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/primitive": "1.1.2", "@radix-ui/react-primitive": "2.1.3", "@radix-ui/react-use-controllable-state": "1.2.2" }, "peerDependencies": { "@types/react": "19.0.0", "@types/react-dom": "19.0.0", "react": "19.0.0", "react-dom": "19.0.0" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-ZoFkBBz9zv9GWer7wIjvdRxmh2wyc2oKWw6C6CseWd6/yq1DK/l5lJ+wnsmFwJZbBYqr02mrf8A2q/CVCuM3ZA=="],+ "@radix-ui/react-tooltip": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/primitive": "1.1.3", "@radix-ui/react-compose-refs": "1.1.2", "@radix-ui/react-context": "1.1.2", "@radix-ui/react-dismissable-layer": "1.1.11", "@radix-ui/react-id": "1.1.1", "@radix-ui/react-popper": "1.2.8", "@radix-ui/react-portal": "1.1.9", "@radix-ui/react-presence": "1.1.5", "@radix-ui/react-primitive": "2.1.3", "@radix-ui/react-slot": "1.2.3", "@radix-ui/react-use-controllable-state": "1.2.2", "@radix-ui/react-visually-hidden": "1.2.3" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-tY7sVt1yL9ozIxvmbtN5qtmH2krXcBCfjEiCgKGLqunJHvgvZG2Pcl2oQ3kbcZARb1BGEHdkLzcYGO8ynVlieg=="],+"@radix-ui/react-use-callback-ref": ["@radix-ui/[email protected]", "", { "peerDependencies": { "@types/react": "19.0.0", "react": "19.0.0" }, "optionalPeers": ["@types/react"] }, "sha512-CasTfvsy+frcFkbXtSJ2Zu9JHpN8TYKxkgJGWbjiZhFivxaeW7rMeZt7QELGVLaYVfFMsKHjb7Ak0nMEe+2Vfw=="],"@radix-ui/react-use-controllable-state": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/react-use-callback-ref": "1.1.0" }, "peerDependencies": { "@types/react": "19.0.0", "react": "19.0.0" }, "optionalPeers": ["@types/react"] }, "sha512-MtfMVJiSr2NjzS0Aa90NPTnvTSg6C/JLCV7ma0W6+OMV78vd8OyRpID+Ng9LxzsPbLeuBnWBA1Nq30AtBIDChw=="],@@ -7903,6 +7907,24 @@"@radix-ui/react-toggle/@radix-ui/react-use-controllable-state": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/react-use-effect-event": "0.0.2", "@radix-ui/react-use-layout-effect": "1.1.1" }, "peerDependencies": { "@types/react": "19.0.0", "react": "19.0.0" }, "optionalPeers": ["@types/react"] }, "sha512-BjasUjixPFdS+NKkypcyyN5Pmg83Olst0+c6vGov0diwTEo6mgdqVR6hxcEgFuh4QrAs7Rc+9KuGJ9TVCj0Zzg=="],+ "@radix-ui/react-tooltip/@radix-ui/primitive": ["@radix-ui/[email protected]", "", {}, "sha512-JTF99U/6XIjCBo0wqkU5sK10glYe27MRRsfwoiq5zzOEZLHU3A3KCMa5X/azekYRCJ0HlwI0crAXS/5dEHTzDg=="],++ "@radix-ui/react-tooltip/@radix-ui/react-compose-refs": ["@radix-ui/[email protected]", "", { "peerDependencies": { "@types/react": "19.0.0", "react": "19.0.0" }, "optionalPeers": ["@types/react"] }, "sha512-z4eqJvfiNnFMHIIvXP3CY57y2WJs5g2v3X0zm9mEJkrkNv4rDxu+sg9Jh8EkXyeqBkB7SOcboo9dMVqhyrACIg=="],++ "@radix-ui/react-tooltip/@radix-ui/react-context": ["@radix-ui/[email protected]", "", { "peerDependencies": { "@types/react": "19.0.0", "react": "19.0.0" }, "optionalPeers": ["@types/react"] }, "sha512-jCi/QKUM2r1Ju5a3J64TH2A5SpKAgh0LpknyqdQ4m6DCV0xJ2HG1xARRwNGPQfi1SLdLWZ1OJz6F4OMBBNiGJA=="],++ "@radix-ui/react-tooltip/@radix-ui/react-dismissable-layer": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/primitive": "1.1.3", "@radix-ui/react-compose-refs": "1.1.2", "@radix-ui/react-primitive": "2.1.3", "@radix-ui/react-use-callback-ref": "1.1.1", "@radix-ui/react-use-escape-keydown": "1.1.1" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-Nqcp+t5cTB8BinFkZgXiMJniQH0PsUt2k51FUhbdfeKvc4ACcG2uQniY/8+h1Yv6Kza4Q7lD7PQV0z0oicE0Mg=="],++ "@radix-ui/react-tooltip/@radix-ui/react-popper": ["@radix-ui/[email protected]", "", { "dependencies": { "@floating-ui/react-dom": "^2.0.0", "@radix-ui/react-arrow": "1.1.7", "@radix-ui/react-compose-refs": "1.1.2", "@radix-ui/react-context": "1.1.2", "@radix-ui/react-primitive": "2.1.3", "@radix-ui/react-use-callback-ref": "1.1.1", "@radix-ui/react-use-layout-effect": "1.1.1", "@radix-ui/react-use-rect": "1.1.1", "@radix-ui/react-use-size": "1.1.1", "@radix-ui/rect": "1.1.1" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-0NJQ4LFFUuWkE7Oxf0htBKS6zLkkjBH+hM1uk7Ng705ReR8m/uelduy1DBo0PyBXPKVnBA6YBlU94MBGXrSBCw=="],++ "@radix-ui/react-tooltip/@radix-ui/react-presence": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/react-compose-refs": "1.1.2", "@radix-ui/react-use-layout-effect": "1.1.1" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-/jfEwNDdQVBCNvjkGit4h6pMOzq8bHkopq458dPt2lMjx+eBQUohZNG9A7DtO/O5ukSbxuaNGXMjHicgwy6rQQ=="],++ "@radix-ui/react-tooltip/@radix-ui/react-primitive": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/react-slot": "1.2.3" }, "peerDependencies": { "@types/react": "19.0.0", "@types/react-dom": "19.0.0", "react": "19.0.0", "react-dom": "19.0.0" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-m9gTwRkhy2lvCPe6QJp4d3G1TYEUHn/FzJUtq9MjH46an1wJU+GdoGC5VLof8RX8Ft/DlpshApkhswDLZzHIcQ=="],++ "@radix-ui/react-tooltip/@radix-ui/react-use-controllable-state": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/react-use-effect-event": "0.0.2", "@radix-ui/react-use-layout-effect": "1.1.1" }, "peerDependencies": { "@types/react": "19.0.0", "react": "19.0.0" }, "optionalPeers": ["@types/react"] }, "sha512-BjasUjixPFdS+NKkypcyyN5Pmg83Olst0+c6vGov0diwTEo6mgdqVR6hxcEgFuh4QrAs7Rc+9KuGJ9TVCj0Zzg=="],++ "@radix-ui/react-tooltip/@radix-ui/react-visually-hidden": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/react-primitive": "2.1.3" }, "peerDependencies": { "@types/react": "19.0.0", "@types/react-dom": "19.0.0", "react": "19.0.0", "react-dom": "19.0.0" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-pzJq12tEaaIhqjbzpCuv/OypJY/BPavOofm+dbab+MHLajy277+1lLm6JFcGgF5eskJ6mquGirhXY2GD/8u8Ug=="],+"@radix-ui/react-use-effect-event/@radix-ui/react-use-layout-effect": ["@radix-ui/[email protected]", "", { "peerDependencies": { "@types/react": "19.0.0", "react": "19.0.0" }, "optionalPeers": ["@types/react"] }, "sha512-RbJRS4UWQFkzHTTwVymMTUv8EqYhOp8dOOviLj2ugtTiXRaRQS7GLGxZTLL1jWhMeoSCf5zmcZkqTl9IiYfXcQ=="],"@radix-ui/react-use-escape-keydown/@radix-ui/react-use-callback-ref": ["@radix-ui/[email protected]", "", { "peerDependencies": { "@types/react": "19.0.0", "react": "19.0.0" }, "optionalPeers": ["@types/react"] }, "sha512-FkBMwD+qbGQeMu1cOHnuGB6x4yzPjho8ap5WtbEJ26umhgqVXbhekKUQO+hZEL1vU92a3wHwdp0HAcqAUF5iDg=="],@@ -9133,6 +9155,8 @@"template-code-generation/@eslint/js": ["@eslint/[email protected]", "", {}, "sha512-UZ1VpFvXf9J06YG9xQBdnzU+kthors6KjhMAl6f4gH4usHyh31rUf2DLGInT8RFYIReYXNSydgPY0V2LuWgl7A=="],+ "template-code-generation/@radix-ui/react-dialog": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/primitive": "1.1.3", "@radix-ui/react-compose-refs": "1.1.2", "@radix-ui/react-context": "1.1.2", "@radix-ui/react-dismissable-layer": "1.1.11", "@radix-ui/react-focus-guards": "1.1.3", "@radix-ui/react-focus-scope": "1.1.7", "@radix-ui/react-id": "1.1.1", "@radix-ui/react-portal": "1.1.9", "@radix-ui/react-presence": "1.1.5", "@radix-ui/react-primitive": "2.1.3", "@radix-ui/react-slot": "1.2.3", "@radix-ui/react-use-controllable-state": "1.2.2", "aria-hidden": "^1.2.4", "react-remove-scroll": "^2.6.3" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-TCglVRtzlffRNxRMEyR36DGBLJpeusFcgMVD9PZEzAKnUs1lKCgX5u9BmC2Yg+LL9MgZDugFFs1Vl+Jp4t/PGw=="],+"template-code-generation/@radix-ui/react-select": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/number": "1.1.1", "@radix-ui/primitive": "1.1.3", "@radix-ui/react-collection": "1.1.7", "@radix-ui/react-compose-refs": "1.1.2", "@radix-ui/react-context": "1.1.2", "@radix-ui/react-direction": "1.1.1", "@radix-ui/react-dismissable-layer": "1.1.11", "@radix-ui/react-focus-guards": "1.1.3", "@radix-ui/react-focus-scope": "1.1.7", "@radix-ui/react-id": "1.1.1", "@radix-ui/react-popper": "1.2.8", "@radix-ui/react-portal": "1.1.9", "@radix-ui/react-primitive": "2.1.3", "@radix-ui/react-slot": "1.2.3", "@radix-ui/react-use-callback-ref": "1.1.1", "@radix-ui/react-use-controllable-state": "1.2.2", "@radix-ui/react-use-layout-effect": "1.1.1", "@radix-ui/react-use-previous": "1.1.1", "@radix-ui/react-visually-hidden": "1.2.3", "aria-hidden": "^1.2.4", "react-remove-scroll": "^2.6.3" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-I30RydO+bnn2PQztvo25tswPH+wFBjehVGtmagkU78yMdwTwVf12wnAOF+AeP8S2N8xD+5UPbGhkUfPyvT+mwQ=="],"template-code-generation/@typescript-eslint/eslint-plugin": ["@typescript-eslint/[email protected]", "", { "dependencies": { "@eslint-community/regexpp": "^4.10.0", "@typescript-eslint/scope-manager": "8.46.0", "@typescript-eslint/type-utils": "8.46.0", "@typescript-eslint/utils": "8.46.0", "@typescript-eslint/visitor-keys": "8.46.0", "graphemer": "^1.4.0", "ignore": "^7.0.0", "natural-compare": "^1.4.0", "ts-api-utils": "^2.1.0" }, "peerDependencies": { "@typescript-eslint/parser": "^8.46.0", "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <6.0.0" } }, "sha512-hA8gxBq4ukonVXPy0OKhiaUh/68D0E88GSmtC1iAEnGaieuDi38LhS7jdCHRLi6ErJBNDGCzvh5EnzdPwUc0DA=="],@@ -10047,6 +10071,24 @@"@radix-ui/react-toggle/@radix-ui/react-use-controllable-state/@radix-ui/react-use-layout-effect": ["@radix-ui/[email protected]", "", { "peerDependencies": { "@types/react": "19.0.0", "react": "19.0.0" }, "optionalPeers": ["@types/react"] }, "sha512-RbJRS4UWQFkzHTTwVymMTUv8EqYhOp8dOOviLj2ugtTiXRaRQS7GLGxZTLL1jWhMeoSCf5zmcZkqTl9IiYfXcQ=="],+ "@radix-ui/react-tooltip/@radix-ui/react-dismissable-layer/@radix-ui/react-use-callback-ref": ["@radix-ui/[email protected]", "", { "peerDependencies": { "@types/react": "19.0.0", "react": "19.0.0" }, "optionalPeers": ["@types/react"] }, "sha512-FkBMwD+qbGQeMu1cOHnuGB6x4yzPjho8ap5WtbEJ26umhgqVXbhekKUQO+hZEL1vU92a3wHwdp0HAcqAUF5iDg=="],++ "@radix-ui/react-tooltip/@radix-ui/react-popper/@radix-ui/react-arrow": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/react-primitive": "2.1.3" }, "peerDependencies": { "@types/react": "19.0.0", "@types/react-dom": "19.0.0", "react": "19.0.0", "react-dom": "19.0.0" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-F+M1tLhO+mlQaOWspE8Wstg+z6PwxwRd8oQ8IXceWz92kfAmalTRf0EjrouQeo7QssEPfCn05B4Ihs1K9WQ/7w=="],++ "@radix-ui/react-tooltip/@radix-ui/react-popper/@radix-ui/react-use-callback-ref": ["@radix-ui/[email protected]", "", { "peerDependencies": { "@types/react": "19.0.0", "react": "19.0.0" }, "optionalPeers": ["@types/react"] }, "sha512-FkBMwD+qbGQeMu1cOHnuGB6x4yzPjho8ap5WtbEJ26umhgqVXbhekKUQO+hZEL1vU92a3wHwdp0HAcqAUF5iDg=="],++ "@radix-ui/react-tooltip/@radix-ui/react-popper/@radix-ui/react-use-layout-effect": ["@radix-ui/[email protected]", "", { "peerDependencies": { "@types/react": "19.0.0", "react": "19.0.0" }, "optionalPeers": ["@types/react"] }, "sha512-RbJRS4UWQFkzHTTwVymMTUv8EqYhOp8dOOviLj2ugtTiXRaRQS7GLGxZTLL1jWhMeoSCf5zmcZkqTl9IiYfXcQ=="],++ "@radix-ui/react-tooltip/@radix-ui/react-popper/@radix-ui/react-use-rect": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/rect": "1.1.1" }, "peerDependencies": { "@types/react": "19.0.0", "react": "19.0.0" }, "optionalPeers": ["@types/react"] }, "sha512-QTYuDesS0VtuHNNvMh+CjlKJ4LJickCMUAqjlE3+j8w+RlRpwyX3apEQKGFzbZGdo7XNG1tXa+bQqIE7HIXT2w=="],++ "@radix-ui/react-tooltip/@radix-ui/react-popper/@radix-ui/react-use-size": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/react-use-layout-effect": "1.1.1" }, "peerDependencies": { "@types/react": "19.0.0", "react": "19.0.0" }, "optionalPeers": ["@types/react"] }, "sha512-ewrXRDTAqAXlkl6t/fkXWNAhFX9I+CkKlw6zjEwk86RSPKwZr3xpBRso655aqYafwtnbpHLj6toFzmd6xdVptQ=="],++ "@radix-ui/react-tooltip/@radix-ui/react-popper/@radix-ui/rect": ["@radix-ui/[email protected]", "", {}, "sha512-HPwpGIzkl28mWyZqG52jiqDJ12waP11Pa1lGoiyUkIEuMLBP0oeK/C89esbXrxsky5we7dfd8U58nm0SgAWpVw=="],++ "@radix-ui/react-tooltip/@radix-ui/react-presence/@radix-ui/react-use-layout-effect": ["@radix-ui/[email protected]", "", { "peerDependencies": { "@types/react": "19.0.0", "react": "19.0.0" }, "optionalPeers": ["@types/react"] }, "sha512-RbJRS4UWQFkzHTTwVymMTUv8EqYhOp8dOOviLj2ugtTiXRaRQS7GLGxZTLL1jWhMeoSCf5zmcZkqTl9IiYfXcQ=="],++ "@radix-ui/react-tooltip/@radix-ui/react-use-controllable-state/@radix-ui/react-use-layout-effect": ["@radix-ui/[email protected]", "", { "peerDependencies": { "@types/react": "19.0.0", "react": "19.0.0" }, "optionalPeers": ["@types/react"] }, "sha512-RbJRS4UWQFkzHTTwVymMTUv8EqYhOp8dOOviLj2ugtTiXRaRQS7GLGxZTLL1jWhMeoSCf5zmcZkqTl9IiYfXcQ=="],+"@react-router/dev/chokidar/readdirp": ["[email protected]", "", {}, "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg=="],"@react-router/dev/vite/esbuild": ["[email protected]", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.21.5", "@esbuild/android-arm": "0.21.5", "@esbuild/android-arm64": "0.21.5", "@esbuild/android-x64": "0.21.5", "@esbuild/darwin-arm64": "0.21.5", "@esbuild/darwin-x64": "0.21.5", "@esbuild/freebsd-arm64": "0.21.5", "@esbuild/freebsd-x64": "0.21.5", "@esbuild/linux-arm": "0.21.5", "@esbuild/linux-arm64": "0.21.5", "@esbuild/linux-ia32": "0.21.5", "@esbuild/linux-loong64": "0.21.5", "@esbuild/linux-mips64el": "0.21.5", "@esbuild/linux-ppc64": "0.21.5", "@esbuild/linux-riscv64": "0.21.5", "@esbuild/linux-s390x": "0.21.5", "@esbuild/linux-x64": "0.21.5", "@esbuild/netbsd-x64": "0.21.5", "@esbuild/openbsd-x64": "0.21.5", "@esbuild/sunos-x64": "0.21.5", "@esbuild/win32-arm64": "0.21.5", "@esbuild/win32-ia32": "0.21.5", "@esbuild/win32-x64": "0.21.5" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw=="],@@ -11045,6 +11087,22 @@"teeny-request/https-proxy-agent/debug": ["[email protected]", "", { "dependencies": { "ms": "2.1.3" } }, "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ=="],+ "template-code-generation/@radix-ui/react-dialog/@radix-ui/primitive": ["@radix-ui/[email protected]", "", {}, "sha512-JTF99U/6XIjCBo0wqkU5sK10glYe27MRRsfwoiq5zzOEZLHU3A3KCMa5X/azekYRCJ0HlwI0crAXS/5dEHTzDg=="],++ "template-code-generation/@radix-ui/react-dialog/@radix-ui/react-compose-refs": ["@radix-ui/[email protected]", "", { "peerDependencies": { "@types/react": "19.0.0", "react": "19.0.0" }, "optionalPeers": ["@types/react"] }, "sha512-z4eqJvfiNnFMHIIvXP3CY57y2WJs5g2v3X0zm9mEJkrkNv4rDxu+sg9Jh8EkXyeqBkB7SOcboo9dMVqhyrACIg=="],++ "template-code-generation/@radix-ui/react-dialog/@radix-ui/react-context": ["@radix-ui/[email protected]", "", { "peerDependencies": { "@types/react": "19.0.0", "react": "19.0.0" }, "optionalPeers": ["@types/react"] }, "sha512-jCi/QKUM2r1Ju5a3J64TH2A5SpKAgh0LpknyqdQ4m6DCV0xJ2HG1xARRwNGPQfi1SLdLWZ1OJz6F4OMBBNiGJA=="],++ "template-code-generation/@radix-ui/react-dialog/@radix-ui/react-dismissable-layer": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/primitive": "1.1.3", "@radix-ui/react-compose-refs": "1.1.2", "@radix-ui/react-primitive": "2.1.3", "@radix-ui/react-use-callback-ref": "1.1.1", "@radix-ui/react-use-escape-keydown": "1.1.1" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-Nqcp+t5cTB8BinFkZgXiMJniQH0PsUt2k51FUhbdfeKvc4ACcG2uQniY/8+h1Yv6Kza4Q7lD7PQV0z0oicE0Mg=="],++ "template-code-generation/@radix-ui/react-dialog/@radix-ui/react-focus-guards": ["@radix-ui/[email protected]", "", { "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-0rFg/Rj2Q62NCm62jZw0QX7a3sz6QCQU0LpZdNrJX8byRGaGVTqbrW9jAoIAHyMQqsNpeZ81YgSizOt5WXq0Pw=="],++ "template-code-generation/@radix-ui/react-dialog/@radix-ui/react-presence": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/react-compose-refs": "1.1.2", "@radix-ui/react-use-layout-effect": "1.1.1" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-/jfEwNDdQVBCNvjkGit4h6pMOzq8bHkopq458dPt2lMjx+eBQUohZNG9A7DtO/O5ukSbxuaNGXMjHicgwy6rQQ=="],++ "template-code-generation/@radix-ui/react-dialog/@radix-ui/react-primitive": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/react-slot": "1.2.3" }, "peerDependencies": { "@types/react": "19.0.0", "@types/react-dom": "19.0.0", "react": "19.0.0", "react-dom": "19.0.0" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-m9gTwRkhy2lvCPe6QJp4d3G1TYEUHn/FzJUtq9MjH46an1wJU+GdoGC5VLof8RX8Ft/DlpshApkhswDLZzHIcQ=="],++ "template-code-generation/@radix-ui/react-dialog/@radix-ui/react-use-controllable-state": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/react-use-effect-event": "0.0.2", "@radix-ui/react-use-layout-effect": "1.1.1" }, "peerDependencies": { "@types/react": "19.0.0", "react": "19.0.0" }, "optionalPeers": ["@types/react"] }, "sha512-BjasUjixPFdS+NKkypcyyN5Pmg83Olst0+c6vGov0diwTEo6mgdqVR6hxcEgFuh4QrAs7Rc+9KuGJ9TVCj0Zzg=="],+"template-code-generation/@radix-ui/react-select/@radix-ui/number": ["@radix-ui/[email protected]", "", {}, "sha512-MkKCwxlXTgz6CFoJx3pCwn07GKp36+aZyu/u2Ln2VrA5DcdyCZkASEDBTd8x5whTQQL5CiYf4prXKLcgQdv29g=="],"template-code-generation/@radix-ui/react-select/@radix-ui/primitive": ["@radix-ui/[email protected]", "", {}, "sha512-JTF99U/6XIjCBo0wqkU5sK10glYe27MRRsfwoiq5zzOEZLHU3A3KCMa5X/azekYRCJ0HlwI0crAXS/5dEHTzDg=="],@@ -12953,6 +13011,12 @@"shiki-twoslash/@typescript/twoslash/@typescript/vfs/debug": ["[email protected]", "", { "dependencies": { "ms": "2.1.3" } }, "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ=="],+ "template-code-generation/@radix-ui/react-dialog/@radix-ui/react-dismissable-layer/@radix-ui/react-use-callback-ref": ["@radix-ui/[email protected]", "", { "peerDependencies": { "@types/react": "19.0.0", "react": "19.0.0" }, "optionalPeers": ["@types/react"] }, "sha512-FkBMwD+qbGQeMu1cOHnuGB6x4yzPjho8ap5WtbEJ26umhgqVXbhekKUQO+hZEL1vU92a3wHwdp0HAcqAUF5iDg=="],++ "template-code-generation/@radix-ui/react-dialog/@radix-ui/react-presence/@radix-ui/react-use-layout-effect": ["@radix-ui/[email protected]", "", { "peerDependencies": { "@types/react": "19.0.0", "react": "19.0.0" }, "optionalPeers": ["@types/react"] }, "sha512-RbJRS4UWQFkzHTTwVymMTUv8EqYhOp8dOOviLj2ugtTiXRaRQS7GLGxZTLL1jWhMeoSCf5zmcZkqTl9IiYfXcQ=="],++ "template-code-generation/@radix-ui/react-dialog/@radix-ui/react-use-controllable-state/@radix-ui/react-use-layout-effect": ["@radix-ui/[email protected]", "", { "peerDependencies": { "@types/react": "19.0.0", "react": "19.0.0" }, "optionalPeers": ["@types/react"] }, "sha512-RbJRS4UWQFkzHTTwVymMTUv8EqYhOp8dOOviLj2ugtTiXRaRQS7GLGxZTLL1jWhMeoSCf5zmcZkqTl9IiYfXcQ=="],+"template-code-generation/@radix-ui/react-select/@radix-ui/react-popper/@radix-ui/react-arrow": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/react-primitive": "2.1.3" }, "peerDependencies": { "@types/react": "19.0.0", "@types/react-dom": "19.0.0", "react": "19.0.0", "react-dom": "19.0.0" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-F+M1tLhO+mlQaOWspE8Wstg+z6PwxwRd8oQ8IXceWz92kfAmalTRf0EjrouQeo7QssEPfCn05B4Ihs1K9WQ/7w=="],"template-code-generation/@radix-ui/react-select/@radix-ui/react-popper/@radix-ui/react-use-rect": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/rect": "1.1.1" }, "peerDependencies": { "@types/react": "19.0.0", "react": "19.0.0" }, "optionalPeers": ["@types/react"] }, "sha512-QTYuDesS0VtuHNNvMh+CjlKJ4LJickCMUAqjlE3+j8w+RlRpwyX3apEQKGFzbZGdo7XNG1tXa+bQqIE7HIXT2w=="],diff --git a/packages/template-code-generation/package.json b/packages/template-code-generation/package.jsonindex faa571b896..c1399c97cd 100644--- a/packages/template-code-generation/package.json+++ b/packages/template-code-generation/package.json@@ -15,7 +15,9 @@"@ai-sdk/react": "^2.0.104","@babel/standalone": "^7.28.5","@monaco-editor/react": "^4.7.0",+ "@radix-ui/react-dialog": "^1.1.15","@radix-ui/react-select": "^2.2.6",+ "@radix-ui/react-tooltip": "^1.2.8","@remotion/bundler": "workspace:*","@remotion/cli": "workspace:*","@remotion/google-fonts": "workspace:*",diff --git a/packages/template-code-generation/src/app/api/generate/route.ts b/packages/template-code-generation/src/app/api/generate/route.tsindex 0d56a76a36..784fd7ead0 100644--- a/packages/template-code-generation/src/app/api/generate/route.ts+++ b/packages/template-code-generation/src/app/api/generate/route.ts@@ -1,5 +1,5 @@import { streamText } from "ai";-import { openai } from "@ai-sdk/openai";+import { createOpenAI } from "@ai-sdk/openai";const SYSTEM_PROMPT = `You are an expert in generating React components for Remotion animations.@@ -93,15 +93,46 @@ return (`;export async function POST(req: Request) {- const { prompt, model = "gpt-4o" } = await req.json();-- const result = streamText({- model: openai(model),- system: SYSTEM_PROMPT,- prompt,- });-- console.log("Generating React component with prompt:", prompt, "model:", model);-- return result.toTextStreamResponse();+ const { prompt, model = "gpt-5-mini", apiKey } = await req.json();++ if (!apiKey) {+ return new Response(JSON.stringify({ error: "API key is required" }), {+ status: 400,+ headers: { "Content-Type": "application/json" },+ });+ }++ if (!apiKey.startsWith("sk-")) {+ return new Response(JSON.stringify({ error: "Invalid API key format" }), {+ status: 400,+ headers: { "Content-Type": "application/json" },+ });+ }++ const openai = createOpenAI({ apiKey });++ try {+ const result = streamText({+ model: openai(model),+ system: SYSTEM_PROMPT,+ prompt,+ });++ console.log(+ "Generating React component with prompt:",+ prompt,+ "model:",+ model,+ );++ return result.toTextStreamResponse();+ } catch (error) {+ console.error("Error generating code:", error);+ return new Response(+ JSON.stringify({+ error: "Failed to generate code. Please check your API key.",+ }),+ { status: 500, headers: { "Content-Type": "application/json" } },+ );+ }}diff --git a/packages/template-code-generation/src/app/layout.tsx b/packages/template-code-generation/src/app/layout.tsxindex e19d2dc5cb..d398a02ff0 100644--- a/packages/template-code-generation/src/app/layout.tsx+++ b/packages/template-code-generation/src/app/layout.tsx@@ -1,5 +1,6 @@import "../../styles/global.css";import { Metadata, Viewport } from "next";+import { ApiKeyProvider } from "@/context/ApiKeyContext";export const metadata: Metadata = {title: "Remotion and Next.js",@@ -19,7 +20,9 @@ export default function RootLayout({}) {return (<html lang="en">- <body className="bg-background">{children}</body>+ <body className="bg-background">+ <ApiKeyProvider>{children}</ApiKeyProvider>+ </body></html>);}diff --git a/packages/template-code-generation/src/app/page.tsx b/packages/template-code-generation/src/app/page.tsxindex f66b99c052..e634e566bb 100644--- a/packages/template-code-generation/src/app/page.tsx+++ b/packages/template-code-generation/src/app/page.tsx@@ -6,6 +6,7 @@ import { ExampleSelector } from "../components/ExampleSelector";import { CodeEditor } from "../components/CodeEditor";import { AnimationPlayer } from "../components/AnimationPlayer";import { PromptInput } from "../components/PromptInput";+import { SettingsModal } from "../components/SettingsModal";import { examples, RemotionExample } from "../templates";import { useAnimationState } from "../hooks/useAnimationState";@@ -101,39 +102,13 @@ const Home: NextPage = () => {<div className="text-xl font-bold text-white font-sans">Remotion Playground</div>- <div className="flex items-center gap-6">- <div className="flex items-center gap-2">- <span className="text-sm text-[#888] font-sans">- Duration (frames):- </span>- <input- type="number"- min={1}- max={1000}- value={durationInFrames}- onChange={(e) =>- setDurationInFrames(- Math.max(1, parseInt(e.target.value) || 1),- )- }- className="w-20 px-3 py-1.5 rounded border border-[#333] bg-[#1a1a1a] text-white text-sm font-sans"- />- </div>- <div className="flex items-center gap-2">- <span className="text-sm text-[#888] font-sans">FPS:</span>- <input- type="number"- min={1}- max={60}- value={fps}- onChange={(e) =>- setFps(- Math.max(1, Math.min(60, parseInt(e.target.value) || 30)),- )- }- className="w-20 px-3 py-1.5 rounded border border-[#333] bg-[#1a1a1a] text-white text-sm font-sans"- />- </div>+ <div className="flex items-center gap-2">+ <SettingsModal+ durationInFrames={durationInFrames}+ onDurationChange={setDurationInFrames}+ fps={fps}+ onFpsChange={setFps}+ /><buttonclassName="px-4 py-2 rounded border-none bg-indigo-500 text-white text-sm font-medium cursor-pointer font-sans transition-colors hover:bg-indigo-600"onClick={() => setIsEditorOpen(!isEditorOpen)}diff --git a/packages/template-code-generation/src/components/PromptInput.tsx b/packages/template-code-generation/src/components/PromptInput.tsxindex 1ad6dfd929..bd0968e2d1 100644--- a/packages/template-code-generation/src/components/PromptInput.tsx+++ b/packages/template-code-generation/src/components/PromptInput.tsx@@ -8,6 +8,13 @@ import {SelectTrigger,SelectValue,} from "@/components/ui/select";+import {+ Tooltip,+ TooltipContent,+ TooltipProvider,+ TooltipTrigger,+} from "@/components/ui/tooltip";+import { useApiKeyContext } from "@/context/ApiKeyContext";const MODELS = [{ id: "gpt-5-mini", name: "GPT-5 Mini" },@@ -24,13 +31,14 @@ interface PromptInputProps {}export function PromptInput({ onCodeGenerated, onStreamingChange }: PromptInputProps) {+ const { apiKey, hasApiKey, isLoaded } = useApiKeyContext();const [prompt, setPrompt] = useState("");const [model, setModel] = useState<ModelId>("gpt-5-mini");const [isLoading, setIsLoading] = useState(false);const handleSubmit = async (e: React.FormEvent) => {e.preventDefault();- if (!prompt.trim() || isLoading) return;+ if (!prompt.trim() || isLoading || !hasApiKey) return;setIsLoading(true);onStreamingChange?.(true);@@ -38,7 +46,7 @@ export function PromptInput({ onCodeGenerated, onStreamingChange }: PromptInputPconst response = await fetch("/api/generate", {method: "POST",headers: { "Content-Type": "application/json" },- body: JSON.stringify({ prompt, model }),+ body: JSON.stringify({ prompt, model, apiKey }),});if (!response.ok) {@@ -117,24 +125,37 @@ export function PromptInput({ onCodeGenerated, onStreamingChange }: PromptInputP))}</SelectContent></Select>- <button- type="submit"- disabled={isLoading || !prompt.trim()}- className="px-4 py-2 rounded border-none bg-indigo-500 text-white text-sm font-medium cursor-pointer font-sans transition-colors hover:bg-indigo-600 disabled:opacity-50 disabled:cursor-not-allowed flex flex-col items-center gap-1"- >- {isLoading ? (- "Generating..."- ) : (- <>- <span>Generate</span>- <span className="flex items-center gap-0.5 text-[10px] text-indigo-200/70">- <kbd className="px-0.5 bg-indigo-600/40 rounded font-mono">β</kbd>- <span>+</span>- <kbd className="px-0.5 bg-indigo-600/40 rounded font-mono">Enter</kbd>- </span>- </>- )}- </button>+ <TooltipProvider>+ <Tooltip>+ <TooltipTrigger asChild>+ <div className="w-full">+ <button+ type="submit"+ disabled={isLoading || !prompt.trim() || !hasApiKey}+ className="w-full px-4 py-2 rounded border-none bg-indigo-500 text-white text-sm font-medium cursor-pointer font-sans transition-colors hover:bg-indigo-600 disabled:opacity-50 disabled:cursor-not-allowed flex flex-col items-center gap-1"+ >+ {isLoading ? (+ "Generating..."+ ) : (+ <>+ <span>Generate</span>+ <span className="flex items-center gap-0.5 text-[10px] text-indigo-200/70">+ <kbd className="px-0.5 bg-indigo-600/40 rounded font-mono">β</kbd>+ <span>+</span>+ <kbd className="px-0.5 bg-indigo-600/40 rounded font-mono">Enter</kbd>+ </span>+ </>+ )}+ </button>+ </div>+ </TooltipTrigger>+ {!hasApiKey && isLoaded && (+ <TooltipContent>+ <p>Add your OpenAI API key in Settings to enable generation</p>+ </TooltipContent>+ )}+ </Tooltip>+ </TooltipProvider></div></form>);diff --git a/packages/template-code-generation/src/components/SettingsModal.tsx b/packages/template-code-generation/src/components/SettingsModal.tsxnew file mode 100644index 0000000000..6ae13b9c96--- /dev/null+++ b/packages/template-code-generation/src/components/SettingsModal.tsx@@ -0,0 +1,188 @@+"use client";++import { useState, useEffect } from "react";+import {+ Dialog,+ DialogContent,+ DialogDescription,+ DialogHeader,+ DialogTitle,+ DialogTrigger,+ DialogFooter,+} from "@/components/ui/dialog";+import { Settings, Eye, EyeOff, ExternalLink } from "lucide-react";+import { useApiKeyContext } from "@/context/ApiKeyContext";++interface SettingsModalProps {+ durationInFrames: number;+ onDurationChange: (duration: number) => void;+ fps: number;+ onFpsChange: (fps: number) => void;+}++export function SettingsModal({+ durationInFrames,+ onDurationChange,+ fps,+ onFpsChange,+}: SettingsModalProps) {+ const { apiKey, setApiKey, clearApiKey, hasApiKey } = useApiKeyContext();+ const [open, setOpen] = useState(false);+ const [inputValue, setInputValue] = useState("");+ const [showKey, setShowKey] = useState(false);++ // Sync input with stored key when modal opens+ useEffect(() => {+ if (open) {+ setInputValue(apiKey);+ setShowKey(false);+ }+ }, [open, apiKey]);++ const handleSave = () => {+ setApiKey(inputValue.trim());+ setOpen(false);+ };++ const handleClear = () => {+ clearApiKey();+ setInputValue("");+ };++ const isValidFormat = inputValue.startsWith("sk-") && inputValue.length > 20;++ return (+ <Dialog open={open} onOpenChange={setOpen}>+ <DialogTrigger asChild>+ <button+ className="px-3 py-2 rounded border-none bg-[#1a1a1a] text-white text-sm font-medium cursor-pointer font-sans transition-colors hover:bg-[#2a2a2a] flex items-center gap-2 border border-[#333]"+ aria-label="Settings"+ >+ <Settings className="w-4 h-4" />+ </button>+ </DialogTrigger>+ <DialogContent className="sm:max-w-[425px] bg-[#1a1a1a] border-[#333] text-white">+ <DialogHeader>+ <DialogTitle>Settings</DialogTitle>+ <DialogDescription className="text-[#888]">+ Configure your animation and API settings.+ </DialogDescription>+ </DialogHeader>+ <div className="grid gap-6 py-4">+ <div className="grid gap-4">+ <h3 className="text-sm font-medium text-white">Animation</h3>+ <div className="grid grid-cols-2 gap-4">+ <div className="grid gap-2">+ <label htmlFor="duration" className="text-[#888] text-sm">+ Duration (frames)+ </label>+ <input+ id="duration"+ type="number"+ min={1}+ max={1000}+ value={durationInFrames}+ onChange={(e) =>+ onDurationChange(Math.max(1, parseInt(e.target.value) || 1))+ }+ className="w-full px-3 py-2 rounded border border-[#333] bg-[#0f0f0f] text-white text-sm font-sans focus:outline-none focus:border-indigo-500"+ />+ </div>+ <div className="grid gap-2">+ <label htmlFor="fps" className="text-[#888] text-sm">+ FPS+ </label>+ <input+ id="fps"+ type="number"+ min={1}+ max={60}+ value={fps}+ onChange={(e) =>+ onFpsChange(+ Math.max(1, Math.min(60, parseInt(e.target.value) || 30))+ )+ }+ className="w-full px-3 py-2 rounded border border-[#333] bg-[#0f0f0f] text-white text-sm font-sans focus:outline-none focus:border-indigo-500"+ />+ </div>+ </div>+ <p className="text-xs text-[#666]">+ Video length: {(durationInFrames / fps).toFixed(2)}s ({durationInFrames} frames / {fps} FPS)+ </p>+ </div>++ <div className="grid gap-2">+ <h3 className="text-sm font-medium text-white">API</h3>+ <label htmlFor="api-key" className="text-[#888] text-sm">+ OpenAI API Key+ </label>+ <div className="relative">+ <input+ id="api-key"+ type={showKey ? "text" : "password"}+ value={inputValue}+ onChange={(e) => setInputValue(e.target.value)}+ placeholder="sk-..."+ className="w-full px-3 py-2 pr-10 rounded border border-[#333] bg-[#0f0f0f] text-white text-sm font-sans placeholder:text-[#666] focus:outline-none focus:border-indigo-500"+ />+ <button+ type="button"+ onClick={() => setShowKey(!showKey)}+ className="absolute right-2 top-1/2 -translate-y-1/2 text-[#888] hover:text-white bg-transparent border-none cursor-pointer"+ >+ {showKey ? (+ <EyeOff className="w-4 h-4" />+ ) : (+ <Eye className="w-4 h-4" />+ )}+ </button>+ </div>+ {inputValue && !isValidFormat && (+ <p className="text-sm text-red-400">+ API key should start with "sk-"+ </p>+ )}+ <p className="text-xs text-[#666]">+ Your API key is stored locally in your browser and only sent to OpenAI for generation requests.+ </p>+ <a+ href="https://platform.openai.com/api-keys"+ target="_blank"+ rel="noopener noreferrer"+ className="text-xs text-indigo-400 hover:text-indigo-300 flex items-center gap-1 w-fit"+ >+ Get your API key from OpenAI+ <ExternalLink className="w-3 h-3" />+ </a>+ </div>+ </div>+ <DialogFooter className="flex gap-2 sm:justify-between">+ {hasApiKey && (+ <button+ onClick={handleClear}+ className="px-4 py-2 rounded border-none bg-red-600 text-white text-sm font-medium cursor-pointer font-sans transition-colors hover:bg-red-700 mr-auto"+ >+ Clear Key+ </button>+ )}+ <div className="flex gap-2">+ <button+ onClick={() => setOpen(false)}+ className="px-4 py-2 rounded border border-[#333] bg-transparent text-white text-sm font-medium cursor-pointer font-sans transition-colors hover:bg-[#2a2a2a]"+ >+ Cancel+ </button>+ <button+ onClick={handleSave}+ disabled={!inputValue.trim() || !isValidFormat}+ className="px-4 py-2 rounded border-none bg-indigo-500 text-white text-sm font-medium cursor-pointer font-sans transition-colors hover:bg-indigo-600 disabled:opacity-50 disabled:cursor-not-allowed"+ >+ Save+ </button>+ </div>+ </DialogFooter>+ </DialogContent>+ </Dialog>+ );+}diff --git a/packages/template-code-generation/src/components/ui/dialog.tsx b/packages/template-code-generation/src/components/ui/dialog.tsxnew file mode 100644index 0000000000..d9ccec91d2--- /dev/null+++ b/packages/template-code-generation/src/components/ui/dialog.tsx@@ -0,0 +1,143 @@+"use client"++import * as React from "react"+import * as DialogPrimitive from "@radix-ui/react-dialog"+import { XIcon } from "lucide-react"++import { cn } from "@/lib/utils"++function Dialog({+ ...props+}: React.ComponentProps<typeof DialogPrimitive.Root>) {+ return <DialogPrimitive.Root data-slot="dialog" {...props} />+}++function DialogTrigger({+ ...props+}: React.ComponentProps<typeof DialogPrimitive.Trigger>) {+ return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />+}++function DialogPortal({+ ...props+}: React.ComponentProps<typeof DialogPrimitive.Portal>) {+ return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />+}++function DialogClose({+ ...props+}: React.ComponentProps<typeof DialogPrimitive.Close>) {+ return <DialogPrimitive.Close data-slot="dialog-close" {...props} />+}++function DialogOverlay({+ className,+ ...props+}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {+ return (+ <DialogPrimitive.Overlay+ data-slot="dialog-overlay"+ className={cn(+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",+ className+ )}+ {...props}+ />+ )+}++function DialogContent({+ className,+ children,+ showCloseButton = true,+ ...props+}: React.ComponentProps<typeof DialogPrimitive.Content> & {+ showCloseButton?: boolean+}) {+ return (+ <DialogPortal data-slot="dialog-portal">+ <DialogOverlay />+ <DialogPrimitive.Content+ data-slot="dialog-content"+ className={cn(+ "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",+ className+ )}+ {...props}+ >+ {children}+ {showCloseButton && (+ <DialogPrimitive.Close+ data-slot="dialog-close"+ className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"+ >+ <XIcon />+ <span className="sr-only">Close</span>+ </DialogPrimitive.Close>+ )}+ </DialogPrimitive.Content>+ </DialogPortal>+ )+}++function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {+ return (+ <div+ data-slot="dialog-header"+ className={cn("flex flex-col gap-2 text-center sm:text-left", className)}+ {...props}+ />+ )+}++function DialogFooter({ className, ...props }: React.ComponentProps<"div">) {+ return (+ <div+ data-slot="dialog-footer"+ className={cn(+ "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",+ className+ )}+ {...props}+ />+ )+}++function DialogTitle({+ className,+ ...props+}: React.ComponentProps<typeof DialogPrimitive.Title>) {+ return (+ <DialogPrimitive.Title+ data-slot="dialog-title"+ className={cn("text-lg leading-none font-semibold", className)}+ {...props}+ />+ )+}++function DialogDescription({+ className,+ ...props+}: React.ComponentProps<typeof DialogPrimitive.Description>) {+ return (+ <DialogPrimitive.Description+ data-slot="dialog-description"+ className={cn("text-muted-foreground text-sm", className)}+ {...props}+ />+ )+}++export {+ Dialog,+ DialogClose,+ DialogContent,+ DialogDescription,+ DialogFooter,+ DialogHeader,+ DialogOverlay,+ DialogPortal,+ DialogTitle,+ DialogTrigger,+}diff --git a/packages/template-code-generation/src/components/ui/tooltip.tsx b/packages/template-code-generation/src/components/ui/tooltip.tsxnew file mode 100644index 0000000000..a4e90d4e9a--- /dev/null+++ b/packages/template-code-generation/src/components/ui/tooltip.tsx@@ -0,0 +1,61 @@+"use client"++import * as React from "react"+import * as TooltipPrimitive from "@radix-ui/react-tooltip"++import { cn } from "@/lib/utils"++function TooltipProvider({+ delayDuration = 0,+ ...props+}: React.ComponentProps<typeof TooltipPrimitive.Provider>) {+ return (+ <TooltipPrimitive.Provider+ data-slot="tooltip-provider"+ delayDuration={delayDuration}+ {...props}+ />+ )+}++function Tooltip({+ ...props+}: React.ComponentProps<typeof TooltipPrimitive.Root>) {+ return (+ <TooltipProvider>+ <TooltipPrimitive.Root data-slot="tooltip" {...props} />+ </TooltipProvider>+ )+}++function TooltipTrigger({+ ...props+}: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {+ return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />+}++function TooltipContent({+ className,+ sideOffset = 0,+ children,+ ...props+}: React.ComponentProps<typeof TooltipPrimitive.Content>) {+ return (+ <TooltipPrimitive.Portal>+ <TooltipPrimitive.Content+ data-slot="tooltip-content"+ sideOffset={sideOffset}+ className={cn(+ "bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",+ className+ )}+ {...props}+ >+ {children}+ <TooltipPrimitive.Arrow className="bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" />+ </TooltipPrimitive.Content>+ </TooltipPrimitive.Portal>+ )+}++export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }diff --git a/packages/template-code-generation/src/context/ApiKeyContext.tsx b/packages/template-code-generation/src/context/ApiKeyContext.tsxnew file mode 100644index 0000000000..487acdeba9--- /dev/null+++ b/packages/template-code-generation/src/context/ApiKeyContext.tsx@@ -0,0 +1,32 @@+"use client";++import { createContext, useContext, ReactNode } from "react";+import { useApiKey } from "../hooks/useApiKey";++interface ApiKeyContextType {+ apiKey: string;+ setApiKey: (key: string) => void;+ clearApiKey: () => void;+ hasApiKey: boolean;+ isLoaded: boolean;+}++const ApiKeyContext = createContext<ApiKeyContextType | undefined>(undefined);++export function ApiKeyProvider({ children }: { children: ReactNode }) {+ const apiKeyState = useApiKey();++ return (+ <ApiKeyContext.Provider value={apiKeyState}>+ {children}+ </ApiKeyContext.Provider>+ );+}++export function useApiKeyContext() {+ const context = useContext(ApiKeyContext);+ if (context === undefined) {+ throw new Error("useApiKeyContext must be used within an ApiKeyProvider");+ }+ return context;+}diff --git a/packages/template-code-generation/src/hooks/useApiKey.ts b/packages/template-code-generation/src/hooks/useApiKey.tsnew file mode 100644index 0000000000..72d069d468--- /dev/null+++ b/packages/template-code-generation/src/hooks/useApiKey.ts@@ -0,0 +1,49 @@+"use client";++import { useState, useEffect, useCallback } from "react";++const STORAGE_KEY = "openai-api-key";++export function useApiKey() {+ const [apiKey, setApiKeyState] = useState<string>("");+ const [isLoaded, setIsLoaded] = useState(false);++ // Load from localStorage on mount (client-side only)+ useEffect(() => {+ if (typeof window !== "undefined") {+ const stored = localStorage.getItem(STORAGE_KEY);+ if (stored) {+ setApiKeyState(stored);+ }+ setIsLoaded(true);+ }+ }, []);++ // Save to localStorage and update state+ const setApiKey = useCallback((key: string) => {+ setApiKeyState(key);+ if (typeof window !== "undefined") {+ if (key) {+ localStorage.setItem(STORAGE_KEY, key);+ } else {+ localStorage.removeItem(STORAGE_KEY);+ }+ }+ }, []);++ // Clear API key+ const clearApiKey = useCallback(() => {+ setApiKeyState("");+ if (typeof window !== "undefined") {+ localStorage.removeItem(STORAGE_KEY);+ }+ }, []);++ return {+ apiKey,+ setApiKey,+ clearApiKey,+ isLoaded,+ hasApiKey: !!apiKey,+ };+}