Commit Graph

433 Commits

Author SHA1 Message Date
Abi Raja
9494f4c1cc fix reset function to reset all state correctly 2023-12-14 08:27:16 -05:00
Abi Raja
ff3ca97241 track history clicks 2023-12-14 06:57:41 -05:00
Abi Raja
d9cb13b1c2 Merge branch 'main' into hosted 2023-12-14 06:53:03 -05:00
Abi Raja
d23cec9bc0 add a front-end for scoring eval results 2023-12-13 16:38:26 -05:00
Abi Raja
a615f25fd7 improve history UX 2023-12-13 12:20:44 -05:00
Abi Raja
08cd5384be remove email submissions now that we have sign in 2023-12-12 12:18:36 -05:00
Abi Raja
d3ec75873c make user log in before they can use the app 2023-12-12 11:34:50 -05:00
Abi Raja
b88320177e Pre-process history for history display so we can write unit tests for it 2023-12-11 21:47:07 -05:00
Abi Raja
0d74d43eb6 fix bug 2023-12-11 19:05:59 -05:00
Abi Raja
1cdfd7d1ac Merge branch 'main' into hosted 2023-12-11 18:56:29 -05:00
Abi Raja
9f064c57a7 after code generation cancellation, leave the app in a good state (revert to last version or reset app if no last version) 2023-12-11 18:56:20 -05:00
Abi Raja
89c716f759 update to include new settings 2023-12-11 18:22:36 -05:00
Abi Raja
7edea28eab Merge branch 'main' into pr/170 2023-12-11 18:22:22 -05:00
Abi Raja
59e8974ebc Improve credit purchase UX 2023-12-11 16:38:48 -05:00
Abi Raja
64789d1c29 use addEvent everywhere 2023-12-10 17:58:41 -05:00
Abi Raja
adbc459347 use addEvent instead of window.plausible 2023-12-10 16:32:26 -05:00
Abi Raja
9ccc47920a Merge branch 'main' into hosted 2023-12-10 16:23:41 -05:00
Abi Raja
e8e3d4cb6f make user set the stack when importing code 2023-12-10 10:22:05 -05:00
Abi Raja
52fee9e49b initial implementation of importing from code 2023-12-09 21:00:18 -05:00
Abi Raja
70a67c0ea7 track HistoryTreeFailed 2023-12-08 16:49:50 -05:00
Abi Raja
7155a0616e Merge branch 'main' into hosted 2023-12-08 16:48:47 -05:00
Abi Raja
68a8d2788d improve tests and catch history tree generation errors better 2023-12-08 16:48:34 -05:00
Abi Raja
0ea6f091e8 add plausible tracking for errors 2023-12-08 16:29:15 -05:00
Alex Lloyd
c0e68db40f remove WIP GeneratedCodeConfig 2023-12-07 18:25:05 -06:00
Alex Lloyd
4abee41e15 Remove redundant comment 2023-12-07 18:18:39 -06:00
Alex Lloyd
edfafa2c48 Fix parameter type for generateCode 2023-12-07 18:16:31 -06:00
Abi Raja
b8a94e7efb add plausible tracking for edits 2023-12-07 16:29:21 -05:00
Abi Raja
7975e0a6f7 add plausible tracking for copy code 2023-12-07 16:28:22 -05:00
Abi Raja
5a114866f2 Merge branch 'main' into hosted 2023-12-07 13:36:28 -05:00
Abi Raja
3bd2321b83 nit: comment fix 2023-12-07 13:34:23 -05:00
Abi Raja
8675d28e96 fix typescript and show badge of type of edit 2023-12-07 13:25:31 -05:00
Abi Raja
b3b478d6d1 add hover card to show full prompt 2023-12-07 13:21:10 -05:00
Abi Raja
2dbf5a3c3f move purchase link to right 2023-12-07 11:58:11 -05:00
Abi Raja
1fb390e48c Merge branch 'main' into hosted 2023-12-07 11:52:37 -05:00
Abi Raja
2f53540e2d fix bug 2023-12-07 11:41:28 -05:00
Abi Raja
b45e9dea29 clean up 2023-12-07 11:29:05 -05:00
Abi Raja
a559cd3120 update to extract history tree with parent indices 2023-12-07 10:09:35 -05:00
Abi Raja
52adb4602b move files 2023-12-07 09:39:19 -05:00
Abi Raja
2457a3f5bd update name 2023-12-07 09:38:42 -05:00
Abi Raja
dd0f3b7648 fix errors 2023-12-07 09:36:37 -05:00
Abi Raja
874afc1e66 fix bug and show prompt 2023-12-07 09:22:22 -05:00
Abi Raja
0e8eef4554 add parent for each item in history 2023-12-06 22:36:31 -05:00
Abi Raja
f5ddb779b4 make history forward chronology and have non-changing indices to refer to items 2023-12-06 22:24:25 -05:00
Abi Raja
eff532bcf5 update test data 2023-12-06 21:58:06 -05:00
Abi Raja
97d651343a add some tests for history utils 2023-12-06 21:57:25 -05:00
Abi Raja
79e36c9529 move files around 2023-12-06 19:07:22 -05:00
Abi Raja
a5e7dcd037 correctly extract history for an update 2023-12-06 17:15:08 -05:00
Abi Raja
286549f101 track current version 2023-12-06 16:02:52 -05:00
Abi Raja
c1d6236391 minor fix 2023-12-06 15:45:14 -05:00
Abi Raja
8008513a6c handle coding state correctly 2023-12-06 15:42:33 -05:00
Abi Raja
3d16d784c2 improve look of history display 2023-12-06 15:37:59 -05:00
Abi Raja
75198cf638 allow viewing older versions 2023-12-06 15:32:40 -05:00
Abi Raja
8a48c6d898 add TODO 2023-12-06 15:16:58 -05:00
Abi Raja
f216146bbd initial history implementation 2023-12-06 14:49:09 -05:00
Abi Raja
c5e0a536ce update openai status 2023-12-06 13:36:23 -05:00
Abi Raja
0e51e59554 update status 2023-12-06 12:04:30 -05:00
Abi Raja
d72912f11c Merge branch 'main' into hosted 2023-12-06 12:04:20 -05:00
Abi Raja
328b75c949 update status 2023-12-06 12:04:12 -05:00
Abi Raja
91934ecae9 add note about OpenAI API 2023-12-06 12:03:44 -05:00
Abi Raja
67e1d2b3d3 Merge branch 'main' into hosted 2023-12-06 10:10:02 -05:00
Abi Raja
c275e945fc show credit usage to the user 2023-12-06 10:09:09 -05:00
Abi Raja
2ba2a79e2f move AccessCodeSection to a separate component 2023-12-06 09:16:21 -05:00
Abi Raja
afb1b3b036 track email conversion rates with plausible 2023-12-05 11:42:59 -05:00
Abi Raja
0f7425eb3b Merge branch 'main' into hosted 2023-12-05 11:36:28 -05:00
Abi Raja
30e6b07bb1 add list of logos 2023-12-05 11:36:17 -05:00
Abi Raja
b8b5e933bd Merge branch 'main' into hosted 2023-12-03 19:59:25 -05:00
Abi Raja
23aa6ebc63 tweak 2023-12-03 19:52:53 -05:00
Abi Raja
1081c100aa update price copy 2023-12-03 12:53:22 -05:00
Pranshu Gupta
3c90e16d3d
Update UrlInputSection.tsx 2023-12-03 13:06:59 +05:30
Abi Raja
e031662b13 tweak price 2023-12-02 09:39:08 -05:00
Abi Raja
4b77361494 test another price 2023-11-30 23:29:09 -05:00
Abi Raja
0d9f93ea1f add plausible tracking for OutputSettings 2023-11-30 18:10:38 -05:00
Abi Raja
b7d808b227 Merge branch 'main' into hosted 2023-11-30 17:46:13 -05:00
Abi Raja
f51e70d701 redo how output settings is configured 2023-11-30 15:58:01 -05:00
Abi Raja
45a64326f6 Merge branch 'main' into pr/122 2023-11-30 13:56:38 -05:00
Abi Raja
0fd6d74138 add note for "Code Editor" theme 2023-11-30 12:42:31 -05:00
Abi Raja
0c532e528c don't show OpenAI Base URL setting on hosted version 2023-11-30 11:39:30 -05:00
Abi Raja
d9264a254a improve copy 2023-11-30 11:37:54 -05:00
Abi Raja
339f07373a Merge branch 'main' into pr/62 2023-11-30 11:36:39 -05:00
Abi Raja
b98bcb6e09 make settings modal not too big 2023-11-30 08:59:51 -05:00
Abi Raja
514688a1c0 Merge branch 'main' of https://github.com/kachbit/screenshot-to-code into pr/115 2023-11-30 08:35:46 -05:00
Abi Raja
ea10e191bb Merge branch 'main' into pr/115 2023-11-30 08:35:25 -05:00
Abi Raja
0979fd5f2b update onboarding note and pricing 2023-11-29 20:56:48 -05:00
kacher
f4ecafad02
Merge branch 'main' into main 2023-11-29 17:46:01 -07:00
Abi Raja
bc036f04e7 update price 2023-11-29 17:24:51 -05:00
Abi Raja
a6be4379e5 Merge branch 'main' into hosted 2023-11-29 16:43:44 -05:00
Abi Raja
5c3fc7df39 add email support when access code is set 2023-11-29 16:43:36 -05:00
Abi Raja
0143223290 Merge branch 'main' into hosted 2023-11-29 14:45:29 -05:00
Abi Raja
562eee8a32 don't show onboarding note when access code is set 2023-11-29 14:45:20 -05:00
Abi Raja
9b87034846 Merge branch 'main' into hosted 2023-11-29 14:37:49 -05:00
Abi Raja
af2fa8d8ab update onboarding note 2023-11-29 14:37:32 -05:00
Abi Raja
228e59a46e update checkout link 2023-11-29 14:33:51 -05:00
Abi Raja
46fdd36f11 Merge branch 'main' into hosted 2023-11-29 14:30:29 -05:00
Abi Raja
78a10c9571 add an accessCode for the hosted version 2023-11-29 11:16:57 -05:00
Abi Raja
058aee85f2 track Downloads 2023-11-29 05:35:22 -05:00
Abi Raja
8d3643a2c3 Merge branch 'main' into hosted 2023-11-29 04:50:29 -05:00
Abi Raja
56e6f1f608 show output settings at all times 2023-11-29 04:48:55 -05:00
Abi Raja
2ad9780e80 minor visual improvements 2023-11-29 04:43:07 -05:00
Abi Raja
58298a15e7 rename vanilla to "no framework" 2023-11-29 04:38:04 -05:00
Abi Raja
e2c1bd2537 improve UI for code output selection 2023-11-29 04:34:01 -05:00
Abi Raja
a839e4a239 add a better display string for output settings 2023-11-29 04:13:22 -05:00
dialmedu
7e504ebbdd add select UI Component and check options 2023-11-29 00:09:23 -05:00
kacher
ffbc89f945
Merge branch 'main' into main 2023-11-28 19:40:59 -07:00
Abi Raja
0222cd06a0 update z-index for code link 2023-11-28 21:29:39 -05:00
Abi Raja
b3139f9f54 Merge branch 'main' into hosted 2023-11-28 21:26:13 -05:00
Abi Raja
89db70daca show sidebar on mobile and set proper z index 2023-11-28 21:22:59 -05:00
kacher
7c3f06bdd2 remove invalid code 2023-11-29 02:19:53 +00:00
Abi Raja
dfdef74b21 add back payment link 2023-11-28 20:58:03 -05:00
kachbit
14dbca8c07 fix conflict 2023-11-28 17:53:50 -08:00
kacher
7a3b36621b
Merge branch 'main' into main 2023-11-28 18:48:17 -07:00
Abi Raja
439fb89645 track framework usage 2023-11-28 20:44:51 -05:00
Abi Raja
7a7be7460f hide payment link 2023-11-28 20:38:45 -05:00
Abi Raja
7eb88b2cec Merge branch 'main' into hosted 2023-11-28 20:37:52 -05:00
Abi Raja
a3b8a78a8d enable output settings on hosted version 2023-11-28 20:37:05 -05:00
Abi Raja
e84ac95603 track Codepen event 2023-11-28 18:13:22 -05:00
Abi Raja
7190bb461f Merge branch 'main' into hosted 2023-11-28 17:48:11 -05:00
Abi Raja
5a91292dcd update copy 2023-11-28 17:48:02 -05:00
Abi Raja
2dddc479b2 add business plan Stripe payment link 2023-11-28 17:25:31 -05:00
Abi Raja
541e662ae0 disable output settings changes on the hosted version for now 2023-11-28 15:20:35 -05:00
Abi Raja
dfe8ae4164 add support for React 2023-11-28 14:05:59 -05:00
Abi Raja
df313f056a add accordion to hide output settings 2023-11-28 12:14:37 -05:00
Abi Raja
f8772a0515 format CodeMirror 2023-11-28 09:49:57 -05:00
Abi Raja
c3f6f763b4 capitalize editor theme display 2023-11-28 09:49:30 -05:00
Abi Raja
397fa0630f add support for outputs in bootstrap 2023-11-28 09:47:57 -05:00
kacher
f33176030d
remove unnecessary css 2023-11-27 21:49:15 -08:00
kachbit
657ffec62e Add 'toggle dark mode' option to settings dialog 2023-11-27 21:42:07 -08:00
kachbit
cb7f70000e configure dark mode styles for toaster popups 2023-11-27 21:40:36 -08:00
kachbit
521d9c584f configure dark mode styles for editor theme dropdown 2023-11-27 21:39:09 -08:00
kachbit
549d87942b configure dark mode styles 2023-11-27 21:29:02 -08:00
Abi Raja
032d9943a8 add feedback link for hosted version 2023-11-27 17:42:21 -05:00
Abi Raja
2e6d4cd01a improve styles of drag and drop upload 2023-11-27 17:16:52 -05:00
Abi Raja
ce7a187e40 Merge branch 'pr/99' 2023-11-26 22:30:36 -05:00
Abi Raja
2eb98587b2 split code tab into separate component and clean up code 2023-11-26 22:30:11 -05:00
Abi Raja
10322253f3 update code style 2023-11-26 22:13:14 -05:00
Abi Raja
b7b219b697 fix typo 2023-11-26 22:09:21 -05:00
Abi Raja
fb4dc08b4e update onboarding note 2023-11-26 21:59:44 -05:00
Abi Raja
e5ca11daef update copy on Settings Dialog for screenshotting a URL 2023-11-26 18:51:18 -05:00
Abi Raja
f9a30be761 update copy on URL input section 2023-11-26 18:49:33 -05:00
Abi Raja
0d542e18cc Reset any existing state before running create 2023-11-26 15:35:22 -05:00
Abi Raja
e8f4bf1dea style fix 2023-11-26 15:31:59 -05:00
Abi Raja
0449fec242
Merge pull request #94 from dialmedu/fix/paste-from-clipboard
small fix, check that dataUrls are valid
2023-11-26 15:31:13 -05:00
Abi Raja
a178e316c4 make drag and drop area more obvious 2023-11-26 15:30:03 -05:00
Abi Raja
7ef6a0b205 collect emails on hosted version 2023-11-26 14:54:02 -05:00
dialmedu
101dcc4bb5 add support open in codepen.io 2023-11-25 00:52:24 -05:00
dialmedu
d177ad30c8 small fix, check that dataUrls are valid, when there is only text on the clipboard 2023-11-24 01:57:29 -05:00
Abi Raja
b9522fede2 update error message 2023-11-23 22:21:05 -05:00
Abi Raja
4d3c16defb improve names 2023-11-23 11:20:30 -05:00
Abi Raja
c3e972eb11 rename resultImg -> resultImage 2023-11-23 11:04:23 -05:00
Abi Raja
56b9e8bf50 clean up 2023-11-23 11:02:22 -05:00
clean99
219b241a67
Merge branch 'main' into feat/add-image-comparison 2023-11-22 12:04:45 +08:00
Abi Raja
55be6a1595 update variable name 2023-11-21 22:17:36 -05:00
Abi Raja
41b8f91cbc Merge branch 'main' into pr/65 2023-11-21 22:13:54 -05:00
Abi Raja
60d903c001 Merge branch 'main' into pr/58 2023-11-21 22:01:23 -05:00
vagusx
8199f14273 chore: clean up 2023-11-22 10:42:01 +08:00
vagusX
4ca8124052
Merge branch 'main' into feat/save-term-accpeted-in-cache 2023-11-22 10:37:20 +08:00
clean99
cc22292941
Merge branch 'main' into feat/add-image-comparison 2023-11-22 10:14:22 +08:00
Abi Raja
f66631425d show reset button when code generation fails 2023-11-21 11:08:51 -05:00
Abi Raja
e983d2b727 Merge branch 'main' into pr/63 2023-11-21 11:05:29 -05:00
Abi Raja
d741df41f6 move constant to constants file 2023-11-21 11:04:51 -05:00
Abi Raja
193e070b0a update type name 2023-11-21 11:00:48 -05:00
Abi Raja
2303ed6d05 add success toast after copying code 2023-11-21 10:56:17 -05:00
clean99
46555e902f fix: code style 2023-11-21 21:24:20 +08:00
clean99
cb1e7a39b9 feat: add switch and screenshot feature in fe 2023-11-21 21:16:26 +08:00
clean99
bc73613fb1 feat: update interface and fix close bug 2023-11-21 21:15:16 +08:00
vagusx
9b9db3ac07 feat: use usePersistedState 2023-11-21 20:25:19 +08:00
vagusx
3bc2568052 feat: Add local storage functionality to track acceptance of terms of service 2023-11-21 16:55:46 +08:00
vagusx
e895dd4668 feat: add copy code button 2023-11-21 16:44:05 +08:00
clean99
2a52095ce9 feat: add client close button 2023-11-21 16:18:32 +08:00
Nothing1024
e69269d844 Feat: OpenAI Base URL supported 2023-11-21 16:05:23 +08:00
clean99
2f1745a0b5 feat: refactor app status type 2023-11-21 15:54:01 +08:00
clean99
d9a4abcbf1 feat: use memo to reduce editor state update 2023-11-21 11:40:20 +08:00
clean99
f5804ad443 fix: remove console 2023-11-21 11:35:42 +08:00
clean99
d10c793a60 fix: cursor didnt focus on right position 2023-11-21 11:33:33 +08:00
clean99
30ab9e384a feat: support edit code 2023-11-21 09:40:00 +08:00
clean99
9dfdc8683d fix: prevent flashing when updating code 2023-11-21 09:23:07 +08:00
Abi Raja
5b1303dc20 add TermsOfServiceDialog for hosted version 2023-11-20 12:38:40 -05:00
Abi Raja
72645512fe update copy re: key storage 2023-11-20 12:07:40 -05:00
Abi Raja
55060b866e Merge branch 'main' into pr/43 2023-11-20 12:05:28 -05:00
Abi Raja
e7c05d7d23 fix screenshotone links 2023-11-20 11:54:31 -05:00
Abi Raja
103d1ce12c centralize config in config.ts 2023-11-20 11:50:06 -05:00
Abi Raja
bf23d3198a support screenshotting a URL with ScreenshotOne 2023-11-20 11:48:33 -05:00
clean99
7fca553823 feat: replace setting state using persisted hook 2023-11-20 12:40:04 +08:00
clean99
5d1e0a3599 feat: add use persisted state hook 2023-11-20 12:39:58 +08:00
Abi Raja
28a05153e9 Merge branch 'main' into pr/7 2023-11-19 21:46:27 -05:00
Abi Raja
87bbe4987a Merge branch 'main' into pr/7 2023-11-19 21:44:25 -05:00
Abi Raja
63add37505 update more values to 7001 2023-11-19 21:41:38 -05:00
Abi Raja
7d4389526c
Merge pull request #36 from kachbit/main
Update codemirror theme to match overall style/color scheme of the page
2023-11-19 21:14:00 -05:00
kacher
d865980123
Update App.tsx 2023-11-19 18:01:17 -08:00
kacher
fa9124381c
minor fixes 2023-11-19 15:17:36 -08:00
kachbit
40c00fc12b added select component 2023-11-19 15:07:32 -08:00
kachbit
6f5c0cb063 editor theme selector 2023-11-19 14:30:10 -08:00
Ikko Eltociear Ashimine
fad46574fd
Update ImageUpload.tsx
seperate -> separate
2023-11-20 00:57:27 +09:00
kachbit
168d4b035b updated codemirror theme 2023-11-18 23:19:34 -08:00
Abi Raja
54bdcfdcfa Merge branch 'main' into pr/19 2023-11-18 15:38:44 -05:00
Abi Raja
6651b884bb minor fixes 2023-11-18 15:38:34 -05:00
Abi Raja
8ed1f61731 improve hosted version experience but disable these elements when running locally 2023-11-18 11:23:56 -05:00
Jirawat Boonkumnerd
3d2978f5d2
feat: add paste from clipboard
- add paste image from clipboard (ctrl+v)
- validate if the file is an image
2023-11-18 06:49:03 +07:00
Abi Raja
ee9b40d990 support setting openai api key on the client side 2023-11-16 18:12:07 -05:00
Abi Raja
e27c278a79 update copy for Placeholder Image Generation setting 2023-11-16 17:41:24 -05:00
Abi Raja
371dddda3f add a settings dialog to allow you to disable the image generation 2023-11-16 17:37:03 -05:00
Abi Raja
67f710521d support desktop and mobile preview 2023-11-16 11:56:54 -05:00
Koen Zweerts
907e85493f
Use performance.now instead of Date.now 2023-11-16 11:11:48 +01:00
Abi Raja
7d6fde2dea make it easy to view code in the app 2023-11-15 20:12:30 -05:00
Abi Raja
e74442c3cb move buttons to the top and reference image below 2023-11-15 19:54:30 -05:00
Abi Raja
6b1c5aecef fix bad gitignore and missing file 2023-11-15 19:42:47 -05:00
Abi Raja
a126c37ed3 improve sidebar visual style 2023-11-15 16:32:57 -05:00
Abi Raja
387da27f51 add back scanning animation 2023-11-15 15:52:03 -05:00
Abi Raja
9254a4344c fix minor bug 2023-11-15 15:22:58 -05:00
Abi Raja
f1b61a4ce4 update buttons to use shadcn 2023-11-15 15:22:46 -05:00
Abi Raja
db56dbd3e6 support updating the initially generated version 2023-11-15 15:08:59 -05:00
Abi Raja
6f3c668c2f add shadcn and some components 2023-11-15 13:11:41 -05:00
Abi Raja
903385e501 add default backend URL as fallback if the user hasn't set up the env file 2023-11-15 11:33:41 -05:00
Abi Raja
4ad7382d3b add icons for buttons 2023-11-15 11:27:25 -05:00
Abi Raja
99508d8e03 throttle the iframe preview so that it doesn't stop updating at the end of code generation due to too many updates 2023-11-15 09:51:34 -05:00
Abi Raja
c4b99c125e make layout better 2023-11-14 23:33:06 -05:00
Abi Raja
51c7334c0e add image generation for placeholder images 2023-11-14 23:05:41 -05:00
Abi Raja
3f071e7a68 make preview look better 2023-11-14 18:54:05 -05:00
Abi Raja
20bb905983 improve button look 2023-11-14 18:47:10 -05:00
Abi Raja
e013f63829 add scanning animation 2023-11-14 18:42:35 -05:00
Abi Raja
95ea486112 improve UI style 2023-11-14 18:21:57 -05:00
Abi Raja
8be1b42fb4 add a console to show progress 2023-11-14 17:43:51 -05:00
Abi Raja
126972bee0 move download button to main App 2023-11-14 17:18:04 -05:00
Abi Raja
c0d1c23145 add a download code button 2023-11-14 15:55:51 -05:00
Abi Raja
fdecb93ea6 aider: Add a button to download the code as index.html in frontend/src/components/Preview.tsx.
# Aider chat conversation:

