PageSourceSearch

https://kanalpha-centrale-5659.taskade.app/chunks/CompletedTasksView-BSZWZOWZ.js

js kanalpha-centrale-5659.taskade.app collected 2026-10-03 15:02:27 UTC 9,556 bytes, 2 lines download raw bytes

1var __IMPORT_META_ENV={};var __PROCESS_ENV={NODE_ENV:"production"};
2import{a as x}from"/chunks/chunk-LA4EZWJM.js";import"/chunks/chunk-45LSLLSF.js";import{b as G}from"/chunks/chunk-NB3D5TSC.js";import{b as K}from"/chunks/chunk-DP67E3KD.js";import{a as _,c as j}from"/chunks/chunk-64B44DNV.js";import{a as A}from"/chunks/chunk-A6NSEO7N.js";import"/chunks/chunk-QK5GDHFF.js";import{Bl as J,Kf as y,Se as F,VB as N,Zg as U,_p as S,cC as E,hf as B,mf as L}from"/chunks/chunk-5XO7YT7G.js";import{b as R,e as M,f as O}from"/chunks/chunk-Q5GT4ESH.js";import"/chunks/chunk-CL4HBHDB.js";import"/chunks/chunk-PE5MZRD7.js";import{a as oe}from"/chunks/chunk-2F2XG2RD.js";import"/chunks/chunk-QLZURSYN.js";import"/chunks/chunk-WCEWIOOT.js";import{d as w}from"/chunks/chunk-43M3N6VY.js";var d=w(oe());var e=w(A()),V="g_done_sections",q="g_done_proj_filter";function z(){try{return JSON.parse(localStorage.getItem(V)||"{}")}catch{return{}}}function re(n,o){try{let r=z();r[n]=o,localStorage.setItem(V,JSON.stringify(r))}catch{}}function ae(n){let o=z();return n in o?o[n]:!1}function se(){try{return localStorage.getItem(q)||""}catch{return""}}function ie(n){try{localStorage.setItem(q,n)}catch{}}function le(n){if(!n)return"";let o=new Date(n);if(isNaN(o.getTime()))return"";let r=Date.now()-o.getTime(),i=Math.floor(r/6e4),l=Math.floor(r/36e5),u=Math.floor(r/864e5);return i<1?"A l'instant":i<60?`il y a ${i}min`:l<24?`il y a ${l}h`:u===1?"Hier":u<7?`il y a ${u}j`:o.toLocaleDateString("fr-FR",{day:"numeric",month:"short"})}function ce(n,o){if(!n||!o)return null;let r=Math.round((new Date(n).getTime()-new Date(o).getTime())/864e5);return r<-1?{label:`${Math.abs(r)}j d'avance`,late:!1}:r>1?{label:`${r}j de retard`,late:!0}:{label:"Dans les temps",late:!1}}function C({sectionKey:n,title:o,count:r,color:i,right:l,children:u}){let[p,b]=(0,d.useState)(()=>ae(n)),m=(0,d.useCallback)(()=>{b(a=>(re(n,!a),!a))},[n]);return(0,e.jsxs)("div",{children:[(0,e.jsxs)("button",{onClick:m,className:"flex items-center gap-2 w-full py-1 group",children:[i&&(0,e.jsx)("div",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:i}}),(0,e.jsx)("span",{className:"text-xs font-medium text-muted-foreground group-hover:text-foreground transition-colors truncate",children:o}),(0,e.jsxs)("span",{className:"text-[10px] text-muted-foreground/40",children:["(",r,")"]}),(0,e.jsx)("div",{className:"flex-1 h-px bg-border/20 mx-1"}),l&&(0,e.jsx)("span",{onClick:a=>a.stopPropagation(),children:l}),p?(0,e.jsx)(L,{className:"w-3 h-3 text-muted-foreground/40 shrink-0"}):(0,e.jsx)(B,{className:"w-3 h-3 text-muted-foreground/40 shrink-0"})]}),(0,e.jsx)(_,{initial:!1,children:p&&(0,e.jsx)(j.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.18,ease:"easeInOut"},className:"overflow-hidden",children:(0,e.jsx)("div",{className:"space-y-1 pb-2",children:u})})})]})}function k({icon:n,label:o,value:r,sub:i}){return(0,e.jsxs)("div",{className:"flex flex-col gap-0.5 px-3 py-2.5 rounded-xl bg-muted/20 border border-border/30",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1.5 text-muted-foreground",children:[(0,e.jsx)(n,{className:"w-3 h-3 shrink-0"}),(0,e.jsx)("span",{className:"text-[10px] font-medium truncate",children:o})]}),(0,e.jsx)("span",{className:"text-lg font-bold tabular-nums leading-none",children:r}),i&&(0,e.jsx)("span",{className:"text-[9px] text-muted-foreground/50 truncate",children:i})]})}function de({done:n,projName:o}){let r=Date.now(),i=n.filter(a=>a.doneAt&&r-new Date(a.doneAt).getTime()<864e5).length,l=n.filter(a=>a.doneAt&&r-new Date(a.doneAt).getTime()<6048e5).length,u=n.filter(a=>a.doneAt&&r-new Date(a.doneAt).getTime()<2592e6).length,p=n.filter(a=>a.due&&a.doneAt),b=p.filter(a=>new Date(a.doneAt)<=new Date(a.due)).length,m=p.length>0?Math.round(b/p.length*100):null;return(0,e.jsx)(C,{sectionKey:"done_stats",title:o?`Stats \u2014 ${o}`:"Stats \u2014 tous projets",count:n.length,children:(0,e.jsxs)("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 pt-1",children:[(0,e.jsx)(k,{icon:y,label:"Total",value:n.length}),(0,e.jsx)(k,{icon:U,label:"Aujourd'hui",value:i,sub:`${l} sem \xB7 ${u} mois`}),m!==null?(0,e.jsx)(k,{icon:E,label:"Dans les temps",value:`${m}%`,sub:`${p.length} avec echeance`}):(0,e.jsx)(k,{icon:F,label:"Cette semaine",value:l,sub:`${u} ce mois`})]})})}function H({task:n,onDelete:o,deleting:r}){let i=ce(n.doneAt,n.due),l=le(n.doneAt);return(0,e.jsxs)(j.div,{layout:!0,initial:{opacity:0,y:-4}
2,animate:{opacity:1,y:0},exit:{opacity:0,x:-20,transition:{duration:.15}},className:"group flex items-center gap-2.5 px-3 py-2 rounded-xl border border-border/15 bg-muted/10 hover:bg-muted/20 transition-all",children:[(0,e.jsx)("div",{className:"w-4 h-4 rounded-full bg-emerald-500/15 border border-emerald-500/30 flex items-center justify-center shrink-0",children:(0,e.jsx)(y,{className:"w-2.5 h-2.5 text-emerald-500"})}),(0,e.jsx)("span",{className:"flex-1 text-sm text-muted-foreground/70 line-through truncate",children:n.title}),(0,e.jsxs)("div",{className:"flex items-center gap-1.5 shrink-0",children:[i&&(0,e.jsx)("span",{className:K("text-[9px] px-1.5 py-0.5 rounded-full hidden sm:block",i.late?"bg-red-500/10 text-red-400":"bg-emerald-500/10 text-emerald-600"),children:i.label}),l&&(0,e.jsx)("span",{className:"text-[9px] text-muted-foreground/35 hidden sm:block",children:l})]}),(0,e.jsx)("button",{onClick:o,disabled:r,className:"opacity-0 group-hover:opacity-100 p-1 rounded-lg text-muted-foreground/30 hover:text-red-400 hover:bg-red-500/10 transition-all disabled:opacity-40",title:"Supprimer",children:r?(0,e.jsx)(S,{className:"w-3.5 h-3.5 animate-spin"}):(0,e.jsx)(N,{className:"w-3.5 h-3.5"})})]})}function ue(){let n=x(t=>t.tasks),o=x(t=>t.projects),r=x(t=>t.bulkDeleteTasks),i=x(t=>t.deleteTask),[l,u]=(0,d.useState)(null),[p,b]=(0,d.useState)(!1),[m,a]=(0,d.useState)(se),D=G(),Q=M(),W=R(),T=O(),I=t=>t===Q||t===W||!!T&&t===T,g=(0,d.useMemo)(()=>n.filter(t=>!t.parentId&&t.status==="ts-done"&&(I(t.ownerId)||I(t.assigneeId))).sort((t,s)=>(s.doneAt||s.createdAt||"").localeCompare(t.doneAt||t.createdAt||"")),[n]),P=(0,d.useMemo)(()=>{let t=new Set(g.map(s=>s.projectId).filter(Boolean));return o.filter(s=>t.has(s.id))},[g,o]),X=P.length>1,h=(0,d.useMemo)(()=>m?g.filter(t=>t.projectId===m):g,[g,m]),Y=m?o.find(t=>t.id===m)?.name??null:null,v=(0,d.useMemo)(()=>{let t=[],s={};return h.forEach(c=>{if(!c.projectId){t.push(c);return}s[c.projectId]||(s[c.projectId]=[]),s[c.projectId].push(c)}),{noProj:t,byProj:s}},[h]),$=async t=>{u(t),await i(t),u(null)},Z=async()=>{let t=h.length;await D({title:"Supprimer les taches terminees",message:`${t} tache${t>1?"s":""} terminee${t>1?"s":""} sera${t>1?"ont":""} supprimee${t>1?"s":""} definitivement.`,confirmLabel:"Supprimer",danger:!0})&&(b(!0),await r(h.map(c=>c.id)),b(!1))},ee=t=>{a(t),ie(t)};return g.length===0?(0,e.jsxs)("div",{className:"text-center py-16 space-y-2",children:[(0,e.jsx)(y,{className:"w-10 h-10 text-muted-foreground/15 mx-auto"}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Aucune tache terminee"}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground/35",children:"Les taches completees apparaitront ici"})]}):(0,e.jsxs)("div",{className:"space-y-3",children:[X&&(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(J,{className:"w-3.5 h-3.5 text-muted-foreground/50 shrink-0"}),(0,e.jsxs)("select",{value:m,onChange:t=>ee(t.target.value),className:"flex-1 bg-muted/20 border border-border/30 rounded-lg px-2.5 py-1.5 text-xs outline-none",children:[(0,e.jsxs)("option",{value:"",children:["Tous les projets (",g.length,")"]}),P.map(t=>(0,e.jsxs)("option",{value:t.id,children:[t.name," (",g.filter(s=>s.projectId===t.id).length,")"]},t.id)),g.some(t=>!t.projectId)&&(0,e.jsxs)("option",{value:"__none__",children:["Sans projet (",g.filter(t=>!t.projectId).length,")"]})]})]}),(0,e.jsx)(de,{done:h,projName:Y}),(0,e.jsxs)("div",{className:"flex items-center justify-between pt-1",children:[(0,e.jsxs)("span",{className:"text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:"font-semibold text-foreground",children:h.length})," ","tache",h.length>1?"s":""," terminee",h.length>1?"s":""]}),h.length>0&&(0,e.jsxs)("button",{onClick:Z,disabled:p,className:"flex items-center gap-1.5 px-2.5 py-1 rounded-lg text-xs text-red-500/70 hover:text-red-500 hover:bg-red-500/10 transition-colors disabled:opacity-40 font-medium",children:[p?(0,e.jsx)(S,{className:"w-3 h-3 animate-spin"}):(0,e.jsx)(N,{className:"w-3 h-3"}),"Tout supprimer"]})]}),(0,e.jsxs)("div",{className:"space-y-2",children:[v.noProj.length>0&&(0,e.jsx)(C,{sectionKey:"done_noproj",title:"Sans projet",count:v.noProj.length,children:v.noProj.map(t=>(0,e.jsx)(H,{task:t,onDelete:()=>$(t.id),deleting:l===t.id},t.id))}),Object.entries(v.byProj).map(([t,s])=>{let c=o.find(f=>f.id===t),te=async()=>{let f=s.length;await D({title:c?.name||"Projet",message:`Supprimer ${f} tache${f>1?"s":""} terminee${f>1?"s":""} de ce projet ?`,confirmLabel:"Supprimer",danger:!0})&&await r(s.map(ne=>ne.id))};return(0,e.jsx)(C,{sectionKey:`done_proj_${t}`,title:c?.name||"Projet",count:s.length,color:c?.color,right:(0,e.jsx)("button",{onClick:te,className:"p-1 rounded text-red-400/50 hover:text-red-400 hover:bg-red-500/10 transition-colors",title:"Supprimer ce groupe",children:(0,e.jsx)(N,{className:"w-2.5 h-2.5"})}),children:s.map(f=>(0,e.jsx)(H,{task:f,onDelete:()=>
2$(f.id),deleting:l===f.id},f.id))},t)})]})]})}export{ue 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.