forked from enriccio104/heaser-shop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
270 lines (233 loc) · 5.97 KB
/
index.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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
<!DOCTYPE html>
<html lang="it">
<head>
<title>Product Page</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #202020;
color: white;
}
header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 20px;
}
header img {
max-height: 50px;
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 20px;
display: flex;
justify-content: space-between;
margin-top: 3%;
}
.product-image {
flex: 1;
margin-right: 50px;
}
.product-info {
flex: 2;
}
.product-image img {
width: 100%;
}
.product-title {
font-size: 2rem;
margin-bottom: 10px;
}
.product-price {
font-size: 1.5rem;
margin-bottom: 10px;
font-weight: bold;
}
.product-description {
margin-bottom: 20px;
}
.cart-btn {
background-color: #4CAF50;
color: white;
padding: 10px 20px;
border: none;
cursor: pointer;
font-size: 1rem;
text-decoration: none;
border-radius: 5px;
}
.cart-btn:hover {
background-color: #3e8e41;
text-decoration: none;
border-radius: 5px;
}
.rating {
background-color: rgba(0, 0, 0, 0.292);
padding: 15px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
width: 1000px;
max-width: 80%;
margin-left: 160px;
}
.rating-title{
font-size: 2rem;
margin-bottom: 10px;
margin-left: 165px;
}
#openFormButton {
background-color: #4caf50;
color: white;
}
#openFormButton:hover,
#openFormButton:focus {
background-color: #45a049;
}
#issueForm {
display: none;
background-color: rgba(0, 0, 0, 0.292);
padding: 20px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
width: 980px;
max-width: 80%;
}
label {
display: block;
margin-bottom: 8px;
color: #ffffff;
}
input,
textarea {
width: 100%;
padding: 10px;
margin-bottom: 15px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
button[type="button"] {
background-color: #007bff;
color: white;
}
button[type="button"]:hover,
button[type="button"]:focus {
background-color: #0056b3;
}
button {
border: none;
padding: 10px 20px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin-bottom: 20px;
cursor: pointer;
border-radius: 5px;
transition: background-color 0.3s ease;
}
.new-r{
margin-left: 165px;
}
</style>
</head>
<body>
<header>
<a href="https://enricozon.mom"
><img
src="https://enricozon.mom/immagini/loghi/enricozonbt.png"
/></a>
</header>
<div class="container">
<div class="product-image">
<img src="product-image.jpg" alt="Product Image">
</div>
<div class="product-info">
<h1 class="product-title">Product Title</h1>
<p class="product-price">$99.99</p>
<p class="product-description">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus ut dui nisi. Donec bibendum scelerisque ante vitae facilisis.</p>
<button class="cart-btn">Buy</button>
</div>
</div>
<div class="new-r">
<h2>Scrivi una recensione</h2>
<button id="openFormButton" onclick="toggleForm()">
Nuova Recensione
</button>
<form id="issueForm">
<label for="name">Nome:</label>
<input type="text" id="name" required /><br />
<label for="score">Punteggio (0/10):</label>
<input type="number" id="score" min="0" max="10" required /><br />
<label for="review">Recensione:</label>
<textarea id="review" rows="4" required></textarea><br />
<button type="button" onclick="createGitHubIssue()">
Invia Recensione
</button>
</form>
</div>
<h1 class="rating-title">Product Title</h1>
<div class="rating">
<p>AleCostaFanPage: (10/10)</p>
<p>IL MIO PREFERITOwdeubidwenbcdwfkhurfdjudbkbghggdffdhdrhghjdfghdfghhhfhgfdgghgggggfhhdjhfhfggghgfgfhgfhfhgh</p>
</div>
<br>
</body>
<script>
function toggleForm() {
var form = document.getElementById("issueForm");
form.style.display = form.style.display === "none" ? "block" : "none";
}
// Base64 decode function
function base64Decode(str) {
return atob(str);
}
// Function to create a GitHub issue with encoded Authorization token
function createGitHubIssue() {
const name = document.getElementById("name").value;
const score = document.getElementById("score").value;
const review = document.getElementById("review").value;
// Encoded token
const encodedToken =
"Z2hwX0xBOUN4ZWxqQUNiRmVYR2dvakhOc1FhTVZOS0xlTzNKYkdMSQo=";
// Decode the token
const decodedToken = base64Decode(encodedToken);
const issueData = {
title: "Recensione Costa",
body: `Nome: ${name}\nPunteggio: ${score}/10\nRecensione: ${review}`,
};
fetch(
"https://api.github.com/repos/Enricozon-Team/enricozon2.0/issues",
{
method: "POST",
headers: {
Authorization: `Bearer ${decodedToken}`,
"Content-Type": "application/json",
},
body: JSON.stringify(issueData),
}
)
.then((response) => {
if (!response.ok) {
throw new Error(`Error: ${response.statusText}`);
}
return response.json();
})
.then((data) => {
console.log("Nuova Recensione Mandata", data);
alert(
"Recensione inviata con successo! Possono volerci fino a 24 ore prima che venga aggiunta."
);
})
.catch((error) => {
console.error("Error creating issue:", error.message);
alert(
"Errore nell'inviare la recensione! Se l'errore persiste, contattate l'assistenza a support@enricozon.mom"
);
});
}
</script>
</html>