pinokiod 3.238.0 → 3.239.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "3.238.0",
3
+ "version": "3.239.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1540,7 +1540,10 @@ body.dark .line:hover {
1540
1540
  /*
1541
1541
  padding: 15px 15px;
1542
1542
  */
1543
+ padding: 5px 10px;
1544
+ /*
1543
1545
  padding: 7px 5px;
1546
+ */
1544
1547
  /*
1545
1548
  border-bottom: 1px solid var(--light-thin);
1546
1549
  */
@@ -145,6 +145,13 @@ body.dark .comment {
145
145
  #save {
146
146
  background: rgba(127, 91, 243, 0.9);
147
147
  }
148
+ #delete-project {
149
+ color: firebrick;
150
+ background: none;
151
+ }
152
+ #delete-project:hover {
153
+ border: 1px solid firebrick;
154
+ }
148
155
  a#customize {
149
156
  text-decoration: underline;
150
157
  cursor: pointer;
@@ -270,8 +277,53 @@ document.addEventListener("DOMContentLoaded", async () => {
270
277
  e.preventDefault()
271
278
  e.stopPropagation()
272
279
  document.querySelector("#editor").classList.toggle("hidden")
280
+ document.body.classList.toggle("center")
273
281
  })
274
282
  <% } %>
283
+ <% if (!init && name) { %>
284
+ const deleteBtn = document.querySelector("#delete-project")
285
+ if (deleteBtn) {
286
+ const projectName = <%- JSON.stringify(name) %>
287
+ deleteBtn.addEventListener("click", async (e) => {
288
+ e.preventDefault()
289
+ e.stopPropagation()
290
+ const confirmed = confirm("Are you sure you wish to delete?")
291
+ if (!confirmed) {
292
+ return
293
+ }
294
+ Swal.fire({
295
+ html: '<i class="fa-solid fa-circle-notch fa-spin"></i> Deleting',
296
+ customClass: {
297
+ container: "loader-container",
298
+ popup: "loader-popup",
299
+ htmlContainer: "loader-dialog",
300
+ footer: "hidden",
301
+ actions: "hidden"
302
+ }
303
+ })
304
+ try {
305
+ const res = await fetch("/pinokio/delete", {
306
+ method: "post",
307
+ headers: {
308
+ "Content-Type": "application/json"
309
+ },
310
+ body: JSON.stringify({ name: projectName })
311
+ }).then((response) => response.json())
312
+ Swal.close()
313
+ if (res && res.success) {
314
+ location.href = "/"
315
+ } else if (res && res.error) {
316
+ alert(res.error)
317
+ } else {
318
+ alert("Failed to delete project")
319
+ }
320
+ } catch (err) {
321
+ Swal.close()
322
+ alert(err.message || "Failed to delete project")
323
+ }
324
+ })
325
+ }
326
+ <% } %>
275
327
  })
276
328
  </script>
277
329
  </head>
@@ -309,6 +361,11 @@ document.addEventListener("DOMContentLoaded", async () => {
309
361
  <% if (home) { %>
310
362
  <a class='home-button home' href="/"><i class='fa-solid fa-home'></i></a>
311
363
  <% } %>
364
+ <% if (name) { %>
365
+ <button class='btn' id='delete-project'>
366
+ <i class="fa-solid fa-trash"></i> Delete Project
367
+ </button>
368
+ <% } %>
312
369
  <div class='flexible'></div>
313
370
  <div class='nav-btns'>
314
371
  <a class='btn' href="<%=editorpath%>"><i class="fa-solid fa-pen-to-square"></i> Edit file</a>