forked from pi-apps/demo
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathindex.html
More file actions
89 lines (76 loc) · 3.76 KB
/
Copy pathindex.html
File metadata and controls
89 lines (76 loc) · 3.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>WHD-Pi App - Whole Human Development</title>
<script src="https://sdk.minepi.com/pi-sdk.js"></script>
<style>
:root {
--pi-purple: #673ab7;
--pi-gold: #ffa500;
}
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; text-align: center; padding: 20px; background-color: #f8f9fa; color: #333; }
.container { background: white; padding: 30px; border-radius: 15px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); max-width: 450px; margin: auto; }
.logo { width: 100px; margin-bottom: 10px; }
h1 { color: var(--pi-purple); font-size: 24px; }
p { color: #666; font-size: 14px; }
.menu-grid { display: none; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }
.menu-item { background: #eee; padding: 15px; border-radius: 10px; text-decoration: none; color: var(--pi-purple); font-weight: bold; font-size: 12px; transition: 0.3s; }
.menu-item:hover { background: var(--pi-purple); color: white; }
.full-width { grid-column: span 2; }
button { background-color: var(--pi-purple); color: white; border: none; padding: 12px 25px; border-radius: 25px; cursor: pointer; font-size: 16px; font-weight: bold; width: 100%; transition: 0.3s; }
button:active { transform: scale(0.98); }
#user-info { margin-top: 20px; padding: 10px; border-top: 1px solid #eee; display: none; }
.status-badge { background: #e8f5e9; color: #2e7d32; padding: 5px 10px; border-radius: 15px; font-size: 12px; margin-top: 5px; display: inline-block; }
</style>
</head>
<body>
<div class="container">
<img src="logo WHD.png" alt="WHD Logo" class="logo">
<h1>WHD-Pi Ecosystem</h1>
<p>Whole Human Development untuk Masa Depan Pioneers</p>
<button id="auth-btn">Login ke WHD-Pi</button>
<div id="user-info">
<div class="status-badge">Akun Terverifikasi</div>
<p id="welcome-msg"></p>
<div class="menu-grid" id="main-menu">
<a href="#" class="menu-item">📚 E-Learning</a>
<a href="#" class="menu-item">🛒 E-Commerce</a>
<a href="#" class="menu-item full-width">📈 E-Marketing & Community</a>
</div>
</div>
</div>
<script>
const Pi = window.Pi;
Pi.init({ version: "2.0", sandbox: true });
const authBtn = document.getElementById('auth-btn');
const userInfo = document.getElementById('user-info');
const welcomeMsg = document.getElementById('welcome-msg');
const mainMenu = document.getElementById('main-menu');
authBtn.addEventListener('click', async () => {
try {
const scopes = ['username', 'payments'];
const auth = await Pi.authenticate(scopes, onIncompletePaymentFound);
welcomeMsg.innerHTML = `Selamat Datang, <strong>${auth.user.username}</strong>!`;
authBtn.style.display = 'none';
userInfo.style.display = 'block';
mainMenu.style.display = 'grid';
} catch (err) {
alert("Gagal login: " + err.message);
}
});
// Navigasi Menu Sederhana
document.querySelectorAll('.menu-item').forEach(item => {
item.addEventListener('click', (e) => {
const menuName = e.target.innerText;
alert("Membuka " + menuName + "... (Halaman sedang disiapkan)");
// Nantinya di sini kita ganti dengan fungsi memanggil ELearning.js
});
});
function onIncompletePaymentFound(payment) {
console.log("Incomplete payment:", payment);
};
</script>
</body>
</html>