1import{a1 as v,r as i,e as y,j as e}from"./index-Y6zZQBsM.js";import{P as j}from"./plus-_vozEkaL.js";import{S as N}from"./search-Dq5PdTYU.js";import{F as w}from"./folder-kanban-B1R0zAoD.js";import{T as F}from"./triangle-alert-BpoKkbm5.js";import{A as C}from"./arrow-right-BhQXg6tb.js";const k=["Planning","Active","Waiting","At Risk","Complete","Archived"],P=["Low","Medium","High","Critical"];function W(){const{user:r}=v(),[o,a]=i.useState([]),[l,d]=i.useState(!0),[x,c]=i.useState(!1),[n,g]=i.useState("all"),[s,h]=i.useState("");i.useEffect(()=>{m()},[]);async function m(){d(!0);try{const t=await y.entities.Project.list("-updated_date",100);a(t.filter(u=>!u.archived))}catch{a([])}finally{d(!1)}}const b=o.filter(t=>{var u,p;if(n!=="all"&&t.status!==n)return!1;if(s){const f=s.toLowerCase();if(!((u=t.name)!=null&&u.toLowerCase().includes(f))&&!((p=t.objective)!=null&&p.toLowerCase().includes(f)))return!1}return!0});return e.jsxs("div",{className:"space-y-4 max-w-5xl",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-[#051D70]",style:{fontFamily:"'Rubik', sans-serif"},children:"Projects"}),e.jsx("p",{className:"text-sm text-gray-500 mt-0.5",children:"Multi-step initiatives: albums, campaigns, launches, partnerships."})]}),e.jsxs("button",{onClick:()=>c(!0),className:"flex items-center gap-1.5 bg-[#FF1F53] text-white px-4 py-2 rounded-full text-sm font-semibold hover:opacity-90 transition-opacity",children:[e.jsx(j,{className:"w-4 h-4"})," New Project"]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(N,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),e.jsx("input",{type:"text",placeholder:"Search projects...",value:s,onChange:t=>h(t.target.value),className:"w-full pl-9 pr-4 py-2.5 rounded-xl border border-gray-200 text-sm focus:outline-none focus:border-[#2FC7FF]"})]}),e.jsxs("select",{value:n,onChange:t=>g(t.target.value),className:"px-3 py-2.5 rounded-xl border border-gray-200 text-sm font-medium text-gray-600 focus:outline-none focus:border-[#2FC7FF]",children:[e.jsx("option",{value:"all",children:"All Statuses"}),k.filter(t=>t!=="Archived").map(t=>e.jsx("option",{value:t,children:t},t))]})]}),l?e.jsx("div",{className:"space-y-3",children:[1,2,3].map(t=>e.jsx("div",{className:"h-24 bg-white rounded-2xl border border-gray-200 animate-pulse"},t))}):b.length===0?e.jsxs("div",{className:"bg-white rounded-2xl border border-gray-200 p-10 text-center",children:[e.jsx(w,{className:"w-10 h-10 text-gray-300 mx-auto mb-3"}),e.jsx("p",{className:"text-sm text-gray-500 font-medium",children:"No projects yet"}),e.jsx("p",{className:"text-xs text-gray-400 mt-1.5 max-w-sm mx-auto mb-4",children:"Use Projects for multi-step work such as album releases, campaigns, website improvements, and major event initiatives."}),e.jsxs("button",{onClick:()=>c(!0),className:"inline-flex items-center gap-1.5 bg-[#FF1F53] text-white px-4 py-2 rounded-full text-sm font-semibold hover:opacity-90 transition-opacity",children:[e.jsx(j,{className:"w-4 h-4"})," Create Project"]})]}):e.jsx("div",{className:"space-y-2.5",children:b.map(t=>e.jsx("div",{className:"bg-white rounded-2xl border border-gray-200 p-4 hover:shadow-sm transition-shadow",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("h3",{className:"font-bold text-[#051D70] text-sm",style:{fontFamily:"'Rubik', sans-serif"},children:t.name}),e.jsx("span",{className:"text-xs text-gray-400 bg-gray-100 px-2 py-0.5 rounded-full",children:t.project_type})]}),t.objective&&e.jsx("p",{className:"text-xs text-gray-500 mb-2 line-clamp-2",children:t.objective}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs",children:[e.jsx(A,{status:t.status}),e.jsx(_,{priority:t.priority}),t.target_date&&e.jsxs("span",{className:"text-gray-500",children:["Target: ",new Date(t.target_date).toLocaleDateString()]}),t.owner_name&&e.jsxs("span",{className:"text-gray-500",children:["Owner: ",t.owner_name]}),t.blocked&&e.jsxs("span",{className:"flex items-center gap-1 text-red-600 font-medium",children:[e.jsx(F,{className:"w-3 h-3"})," Blocked"]})]})]}),e.jsx(C,{className:"w-4 h-4 text-gray-300 flex-shrink-0 mt-1"})]})},t.id))}),x&&e.jsx(S,{onClose:()=>c(!1),onCreated:m,user:r})]})}function S({onClose:r,onCreated:o,user:a}){const[l,d]=i.useState({name:"",project_type:"Album Release",objective:"",priority:"Medium",target_date:"",owner_id:(a==null?void 0:a.id)||"",owner_name:(a==null?void 0:a.display_name)||(a==null?void 0:a.full_name)||""}),[x,c]=i.useState(!1),n=(s,h)=>d(m=>({...m,[s]:h}));async function g(){if(l.name.trim()){c(!0);try{await y.entities.Project.create({...l,status:"Planning"}),o(),r()}catch{c(!1)}}}return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4",children:e.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl max-w-lg w-full p-5",children:[e.jsx("h2",{className:"font-bold text-[#051D70] text-lg mb-4",style:{fontFamily:"'Rubik', sans-serif"},children:"New Project"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-semibold text-gray-500 mb-1 block",children:"Project Name *"}),e.jsx("input",{value:l.name,onChange:s=>n("name",s.target.value),className:"w-full px-3 py-2 rounded-lg border border-gray-200 text-sm focus:outline-none focus:border-[#2FC7FF]",placeholder:"e.g. Fall Album Release"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-semibold text-gray-500 mb-1 block",children:"Type"}
1),e.jsx("select",{value:l.project_type,onChange:s=>n("project_type",s.target.value),className:"w-full px-3 py-2 rounded-lg border border-gray-200 text-sm focus:outline-none focus:border-[#2FC7FF]",children:["Album Release","Video Release","Marketing Campaign","Merchandise Launch","Website Work","Partnership","Internal Project","Other"].map(s=>e.jsx("option",{children:s},s))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-semibold text-gray-500 mb-1 block",children:"Objective"}),e.jsx("textarea",{value:l.objective,onChange:s=>n("objective",s.target.value),rows:2,className:"w-full px-3 py-2 rounded-lg border border-gray-200 text-sm focus:outline-none focus:border-[#2FC7FF]",placeholder:"What does success look like?"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-semibold text-gray-500 mb-1 block",children:"Priority"}),e.jsx("select",{value:l.priority,onChange:s=>n("priority",s.target.value),className:"w-full px-3 py-2 rounded-lg border border-gray-200 text-sm focus:outline-none focus:border-[#2FC7FF]",children:P.map(s=>e.jsx("option",{children:s},s))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-semibold text-gray-500 mb-1 block",children:"Target Date"}),e.jsx("input",{type:"date",value:l.target_date,onChange:s=>n("target_date",s.target.value),className:"w-full px-3 py-2 rounded-lg border border-gray-200 text-sm focus:outline-none focus:border-[#2FC7FF]"})]})]})]}),e.jsxs("div",{className:"flex gap-2 mt-5",children:[e.jsx("button",{onClick:r,className:"flex-1 py-2.5 rounded-lg border border-gray-200 text-sm font-semibold text-gray-600 hover:bg-gray-50",children:"Cancel"}),e.jsx("button",{onClick:g,disabled:x||!l.name.trim(),className:"flex-1 py-2.5 rounded-lg bg-[#FF1F53] text-white text-sm font-semibold hover:opacity-90 disabled:opacity-50",children:x?"Creating...":"Create Project"})]})]})})}function A({status:r}){const o={Planning:"bg-gray-100 text-gray-600",Active:"bg-blue-100 text-blue-700",Waiting:"bg-indigo-100 text-indigo-700","At Risk":"bg-red-100 text-red-700",Complete:"bg-green-100 text-green-700",Archived:"bg-gray-100 text-gray-400"};return e.jsx("span",{className:`px-2 py-0.5 rounded-full text-xs font-semibold ${o[r]||"bg-gray-100 text-gray-600"}`,children:r})}function _({priority:r}){const o={Low:"text-gray-500",Medium:"text-blue-600",High:"text-amber-600",Critical:"text-red-600"};return e.jsx("span",{className:`font-semibold ${o[r]||"text-gray-500"}`,children:r})}export{W 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.