@markus-global/cli 0.12.0-rc.0 → 0.12.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/markus.mjs +9 -8
- package/dist/web-ui/assets/{AsyncState-BebkDWbq.js → AsyncState-Brx503Qq.js} +1 -1
- package/dist/web-ui/assets/{CommentInput-BRZWIC3U.js → CommentInput-CyyImwaF.js} +1 -1
- package/dist/web-ui/assets/{ContentRenderer-PGP8H_Zz.js → ContentRenderer-CpiisvVQ.js} +2 -2
- package/dist/web-ui/assets/{DeliverableShareModal-CcigVYGz.js → DeliverableShareModal-BbvcR0LN.js} +1 -1
- package/dist/web-ui/assets/{Deliverables-CQwXaCA4.js → Deliverables-DIeYy6k7.js} +1 -1
- package/dist/web-ui/assets/{Notifications-BvHJCIRG.js → Notifications-BoPgYIh8.js} +1 -1
- package/dist/web-ui/assets/{Search-BA-aXh7i.js → Search-Bc44e8vT.js} +1 -1
- package/dist/web-ui/assets/{SendToChat-CAfyKhpq.js → SendToChat-BHNwDw6Q.js} +1 -1
- package/dist/web-ui/assets/{Settings-icFp6tNI.js → Settings-5tk3XjBZ.js} +1 -1
- package/dist/web-ui/assets/{Store-DKwOcmMu.js → Store-CMxzEtXt.js} +1 -1
- package/dist/web-ui/assets/{Switch-C7lFnHA7.js → Switch-C1h7-ixU.js} +1 -1
- package/dist/web-ui/assets/{Team-DyqXLZ-X.js → Team-Dcl-5Zvh.js} +4 -4
- package/dist/web-ui/assets/{Work-BXGrda4S.js → Work-Dj9tQYXg.js} +1 -1
- package/dist/web-ui/assets/{arc-Dnk6N-Zc.js → arc-BA1zZ3ag.js} +1 -1
- package/dist/web-ui/assets/{architectureDiagram-3BPJPVTR-CV8JIXXD.js → architectureDiagram-3BPJPVTR-DTUETQs3.js} +1 -1
- package/dist/web-ui/assets/{blockDiagram-GPEHLZMM-D9pKmrXH.js → blockDiagram-GPEHLZMM-D5dvIq_3.js} +1 -1
- package/dist/web-ui/assets/{c4Diagram-AAUBKEIU-Q26HvIpY.js → c4Diagram-AAUBKEIU-CBurhkOF.js} +1 -1
- package/dist/web-ui/assets/channel-CYxqacYz.js +1 -0
- package/dist/web-ui/assets/{chunk-2J33WTMH-BSjFVwnx.js → chunk-2J33WTMH-JDr6ZP1p.js} +1 -1
- package/dist/web-ui/assets/{chunk-4BX2VUAB-BZXv4MQp.js → chunk-4BX2VUAB-CsXt6Gd5.js} +1 -1
- package/dist/web-ui/assets/{chunk-55IACEB6-CeKd3oeJ.js → chunk-55IACEB6-BPhC3YgG.js} +1 -1
- package/dist/web-ui/assets/{chunk-727SXJPM-DP1tSQo5.js → chunk-727SXJPM-BgceLEQx.js} +1 -1
- package/dist/web-ui/assets/{chunk-AQP2D5EJ-DqEncn7j.js → chunk-AQP2D5EJ-Bq58a84v.js} +1 -1
- package/dist/web-ui/assets/{chunk-FMBD7UC4-tuDUJ9Xx.js → chunk-FMBD7UC4-DyMa3olF.js} +1 -1
- package/dist/web-ui/assets/{chunk-ND2GUHAM-DoC8aLWB.js → chunk-ND2GUHAM-BsgTeDYu.js} +1 -1
- package/dist/web-ui/assets/{chunk-QZHKN3VN-74zpvcgs.js → chunk-QZHKN3VN-BQpJPCpr.js} +1 -1
- package/dist/web-ui/assets/classDiagram-4FO5ZUOK-mygctjMz.js +1 -0
- package/dist/web-ui/assets/classDiagram-v2-Q7XG4LA2-mygctjMz.js +1 -0
- package/dist/web-ui/assets/{cose-bilkent-S5V4N54A-DjYUalC1.js → cose-bilkent-S5V4N54A-BCbssvKI.js} +1 -1
- package/dist/web-ui/assets/{dagre-BM42HDAG-oSewacE8.js → dagre-BM42HDAG-CT9IdAY4.js} +1 -1
- package/dist/web-ui/assets/{diagram-2AECGRRQ-C1fiWe46.js → diagram-2AECGRRQ-x2pwUpLt.js} +1 -1
- package/dist/web-ui/assets/{diagram-5GNKFQAL-9G_q6hCa.js → diagram-5GNKFQAL-d9_JOrSK.js} +1 -1
- package/dist/web-ui/assets/{diagram-KO2AKTUF-CSm-lJp-.js → diagram-KO2AKTUF-CAVFWSkN.js} +1 -1
- package/dist/web-ui/assets/{diagram-LMA3HP47-BTAORcHx.js → diagram-LMA3HP47-DQEHXvkq.js} +1 -1
- package/dist/web-ui/assets/{diagram-OG6HWLK6-DbcCkDfo.js → diagram-OG6HWLK6-BW62W4O-.js} +1 -1
- package/dist/web-ui/assets/{docx-preview-DjqdA44x.js → docx-preview-pqFDBX8M.js} +1 -1
- package/dist/web-ui/assets/{erDiagram-TEJ5UH35-DFa-B8-u.js → erDiagram-TEJ5UH35-yYImCEy2.js} +1 -1
- package/dist/web-ui/assets/{flowDiagram-I6XJVG4X-WCTnaK9M.js → flowDiagram-I6XJVG4X-Cpk1pKF0.js} +1 -1
- package/dist/web-ui/assets/{ganttDiagram-6RSMTGT7-DbW1CoJJ.js → ganttDiagram-6RSMTGT7-BnwH90c8.js} +1 -1
- package/dist/web-ui/assets/{gitGraphDiagram-PVQCEYII-1faDfO29.js → gitGraphDiagram-PVQCEYII-ELEziEhc.js} +1 -1
- package/dist/web-ui/assets/{index-B8h1PPzP.js → index-Dt7RN5t2.js} +5 -5
- package/dist/web-ui/assets/{infoDiagram-5YYISTIA-DfXKP4tQ.js → infoDiagram-5YYISTIA-48XZ0hV0.js} +1 -1
- package/dist/web-ui/assets/{ishikawaDiagram-YF4QCWOH-D6FOsFQ5.js → ishikawaDiagram-YF4QCWOH-B0wQJGwe.js} +1 -1
- package/dist/web-ui/assets/{journeyDiagram-JHISSGLW-DXpxntIF.js → journeyDiagram-JHISSGLW-BNsrI94Q.js} +1 -1
- package/dist/web-ui/assets/{kanban-definition-UN3LZRKU-Dt7FBCF3.js → kanban-definition-UN3LZRKU-Cp8eSqCe.js} +1 -1
- package/dist/web-ui/assets/{mermaid.core-sTcSUoRD.js → mermaid.core-BYCWrkC-.js} +5 -5
- package/dist/web-ui/assets/{mindmap-definition-RKZ34NQL-CvOU23ga.js → mindmap-definition-RKZ34NQL-Ccay8RYS.js} +1 -1
- package/dist/web-ui/assets/{pieDiagram-4H26LBE5-DUedtXVj.js → pieDiagram-4H26LBE5-BUzaEdin.js} +1 -1
- package/dist/web-ui/assets/{quadrantDiagram-W4KKPZXB-CqpHHRca.js → quadrantDiagram-W4KKPZXB-BtM1AkZX.js} +1 -1
- package/dist/web-ui/assets/{requirementDiagram-4Y6WPE33-CKZYvVDJ.js → requirementDiagram-4Y6WPE33-eqO2tGIB.js} +1 -1
- package/dist/web-ui/assets/{sankeyDiagram-5OEKKPKP-gZ0nzDfs.js → sankeyDiagram-5OEKKPKP-M6qPg2gI.js} +1 -1
- package/dist/web-ui/assets/{sequenceDiagram-3UESZ5HK-DN3XdBkW.js → sequenceDiagram-3UESZ5HK-DtIYVpzR.js} +1 -1
- package/dist/web-ui/assets/{stateDiagram-AJRCARHV-BvtafGxO.js → stateDiagram-AJRCARHV-CLVsjtbI.js} +1 -1
- package/dist/web-ui/assets/stateDiagram-v2-BHNVJYJU-BfZl6BED.js +1 -0
- package/dist/web-ui/assets/{timeline-definition-PNZ67QCA-BrR919lp.js → timeline-definition-PNZ67QCA-CUwncHES.js} +1 -1
- package/dist/web-ui/assets/{vennDiagram-CIIHVFJN-B7CTm4yM.js → vennDiagram-CIIHVFJN-KDkzNQIk.js} +1 -1
- package/dist/web-ui/assets/{wardley-L42UT6IY-CyqFngx_.js → wardley-L42UT6IY-BqliL5Bv.js} +1 -1
- package/dist/web-ui/assets/{wardleyDiagram-YWT4CUSO-BCqEPBJ5.js → wardleyDiagram-YWT4CUSO-B4qeGz2Q.js} +1 -1
- package/dist/web-ui/assets/{xychartDiagram-2RQKCTM6-BmT6Cmz-.js → xychartDiagram-2RQKCTM6-3877u0ek.js} +1 -1
- package/dist/web-ui/index.html +1 -1
- package/package.json +1 -1
- package/dist/web-ui/assets/channel-BZs6ereM.js +0 -1
- package/dist/web-ui/assets/classDiagram-4FO5ZUOK-C9JIxJeJ.js +0 -1
- package/dist/web-ui/assets/classDiagram-v2-Q7XG4LA2-C9JIxJeJ.js +0 -1
- package/dist/web-ui/assets/stateDiagram-v2-BHNVJYJU-B2nWDV5R.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as z,r as i,l as c,j as e,n as d,P as x,A as I}from"./index-B8h1PPzP.js";import{P as O,E as K}from"./AsyncState-BebkDWbq.js";function G(){const{t:l}=z(["common","home","work"]),[u,b]=i.useState(""),[a,o]=i.useState("all"),[t,m]=i.useState({agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]}),[h,y]=i.useState(!1),[w,p]=i.useState(!1),v=i.useRef(null),j=i.useRef(void 0);i.useEffect(()=>{setTimeout(()=>v.current?.focus(),100)},[]);const W=i.useCallback(async s=>{if(!s.trim()){m({agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]}),p(!1);return}y(!0),p(!0);const n=s.toLowerCase();try{const[N,C,V,L,R,A]=await Promise.allSettled([c.agents.list(),c.tasks.list({search:s,pageSize:20}),c.requirements.list(),c.projects.list(),c.deliverables.search({q:s,limit:20}),c.teams.list()]),E=N.status==="fulfilled"?N.value.agents.filter(r=>r.name?.toLowerCase().includes(n)||r.role?.toLowerCase().includes(n)):[],M=C.status==="fulfilled"?C.value.tasks:[],H=V.status==="fulfilled"?V.value.requirements.filter(r=>r.title?.toLowerCase().includes(n)||r.description?.toLowerCase().includes(n)):[],T=L.status==="fulfilled"?L.value.projects.filter(r=>r.name?.toLowerCase().includes(n)||r.description?.toLowerCase().includes(n)):[],P=R.status==="fulfilled"?R.value.results:[],S=[];if(A.status==="fulfilled"){const r=await Promise.allSettled(A.value.teams.map(f=>c.workflows.list(f.id)));for(const f of r)if(f.status==="fulfilled")for(const g of f.value.workflows)(g.name.toLowerCase().includes(n)||(g.displayName||"").toLowerCase().includes(n)||g.description?.toLowerCase().includes(n))&&S.push(g)}m({agents:E,tasks:M,requirements:H,projects:T,deliverables:P,workflows:S})}catch{m({agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]})}finally{y(!1)}},[]),B=s=>{b(s),j.current&&clearTimeout(j.current),j.current=setTimeout(()=>W(s),400)},q=[{id:"all",label:l("common:all",{defaultValue:"全部"})},{id:"agents",label:l("common:agents",{defaultValue:"智能体"})},{id:"tasks",label:l("common:tasks",{defaultValue:"任务"})},{id:"requirements",label:l("common:requirements",{defaultValue:"需求"})},{id:"projects",label:l("common:projects",{defaultValue:"项目"})},{id:"deliverables",label:l("common:deliverables",{defaultValue:"交付物"})},{id:"workflows",label:l("common:workflows",{defaultValue:"工作流"})}],k=t.agents.length>0||t.tasks.length>0||t.requirements.length>0||t.projects.length>0||t.deliverables.length>0||t.workflows.length>0;return e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"shrink-0 px-4 pt-4 pb-2 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>d.navigate(x.HOME),className:"p-1.5 rounded-lg hover:bg-surface-overlay transition-colors shrink-0",children:e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M19 12H5"}),e.jsx("polyline",{points:"12 19 5 12 12 5"})]})}),e.jsxs("div",{className:"flex-1 relative",children:[e.jsxs("svg",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-fg-tertiary",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),e.jsx("input",{ref:v,value:u,onChange:s=>B(s.target.value),placeholder:l("common:search"),className:"w-full bg-surface-elevated border border-border-default rounded-xl pl-9 pr-3 py-2.5 text-sm text-fg-primary placeholder:text-fg-tertiary focus:border-brand-500 focus:outline-none transition-colors"}),u&&e.jsx("button",{onClick:()=>{b(""),m({agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]}),p(!1),v.current?.focus()},className:"absolute right-3 top-1/2 -translate-y-1/2 text-fg-tertiary hover:text-fg-secondary",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),e.jsx("div",{className:"flex gap-1 overflow-x-auto scrollbar-hide",children:q.map(s=>e.jsx("button",{onClick:()=>o(s.id),className:`px-3 py-1.5 text-xs rounded-lg whitespace-nowrap transition-colors ${a===s.id?"bg-brand-600 text-white":"bg-surface-elevated text-fg-secondary hover:text-fg-primary"}`,children:s.label},s.id))})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-4 pb-4",children:[h&&e.jsx(O,{className:"py-12"}),!h&&w&&!k&&e.jsx(K,{className:"py-12",icon:e.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),title:l("common:noResults",{defaultValue:"没有找到相关结果"})}),!h&&k&&e.jsxs("div",{className:"space-y-4",children:[(a==="all"||a==="agents")&&t.agents.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:agents",{defaultValue:"智能体"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.agents.slice(0,8):t.agents).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.TEAM,{agentId:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx(I,{name:s.name||"Agent",avatarUrl:s.avatarUrl,size:32}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-medium text-fg-primary truncate",children:s.name}),e.jsx("div",{className:"text-xs text-fg-tertiary truncate",children:s.role||s.status})]}),e.jsx($,{status:s.status})]},s.id))}),a==="all"&&t.agents.length>8&&e.jsxs("button",{onClick:()=>o("agents"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.agents.length,")"]})]}),(a==="all"||a==="tasks")&&t.tasks.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:tasks",{defaultValue:"任务"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.tasks.slice(0,8):t.tasks).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.WORK,{openTask:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx(D,{status:s.status}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.title}),e.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[s.status," · ",s.priority||""]})]})]},s.id))}),a==="all"&&t.tasks.length>8&&e.jsxs("button",{onClick:()=>o("tasks"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.tasks.length,")"]})]}),(a==="all"||a==="requirements")&&t.requirements.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:requirements",{defaultValue:"需求"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.requirements.slice(0,8):t.requirements).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.WORK,{openRequirement:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx("div",{className:`w-8 h-8 rounded-lg flex items-center justify-center shrink-0 ${s.status==="approved"?"text-green-500 bg-green-500/15":s.status==="pending"?"text-amber-500 bg-amber-500/15":s.status==="rejected"?"text-red-500 bg-red-500/15":"text-fg-tertiary bg-surface-elevated"}`,children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("polyline",{points:"14 2 14 8 20 8"}),e.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),e.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.title}),e.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[s.status," · ",s.priority||""]})]})]},s.id))}),a==="all"&&t.requirements.length>8&&e.jsxs("button",{onClick:()=>o("requirements"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.requirements.length,")"]})]}),(a==="all"||a==="projects")&&t.projects.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:projects",{defaultValue:"项目"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.projects.slice(0,8):t.projects).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.WORK,{projectId:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-brand-500/15 flex items-center justify-center shrink-0",children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-brand-500",children:e.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.name}),s.description&&e.jsx("div",{className:"text-xs text-fg-tertiary truncate",children:s.description})]})]},s.id))}),a==="all"&&t.projects.length>8&&e.jsxs("button",{onClick:()=>o("projects"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.projects.length,")"]})]}),(a==="all"||a==="deliverables")&&t.deliverables.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:deliverables",{defaultValue:"交付物"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.deliverables.slice(0,8):t.deliverables).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.DELIVERABLES,{openDeliverable:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-purple-500/15 flex items-center justify-center shrink-0",children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-purple-500",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("polyline",{points:"14 2 14 8 20 8"})]})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.title}),e.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[s.type," · ",s.status]})]})]},s.id))}),a==="all"&&t.deliverables.length>8&&e.jsxs("button",{onClick:()=>o("deliverables"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.deliverables.length,")"]})]}),(a==="all"||a==="workflows")&&t.workflows.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:workflows",{defaultValue:"工作流"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.workflows.slice(0,8):t.workflows).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.WORK,{boardType:"workflows"}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-teal-500/15 flex items-center justify-center shrink-0",children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-teal-500",children:[e.jsx("circle",{cx:"12",cy:"12",r:"3"}),e.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"})]})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.displayName||s.name}),e.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[s.stepCount," steps · v",s.version]})]})]},s.name))}),a==="all"&&t.workflows.length>8&&e.jsxs("button",{onClick:()=>o("workflows"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.workflows.length,")"]})]})]}),!h&&!w&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"text-fg-tertiary mb-3",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),e.jsx("p",{className:"text-sm text-fg-tertiary",children:l("common:search")})]})]})]})}function $({status:l}){const u=l==="active"||l==="idle"?"bg-green-500":l==="working"||l==="busy"?"bg-blue-500":"bg-gray-400";return e.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${u}`})}function D({status:l}){const u=l==="completed"?"text-green-500 bg-green-500/15":l==="in_progress"?"text-blue-500 bg-blue-500/15":l==="pending"?"text-amber-500 bg-amber-500/15":"text-fg-tertiary bg-surface-elevated";return e.jsx("div",{className:`w-8 h-8 rounded-lg flex items-center justify-center shrink-0 ${u}`,children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M9 11l3 3L22 4"}),e.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]})})}export{G as SearchPage};
|
|
1
|
+
import{u as z,r as i,l as c,j as e,n as d,P as x,A as I}from"./index-Dt7RN5t2.js";import{P as O,E as K}from"./AsyncState-Brx503Qq.js";function G(){const{t:l}=z(["common","home","work"]),[u,b]=i.useState(""),[a,o]=i.useState("all"),[t,m]=i.useState({agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]}),[h,y]=i.useState(!1),[w,p]=i.useState(!1),v=i.useRef(null),j=i.useRef(void 0);i.useEffect(()=>{setTimeout(()=>v.current?.focus(),100)},[]);const W=i.useCallback(async s=>{if(!s.trim()){m({agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]}),p(!1);return}y(!0),p(!0);const n=s.toLowerCase();try{const[N,C,V,L,R,A]=await Promise.allSettled([c.agents.list(),c.tasks.list({search:s,pageSize:20}),c.requirements.list(),c.projects.list(),c.deliverables.search({q:s,limit:20}),c.teams.list()]),E=N.status==="fulfilled"?N.value.agents.filter(r=>r.name?.toLowerCase().includes(n)||r.role?.toLowerCase().includes(n)):[],M=C.status==="fulfilled"?C.value.tasks:[],H=V.status==="fulfilled"?V.value.requirements.filter(r=>r.title?.toLowerCase().includes(n)||r.description?.toLowerCase().includes(n)):[],T=L.status==="fulfilled"?L.value.projects.filter(r=>r.name?.toLowerCase().includes(n)||r.description?.toLowerCase().includes(n)):[],P=R.status==="fulfilled"?R.value.results:[],S=[];if(A.status==="fulfilled"){const r=await Promise.allSettled(A.value.teams.map(f=>c.workflows.list(f.id)));for(const f of r)if(f.status==="fulfilled")for(const g of f.value.workflows)(g.name.toLowerCase().includes(n)||(g.displayName||"").toLowerCase().includes(n)||g.description?.toLowerCase().includes(n))&&S.push(g)}m({agents:E,tasks:M,requirements:H,projects:T,deliverables:P,workflows:S})}catch{m({agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]})}finally{y(!1)}},[]),B=s=>{b(s),j.current&&clearTimeout(j.current),j.current=setTimeout(()=>W(s),400)},q=[{id:"all",label:l("common:all",{defaultValue:"全部"})},{id:"agents",label:l("common:agents",{defaultValue:"智能体"})},{id:"tasks",label:l("common:tasks",{defaultValue:"任务"})},{id:"requirements",label:l("common:requirements",{defaultValue:"需求"})},{id:"projects",label:l("common:projects",{defaultValue:"项目"})},{id:"deliverables",label:l("common:deliverables",{defaultValue:"交付物"})},{id:"workflows",label:l("common:workflows",{defaultValue:"工作流"})}],k=t.agents.length>0||t.tasks.length>0||t.requirements.length>0||t.projects.length>0||t.deliverables.length>0||t.workflows.length>0;return e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"shrink-0 px-4 pt-4 pb-2 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>d.navigate(x.HOME),className:"p-1.5 rounded-lg hover:bg-surface-overlay transition-colors shrink-0",children:e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M19 12H5"}),e.jsx("polyline",{points:"12 19 5 12 12 5"})]})}),e.jsxs("div",{className:"flex-1 relative",children:[e.jsxs("svg",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-fg-tertiary",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),e.jsx("input",{ref:v,value:u,onChange:s=>B(s.target.value),placeholder:l("common:search"),className:"w-full bg-surface-elevated border border-border-default rounded-xl pl-9 pr-3 py-2.5 text-sm text-fg-primary placeholder:text-fg-tertiary focus:border-brand-500 focus:outline-none transition-colors"}),u&&e.jsx("button",{onClick:()=>{b(""),m({agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]}),p(!1),v.current?.focus()},className:"absolute right-3 top-1/2 -translate-y-1/2 text-fg-tertiary hover:text-fg-secondary",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),e.jsx("div",{className:"flex gap-1 overflow-x-auto scrollbar-hide",children:q.map(s=>e.jsx("button",{onClick:()=>o(s.id),className:`px-3 py-1.5 text-xs rounded-lg whitespace-nowrap transition-colors ${a===s.id?"bg-brand-600 text-white":"bg-surface-elevated text-fg-secondary hover:text-fg-primary"}`,children:s.label},s.id))})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-4 pb-4",children:[h&&e.jsx(O,{className:"py-12"}),!h&&w&&!k&&e.jsx(K,{className:"py-12",icon:e.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),title:l("common:noResults",{defaultValue:"没有找到相关结果"})}),!h&&k&&e.jsxs("div",{className:"space-y-4",children:[(a==="all"||a==="agents")&&t.agents.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:agents",{defaultValue:"智能体"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.agents.slice(0,8):t.agents).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.TEAM,{agentId:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx(I,{name:s.name||"Agent",avatarUrl:s.avatarUrl,size:32}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-medium text-fg-primary truncate",children:s.name}),e.jsx("div",{className:"text-xs text-fg-tertiary truncate",children:s.role||s.status})]}),e.jsx($,{status:s.status})]},s.id))}),a==="all"&&t.agents.length>8&&e.jsxs("button",{onClick:()=>o("agents"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.agents.length,")"]})]}),(a==="all"||a==="tasks")&&t.tasks.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:tasks",{defaultValue:"任务"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.tasks.slice(0,8):t.tasks).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.WORK,{openTask:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx(D,{status:s.status}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.title}),e.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[s.status," · ",s.priority||""]})]})]},s.id))}),a==="all"&&t.tasks.length>8&&e.jsxs("button",{onClick:()=>o("tasks"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.tasks.length,")"]})]}),(a==="all"||a==="requirements")&&t.requirements.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:requirements",{defaultValue:"需求"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.requirements.slice(0,8):t.requirements).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.WORK,{openRequirement:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx("div",{className:`w-8 h-8 rounded-lg flex items-center justify-center shrink-0 ${s.status==="approved"?"text-green-500 bg-green-500/15":s.status==="pending"?"text-amber-500 bg-amber-500/15":s.status==="rejected"?"text-red-500 bg-red-500/15":"text-fg-tertiary bg-surface-elevated"}`,children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("polyline",{points:"14 2 14 8 20 8"}),e.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),e.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.title}),e.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[s.status," · ",s.priority||""]})]})]},s.id))}),a==="all"&&t.requirements.length>8&&e.jsxs("button",{onClick:()=>o("requirements"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.requirements.length,")"]})]}),(a==="all"||a==="projects")&&t.projects.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:projects",{defaultValue:"项目"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.projects.slice(0,8):t.projects).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.WORK,{projectId:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-brand-500/15 flex items-center justify-center shrink-0",children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-brand-500",children:e.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.name}),s.description&&e.jsx("div",{className:"text-xs text-fg-tertiary truncate",children:s.description})]})]},s.id))}),a==="all"&&t.projects.length>8&&e.jsxs("button",{onClick:()=>o("projects"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.projects.length,")"]})]}),(a==="all"||a==="deliverables")&&t.deliverables.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:deliverables",{defaultValue:"交付物"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.deliverables.slice(0,8):t.deliverables).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.DELIVERABLES,{openDeliverable:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-purple-500/15 flex items-center justify-center shrink-0",children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-purple-500",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("polyline",{points:"14 2 14 8 20 8"})]})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.title}),e.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[s.type," · ",s.status]})]})]},s.id))}),a==="all"&&t.deliverables.length>8&&e.jsxs("button",{onClick:()=>o("deliverables"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.deliverables.length,")"]})]}),(a==="all"||a==="workflows")&&t.workflows.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:workflows",{defaultValue:"工作流"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.workflows.slice(0,8):t.workflows).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.WORK,{boardType:"workflows"}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-teal-500/15 flex items-center justify-center shrink-0",children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-teal-500",children:[e.jsx("circle",{cx:"12",cy:"12",r:"3"}),e.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"})]})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.displayName||s.name}),e.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[s.stepCount," steps · v",s.version]})]})]},s.name))}),a==="all"&&t.workflows.length>8&&e.jsxs("button",{onClick:()=>o("workflows"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.workflows.length,")"]})]})]}),!h&&!w&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"text-fg-tertiary mb-3",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),e.jsx("p",{className:"text-sm text-fg-tertiary",children:l("common:search")})]})]})]})}function $({status:l}){const u=l==="active"||l==="idle"?"bg-green-500":l==="working"||l==="busy"?"bg-blue-500":"bg-gray-400";return e.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${u}`})}function D({status:l}){const u=l==="completed"?"text-green-500 bg-green-500/15":l==="in_progress"?"text-blue-500 bg-blue-500/15":l==="pending"?"text-amber-500 bg-amber-500/15":"text-fg-tertiary bg-surface-elevated";return e.jsx("div",{className:`w-8 h-8 rounded-lg flex items-center justify-center shrink-0 ${u}`,children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M9 11l3 3L22 4"}),e.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]})})}export{G as SearchPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as v,r as m,j as e,n as w,P as N}from"./index-
|
|
1
|
+
import{u as v,r as m,j as e,n as w,P as N}from"./index-Dt7RN5t2.js";function C(n,r,l){if(n){if(r.some(o=>o.id===n))return`agent:${n}`;if(l.some(o=>o.id===n))return`human:${n}`}return r[0]?`agent:${r[0].id}`:l[0]?`human:${l[0].id}`:""}function V(n){const r=n.trim();return r.length>40?`${r.slice(0,24)}…${r.slice(-12)}`:r}function $({onClick:n,label:r,className:l}){return e.jsxs("button",{type:"button",onClick:n,title:r,"aria-label":r,className:l??"shrink-0 inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg border border-border-default text-xs text-fg-secondary hover:text-brand-500 hover:border-brand-500/40 hover:bg-brand-500/10 transition-colors",children:[e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"}),e.jsx("line",{x1:"12",y1:"7",x2:"12",y2:"11"}),e.jsx("line",{x1:"10",y1:"9",x2:"14",y2:"9"})]}),e.jsx("span",{className:"hidden sm:inline",children:r})]})}function A({chipLabel:n,chipContent:r,agents:l,users:o,defaultTarget:b,onClose:c}){const{t:s}=v(["work","common"]),[d,g]=m.useState(()=>b||C(void 0,l,o)),[x,k]=m.useState(""),u=m.useMemo(()=>{const t=x.trim().toLowerCase(),i=a=>!t||a.toLowerCase().includes(t);return[...l.filter(a=>i(a.name)).map(a=>({value:`agent:${a.id}`,name:a.name,meta:a.status,isAgent:!0})),...o.filter(a=>i(a.name)).map(a=>({value:`human:${a.id}`,name:a.name,meta:"",isAgent:!1}))]},[l,o,x]),[j,h]=d.split(":"),f=j==="agent"?l.find(t=>t.id===h)?.name??"":o.find(t=>t.id===h)?.name??"",y=()=>{if(!d)return;const[t,i]=d.split(":"),a={chatChips:JSON.stringify([{label:n,content:r}])};t==="agent"?a.agentId=i:a.dm=i,w.navigate(N.TEAM,a),c()};return e.jsx("div",{className:"fixed inset-0 z-[10050] flex items-center justify-center bg-black/60 p-4",onClick:c,children:e.jsxs("div",{className:"w-full max-w-md max-h-[85vh] flex flex-col bg-surface-primary border border-border-default rounded-2xl shadow-2xl overflow-hidden",onClick:t=>t.stopPropagation(),children:[e.jsxs("div",{className:"px-5 pt-4 pb-3 border-b border-border-default shrink-0",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsx("h3",{className:"text-sm font-semibold text-fg-primary",children:s("work:task.sendToChatTitle",{defaultValue:"发送到对话"})}),e.jsx("button",{onClick:c,className:"text-fg-tertiary hover:text-fg-secondary text-xl leading-none -mt-1","aria-label":s("common:close"),children:"×"})]}),e.jsx("p",{className:"mt-1 text-xs text-fg-tertiary leading-relaxed",children:s("work:task.sendToChatHint",{defaultValue:"选择要发送到的对话,它会作为上下文标签加入输入框,你可以接着补充说明。"})})]}),e.jsxs("div",{className:"px-5 pt-3 pb-2 shrink-0",children:[e.jsx("label",{className:"block text-[10px] font-semibold text-fg-tertiary uppercase tracking-wider mb-1",children:s("work:task.sendToChatTarget",{defaultValue:"发送给"})}),e.jsxs("div",{className:"relative",children:[e.jsxs("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-fg-tertiary pointer-events-none",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),e.jsx("input",{value:x,onChange:t=>k(t.target.value),placeholder:s("work:task.sendToChatSearch",{defaultValue:"搜索智能体或成员…"}),className:"w-full pl-8 pr-3 py-2 bg-surface-elevated border border-border-default rounded-lg text-sm text-fg-primary outline-none focus:border-brand-500 placeholder:text-fg-tertiary"})]}),e.jsx("div",{className:"mt-1.5 text-[11px] text-fg-tertiary truncate",children:f?`${s("work:task.sendToChatTarget",{defaultValue:"发送给"})}:${f}`:s("work:task.sendToChatNoTarget",{defaultValue:"当前没有可发送的对象"})})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto px-2 pb-2",children:u.length===0?e.jsx("div",{className:"px-3 py-6 text-center text-xs text-fg-tertiary",children:s("work:task.sendToChatEmpty",{defaultValue:"没有匹配的对象"})}):u.map((t,i)=>{const a=i===0||u[i-1].isAgent!==t.isAgent,p=t.value===d;return e.jsxs("div",{children:[a&&e.jsx("div",{className:"px-3 pt-2 pb-1 text-[10px] font-semibold text-fg-tertiary uppercase tracking-wider",children:t.isAgent?s("work:task.sendToChatAgents",{defaultValue:"智能体"}):s("work:task.sendToChatHumans",{defaultValue:"成员"})}),e.jsxs("button",{type:"button",onClick:()=>g(t.value),className:`w-full text-left px-3 py-2 rounded-lg flex items-center gap-2 transition-colors ${p?"bg-brand-500/15 text-brand-500 font-medium":"text-fg-secondary hover:bg-surface-elevated"}`,children:[e.jsx("span",{className:"w-5 h-5 flex items-center justify-center text-sm shrink-0",children:t.isAgent?"🤖":"👤"}),e.jsx("span",{className:"flex-1 min-w-0 truncate text-sm",children:t.name}),t.meta&&e.jsx("span",{className:"text-[10px] text-fg-tertiary shrink-0",children:t.meta}),p&&e.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:"shrink-0",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})]})]},t.value)})}),e.jsxs("div",{className:"px-5 py-3 border-t border-border-default bg-surface-secondary/40 shrink-0",children:[e.jsx("span",{className:"block text-[10px] font-semibold text-fg-tertiary uppercase tracking-wider mb-1",children:s("work:task.sendToChatContext",{defaultValue:"将加入的上下文标签"})}),e.jsx("span",{className:"inline-flex items-center gap-1 max-w-full pl-2 pr-2 py-1 rounded-lg bg-brand-500/10 text-brand-500 text-xs border border-brand-500/20",title:r,children:e.jsx("span",{className:"truncate",children:n})}),e.jsxs("div",{className:"mt-3 flex items-center justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:c,className:"px-3 py-1.5 text-xs rounded-lg border border-border-default text-fg-secondary hover:bg-surface-elevated transition-colors",children:s("common:cancel")}),e.jsx("button",{type:"button",onClick:y,disabled:!d,className:"px-3 py-1.5 text-xs rounded-lg bg-brand-600 hover:bg-brand-500 text-white font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:s("work:task.sendToChatConfirm",{defaultValue:"发送到对话"})})]})]})]})})}export{A as S,$ as a,C as r,V as s};
|