feat: Updated frontend/src/App.tsx
This commit is contained in:
parent
47267aefb1
commit
2339fa5af5
@ -77,10 +77,12 @@ function App() {
|
|||||||
return png;
|
return png;
|
||||||
};
|
};
|
||||||
const [message, setMessage] = useState('');
|
const [message, setMessage] = useState('');
|
||||||
|
const [error, setError] = useState(null);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetch('http://localhost:5000/')
|
fetch('http://localhost:5000/status')
|
||||||
.then(response => response.text())
|
.then(response => response.json())
|
||||||
.then(data => setMessage(data));
|
.then(data => setMessage(data.message))
|
||||||
|
.catch(error => setError(error.toString()));
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const downloadCode = () => {
|
const downloadCode = () => {
|
||||||
@ -120,7 +122,6 @@ function App() {
|
|||||||
|
|
||||||
// Merge settings with params
|
// Merge settings with params
|
||||||
const updatedParams = { ...params, ...settings, outputSettings };
|
const updatedParams = { ...params, ...settings, outputSettings };
|
||||||
|
|
||||||
generateCode(
|
generateCode(
|
||||||
wsRef,
|
wsRef,
|
||||||
updatedParams,
|
updatedParams,
|
||||||
@ -208,7 +209,8 @@ function App() {
|
|||||||
{(appState === AppState.CODING ||
|
{(appState === AppState.CODING ||
|
||||||
<div className="flex items-center justify-between mt-10 mb-2">
|
<div className="flex items-center justify-between mt-10 mb-2">
|
||||||
<h1 className="text-2xl ">Screenshot to Code</h1>
|
<h1 className="text-2xl ">Screenshot to Code</h1>
|
||||||
<p>{message}</p>
|
{message && <p>{message}</p>}
|
||||||
|
{error && <p>Error: {error}</p>}
|
||||||
<SettingsDialog settings={settings} setSettings={setSettings} />
|
<SettingsDialog settings={settings} setSettings={setSettings} />
|
||||||
</div>
|
</div>
|
||||||
appState === AppState.CODE_READY) && (
|
appState === AppState.CODE_READY) && (
|
||||||
@ -231,7 +233,6 @@ function App() {
|
|||||||
<CodePreview code={generatedCode} />
|
<CodePreview code={generatedCode} />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{appState === AppState.CODE_READY && (
|
{appState === AppState.CODE_READY && (
|
||||||
<div>
|
<div>
|
||||||
<div className="grid w-full gap-2">
|
<div className="grid w-full gap-2">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user