-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevent.html
218 lines (188 loc) · 9.3 KB
/
event.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/x-icon" href="https://ik.imagekit.io/aoe2tournaments/Watermelon%20(4).webp">
<title>Event Details</title>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css">
<link href="https://fonts.googleapis.com/css2?family=Eczar:[email protected]&display=swap" rel="stylesheet">
<style>
h2 {
color: black;
text-align: center;
font-size: 32px;
}
.event-detail-box {
background: rgba(255, 255, 255, 0.8);
border-radius: 5px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
padding: 15px;
width: 80%;
max-width: 800px;
margin: auto;
color: #000;
}
.important-links {
background: #f0f8ff;
border: 1px solid #a0c4ff;
border-radius: 5px;
padding: 15px;
margin-top: 0px;
margin-left: 50px;
max-width: 30%;
}
.important-links h3 {
margin-top: 0;
}
.important-link {
display: flex;
justify-content: space-between;
margin-bottom: 10px;
}
.event-detail-box img {
display: block;
width: 60%;
height: auto;
margin-left: auto;
margin-right: auto;
border-radius: 5px;
}
p {
margin-left: 70px;
}
</style>
</head>
<body>
<div class = "navcontainer">
<nav class="topnav">
<a href="index.html">Tournaments</a>
<a href="images.html">Images</a>
<a href="links.html">Resources</a>
<a href="https://forms.gle/yHM5ecGqhnZP33KF8" target="_blank">Add Event</a>
</nav>
</div>
<h1>Event Details</h1>
<div class="event-detail-box" id="event-detail-box"></div>
<script>
const urlParams = new URLSearchParams(window.location.search);
const eventName = urlParams.get('event');
const eventsURL = 'https://docs.google.com/spreadsheets/d/e/2PACX-1vR3NVTnrKkbLNQAbEeH8-pVEYghucF8vqQ55eVt9P4vmnU67nbUvn9WTlTdyjHil_55sx2MCXmDfGrX/pub?output=csv';
function formatDateToMonthDay(dateString) {
const dateParts = dateString.split('/');
const date = new Date(dateParts[2], dateParts[0] - 1, dateParts[1]);
const options = { month: 'long', day: 'numeric' };
return date.toLocaleDateString('en-US', options);
}
async function fetchEventDetails() {
const response = await fetch(eventsURL);
const data = await response.text();
const rows = data.split('\n').map(row => {
return row.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/)
});
const headers = rows[0];
const events = rows.slice(1).map(row => {
let event = {};
headers.forEach((header, index) => {
event[header.trim()] = row[index].trim().replace(/(^"|"$)/g, '');
});
return event;
});
const eventDetailContainer = document.getElementById('event-detail-box');
const event = events.find(e => e.Name === eventName);
let importantLinksHTML = ``;
if (event) {
let eventDetailsHTML = `
<img src="${event.Image ? event.Image : 'https://ik.imagekit.io/aoe2tournaments/age-of-empires-2-definitive-edit.webp'}" alt="${event.Name}">
<h2>${event.Name}</h2>`;
if (event.SignupDeadline) {
const formattedDeadline = formatDateToMonthDay(event.SignupDeadline);
eventDetailsHTML += `<p><strong>Signup Deadline:</strong> <i class="bi bi-calendar fs-5"></i> ${formattedDeadline}</p>`;
}
if (event.StartDate) {
const formattedStart = formatDateToMonthDay(event.StartDate);
eventDetailsHTML += `<p>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-calendar" viewBox="0 0 16 16">
<path d="M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5M1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4z"/>
</svg> Begins: ${formattedStart}`
if(event.EndDate){
const formattedEnd = formatDateToMonthDay(event.EndDate);
eventDetailsHTML += ` ~ ${formattedEnd}`;
}
eventDetailsHTML += `<p>`;
} else {
eventDetailsHTML += `<p>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-calendar" viewBox="0 0 16 16">
<path d="M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5M1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4z"/>
</svg> Begins: TBA</p>`;
}
if (event.DiscordLink) {
eventDetailsHTML += `<p><strong><i class="bi bi-discord"></i></strong><a href="${event.DiscordLink}" target="_blank">${event.Discord} Discord</a></p>`;
}
if (event.Description) {
eventDetailsHTML += `<p>${event.Description}</p>`;
}
if (event.Liquid) {
eventDetailsHTML += `<p><a href="${event.Liquid}" target="_blank">Liquidpedia Page</a></p>`;
}
if (event.Signup) {
eventDetailsHTML += `<p><a href="${event.Signup}" target="_blank">Sign up here</a></p>`;
}
if (event.Twitch) {
eventDetailsHTML += `<p><a href="${event.Twitch}" target="_blank">Watch the event here</a></p>`;
}
if (event.Sponsor) {
eventDetailsHTML += `<p><strong>Sponsor: </strong> ${event.Sponsor}</p>`;
}
if (event.Prize) {
eventDetailsHTML += `<p><strong>Prize Pool:</strong> ${event.Prize}</p>`;
}
if (event.Host) {
eventDetailsHTML += `<p><strong>Host:</strong> ${event.Host}</p>`;
}
if (event.Admins) {
eventDetailsHTML += `<p><strong>Admins:</strong> ${event.Admins}</p>`;
}
importantLinksHTML += `<div class="important-links"><h3>Important Links</h3>`;
let linkStringStart = importantLinksHTML; //to compare later
if (event['GroupMap']) {
importantLinksHTML += `<div class="important-link"><a href="${event['GroupMap']}" target="_blank"><strong>Group Stage Map Draft</strong></a></div>`;
}
if (event['GroupCiv']) {
importantLinksHTML += `<div class="important-link"><a href="${event['GroupCiv']}" target="_blank"><strong>Group Stage Civ Draft</strong></a></div>`;
}
if (event['KO Map Draft Link']) {
importantLinksHTML += `<div class="important-link"><a href="${event['KO Map Draft Link']}" target="_blank"><strong>KO Map Draft Link</strong></a></div>`;
}
if (event['KO Civ Draft Link']) {
importantLinksHTML += `<div class="important-link"><a href="${event['KO Civ Draft Link']}" target="_blank"><strong>KO Civ Draft Link</strong></a></div>`;
}
if (event.Handbook) {
importantLinksHTML += `<div class="important-link"><a href="${event['Handbook']}" target="_blank"><strong>Handbook</strong></a></div>`;
}
if(importantLinksHTML != linkStringStart){
eventDetailsHTML += importantLinksHTML;
}
if (event.Players) {
eventDetailsHTML += `<p><strong>Players:</strong> <a href="${event.Players}" target="_blank">Link</a></p>`;
}
if (event.L1) {
eventDetailsHTML += `<p><a href="${event.LL1}" target="_blank">${event.L1}</a></p>`;
}
if (event.L2) {
eventDetailsHTML += `<p><a href="${event.LL2}" target="_blank">${event.L2}</a></p>`;
}
eventDetailsHTML += `</div>`;
if (event['DivisionElo Range']) {
eventDetailsHTML += `<p><strong>Division Elo Range:</strong> ${event['DivisionElo Range']}</p>`;
}
eventDetailContainer.innerHTML = eventDetailsHTML;
} else {
eventDetailContainer.innerHTML = `<p>No details available for this event.</p>`;
}
}
window.onload = fetchEventDetails;
</script>
</body>
</html>