-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlayout.html
320 lines (273 loc) · 11.7 KB
/
layout.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
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>{{ store.name }}</title>
<link rel="shortcut icon" href="{{ favicon }}">
<script src="https://kit.fontawesome.com/9f19093a36.js" crossorigin="anonymous"></script>
<script src="https://cdn.tailwindcss.com?plugins=typography"></script>
<script src="https://templates-cdn.paynow.gg/templates/214207081106907136/gifting.js"></script>
<script>
tailwind.config = {
theme: {
extend: {
colors: {
primary: '#8549e6'
},
typography: {
DEFAULT: {
css: {
// Make sure empty paragraphs take up space
'p:empty, p:has(:only-child:empty)': {
minHeight: '1em',
marginBottom: '1em',
},
},
}
}
}
}
}
</script>
<script>
// Dropdowns
const toggleDropdown = (node_id) => {
//closeOtherDropdowns(`menu-${node_id}`);
const el = document.getElementById(`menu-${node_id}`);
if (el) {
el.classList.toggle('hidden');
}
};
const closeOtherDropdowns = (current) => {
const els = document.getElementsByClassName('menu-dropdown');
for (let el of els) {
if (!el.classList.contains('hidden') && current !== el.id) {
el.classList.add('hidden');
}
}
};
const closeModal = () => {
const el = document.getElementById('modal');
if (!el.classList.contains('hidden')) {
el.classList.add('hidden');
}
};
window.onclick = function (event) {
const modal = document.getElementById('modal');
if (event.target === modal) {
modal.classList.add('hidden');
}
}
</script>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap"
rel="stylesheet">
</head>
<body class="bg-[#D6D6D6] font-[Poppins]">
<div class="my-10 mx-auto max-w-7xl px-6 lg:px-2">
<div id="modal"
class="hidden flex justify-center items-center overflow-auto fixed z-10 left-0 top-0 w-full h-full bg-[rgba(0,0,0,0.7)]">
<div id="modal-content" class="my-[15%] mx-auto w-[80%] lg:w-[40%] bg-white rounded-xl p-6">
</div>
</div>
<div class="shadow flex justify-center items-center bg-gray-50 h-[10rem] p-6 rounded-xl">
<a href="/">
{% if store.logo_url %}
<img class="mx-auto h-[5rem]" alt="{{ store.name }}'s logo" src="{{ store.logo_url }}" />
{% else %}
<h1 class="text-gray-200 font-medium text-6xl">{{ store.name }}</h1>
{% endif %}
</a>
</div>
<div class="grid grid-cols-12 gap-4 mt-4">
<div class="lg:col-span-9 col-span-12">
<div class="shadow bg-gray-50 rounded-xl p-4">
<ul class="inline-flex flex-wrap items-center h-full gap-6 tracking-wide">
<li class="text-bold uppercase font-black hover:text-gray-400 {% if request.path == " /"
%}text-primary hover:text-primary{% endif %}">
<a href="/">
Home
</a>
</li>
{% for navlink in navlinks %}
<li
class="text-bold uppercase font-black hover:text-gray-400 {% if activeNavlink.node_id == navlink.node_id %}text-primary hover:text-primary{% endif %}">
<div class="relative inline-block text-left">
<a href="{% if navlink.children|length > 0 %}#{% else %}products?tag={{ navlink.tag_query }}{% endif %}"
onclick="toggleDropdown('{{ navlink.node_id }}')">
{{ navlink.name }}
{% if navlink.children|length > 0 %}
<i class="fa-solid fa-chevron-down"></i>
{% endif %}
</a>
{% if navlink.children|length > 0 %}
{% include 'menu-links.html' with {'navlink': navlink} only %}
{% endif %}
</div>
</li>
{% endfor %}
{% if store.game != "minecraft" and store.game != "minecraft_offline" %}
<li class="text-bold uppercase font-black hover:text-gray-400">
<a href="/subscriptions" {% if request.path=="/subscriptions" %}
class="text-primary hover:text-primary" {% endif %}>
My Subscriptions
</a>
</li>
{% endif %}
</ul>
</div>
<div class="mt-2">
{% block content %}{% endblock %}
</div>
</div>
<div class="flex flex-col col-span-12 lg:col-span-3 gap-4">
{% if customer.id %}
<a href="/cart">
<div class="shadow bg-sky-900 hover:bg-sky-800 rounded-xl p-4 text-white">
<div class="flex justify-between">
<div class="flex flex-col gap-2">
<div class="flex font-bold uppercase text-xl items-center gap-2">
<i class="fa-solid fa-cart-shopping"></i>
<span>View Cart</span>
</div>
<span>
{% if cart.lines|length == 0 %}
<span>Your cart is empty!</span>
{% else %}
<span class="text-gray-300">{{ cart.lines|length }} item{% if cart.lines|length > 1
%}s{% endif %}</span> - <span class="font-bold">{{ cart.total | money }} {{
store.currency }}</span>
{% endif %}
</span>
</div>
<img class="h-14 rounded-2xl" alt="Avatar" src="{{ customer.profile.avatar_url }}" />
</div>
</div>
</a>
{% else %}
<a href="/auth/sign-in">
<div class="shadow bg-sky-900 hover:bg-sky-800 rounded-xl p-4">
<span
class="flex gap-2 items-center text-lg uppercase font-black text-white opacity-90 hover:opacity-100">
<i class="fa-solid fa-cart-shopping"></i>
Sign in here
</span>
</div>
</a>
{% endif %}
{% if customer.id %}
<a href="/auth/sign-out">
<div class="shadow bg-gray-800 text-white hover:bg-gray-700 rounded-xl p-2">
<div class="flex justify-between items-center pr-2">
<div class="flex gap-2">
<img class="h-10 rounded-2xl" alt="Avatar" src="{{ customer.profile.avatar_url }}" />
<div class="flex flex-col">
<span class="font-medium">{{ customer.profile.name ?? customer.name }}</span>
<span class="text-xs">{{ customer.profile.id ?? customer.id }}</span>
</div>
</div>
<div class="flex items-center gap-1.5">
<i class="fa-solid fa-right-from-bracket"></i>
<span class="font-bold">LOG OUT</span>
</div>
</div>
</div>
</a>
{% endif %}
{{ modules | raw }}
</div>
</div>
<footer class="mt-20">
<div class="flex items-center justify-between">
<div>
<span class="font-medium">© {{ store.name }} {{ 'now' | date('Y') }}</span>
</div>
<div class="flex justify-center gap-2">
<a href="/legal/terms-of-service">Terms of Service</a>
<span class="bg-gray-400 w-[1px]"></span>
<a href="/legal/privacy-policy">Privacy Policy</a>
</div>
</div>
</footer>
</div>
</body>
</html>
<!-- Checkout JS -->
<script>
function subscribeToProduct() {
var productSlug = document.querySelector("[data-product-slug]").getAttribute("data-product-slug");
var gameServerId = document.getElementById('gameServerDropdown')?.value;
const query = new URLSearchParams({
subscription: true
});
if (gameServerId) {
query.set('gameserver_id', gameServerId);
}
const checkoutUrl = `/products/${productSlug}/checkout?${query.toString()}`;
window.location.href = checkoutUrl;
}
function addProductToCart() {
var productSlug = document.querySelector("[data-product-slug]").getAttribute("data-product-slug");
var gameServerId = document.getElementById('gameServerDropdown')?.value;
const query = new URLSearchParams();
if (gameServerId) {
query.set('gameserver_id', gameServerId);
}
const checkoutUrl = `/cart/add/${productSlug}?${query.toString()}`;
window.location.href = checkoutUrl;
}
</script>
<!-- Alerting JS -->
<script>
// Get the URL query parameters
const urlParams = new URLSearchParams(window.location.search);
// Check if the 'err' parameter exists
if (urlParams.has('err')) {
// Get the value of the 'err' parameter
const errorMessage = urlParams.get('err');
// Show an alert with the error message
alert(decodeURIComponent(errorMessage));
}
</script>
<!-- Gifting JS -->
<script>
function toggleGiftActions() {
var mainActions = document.getElementById('mainActions');
var giftActions = document.getElementById('giftActions');
if (mainActions && giftActions) {
mainActions.classList.toggle('hidden');
giftActions.classList.toggle('hidden');
} else {
console.error('Elements not found');
}
}
function isValidSteamID(steamid) {
var numericCheck = /^[0-9]+$/.test(steamid);
var lengthCheck = steamid.length >= 16 && steamid.length <= 20; // adjust as needed
return numericCheck && lengthCheck;
}
function handlePurchase() {
var steamidInput = document.getElementById('steamidInput');
var steamid = steamidInput.value.trim();
var productSlug = document.querySelector("[data-product-slug]").getAttribute("data-product-slug");
var gameServerId = document.getElementById('gameServerDropdown')?.value;
if (isValidSteamID(steamid)) {
// Construct the checkout URL dynamically
const query = new URLSearchParams({
"gift_to": steamid
});
if (gameServerId) {
query.set('gameserver_id', gameServerId);
}
var checkoutUrl = `/products/${productSlug}/checkout?${query.toString()}`;
window.location.href = checkoutUrl;
} else {
// Else, show an error popup
alert("Please enter a valid SteamID!");
}
}
</script>