sedefiizm commited on
Commit
dbc4e43
·
verified ·
1 Parent(s): 9a52526

Rename app.js to App.js

Browse files
Files changed (2) hide show
  1. App.js +94 -0
  2. app.js +0 -0
App.js ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import React, { useState } from "react";
2
+ import "./App.css";
3
+
4
+ function App() {
5
+ const [prompt, setPrompt] = useState("");
6
+ const [image, setImage] = useState(null);
7
+ const [loading, setLoading] = useState(false);
8
+
9
+ const handleGenerate = async (isPremium) => {
10
+ setLoading(true);
11
+ try {
12
+ const response = await fetch("http://localhost:5000/generate", {
13
+ method: "POST",
14
+ headers: {
15
+ "Content-Type": "application/json",
16
+ },
17
+ body: JSON.stringify({ prompt, premium: isPremium }),
18
+ });
19
+ const data = await response.json();
20
+ setImage(data.image_url);
21
+ } catch (error) {
22
+ console.error("Görsel oluşturulurken hata oluştu:", error);
23
+ }
24
+ setLoading(false);
25
+ };
26
+
27
+ return (
28
+ <div className="app-container">
29
+ {/* HEADER */}
30
+ <header className="header">
31
+ <div className="logo">Logo</div>
32
+ <div className="header-right">
33
+ <div className="new-project">
34
+ <span className="new-project-text">Yeni Proje</span>
35
+ <span className="new-project-icon">+</span>
36
+ </div>
37
+ <div className="profile">
38
+ <img src="profile.jpg" alt="Profile" className="profile-pic" />
39
+ </div>
40
+ </div>
41
+ </header>
42
+
43
+ {/* SOL PANEL */}
44
+ <div className="side-panel">
45
+ <label>Toplam Alan (m²)</label>
46
+ <input type="number" placeholder="Örn: 100" />
47
+
48
+ <label>Yatak Odası</label>
49
+ <input type="number" placeholder="0" />
50
+
51
+ <label>Banyo</label>
52
+ <input type="number" placeholder="0" />
53
+
54
+ <label>Mutfak</label>
55
+ <input type="number" placeholder="0" />
56
+
57
+ <label>Oturma Odası</label>
58
+ <input type="number" placeholder="0" />
59
+
60
+ <label>Yemek Odası</label>
61
+ <input type="number" placeholder="0" />
62
+
63
+ <label>Giriş</label>
64
+ <input type="number" placeholder="0" />
65
+
66
+ <label>Garaj</label>
67
+ <input type="number" placeholder="0" />
68
+
69
+ {/* PROMPT ALANI */}
70
+ <textarea
71
+ placeholder="Özel isteğinizi buraya yazın..."
72
+ value={prompt}
73
+ onChange={(e) => setPrompt(e.target.value)}
74
+ ></textarea>
75
+
76
+ {/* BUTONLAR */}
77
+ <div className="buttons">
78
+ <button onClick={() => handleGenerate(false)}>Oluştur</button>
79
+ <button className="premium-button" onClick={() => handleGenerate(true)}>
80
+ Yükselt <span className="lock-icon">🔒</span>
81
+ </button>
82
+ </div>
83
+ </div>
84
+
85
+ {/* GÖRSEL ALANI */}
86
+ <div className="image-container">
87
+ {loading && <p>Görsel oluşturuluyor...</p>}
88
+ {image && <img src={`data:image/png;base64,${image}`} alt="Generated Floor Plan" />}
89
+ </div>
90
+ </div>
91
+ );
92
+ }
93
+
94
+ export default App;
app.js DELETED
File without changes