PageSourceSearch

https://loothing.xyz/assets/EventTemplates-CIOc80kG.js

js loothing.xyz collected 2026-10-02 02:13:20 UTC 9,712 bytes, 1 lines download raw bytes

1import{r as e,j as t}from"./react-vendor-BR2bEzcq.js";import{u as s,a,d as i,e as l,f as n}from"./useEventTemplates-Dw8FmtA4.js";import{b as r,m as o,F as c,A as d,k as m}from"./index-CpSDEIFT.js";import{E as x}from"./EventTypeBadge-DFraKKM-.js";import{D as p}from"./DifficultyBadge-DM2Nlw_e.js";import{a as h}from"./eventTypes-BQMgNGym.js";import{L as g}from"./loader-circle-D91B_GSQ.js";import{P as u}from"./plus-CfdF0ep3.js";import{S as j}from"./sparkles-BkZALuyM.js";import{C as y}from"./clock-7p0Hl2bb.js";import{E as f}from"./external-link-CAsIjkPz.js";import{P as N}from"./pencil-0_ZHHQde.js";import{C as b}from"./copy-8tRFsKvC.js";import{T as v}from"./trash-2-CefGdBnP.js";import"./axios-ClGXtqae.js";import"./circle-question-mark-BGHDN8r9.js";import"./party-popper-wEU4tqv-.js";function w(e){return e&&0!==e.length?e.map(e=>`${e.limit} ${e.role}`).join(" / "):null}function C(e){if(!e)return null;const t=Math.floor(e/60),s=e%60;return 0===s?`${t}h`:0===t?`${s}m`:`${t}h ${s}m`}const k=()=>{const k=r(),T=m(),{templates:$,isLoading:D,error:E}=s(),{create:M,isPending:F}=a(),{remove:S}=i(),{clone:U}=l(),{presets:L,isLoading:P}=n(),[q,A]=e.useState(null),[B,I]=e.useState(null),[K,R]=e.useState(null),[V,Y]=e.useState(null),z=async e=>{I(e.id);try{await U({id:e.id,name:`${e.name||e.title} (Copy)`}),T.success("Template cloned")}catch{T.error("Failed to clone template")}finally{I(null)}},G=async e=>{if(confirm("Delete this template?")){A(e);try{await S(e),T.success("Template deleted")}catch{T.error("Failed to delete template")}finally{A(null)}}};return t.jsxs(o.div,{initial:{opacity:0}
1,animate:{opacity:1},className:"min-h-screen p-4 lg:p-6 space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("h1",{className:"text-xl lg:text-2xl font-bold text-white",children:"Event Templates"}),t.jsx("p",{className:"text-sm text-gray-400 mt-1",children:"Reusable configurations for quick event creation"})]}),t.jsxs("button",{onClick:async()=>{try{const e=await M({name:"Untitled Template",eventType:"raid"});k(`/event-templates/${e.template?.id}/edit`)}catch{T.error("Failed to create template")}},disabled:F,className:"flex items-center gap-2 px-4 py-2 bg-indigo-600 hover:bg-indigo-500 text-white rounded-lg transition-colors font-medium text-sm disabled:opacity-50",children:[F?t.jsx(g,{className:"h-4 w-4 animate-spin"}):t.jsx(u,{className:"h-4 w-4"}),"New Template"]})]}),(L.length>0||P)&&t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(j,{className:"h-4 w-4 text-indigo-400"}),t.jsx("h2",{className:"text-sm font-semibold text-gray-300",children:"System Presets"}),t.jsx("span",{className:"text-xs text-gray-500",children:"— quick-start configurations"})]}),t.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:L.map(e=>{const s=e.templateData||{},a=w(s.signupConfig?.roles||[]),i=C(s.durationMinutes),l=s.typeData?.difficulty;return t.jsxs("div",{className:"glass-card p-4 border border-indigo-500/20 hover:border-indigo-500/40 transition-colors",children:[t.jsxs("div",{className:"flex items-start justify-between mb-2",children:[t.jsx("h3",{className:"text-white font-medium text-sm truncate pr-2",children:e.name}),t.jsx(x,{type:e.eventType})]}),t.jsxs("div",{className:"space-y-1 mb-3",children:[l&&t.jsx(p,{difficulty:l}),a&&t.jsx("p",{className:"text-xs text-gray-400",children:a}),i&&t.jsxs("p",{className:"text-xs text-gray-500 flex items-center gap-1",children:[t.jsx(y,{className:"h-3 w-3"}),i]}),e.description&&!a&&t.jsx("p",{className:"text-xs text-gray-400 line-clamp-2",children:e.description})]}),t.jsxs("button",{onClick:()=>(async e=>{R(e.id);try{const t=await M({name:e.name,eventType:e.eventType,description:e.description,templateData:e.templateData});T.success("Preset added to your templates"),k(`/events/new?template=${t.template?.id}`)}catch{T.error("Failed to use preset")}finally{R(null)}})(e),disabled:K===e.id,className:"flex items-center gap-1 px-3 py-1.5 text-xs font-medium text-indigo-400 hover:text-indigo-300 bg-indigo-500/10 hover:bg-indigo-500/20 rounded-md transition-colors disabled:opacity-50",children:[K===e.id?t.jsx(g,{className:"h-3 w-3 animate-spin"}):t.jsx(f,{className:"h-3 w-3"}),"Use"]})]},e.id)})})]}),$.length>0&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(c,{className:"h-4 w-4 text-gray-400"}),t.jsx("h2",{className:"text-sm font-semibold text-gray-300",children:"Your Templates"})]}),E&&t.jsxs("div",{className:"glass-card p-4 border-red-500/30 text-red-400 text-sm",children:["Failed to load templates: ",E.message]}),D?t.jsx("div",{className:"flex justify-center py-12",children:t.jsx(g,{className:"h-8 w-8 text-indigo-400 animate-spin"})}):0===$.length?t.jsxs("div",{className:"glass-card p-12 text-center",children:[t.jsx(c,{className:"h-12 w-12 text-gray-600 mx-auto mb-4"}),t.jsx("p",{className:"text-gray-400 mb-2",children:"No templates yet"}),t.jsx("p",{className:"text-gray-500 text-sm",children:"Create a template to quickly set up recurring events"})]}):t.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:t.jsx(d,{children:$.map((e,s)=>{const a=h[e.eventType]||"border-l-gray-500",i=V===e.id;return t.jsxs(o.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,scale:.95},transition:{delay:.05*s},className:`glass-card relative overflow-hidden border-l-4 ${a} transition-colors group`,onMouseEnter:()=>Y(e.id),onMouseLeave:()=>Y(null),children:[t.jsxs("div",{className:"p-5",children:[t.jsxs("div",{className:"flex items-start justify-between mb-2",children:[t.jsx("h3",{className:"text-white font-semibold truncate pr-2",children:e.title||e.name}),t.jsx(x,{type:e.eventType})]}),(()=>{const s=e.templateData||{},a=w(s.signupConfig?.roles),i=s.typeData?.difficulty,l=s.typeData?.raidName,n=C(s.durationMinutes),r=function(e){if(!e)return null;const t=Date.now()-new Date(e).getTime(),s=Math.floor(t/864e5);return 0===s?"Today":1===s?"1 day ago":s<30?`${s} days ago`:`${Math.floor(s/30)}mo ago`}(e.lastUsedAt),o=e.useCount||0;return t.jsxs("div",{className:"space-y-1.5 mb-3",children:[(i||l)&&t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[i&&t.jsx(p,{difficulty:i}),l&&t.jsx("span",{className:"text-xs text-gray-400",children:l})]}),a&&t.jsx("p",{className:"text-xs text-gray-400",children:a}),t.jsxs("div",{className:"flex items-center gap-3 text-xs text-gray-500",children:[n&&t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(y,{className:"h-3 w-3"}),n]}),o>0&&t.jsxs("span",{children:["Used ",o,"×",r?` · ${r}`:""]})]}),!i&&!a&&e.description&&t.jsx("p",{className:"text-gray-400 text-sm line-clamp-2",children:e.description})]})})()]}),t.jsxs("div",{className:"flex items-center gap-2 px-5 pb-4 lg:hidden",children:[t.jsxs("button",{onClick:()=>k(`/events/new?template=${e.id}`),className:"flex items-center gap-1.5 px-3 py-2 min-h-[44px] text-xs font-medium text-indigo-400 bg-indigo-500/10 hover:bg-indigo-500/20 rounded-lg transition-colors flex-1 justify-center",children:[t.jsx(f,{className:"h-4 w-4"}),"Use"]}),t.jsxs("button",{onClick:()=>k(`/event-templates/${e.id}/edit`),className:"flex items-center gap-1.5 px-3 py-2 min-h-[44px] text-xs font-medium text-gray-300 bg-white/5 hover:bg-white/10 rounded-lg transition-colors flex-1 justify-center",children:[t.jsx(N,{className:"h-4 w-4"}),"Edit"]}),t.jsxs("button",{onClick:()=>z(e),disabled:B===e.id,className:"flex items-center gap-1.5 px-3 py-2 min-h-[44px] text-xs font-medium text-gray-300 bg-white/5 hover:bg-white/10 rounded-lg transition-colors disabled:opacity-50 flex-1 justify-center",children:[B===e.id?t.jsx(g,{className:"h-4 w-4 animate-spin"}):t.jsx(b,{className:"h-4 w-4"}),"Clone"]}),t.jsx("button",{onClick:()=>G(e.id),disabled:q===e.id,className:"flex items-center gap-1.5 px-3 py-2 min-h-[44px] text-xs font-medium text-red-400 bg-red-500/10 hover:bg-red-500/20 rounded-lg transition-colors disabled:opacity-50",children:q===e.id?t.jsx(g,{className:"h-4 w-4 animate-spin"}):t.jsx(v,{className:"h-4 w-4"})})]}),t.jsx(d,{children:i&&t.jsxs(o.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:"absolute inset-0 bg-gray-900/80 backdrop-blur-xs hidden lg:flex items-center justify-center gap-3 p-4",children:[t.jsxs("button",{onClick:()=>k(`/events/new?template=${e.id}`),className:"flex flex-col items-center gap-1.5 px-4 py-3 text-xs font-medium text-indigo-400 hover:text-indigo-300 bg-indigo-500/10 hover:bg-indigo-500/20 rounded-lg transition-colors",children:[t.jsx(f,{className:"h-4 w-4"}),"Use"]}),t.jsxs("button",{onClick:()=>k(`/event-templates/${e.id}/edit`),className:"flex flex-col items-center gap-1.5 px-4 py-3 text-xs font-medium text-gray-300 hover:text-white bg-white/5 hover:bg-white/10 rounded-lg transition-colors",children:[t.jsx(N,{className:"h-4 w-4"}),"Edit"]}),t.jsxs("button",{onClick:()=>z(e),disabled:B===e.id,className:"flex flex-col items-center gap-1.5 px-4 py-3 text-xs font-medium text-gray-300 hover:text-white bg-white/5 hover:bg-white/10 rounded-lg transition-colors disabled:opacity-50",children:[B===e.id?t.jsx(g,{className:"h-4 w-4 animate-spin"}):t.jsx(b,{className:"h-4 w-4"}),"Clone"]}),t.jsxs("button",{onClick:()=>G(e.id),disabled:q===e.id,className:"flex flex-col items-center gap-1.5 px-4 py-3 text-xs font-medium text-red-400 hover:text-red-300 bg-red-500/10 hover:bg-red-500/20 rounded-lg transition-colors disabled:opacity-50",children:[q===e.id?t.jsx(g,{className:"h-4 w-4 animate-spin"}):t.jsx(v,{className:"h-4 w-4"}),"Delete"]})]})})]},e.id)})})})]})};export{k as default};

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.