Spaces:
Sleeping
Sleeping
Upload 4 files
Browse files
app.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Pi.init({ version: "2.0", sandbox: true });
|
| 2 |
+
|
| 3 |
+
function setStatus(msg){document.getElementById("status").innerText="Status: "+msg;}
|
| 4 |
+
function setOutput(msg){document.getElementById("output").innerText=msg;}
|
| 5 |
+
|
| 6 |
+
async function connectPi(){
|
| 7 |
+
setStatus("Connecting…");
|
| 8 |
+
try{
|
| 9 |
+
const user=await Pi.authenticate(["username"]);
|
| 10 |
+
setStatus("Connected as @"+user.username);
|
| 11 |
+
}catch(e){setStatus("Error: "+e.message);}
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
function generate(){
|
| 15 |
+
const t=document.getElementById("prompt").value;
|
| 16 |
+
if(!t) return setOutput("Enter something first.");
|
| 17 |
+
setOutput("You asked to build: "+t);
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
async function startPayment(){
|
| 21 |
+
setStatus("Starting payment…");
|
| 22 |
+
try{
|
| 23 |
+
const p=await Pi.createPayment({
|
| 24 |
+
amount:1,
|
| 25 |
+
memo:"Quantum Pi Forge Test Payment",
|
| 26 |
+
metadata:{example:true}
|
| 27 |
+
});
|
| 28 |
+
setStatus("Payment created: "+p.identifier);
|
| 29 |
+
}catch(e){setStatus("Payment error: "+e.message);}
|
| 30 |
+
}
|
index.html
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html><head><meta charset='UTF-8'><meta name='viewport' content='width=device-width, initial-scale=1.0'>
|
| 3 |
+
<title>Quantum Pi Forge</title>
|
| 4 |
+
<link rel="stylesheet" href="style.css">
|
| 5 |
+
<script src="https://sdk.minepi.com/pi-sdk.js"></script></head>
|
| 6 |
+
<body>
|
| 7 |
+
<div class="container">
|
| 8 |
+
<img src="logo.png" class="logo" />
|
| 9 |
+
<h1>Quantum Pi Forge</h1>
|
| 10 |
+
<p class="sub">AI-powered Pi App Builder</p>
|
| 11 |
+
<button class="main-btn" onclick="connectPi()">Connect Pi Account</button>
|
| 12 |
+
<div id="status" class="status">Status: Waiting…</div>
|
| 13 |
+
<div class="panel">
|
| 14 |
+
<textarea id="prompt" placeholder="Describe what you want to build…"></textarea>
|
| 15 |
+
<button class="action-btn" onclick="generate()">Generate App Code</button>
|
| 16 |
+
</div>
|
| 17 |
+
<div class="panel">
|
| 18 |
+
<button class="action-btn" onclick="startPayment()">Test Payment (1 test-pi)</button>
|
| 19 |
+
</div>
|
| 20 |
+
<div id="output" class="output"></div>
|
| 21 |
+
</div>
|
| 22 |
+
<script src="app.js"></script>
|
| 23 |
+
</body></html>
|
logo.png
ADDED
|
style.css
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
body{margin:0;background:#000;font-family:Arial;color:#fff}
|
| 2 |
+
.container{text-align:center;padding:30px}
|
| 3 |
+
.logo{width:120px;margin-top:20px}
|
| 4 |
+
h1{font-size:28px;margin-bottom:5px}
|
| 5 |
+
.sub{opacity:.7;margin-bottom:20px}
|
| 6 |
+
.main-btn,.action-btn{background:#7b2fff;color:#fff;padding:12px 22px;font-size:16px;border:none;border-radius:10px;margin-top:20px}
|
| 7 |
+
.status{margin-top:20px;font-size:14px;opacity:.8}
|
| 8 |
+
.panel{margin-top:30px}
|
| 9 |
+
textarea{width:90%;height:120px;background:#111;border:1px solid #333;border-radius:10px;color:#fff;padding:10px;font-size:15px}
|
| 10 |
+
.output{margin-top:30px;text-align:left;background:#111;padding:15px;border-radius:10px;width:90%;margin-left:auto;margin-right:auto;font-size:13px;border:1px solid #333}
|