USER: add previ

ASSISTANT:
^C KeyboardInterrupt

USER: add `frontend/src/components/Preview.tsx`

ASSISTANT: Sure, I can help with that. Could you please provide more details about the changes you want to make in `frontend/src/components/Preview.tsx`?

USER: add a button to download the code as index.html

ASSISTANT: To add a download button, we need to modify the `frontend/src/components/Preview.tsx` file. We will add a new button that, when clicked, will trigger a download of the generated code as an `index.html` file.

Here is the step-by-step plan:

1. Import the `useState` hook from React.
2. Create a new state variable `blobUrl` and a function `createBlobUrl` to update it.
3. In the `createBlobUrl` function, create a new Blob from the `code` prop, create a URL for the Blob, and set `blobUrl` to this URL.
4. Add a new button that triggers the `createBlobUrl` function when clicked.
5. Set the `href` attribute of the button to `blobUrl` and the `download` attribute to `index.html`.

Here is the *edit block* for these changes:

```jsx
frontend/src/components/Preview.tsx
<<<<<<< HEAD
interface Props {
  code: string;
}

function Preview({ code }: Props) {
  return (
    <div className="w-[704px]">
      <iframe
        title="Iframe Example"
        srcDoc={code}
        className="border-[5px] border-black rounded-[33px] p-4 shadow-lg
        transform scale-[0.8] origin-top-left w-[1280px] h-[832px]"
      ></iframe>
    </div>
  );
}
export default Preview;
=======
import { useState } from 'react';

interface Props {
  code: string;
}

function Preview({ code }: Props) {
  const [blobUrl, setBlobUrl] = useState('');

  const createBlobUrl = () => {
    const blob = new Blob([code], { type: 'text/html' });
    const url = URL.createObjectURL(blob);
    setBlobUrl(url);
  };

  return (
    <div className="w-[704px]">
      <iframe
        title="Iframe Example"
        srcDoc={code}
        className="border-[5px] border-black rounded-[33px] p-4 shadow-lg
        transform scale-[0.8] origin-top-left w-[1280px] h-[832px]"
      ></iframe>
      <button onClick={createBlobUrl} href={blobUrl} download="index.html">
        Download code
      </button>
    </div>
  );
}
export default Preview;
>>>>>>> updated
```
2023-11-14 15:48:18 -05:00
Abi Raja
593eb5ba63 fix toasts, error capture and get end to end working 2023-11-14 15:41:04 -05:00
Abi Raja
3f4cf2895e better UX for different app states 2023-11-14 15:31:24 -05:00
Abi Raja
444c16abe6 show generated code in preview 2023-11-14 14:49:05 -05:00
Abi Raja
209929d6b3 minor refactor and typescript checker 2023-11-14 14:47:03 -05:00
Abi Raja
ce763782c4 add backend with openai calling 2023-11-14 14:40:17 -05:00
Abi Raja
53c6b13887 support to the backend via websockets and display progress to user 2023-11-14 13:50:42 -05:00
Abi Raja
169dd0a337 add a desktop preview 2023-11-14 13:36:34 -05:00
Abi Raja
5a8d7d9071 add a CodePreview element 2023-11-14 13:33:06 -05:00
Abi Raja
2bf4b62082 add a basic UI 2023-11-14 13:10:41 -05:00