Commit Graph

63 Commits

Author SHA1 Message Date
Abi Raja
ebedef2bef
Update README.md 2023-11-16 12:26:29 -05:00
Abi Raja
d194552430
Update README.md 2023-11-16 12:21:16 -05:00
Abi Raja
67f710521d support desktop and mobile preview 2023-11-16 11:56:54 -05:00
Abi Raja
e11b9c929b
Add FAQ section to README 2023-11-16 11:33:11 -05:00
Abi Raja
0dcefb34fb remove readme in pyproject.toml 2023-11-16 10:51:46 -05:00
Abi Raja
a776ce53cb
Merge pull request #4 from zweertsk/tweak/use-performance-now
Use performance.now instead of Date.now
2023-11-16 08:16:24 -05:00
Abi Raja
4a61f9ea05
Update README to add info about poetry 2023-11-16 08:12:06 -05:00
Abi Raja
4711ac2ab8
Update README.md 2023-11-16 07:54:28 -05:00
Abi Raja
1348ab9813
Add another example 2023-11-16 07:54:02 -05:00
Abi Raja
e0c945e69b
Update README.md 2023-11-16 07:52:32 -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
c061c9b610 improve image cache so we don't re-generate the same images on update 2023-11-15 17:31:01 -05:00
Abi Raja
62c5458e08 add radix-ui dep 2023-11-15 16:34:05 -05:00
Abi Raja
a126c37ed3 improve sidebar visual style 2023-11-15 16:32:57 -05:00
Abi Raja
7ed13c5fd4 only need to generate images that use placeholders from https://placehold.co 2023-11-15 16:19:06 -05:00
Abi Raja
498fe2075e Merge branch 'main' of https://github.com/abi/screenshot-to-code 2023-11-15 15:52:05 -05:00
Abi Raja
387da27f51 add back scanning animation 2023-11-15 15:52:03 -05:00
Abi Raja
ade0cc14f0
Update README.md 2023-11-15 15:30:01 -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
07eba3ba4a
Update README.md 2023-11-15 11:48:20 -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
1420bb8586
Update README.md 2023-11-15 11:29:53 -05:00
Abi Raja
4ad7382d3b add icons for buttons 2023-11-15 11:27:25 -05:00
Abi Raja
14a96998cf Merge branch 'main' of https://github.com/abi/screenshot-to-code 2023-11-15 09:51:35 -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
ba15787fca
Update README.md 2023-11-15 07:55:24 -05:00
Abi Raja
670c551d66
Update README.md 2023-11-14 23:44:26 -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
fca6f47882 Update README.md 2023-11-14 17:52:28 -05:00
Abi Raja
e2dc80f47d Update README.md 2023-11-14 17:49:17 -05:00
Abi Raja
8be1b42fb4 add a console to show progress 2023-11-14 17:43:51 -05:00
Abi Raja
beff936e4e update prompt to clarify font awesome <link> 2023-11-14 17:23:02 -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
86dd82e358 write logs to file 2023-11-14 15:26:14 -05:00
Abi Raja
5be9736120 Update .gitignore 2023-11-14 15:10:47 -05:00