PageSourceSearch

https://loopmind-workspace.lovable.app/assets/Tasks-C4ISNeym.js

js loopmind-workspace.lovable.app collected 2026-10-03 03:32:01 UTC 10,724 bytes, 1 lines download raw bytes

1import{j as e,r as i}from"./query-DOYoFW5m.js";import{u as ce,a as de,b as ue}from"./react-vendor-CHk1VZ_f.js";import{a0 as S,a1 as P,a2 as M,a3 as A,a4 as n,B as k,a5 as me,I as he,a6 as pe,a7 as xe,a8 as je,t as ge,H as fe,K as ke,r as Ce,z as ve,g as G,S as y}from"./index-XeehUy3B.js";import{u as Ne}from"./index-DvcAZRba.js";import{E as J}from"./empty-state-DPePf_jc.js";import{C as we,D as ye,U as _e}from"./DeleteTaskDialog-Bz9AEVAr.js";import{S as X}from"./search-BvX2DGOZ.js";import{u as K}from"./useMountEffect-C0LQBz6l.js";import{P as W}from"./plus-DGG5K7F6.js";import{F as be}from"./folder-open-BNBzF8-e.js";import"./supabase-B2hP58mJ.js";import"./isSameDay-68FM885B.js";import"./useClientMembers-YvW-OK_x.js";import"./circle-x-ZzOZeZk6.js";import"./circle-alert-BTpcICbA.js";import"./clock-Dk88mId6.js";import"./repeat-BC2sDaGv.js";import"./ellipsis-vertical-C-v72US0.js";import"./trash-2-4hbopZgb.js";import"./ToolExecutionIndicator-NAGesp2U.js";import"./circle-check-big-CwuUFV3s.js";import"./StreamingMessage-DLevUOGO.js";import"./markdown-bi9VQe19.js";import"./send-ECp6VnDS.js";import"./confirm-dialog-C3VjzTVY.js";import"./alert-dialog-B9y1SQCJ.js";import"./triangle-alert-Wm9adOVQ.js";const Te=({filters:l,onFiltersChange:c,projects:d,onClearFilters:C,hasActiveFilters:u})=>{const _=r=>{c({...l,project_id:r==="all"?void 0:r,offset:0})},g=r=>{c({...l,status:r,include_completed:r==="completed"||r==="cancelled"||r==="failed",offset:0})},D=r=>{c({...l,priority:r,offset:0})},v=r=>{c({...l,task_source:r==="all"?void 0:r,offset:0})},h=r=>{c({...l,search:r||void 0,offset:0})},f=()=>{c({...l,assigned_by_me:!l.assigned_by_me,offset:0})};return e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsxs(S,{value:l.project_id||"all",onValueChange:_,children:[e.jsx(P,{className:"w-[180px]",children:e.jsx(M,{placeholder:"All Projects"})}),e.jsxs(A,{children:[e.jsx(n,{value:"all",children:"All"}),e.jsx(n,{value:"personal",children:"Personal Tasks"}),d.map(r=>e.jsx(n,{value:r.id,children:r.name},r.id))]})]}),e.jsxs(S,{value:l.status||"all",onValueChange:g,children:[e.jsx(P,{className:"w-[180px]",children:e.jsx(M,{placeholder:"All Status"})}),e.jsxs(A,{children:[e.jsx(n,{value:"all",children:"All Status"}),e.jsx(n,{value:"needs_review",children:"Needs review"}),e.jsx(n,{value:"awaiting_action",children:"Action Required"}),e.jsx(n,{value:"pending",children:"Pending"}),e.jsx(n,{value:"in_progress",children:"In Progress"}),e.jsx(n,{value:"awaiting_approval",children:"Awaiting Approval"}),e.jsx(n,{value:"paused",children:"Paused"}),e.jsx(n,{value:"completed",children:"Completed"}),e.jsx(n,{value:"failed",children:"Failed"}),e.jsx(n,{value:"cancelled",children:"Cancelled"})]})]}),e.jsxs(S,{value:l.priority||"all",onValueChange:D,children:[e.jsx(P,{className:"w-[150px]",children:e.jsx(M,{placeholder:"All Priority"})}),e.jsxs(A,{children:[e.jsx(n,{value:"all",children:"All Priority"}),e.jsx(n,{value:"urgent",children:"Urgent"}),e.jsx(n,{value:"high",children:"High"}),e.jsx(n,{value:"medium",children:"Medium"}),e.jsx(n,{value:"low",children:"Low"})]})]}),e.jsxs(S,{value:l.task_source||"all",onValueChange:v,children:[e.jsx(P,{className:"w-[150px]",children:e.jsx(M,{placeholder:"All Sources"})}),e.jsxs(A,{children:[e.jsx(n,{value:"all",children:"All Sources"}),e.jsx(n,{value:"scheduled",children:"Recurring"}),e.jsx(n,{value:"chat",children:"From Chat"}),e.jsx(n,{value:"workflow_trigger",children:"Workflow"}),e.jsx(n,{value:"task_page",children:"Manual"})]})]}),e.jsxs(k,{variant:l.assigned_by_me?"default":"outline",size:"sm",onClick:f,className:"gap-1.5 h-10",children:[e.jsx(me,{className:"h-4 w-4"}),"Assigned by me"]}),e.jsxs("div",{className:"relative flex-1 min-w-[200px] max-w-[300px]",children:[e.jsx(X,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(he,{placeholder:"Search tasks...",value:l.search||"",onChange:r=>h(r.target.value),className:"pl-9"})]}),u&&e.jsxs(k,{variant:"ghost",size:"sm",onClick:C,className:"gap-1",children:[e.jsx(pe,{className:"h-4 w-4"}),"Clear"]})]})},Se=400,Pe=()=>e.jsx("div",{className:"rounded-lg border bg-card p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(y,{className:"h-5 w-5 rounded"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx(y,{className:"h-5 w-3/4"}),e.jsx(y,{className:"h-4 w-1/2"}),e.jsxs("div",{className:"flex gap-2 pt-2",children:[e.jsx(y,{className:"h-5 w-16 rounded-full"}),e.jsx(y,{className:"h-5 w-20 rounded-full"})]})]})]})}),Y=i.memo(({task:l,onClick:c,onCancel:d,onRequestDelete:C,onPriorityChange:u})=>e.jsx(_e,{task:l,onClick:c,onCancel:d,onRequestDelete:C,onPriorityChange:u}));Y.displayName="MemoizedTaskCard";const ts=()=>{const l=ce(),c=de(),[d,C]=ue();i.useEffect(()=>{const s=d.get("task_id");if(s){const o=d.get("step"),p=o?`/tasks/${s}?step=${o}`:`/tasks/${s}`;l(p,{replace:!0})}},[]);const{tasks:u,isLoading:_,isLoadingMore:g,totalCount:D,hasMore:v,loadTasks:h,refreshTasks:f,loadMoreTasks:r,cancelTask:q,deleteTask:z,updateTaskPriority:V}=xe(),{projects:B}=je(),[Q,b]=i.useState(!1),[a,R]=i.useState(()=>{const s=d.get("status"),o=d.get("priority"),p=d.get("project_id"),t={};return s&&(t.status=s),o&&(t.priority=o),p&&(t.project_id=p),t}),[Z,ee]=i.useState(new Set),[E,se]=i.useState(null),[$,L]=i.useState(null),{ref:ae,inView:te}=Ne({threshold:0,rootMargin:"100px"}),N=i.useRef(null),U=i.useCallback(()=>{N.current&&clearTimeout(N.current),N.current=setTimeout(()=>{f(a)},1e3)},[f,a]);K(()=>()=>{N.current&&clearTimeout(N.current)}),ge({onTaskCreated:U,onTaskUpdated:U,onTaskDeleted:U}),i.useEffect(()=>{const s=new URLSearchParams(d),o=(p,t)=>{t==null||t===""||t==="all"||t===!1?s.delete(p):s.set(p,String(t))};o("status",a.status),o("priority",a.priority),o("project_id",a.project_id),s.toString()!==d.toString()&&C(s,{replace:!0})},[a.status,a.priority,a.project_id]),K(()=>{h(a)}),te&&v&&!g&&!_&&queueMicrotask(()=>r());const F=i.useCallback(s=>{if(s.search!==a.search){E&&clearTimeout(E);const o=setTimeout(()=>{R(s),h(s)},Se);se(o)}else R(s),h(s)},[a.search,E,h]),H=i.useCallback(()=>{R({}),h({})}
1,[h]),T=i.useMemo(()=>u.filter(s=>s.status==="awaiting_action"||s.pending_todos_count>0).length,[u]),I=i.useMemo(()=>!!(a.project_id||a.status&&a.status!=="all"||a.priority&&a.priority!=="all"||a.task_source||a.search||a.assigned_by_me),[a]),re=i.useCallback(s=>{const o=s.pending_todo_step_id?`?step=${s.pending_todo_step_id}`:"";l(`/tasks/${s.id}${o}`,{state:{returnTo:c.pathname+c.search}})},[l,c.pathname,c.search]),ne=i.useCallback(async s=>{await q(s)},[q]),le=i.useCallback(async(s,o)=>{await V(s,o)},[V]),oe=i.useCallback(async s=>{await z(s)},[z]),ie=i.useCallback(s=>{f(a),b(!1),l(`/tasks/${s}`)},[f,a,l]),O=i.useMemo(()=>B.map(s=>({id:s.id,name:s.name||s.subject||""})),[B]);return e.jsxs(e.Fragment,{children:[e.jsxs(fe,{children:[e.jsx("title",{children:"Tasks | LoopMind AI"}),e.jsx("meta",{name:"description",content:"Manage all your tasks across projects in one unified view"})]}),e.jsxs("div",{className:"space-y-6 animate-fade-in",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-3xl font-bold tracking-tight",children:"Tasks"}),(T>0||a.status==="needs_review")&&e.jsx("button",{type:"button","data-testid":"needs-review-chip",onClick:()=>F({...a,status:a.status==="needs_review"?"all":"needs_review",offset:0}),className:`text-sm mt-1 rounded-full px-2.5 py-0.5 border transition-colors ${a.status==="needs_review"?"bg-orange-100 border-orange-300 text-orange-700 dark:bg-orange-950 dar
1k:border-orange-800 dark:text-orange-300":"border-transparent text-orange-600 hover:bg-orange-50 dark:hover:bg-orange-950/50"}`,children:a.status==="needs_review"?"Showing tasks needing review — clear":`${T} task${T>1?"s":""} require${T===1?"s":""} your action`})]}),e.jsxs(k,{onClick:()=>b(!0),className:"gap-2",children:[e.jsx(W,{className:"h-4 w-4"}),"New Task"]})]}),e.jsx(Te,{filters:a,onFiltersChange:F,projects:O,onClearFilters:H,hasActiveFilters:I}),e.jsx("div",{className:"grid gap-4",children:_&&u.length===0?e.jsx("div",{className:"space-y-3",children:[...Array(5)].map((s,o)=>e.jsx(Pe,{},o))}):u.length===0?I?e.jsx(J,{icon:X,title:"No tasks match your filters",description:"Try adjusting your filters or search query.",action:e.jsx(k,{variant:"outline",onClick:H,children:"Clear filters"})}):e.jsx(J,{icon:ke,title:"No tasks yet",description:"Create your first task to get started",action:e.jsxs(k,{onClick:()=>b(!0),className:"gap-2",children:[e.jsx(W,{className:"h-4 w-4"}),"Create Task"]})}):e.jsxs("div",{className:"space-y-6",children:[(()=>{const s=new Map,o="__none__";return u.forEach(t=>{var w;const m=t.project_id||o;if(!s.has(m)){const j=t.project_name||((w=O.find(x=>x.id===m))==null?void 0:w.name)||null;s.set(m,{name:j||"No Project",tasks:[]})}s.get(m).tasks.push(t)}),[...s.entries()].sort(([t],[m])=>t===o?1:m===o?-1:s.get(t).name.localeCompare(s.get(m).name)).map(([t,m])=>{const w=Z.has(t);return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("button",{onClick:()=>ee(j=>{const x=new Set(j);return x.has(t)?x.delete(t):x.add(t),x}),className:"flex items-center gap-2 px-1 w-full sticky top-0 bg-background/95 backdrop-blur-sm z-10 py-2 border-b border-border/50 hover:bg-accent/50 rounded-sm transition-colors",children:[w?e.jsx(Ce,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(ve,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(be,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:m.name}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",m.tasks.length,")"]})]}),!w&&e.jsx("div",{className:"space-y-3 pl-1",children:m.tasks.map(j=>e.jsx(Y,{task:j,onClick:()=>re(j),onCancel:ne,onRequestDelete:x=>L(x),onPriorityChange:le},j.id))})]},t)})})(),e.jsx("div",{ref:ae,className:"h-1"}),g&&e.jsx("div",{className:"flex justify-center py-4",children:e.jsx(G,{className:"h-6 w-6 animate-spin text-muted-foreground"})}),!v&&u.length>0&&e.jsx("p",{className:"text-center text-muted-foreground py-4 text-sm",children:"You've reached the end"}),e.jsxs("div",{className:"flex items-center justify-between pt-2 pb-4 text-sm text-muted-foreground border-t mt-4",children:[e.jsxs("span",{children:["Showing ",u.length," of ",D," tasks"]}),v&&e.jsxs(k,{variant:"outline",size:"sm",onClick:r,disabled:g,children:[g&&e.jsx(G,{className:"h-4 w-4 animate-spin mr-2"}),"Load more"]})]})]})})]}),e.jsx(we,{open:Q,onOpenChange:b,projects:O,onTaskCreated:ie,onRefreshNeeded:()=>h(a)}),$&&e.jsx(ye,{taskTitle:$.title,onConfirm:async()=>{await oe($.id),L(null)},onCancel:()=>L(null)})]})};export{ts 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.