From ac8198e5ba9c29b7ec15e7f612623e9aa8f343ef Mon Sep 17 00:00:00 2001 From: Abi Raja Date: Fri, 17 May 2024 12:30:26 -0400 Subject: [PATCH 1/6] Add field for Anthropic API key in settings --- frontend/src/components/SettingsDialog.tsx | 20 ++++++++++++++++++++ frontend/src/types.ts | 1 + 2 files changed, 21 insertions(+) diff --git a/frontend/src/components/SettingsDialog.tsx b/frontend/src/components/SettingsDialog.tsx index 2e7814b..1a9c5a6 100644 --- a/frontend/src/components/SettingsDialog.tsx +++ b/frontend/src/components/SettingsDialog.tsx @@ -108,6 +108,26 @@ function SettingsDialog({ settings, setSettings }: Props) { )} + + + + setSettings((s) => ({ + ...s, + anthropicApiKey: e.target.value, + })) + } + /> + Screenshot by URL Config diff --git a/frontend/src/types.ts b/frontend/src/types.ts index bbabeff..dbe10ad 100644 --- a/frontend/src/types.ts +++ b/frontend/src/types.ts @@ -16,6 +16,7 @@ export interface Settings { codeGenerationModel: CodeGenerationModel; // Only relevant for hosted version isTermOfServiceAccepted: boolean; + anthropicApiKey: string | null; // Added property for anthropic API key } export enum AppState { From 1f9c5b2c80a52c285323350581d4cd605bda3097 Mon Sep 17 00:00:00 2001 From: Abi Raja Date: Fri, 17 May 2024 14:47:54 -0400 Subject: [PATCH 2/6] set initial value --- frontend/src/App.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index fd1576e..c05c44f 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -59,6 +59,7 @@ function App() { { openAiApiKey: null, openAiBaseURL: null, + anthropicApiKey: null, screenshotOneApiKey: null, isImageGenerationEnabled: true, editorTheme: EditorTheme.COBALT, From 9d1fbc9b231197cd3c97f264d4f130062973433e Mon Sep 17 00:00:00 2001 From: Abi Raja Date: Thu, 30 May 2024 09:38:15 -0400 Subject: [PATCH 3/6] add zustand and create a dummy app store that isn't used yet --- frontend/package.json | 3 ++- frontend/src/App.tsx | 5 ++++- frontend/src/store/app-store.ts | 10 ++++++++++ frontend/yarn.lock | 12 ++++++++++++ 4 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 frontend/src/store/app-store.ts diff --git a/frontend/package.json b/frontend/package.json index 92bebfc..4652dc7 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -46,7 +46,8 @@ "tailwindcss-animate": "^1.0.7", "thememirror": "^2.0.1", "vite-plugin-checker": "^0.6.2", - "webm-duration-fix": "^1.0.4" + "webm-duration-fix": "^1.0.4", + "zustand": "^4.5.2" }, "devDependencies": { "@types/jest": "^29.5.12", diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index ce68c53..1cb02e1 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -378,7 +378,10 @@ function App() { /> )}
-
+

Screenshot to Code

diff --git a/frontend/src/store/app-store.ts b/frontend/src/store/app-store.ts new file mode 100644 index 0000000..7298c72 --- /dev/null +++ b/frontend/src/store/app-store.ts @@ -0,0 +1,10 @@ +import { create } from "zustand"; + +// Store for app-wide state +interface AppStore { + inputMode: "image" | "video"; +} + +export const useStore = create(() => ({ + inputMode: "image", +})); diff --git a/frontend/yarn.lock b/frontend/yarn.lock index 7285b73..e1254e8 100644 --- a/frontend/yarn.lock +++ b/frontend/yarn.lock @@ -5642,6 +5642,11 @@ use-sidecar@^1.1.2: detect-node-es "^1.1.0" tslib "^2.0.0" +use-sync-external-store@1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz#7dbefd6ef3fe4e767a0cf5d7287aacfb5846928a" + integrity sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA== + util-deprecate@^1.0.2: version "1.0.2" resolved "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz" @@ -5937,3 +5942,10 @@ zod@3.22.4: version "3.22.4" resolved "https://registry.yarnpkg.com/zod/-/zod-3.22.4.tgz#f31c3a9386f61b1f228af56faa9255e845cf3fff" integrity sha512-iC+8Io04lddc+mVqQ9AZ7OQ2MrUKGN+oIQyq1vemgt46jwCwLfhq7/pwnBnNXXXZb8VTVLKwp9EDkx+ryxIWmg== + +zustand@^4.5.2: + version "4.5.2" + resolved "https://registry.yarnpkg.com/zustand/-/zustand-4.5.2.tgz#fddbe7cac1e71d45413b3682cdb47b48034c3848" + integrity sha512-2cN1tPkDVkwCy5ickKrI7vijSjPksFRfqS6237NzT0vqSsztTNnQdHw9mmN7uBdk3gceVXU0a+21jFzFzAc9+g== + dependencies: + use-sync-external-store "1.2.0" From 8e579e425ee0bb12baf19186b71ee8a7b840d266 Mon Sep 17 00:00:00 2001 From: Abi Raja Date: Fri, 31 May 2024 13:51:43 -0400 Subject: [PATCH 4/6] clean up settings dialog look --- frontend/src/components/SettingsDialog.tsx | 84 +++++++++++----------- 1 file changed, 44 insertions(+), 40 deletions(-) diff --git a/frontend/src/components/SettingsDialog.tsx b/frontend/src/components/SettingsDialog.tsx index 1a9c5a6..97d8f38 100644 --- a/frontend/src/components/SettingsDialog.tsx +++ b/frontend/src/components/SettingsDialog.tsx @@ -49,7 +49,7 @@ function SettingsDialog({ settings, setSettings }: Props) {