1import { a_ as useRouter, r as ref, j as onMounted, l as createElementBlock, m as openBlock, q as createBaseVNode, s as createCommentVNode, F as Fragment, A as renderList, Q as withKeys, t as withModifiers, y as toDisplayString } from "#entry"; 2import { u as useEdits } from "./D6YAZUPU.js"; 3import { d as definePageMeta } from "./D6xOieR_.js"; 4const _hoisted_1 = { class: "vs-edits-lobby" }; 5const _hoisted_2 = { class: "vs-edits-lobby__list" }; 6const _hoisted_3 = { 7 key: 0, 8 class: "vs-edits-lobby__empty" 9}; 10const _hoisted_4 = ["onClick", "onKeydown"]; 11const _hoisted_5 = { class: "vs-edits-lobby__preview" }; 12const _hoisted_6 = ["src"]; 13const _hoisted_7 = { 14 key: 1, 15 class: "vs-edits-lobby__img-empty" 16}; 17const _hoisted_8 = { class: "vs-edits-lobby__meta" }; 18const _hoisted_9 = { class: "vs-edits-lobby__name" }; 19const _hoisted_10 = { class: "vs-edits-lobby__sub" }; 20const _hoisted_11 = ["onClick"]; 21const _hoisted_12 = ["onClick"]; 22const _sfc_main = { 23 __name: "myEdits", 24 setup(__props) { 25 definePageMeta({ layout: "default" }); 26 const router = useRouter(); 27 const api = useEdits(); 28 const items = ref([]); 29 function refresh() { 30 items.value = api.listEdits(); 31 } 32 onMounted(() => { 33 refresh(); 34 }); 35 function formatDate(iso) { 36 try { 37 const d = new Date(String(iso || "")); 38 if (Number.isNaN(d.getTime())) return ""; 39 return d.toLocaleString(); 40 } catch { 41 return ""; 42 } 43 } 44 function openEdit(id) { 45 if (!id) return; 46 router.push(`/edit?id=${encodeURIComponent(id)}`); 47 } 48 function onNew() { 49 const it = api.createEdit({ title: "New edit", imageUrl: "" }); 50 refresh(); 51 openEdit(it.id); 52 } 53 function onRename(it) { 54 const t = window.prompt("Edit name", String(it?.title || "New edit")); 55 if (t == null) return;
56 api.saveEdit(it.id, { title: t }); 57 refresh(); 58 } 59 function onDelete(it) { 60 const ok = window.confirm("Delete this edit?"); 61 if (!ok) return; 62 api.deleteEdit(it.id); 63 refresh(); 64 } 65 return (_ctx, _cache) => { 66 return openBlock(), createElementBlock("div", _hoisted_1, [ 67 createBaseVNode("div", { class: "vs-edits-lobby__head" }, [ 68 _cache[1] || (_cache[1] = createBaseVNode("div", { class: "vs-edits-lobby__title" }, "My Edits", -1)), 69 createBaseVNode("button", { 70 class: "vs-edits-lobby__new", 71 type: "button", 72 onClick: onNew 73 }, "New edit") 74 ]), 75 createBaseVNode("div", _hoisted_2, [ 76 !items.value.length ? (openBlock(), createElementBlock("div", _hoisted_3, "No edits yet")) : createCommentVNode("", true), 77 (openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (it) => { 78 return openBlock(), createElementBlock("div", { 79 key: it.id, 80 class: "vs-edits-lobby__item", 81 role: "button", 82 tabindex: "0", 83 onClick: ($event) => openEdit(it.id), 84 onKeydown: withKeys(withModifiers(($event) => openEdit(it.id), ["prevent"]), ["enter"]) 85 }, [ 86 createBaseVNode("div", _hoisted_5, [ 87 it.currentImageUrl || it.imageUrl ? (openBlock(), createElementBlock("img", { 88 key: 0, 89 class: "vs-edits-lobby__img", 90 src: it.currentImageUrl || it.imageUrl, 91 alt: "" 92 }, null, 8, _hoisted_6)) : (openBlock(), createElementBlock("div", _hoisted_7, "No image")) 93 ]), 94 createBaseVNode("div", _hoisted_8, [ 95 createBaseVNode("div", _hoisted_9, toDisplayString(it.title || "New edit"), 1), 96 createBaseVNode("div", _hoisted_10, toDisplayString(formatDate(it.updatedAt || it.createdAt)), 1) 97 ]), 98 createBaseVNode("div", { 99 class: "vs-edits-lobby__actions", 100 onClick: _cache[0] || (_cache[0] = withModifiers(() => { 101 }, ["stop"])) 102 }, [ 103 createBaseVNode("button", { 104 class: "vs-edits-lobby__btn", 105 type: "button", 106 onClick: withModifiers(($event) => onRename(it), ["stop"]) 107 }, "Rename", 8, _hoisted_11), 108 createBaseVNode("button", { 109 class: "vs-edits-lobby__btn vs-edits-lobby__btn--danger", 110 type: "button", 111 onClick: withModifiers(($event) => onDelete(it), ["stop"]) 112 }, "Delete", 8, _hoisted_12) 113 ]) 114 ], 40, _hoisted_4); 115 }), 128)) 116 ]) 117 ]); 118 }; 119 } 120}; 121export { 122 _sfc_main as default 123};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.