1import{k as e}from"./vendor-radix-D823uugn.js";import{l as Ae,r as n}from"./vendor-react-glauINiL.js";import{u as _,s as Oe,t as _e,l as Me,b as Ve,M as Le}from"./queries-DraX9nMg.js";import{u as D,c as Be,d as Ue,e as Fe,f as Ge,g as He,h as ze}from"./mutations-wrQUKwus.js";import{C as M,a as Y,b as ee,d as V}from"./card-DBYplX18.js";import{c as te,B as i,E as se,M as $e,g as Je}from"./index-B5h3Aqqi.js";import{I as m}from"./input-CV1FZFeV.js";import{P as qe,a as Ke,b as We}from"./popover-Ch186DEs.js";import{S as b,a as y,b as C,c as w,d as c}from"./select-8SvDOWqa.js";import{T as Qe,a as Ze,b as Xe,c as Ye}from"./tooltip-BRyUlXiy.js";import{t as es}from"./use-toast-BIsZ-81Z.js";import{P as xe}from"./report-languages-BtZpGDom.js";import{T as he}from"./trash-2-CrbG-3kR.js";import{P as ss}from"./pencil-Bgdkwo-A.js";import{U as ts}from"./user-CKVmCo0G.js";import{B as as}from"./briefcase-Bx3UtOW3.js";import{b as ns,f as rs}from"./format-DO6s8VpE.js";import{s as ls}from"./subDays-CnNSVamv.js";import{e as is}from"./endOfDay-CRpbwlQ7.js";import"./vendor-apollo-CQmIcWCv.js";import"./useIsomorphicLayoutEffect-DfcIdw78.js";import"./vendor-charts-ZOglVwNV.js";const cs=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],os=te("archive",cs);const ds=[["path",{d:"M10 12h4",key:"a56b0p"}],["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M14 21v-3a2 2 0 0 0-4 0v3",key:"1rgiei"}],["path",{d:"M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2",key:"secmi2"}],["path",{d:"M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16",key:"16ra0t"}]],ms=te("building-2",ds);const us=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],xs=te("lock",us),H=[{value:"#E5484D",label:"Red"},{value:"#E54666",label:"Pink"},{value:"#8E4EC6",label:"Purple"},{value:"#6E56CF",label:"Violet"},{value:"#3E63DD",label:"Blue"},{value:"#0091FF",label:"Sky"},{value:"#00A2C7",label:"Cyan"},{value:"#12A594",label:"Teal"},{value:"#30A46C",label:"Green"},{value:"#978365",label:"Sand"},{value:"#F76808",label:"Orange"},{value:"#FFAC00",label:"Amber"}];function hs({className:l}){return e.jsx("svg",{className:l,viewBox:"0 0 24 24","aria-hidden":"true",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M12 2.2a9.8 9.8 0 0 0-3.1 19.1c.49.09.67-.21.67-.47v-1.78c-2.7.59-3.27-1.15-3.27-1.15-.44-1.12-1.08-1.42-1.08-1.42-.88-.61.07-.6.07-.6.98.07 1.5 1.01 1.5 1.01.87 1.48 2.28 1.05 2.83.8.09-.63.34-1.05.61-1.29-2.15-.24-4.41-1.08-4.41-4.79 0-1.05.38-1.92 1-2.6-.1-.25-.43-1.23.1-2.56 0 0 .82-.26 2.67 1a9.2 9.2 0 0 1 4.86 0c1.85-1.26 2.66-1 2.66-1 .53 1.33.2 2.31.1 2.56.63.68 1 1.55 1 2.6 0 3.72-2.27 4.54-4.43 4.78.35.3.66.91.66 1.83v2.6c0 .26.18.57.68.47A9.8 9.8 0 0 0 12 2.2Z",fill:"currentColor"})})}function pe({value:l,defaultValue:E,onChange:x}){const h=E||1800,N=h>=3600&&h%3600===0,d=N?h/3600:h/60,R=N?"hr":"min",P=l?l>=3600&&l%3600===0:!1,T=l?P?l/3600:l/60:null,[p,L]=n.useState(T!==null?T.toString():""),[j,B]=n.useState(l?P?"hr":"min":R),u=(r,g)=>{if(!r){x(null);return}const f=parseFloat(r);if(isNaN(f)||f<=0){x(null);return}x(g==="hr"?f*3600:f*60)};return e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(Je,{className:"h-3 w-3 text-muted-foreground shrink-0"}),e.jsx(m,{type:"number",min:1,placeholder:d.toString(),value:p,onChange:r=>L(r.target.value),onBlur:()=>u(p,j),onKeyDown:r=>{r.key==="Enter"&&(r.preventDefault(),u(r.target.value,j))},className:"h-8 w-16 text-xs"}),e.jsxs(b,{value:j,onValueChange:r=>{const g=r;B(g),p&&u(p,g)},children:[e.jsx(y,{className:"h-8 text-xs w-20",children:e.jsx(C,{})}),e.jsxs(w,{children:[e.jsx(c,{value:"min",children:"min"}),e.jsx(c,{value:"hr",children:"hr"})]})]}),!p&&e.jsx("span",{className:"text-[10px] text-muted-foreground",children:"(default)"})]})}function Vs(){const l=Ae(),[E,x]=n.useState(!1),[h,N]=n.useState(!1),[d,R]=n.useState(null),[P,T]=n.useState(""),[p,L]=n.useState(H[0].value),[j,B]=n.useState(""),[u,r]=n.useState(""),[g,f]=n.useState(""),[z,$]=n.useState(""),[v,k]=n.useState([]),[I,J]=n.useState(""),[q,K]=n.useState("Default"),[U,je]=n.useState(""),[ae,ne]=n.useState(null),ge=n.useMemo(()=>ns(ls(new Date,30)),[]),fe=n.useMemo(()=>is(new Date),[]),{data:A,refetch:W}=_(_e,{variables:{recentDateFrom:ge,recentDateTo:fe,recentLimit:3},fetchPolicy:"network-only"}),{data:O,refetch:Q}=_(Me),{data:re}=_(Ve),{data:Z}=_(Le),{data:le}=_(Oe,{skip:!Z?.me?.githubConnected,fetchPolicy:"network-only"}),ie=Z?.me?.timePrecision||1800,ve=re?.usageStats?.usage?.projectCount??0,ce=re?.usageStats?.limits?.maxProjects??1,X=ve>=ce&&ce<999999,[Ne]=D(ze,{onCompleted:()=>{T(""),L(H[0].value),B(""),K("Default"),ne(null),x(!1),W()},onError:s=>{es({title:"Cannot create project",description:s.message,variant:"destructive"})}}),[S]=D(Ue,{onCompleted:()=>W()}),[be]=D(Fe,{onCompleted:()=>W()}),[ye]=D(He,{onCompleted:()=>{F(),N(!1),Q()}}),[Ce]=D(Ge,{onCompleted:()=>{F(),R(null),Q()}}),[we]=D(Be,{onCompleted:()=>Q()}),F=()=>{r(""),f(""),$(""),k([]),J("")},Pe=s=>{s.preventDefault(),P&&Ne({variables:{input:{name:P,clientId:j&&j!=="none"?j:void 0,color:p,isBillable:!0,timePrecision:ae||void 0,reportLanguageOverride:q==="Default"?void 0:q}}})},Se=s=>{s.preventDefault(),u&&ye({variables:{input:{name:u,email:g||void 0,company:z||void 0,rates:v.map(t=>({rate:t.rate,currency:t.currency,startDate:new Date(t.startDate).toISOString(),endDate:t.endD
1ate?new Date(t.endDate).toISOString():void 0})),vatPercentage:I?parseFloat(I):void 0}}})},De=s=>{s.preventDefault(),!(!u||!d)&&Ce({variables:{id:d,input:{name:u,email:g||void 0,company:z||void 0,rates:v.map(t=>({rate:t.rate,currency:t.currency,startDate:new Date(t.startDate).toISOString(),endDate:t.endDate?new Date(t.endDate).toISOString():void 0})),vatPercentage:I?parseFloat(I):void 0}}})},Ee=s=>{R(s.id),r(s.name),f(s.email||""),$(s.company||""),k(s.rates||[]),J(s.vatPercentage?.toString()||""),N(!1)},Re=()=>{R(null),F()},oe=s=>{if(!s||s.length===0)return null;const t=new Date;return s.find(a=>{const o=new Date(a.startDate),ue=a.endDate?new Date(a.endDate):null;return t>=o&&(!ue||t<=ue)})||s[s.length-1]},Te=()=>{const s=v[v.length-1];k([...v,{rate:s?.rate||0,currency:s?.currency||"USD",startDate:new Date().toISOString().split("T")[0]}])},ke=s=>{k(v.filter((t,a)=>a!==s))},G=(s,t,a)=>{const o=[...v];o[s]={...o[s],[t]:a},k(o)},de=n.useMemo(()=>{const s=new Map;for(const t of A?.projects||[])s.set(t.id,t.recentTimeBlocks||[]);return s},[A]),me=n.useMemo(()=>{const s=le?.githubRepositories||[];if(!U.trim())return s;const t=U.toLowerCase();return s.filter(a=>a.fullName.toLowerCase().includes(t))},[le,U]),Ie=(s,t,a)=>{const o=new Set(s.githubRepositories||[]);
1a?o.add(t):o.delete(t),S({variables:{id:s.id,input:{githubRepositories:Array.from(o)}}})};return e.jsxs("div",{className:"p-4 md:p-6 space-y-6 overflow-x-hidden",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Projects"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage clients, projects, billing rules, and report settings"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold",children:"Clients"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage your clients for invoicing"})]}),!h&&!d&&e.jsxs(i,{variant:"outline",size:"sm",onClick:()=>N(!0),children:[e.jsx(se,{className:"mr-2 h-4 w-4"}),"Add Client"]})]}),(h||d)&&e.jsxs(M,{className:"mb-4",children:[e.jsx(Y,{className:"pb-3",children:e.jsx(ee,{className:"text-base",children:d?"Edit Client":"New Client"})}),e.jsx(V,{children:e.jsxs("form",{onSubmit:d?De:Se,className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-3",children:[e.jsx(m,{placeholder:"Client name *",value:u,onChange:s=>r(s.target.value),required:!0}),e.jsx(m,{placeholder:"Email (optional)",type:"email",value:g,onChange:s=>f(s.target.value)}),e.jsx(m,{placeholder:"Company (optional)",value:z,onChange:s=>$(s.target.value)}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(m,{placeholder:"VAT %",type:"number",value:I,onChange:s=>J(s.target.value)}),e.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:"% VAT"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Hourly Rates History"}),e.jsxs(i,{type:"button",variant:"outline",size:"sm",onClick:Te,children:[e.jsx(se,{className:"h-3 w-3 mr-1"})," Add Rate"]})]}),v.map((s,t)=>e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-5 gap-2 items-end bg-muted/40 p-2 rounded-lg",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-[10px] uppercase text-muted-foreground",children:"Start Date"}),e.jsx(m,{type:"date",value:s.startDate.split("T")[0],onChange:a=>G(t,"startDate",a.target.value),className:"h-8 text-xs",required:!0})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-[10px] uppercase text-muted-foreground",children:"End Date"}),e.jsx(m,{type:"date",value:s.endDate?.split("T")[0]||"",onChange:a=>G(t,"endDate",a.target.value||void 0),className:"h-8 text-xs"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-[10px] uppercase text-muted-foreground",children:"Rate"}),e.jsx(m,{type:"number",step:"0.01",value:s.rate,onChange:a=>G(t,"rate",parseFloat(a.target.value)),className:"h-8 text-xs",required:!0})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-[10px] uppercase text-muted-foreground",children:"Currency"}),e.jsxs(b,{value:s.currency,onValueChange:a=>G(t,"currency",a),children:[e.jsx(y,{className:"h-8 text-xs",children:e.jsx(C,{})}),e.jsxs(w,{children:[e.jsx(c,{value:"USD",children:"USD"}),e.jsx(c,{value:"EUR",children:"EUR"}),e.jsx(c,{value:"GBP",children:"GBP"}),e.jsx(c,{value:"EEK",children:"EEK"})]})]})]}),e.jsx(i,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive",onClick:()=>ke(t),children:e.jsx(he,{className:"h-4 w-4"})})]},`${s.startDate}-${s.endDate||"open"}-${s.currency}-${s.rate}`))]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(i,{type:"button",variant:"ghost",size:"sm",onClick:()=>{d?Re():(N(!1),F())},children:"Cancel"}),e.jsx(i,{type:"submit",size:"sm",children:d?"Update":"Create"})]})]})})]}),O?.clients&&O.clients.length>0?e.jsx("div",{className:"grid gap-2 md:grid-cols-2 lg:grid-cols-3",children:O.clients.map(s=>e.jsx(M,{className:"group",children:e.jsxs(V,{className:"p-4 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:"bg-primary/10 p-2 rounded-full shrink-0",children:e.jsx(ms,{className:"h-4 w-4 text-primary"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"font-medium truncate",children:s.name}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[s.company&&e.jsx("span",{className:"truncate",children:s.company}),(()=>{const t=oe(s.rates);return t?e.jsxs("span",{children:["· ",t.rate," ",t.currency]}):null})(),s.vatPercentage&&e.jsxs("span",{children:["· ",s.vatPercentage,"% VAT"]})]})]})]}),e.jsxs("div",{className:"flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[e.jsx(i,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>Ee(s),children:e.jsx(ss,{className:"h-3 w-3"})}),e.jsx(i,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive",onClick:()=>{confirm("Delete this client? Projects using this client will become unassigned.")&&we({variables:{id:s.id}})},children:e.jsx(he,{className:"h-3 w-3"})})]})]})},s.id))}):!h&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"No clients yet. Add a client to assign projects."})]}),e.jsx("hr",{className:"border-border"}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold",children:"Projects"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Organize your time by project"})]}),!E&&e.jsx(Qe,{children:e.jsxs(Ze,{children:[e.jsx(Xe,{asChild:!0,children:e.jsx("span",{children:e.jsxs(i,{onClick:()=>x(!0),disabled:X,children:[X?e.jsx(xs,{className:"mr-2 h-4 w-4"}):e.jsx(se,{className:"mr-2 h-4 w-4"}),"New Project"]})})}),X&&e.jsx(Ye,{children:e.jsxs("p",{children:["Project limit reached. ",e.jsx("button",{type:"button",onClick:()=>l("/dashboard/settings"),className:"underline font-medium",children:"Upgrade to Pro"})," for unlimited projects."]})})]})})]}),E&&e.jsxs(M,{className:"mb-4",children:[e.jsx(Y,{className:"pb-3",children:e.jsx(ee,{className:"text-base",children:"New Project"})}),e.jsx(V,{children:e.jsxs("form",{onSubmit:Pe,className:"space-y-3",children:[e.jsx(m,{placeholder:"Project name *",value:P,onChange:s=>T(s.target.value),required:!0}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs(b,{value:p,onValueChange:L,children:[e.jsx(y,{className:"w-[140px]",children:e.jsx(C,{})}),e.jsx(w,{children:H.map(s=>e.jsx(c,{value:s.value,children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-3 h-3 rounded-full shrink-0",style:{backgroundColor:s.value}}),s.label]})},s.value))})]}),e.jsxs(b,{value:j,onValueChange:B,children:[e.jsx(y,{className:"flex-1",children:e.jsx(C,{placeholder:"No Client"})}),e.jsxs(w,{children:[e.jsx(c,{value:"none",children:"No Client"}),O?.clients?.map(s=>e.jsx(c,{value:s.id,children:s.name},s.id))]})]}),e.jsxs(b,{value:q,onValueChange:K,children:[e.jsx(y,{className:"w-[160px]",children:e.jsx(C,{placeholder:"Report language"})}),e.jsx(w,{children:xe.map(s=>e.jsx(c,{value:s.value,children:s.label},s.value))})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:"Billing precision:"}),e.jsx(pe,{value:ae,defaultValue:ie,onChange:ne})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(i,{type:"button",variant:"ghost",size:"sm",onClick:()=>{K("Default"),x(!1)},children:"Cancel"}),e.jsx(i,{type:"submit",size:"sm",children:"Create Project"})]})]})})]}),A?.projects&&A.projects.length>0?e.jsx("div",{className:"grid gap-3 md:grid-cols-2 lg:grid-cols-3",children:A.projects.map(s=>e.jsxs(M,{className:"group",children:[e.jsxs(Y,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsxs(ee,{className:"text-base font-semibold flex items-center gap-2.5 min-w-0",children:[e.jsxs(b,{value:s.color||"#8B8589",onValueChange:t=>
1{S({variables:{id:s.id,input:{color:t}}})},children:[e.jsx(y,{className:"w-[130px] h-8 text-xs",children:e.jsx(C,{})}),e.jsx(w,{children:H.map(t=>e.jsx(c,{value:t.value,children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-3 h-3 rounded-full shrink-0",style:{backgroundColor:t.value}}),t.label]})},t.value))})]}),e.jsx("span",{className:"truncate",children:s.name})]}),e.jsx(i,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>{confirm("Archive this project?")&&be({variables:{id:s.id}})},children:e.jsx(os,{className:"h-4 w-4 text-muted-foreground"})})]}),e.jsxs(V,{className:"pt-0",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(ts,{className:"h-3 w-3"}),O?.clients?.find(t=>t.id===s.clientId)?.name||"No Client"]}),(()=>{const t=oe(s.rates);return t?e.jsxs("div",{className:"mt-1 text-sm font-medium",children:[t.rate," ",t.currency,"/h"]}):null})(),e.jsxs("div",{className:"mt-2 pt-2 border-t border-border/40 space-y-2",children:[e.jsx(pe,{value:s.timePrecision,defaultValue:ie,onChange:t=>
1S({variables:{id:s.id,input:{timePrecision:t}}})},`precision-${s.id}-${s.timePrecision}`),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:s.showTimeOfDay??!0,onChange:t=>S({variables:{id:s.id,input:{showTimeOfDay:t.target.checked}}}),className:"rounded border-border"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"Show time of day"})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:s.showAmountInReports??!0,onChange:t=>S({variables:{id:s.id,input:{showAmountInReports:t.target.checked}}}),className:"rounded border-border"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"Show amounts in reports"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{htmlFor:`report-language-${s.id}`,className:"text-xs font-medium text-muted-foreground",children:"Report language"}),e.jsxs(b,{value:s.reportLanguageOverride||"Default",onValueChange:t=>
1S({variables:{id:s.id,input:{reportLanguageOverride:t==="Default"?null:t}}}),children:[e.jsx(y,{id:`report-language-${s.id}`,className:"h-8 w-full text-xs",children:e.jsx(C,{})}),e.jsx(w,{children:xe.map(t=>e.jsx(c,{value:t.value,children:t.label},t.value))})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"sr-only",children:"GitHub repositories"}),e.jsxs(qe,{children:[e.jsx(Ke,{asChild:!0,children:e.jsxs(i,{type:"button",variant:"outline",size:"sm",className:"inline-flex h-8 w-full items-center justify-start gap-1.5 text-xs",children:[e.jsx(hs,{className:"h-4 w-4 shrink-0"}),s.githubRepositories?.length?`${s.githubRepositories.length} GitHub repo${s.githubRepositories.length===1?"":"s"} selected`:"Select GitHub repos"]})}),e.jsx(We,{align:"start",className:"w-80 space-y-3",children:Z?.me?.githubConnected?e.jsxs(e.Fragment,{children:[e.jsx(m,{value:U,onChange:t=>je(t.target.value),placeholder:"Filter repositories",className:"h-8 text-xs"}),e.jsx("div",{className:"max-h-64 space-y-2 overflow-y-auto pr-1",children:me.length>0?me.map(t=>{const a=(s.githubRepositories||[]).includes(t.fullName);return e.jsxs("label",{className:"flex items-start gap-2 rounded-lg border p-2 text-xs",children:[e.jsx("input",{type:"checkbox",checked:a,onChange:o=>Ie(s,t.fullName,o.target.checked),className:"mt-0.5 rounded border-border"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"font-medium break-all",children:t.fullName}),e.jsx("p",{className:"text-muted-foreground",children:t.private?"Private":"Public"})]})]},t.id)}):e.jsx("p",{className:"text-xs text-muted-foreground",children:"No repositories match."})})]}):e.jsx("p",{className:"text-xs text-muted-foreground",children:"Connect GitHub in Settings first."})})]})]})]}),e.jsx("div",{className:"space-y-2",children:!!s.githubRepositories?.length&&e.jsx("div",{className:"flex flex-wrap gap-1",children:s.githubRepositories.map(t=>e.jsx("span",{className:"max-w-full truncate rounded-full bg-muted px-2 py-0.5 text-[10px] text-muted-foreground",children:t},t))})})]}),e.jsxs("div",{className:"mt-3 pt-3 border-t border-border/40",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Recent time entries"}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Last 30 days"})]}),(de.get(s.id)||[]).length>0?e.jsx("div",{className:"space-y-2",children:(de.get(s.id)||[]).map(t=>e.jsx("div",{className:"rounded-lg border bg-card/60 p-2.5",children:(()=>{const a=!!t.summaryOverride&&t.summaryOverride!==t.originalSummary;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-1 flex items-center gap-2 text-[10px] text-muted-foreground",children:[e.jsx("span",{className:"font-mono",children:rs(new Date(t.blockStart),"MMM d, HH:mm")}),e.jsx("span",{children:"·"}),e.jsxs("span",{children:[t.recordingCount," rec"]}),e.jsx("span",{children:"·"}),e.jsxs("span",{children:[t.billedMinutes,"m"]})]}),e.jsx("div",{className:"flex items-start gap-2",children:e.jsxs("div",{className:"flex items-start gap-2 flex-1 min-w-0",children:[e.jsx($e,{className:"h-3 w-3 text-muted-foreground mt-0.5 shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"break-words whitespace-normal text-xs leading-snug",children:t.summary||"Working session"}),a&&t.originalSummary&&e.jsx("span",{className:"mt-1 inline-flex text-[10px] text-muted-foreground",title:`Original: ${t.originalSummary}`,children:"edited"})]})]})})]})})()},t.id))}):e.jsx("p",{className:"text-xs text-muted-foreground",children:"No recent time entries for this project."}),e.jsxs("div",{className:"mt-2 pt-2 border-t border-border/40 text-[11px] text-muted-foreground",children:["Edit full history in ",e.jsx("button",{type:"button",className:"underline underline-offset-2 hover:text-foreground",onClick:()=>l("/dashboard/time"),children:"Time Tracking"})," or ",e.jsx("button",{type:"button",className:"underline underline-offset-2 hover:text-foreground",onClick:()=>l("/dashboard/recordings"),children:"Recordings"}),"."]})]})]})]},s.id))}):!E&&e.jsx(M,{children:e.jsxs(V,{className:"py-8 flex flex-col items-center",children:[e.jsx(as,{className:"h-10 w-10 text-muted-foreground mb-3 opacity-20"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"No projects yet"}),e.jsx(i,{variant:"outline",size:"sm",className:"mt-3",onClick:()=>x(!0),children:"Create your first project"})]})})]})]})}export{Vs as Projects};
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.