forked from hyunleee/roul-fi-front
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdashboard.html
153 lines (142 loc) · 7.2 KB
/
dashboard.html
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Roul-Fi</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<style>
.container {
display: flex;
margin-top: 70px;
margin-bottom: 30px;
justify-content: center;
align-items: center;
}
.nav-item{
margin-right: 30px;
font-size: 30px;
}
</style>
</head>
<body>
<nav class="navbar bg-body-tertiary">
<div class="container-fluid d-flex justify-content-between align-items-center">
<a class="navbar-brand" href="#" style="font-size: 38px;">
<img src="./images/Logo.png" alt="Logo" width="50" height="auth" class="d-inline-block align-text-top">
Roul-Fi
</a>
<ul class="navbar-nav d-flex flex-row">
<li class="nav-item" style="margin-right: 40px;">
<a class="nav-link" href="stake.html">Stake</a>
</li>
<li class="nav-item" style="margin-right: 40px;">
<a class="nav-link" href="play.html">Play</a>
</li>
<li class="nav-item" style="margin-right: 40px;">
<a class="nav-link" href="dashboard.html">Leaderboard</a>
</li>
<li class="nav-item" style="display: flex; justify-content: center; align-items: center; margin-top: 10px;" >
<p style="font-size:25px; color: rgb(0, 139, 185)" id="walletaddresshex"></p>
</li>
</ul>
</div>
</nav>
<section class="container" style="display: flex; flex-direction: column; justify-content: center; align-items: center;">
<div style="margin-bottom: 50px;">
<img src="./images/dashboard-title.png" alt="logo2" width="600px" height="auth">
</div>
<div style = "color: white; width: 1100px; height: 50px; background-color:#0d7ac2; border-radius: 10px; display: flex; display: flex; justify-content: space-around; align-items: center; gap: 20px; padding-top: 13px; margin-bottom: 10px;">
<p>Ranks</p>
<p>Address</p>
<p>Participated Games</p>
<p>Earned RFT</p>
</div>
<div style = "width: 1100px; height: 50px; background-color:#d1d1d1; border-radius: 10px; display: flex; display: flex; justify-content: space-around; align-items: center; gap: 20px; padding-top: 13px; margin-bottom: 10px;">
<p>1</p>
<p>0x8493...2345</p>
<p>690,309</p>
<p>9015</p>
</div>
<div style = "width: 1100px; height: 50px; background-color:#d1d1d1; border-radius: 10px; display: flex; display: flex; justify-content: space-around; align-items: center; gap: 20px; padding-top: 13px; margin-bottom: 10px;">
<p>2</p>
<p>0x4839...4938</p>
<p>609,382</p>
<p>8938</p>
</div>
<div style = "width: 1100px; height: 50px; background-color:#d1d1d1; border-radius: 10px; display: flex; display: flex; justify-content: space-around; align-items: center; gap: 20px; padding-top: 13px; margin-bottom: 10px;">
<p>3</p>
<p>0x3283...6007</p>
<p>599,382</p>
<p>8836</p>
</div>
<div style = "width: 1100px; height: 50px; background-color:#d1d1d1; border-radius: 10px; display: flex; display: flex; justify-content: space-around; align-items: center; gap: 20px; padding-top: 13px; margin-bottom: 10px;">
<p>4</p>
<p>0x2838...9599</p>
<p>578,994</p>
<p>8644</p>
</div>
<div style = "width: 1100px; height: 50px; background-color:#d1d1d1; border-radius: 10px; display: flex; display: flex; justify-content: space-around; align-items: center; gap: 20px; padding-top: 13px; margin-bottom: 10px;">
<p>5</p>
<p>0x2874...6979</p>
<p>509,339</p>
<p>7747</p>
</div>
<div style = "width: 1100px; height: 50px; background-color:#d1d1d1; border-radius: 10px; display: flex; display: flex; justify-content: space-around; align-items: center; gap: 20px; padding-top: 13px; margin-bottom: 10px;">
<p>6</p>
<p>0x3898...3844</p>
<p>488,887</p>
<p>6944</p>
</div>
<div style = "width: 1100px; height: 50px; background-color:#d1d1d1; border-radius: 10px; display: flex; display: flex; justify-content: space-around; align-items: center; gap: 20px; padding-top: 13px; margin-bottom: 10px;">
<p>7</p>
<p>0x8977...3422</p>
<p>455,244</p>
<p>5900</p>
</div>
<div style = "width: 1100px; height: 50px; background-color:#d1d1d1; border-radius: 10px; display: flex; display: flex; justify-content: space-around; align-items: center; gap: 20px; padding-top: 13px; margin-bottom: 10px;">
<p>8</p>
<p>0x4775...5385</p>
<p>400,388</p>
<p>4899</p>
</div>
<div style = "width: 1100px; height: 50px; background-color:#d1d1d1; border-radius: 10px; display: flex; display: flex; justify-content: space-around; align-items: center; gap: 20px; padding-top: 13px; margin-bottom: 10px;">
<p>9</p>
<p>0x4739...5113</p>
<p>299,309</p>
<p>3444</p>
</div>
</section>
<div style="display: flex; justify-content: center; align-items: center" >
<p style="color:rgb(111, 111, 111)">Presented by BV24</p>
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/web3@latest/dist/web3.min.js"></script>
<script>
function sliceHex(hexValue) {
// 헥스값을 문자열로 변환
let hexString = hexValue.toString();
// 만약에 입력값이 0x로 시작하는 형태라면 "0x"를 제거
if (hexString.startsWith('0x')) {
hexString = hexString.slice(2);
}
// 왼쪽 5개 문자 슬라이싱
let leftSlice = hexString.slice(0, 5);
// 오른쪽 3개 문자 슬라이싱
let rightSlice = hexString.slice(-3);
// 완전한 문자열로 조합하여 반환
return "0x" + leftSlice + "..." + rightSlice;
}
const wallet = async () => {
if(window.ethereum !== "undefined") {
const accounts = await ethereum.request({method: "eth_requestAccounts"});
const account = accounts[0];
console.log(`my contract: ${account}`);
var walletaddress = sliceHex(account);
console.log(walletaddress);
document.getElementById("walletaddresshex").innerHTML = walletaddress;
}
}
wallet();
</body>
</html>