PageSourceSearch

https://task.com.tw/assets/Tags-CDNoW-IG.js

js task.com.tw collected 2026-10-08 16:08:11 UTC 7,208 bytes, 1 lines download raw bytes

1import{r as i,t,j as s,aZ as b,P as L,au as I,T as z}from"./vendor-react-Cek5_fI5.js";import{W as A,b as R,t as r,D as B,y as v,X as $,B as n,z as w,A as C,E as y,L as o,I as k,C as S,d as E}from"./index-DnYEcI1T.js";import"./vendor-charts-CdtAEet6.js";import"./vendor-export-Do0PDzts.js";const P=["#3b82f6","#ef4444","#22c55e","#f59e0b","#8b5cf6","#ec4899","#06b6d4","#f97316","#6366f1","#14b8a6","#84cc16","#e11d48","#0ea5e9","#a855f7","#64748b"];function X(){A();const{currentOrg:d}=R(),c=d?.orgId??0,{data:g,isLoading:D}=r.tags.list.useQuery({orgId:c},{enabled:!!c}),x=r.useUtils(),[M,T]=i.useState(!1),[e,l]=i.useState(null),[m,j]=i.useState(""),[f,N]=i.useState("#3b82f6"),p=r.tags.create.useMutation({onSuccess:()=>{x.tags.list.invalidate(),T(!1),j(""),N("#3b82f6"),t.success("標籤已建立")},onError:a=>t.error(a.message)}),u=r.tags.update.useMutation({onSuccess:()=>{x.tags.list.invalidate(),l(null),t.success("標籤已更新")},onError:a=>t.error(a.message)}),O=r.tags.delete.useMutation({onSuccess:()=>{x.tags.list.invalidate(),t.success("標籤已刪除")},onError:a=>t.error(a.message)}),h=d?.role==="owner"||d?.role==="admin";return s.jsx(B,{"data-loc":"client/src/pages/Tags.tsx:51",children:s.jsxs("div",{"data-loc":"client/src/pages/Tags.tsx:52",className:"space-y-6",children:[s.jsxs("div",{"data-loc":"client/src/pages/Tags.tsx:53",className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[s.jsxs("div",{"data-loc":"client/src/pages/Tags.tsx:54",children:[s.jsxs("h1",{"data-loc":"client/src/pages/Tags.tsx:55",className:"text-xl sm:text-2xl font-bold flex items-center gap-2",children:[s.jsx(b,{"data-loc":"client/src/pages/Tags.tsx:56",className:"h-5 w-5 sm:h-6 sm:w-6 text-primary"})," 標籤管理"]}),s.jsx("p",{"data-loc":"client/src/pages/Tags.tsx:58",className:"text-muted-foreground mt-1 text-sm",children:"管理任務分類標籤,方便依專案或部門分組"})]}),h&&s.jsxs(v,{"data-loc":"client/src/pages/Tags.tsx:61",open:M,onOpenChange:T,children:[s.jsx($,{"data-loc":"client/src/pages/Tags.tsx:62",asChild:!0,children:s.jsxs(n,{"data-loc":"client/src/pages/Tags.tsx:63",children:[s.jsx(L,{"data-loc":"client/src/pages/Tags.tsx:63",className:"h-4 w-4 mr-2"})," 新增標籤"]})}),s.jsxs(w,{"data-loc":"client/src/pages/Tags.tsx:65",children:[s.jsx(C,{"data-loc":"client/src/pages/Tags.tsx:66",children:s.jsx(y,{"data-loc":"client/src/pages/Tags.tsx:66",children:"新增標籤"})}),s.jsxs("div",{"data-loc":"client/src/pages/Tags.tsx:67",className:"space-y-4",children:[s.jsxs("div",{"data-loc":"client/src/pages/Tags.tsx:68",className:"space-y-2",children:[s.jsx(o,{"data-loc":"client/src/pages/Tags.tsx:69",className:"text-sm font-medium",children:"標籤名稱"}),s.jsx(k,{"data-loc":"client/src/pages/Tags.tsx:70",value:m,onChange:a=>j(a.target.value),placeholder:"例如:行銷專案"})]}),s.jsxs("div",{"data-loc":"client/src/pages/Tags.tsx:72",className:"space-y-2",children:[s.jsx(o,{"data-loc":"client/src/pages/Tags.tsx:73",className:"text-sm font-medium",children:"標籤顏色"}),s.jsx("div",{"data-loc":"client/src/pages/Tags.tsx:74",className:"flex flex-wrap gap-2 mt-2",children:P.map(a=>s.jsx("button",{"data-loc":"client/src/pages/Tags.tsx:76",onClick:()=>N(a),className:`w-8 h-8 rounded-full border-2 transition-all ${f===a?"border-foreground scale-110":"border-transparent"}`,style:{backgroundColor:a}},a))})]}),s.jsx(n,{"data-loc":"client/src/pages/Tags.tsx:82",className:"w-full",onClick:()=>p.mutate({orgId:c,name:m,color:f}),disabled:!m.trim()||p.isPending,children:p.isPending?"建立中...":"建立標籤"})]})]})]})]}),D?s.jsx("div",{"data-loc":"client/src/pages/Tags.tsx:93",className:"text-center py-12 text-muted-foreground",children:"載入中..."}):!g||g.length===0?s.jsx(S,{"data-loc":"client/src/pages/Tags.tsx:95",children:s.jsxs(E,{"data-loc":"client/src/pages/Tags.tsx:96",className:"py-12 text-center text-muted-foreground",children:[s.jsx(b,{"data-loc":"client/src/pages/Tags.tsx:97",className:"h-12 w-12 mx-auto mb-4 opacity-30"}),s.jsx("p",{"data-loc":"client/src/pages/Tags.tsx:98",children:"尚未建立任何標籤"}),h&&s.jsx("p",{"data-loc":"client/src/pages/Tags.tsx:99",className:"text-sm mt-2",children:"點擊「新增標籤」開始建立分類"})]})}):s.jsx("div",{"data-loc":"client/src/pages/Tags.tsx:103",className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:g.map(a=>s.jsx(S,{"data-loc":"client/src/pages/Tags.tsx:105",className:"group hover:shadow-md transition-shadow",children:s.jsxs(E,{"data-loc":"client/src/pages/Tags.tsx:106",className:"p-4 flex items-center justify-between",children:[s.jsxs("div",{"data-loc":"client/src/pages/Tags.tsx:107",className:"flex items-center gap-3",children:[s.jsx("div",{"data-loc":"client/src/pages/Tags.tsx:108",className:"w-4 h-4 rounded-full shrink-0",style:{backgroundColor:a.color}}),s.jsx("span",{"data-loc":"client/src/pages/Tags.tsx:109",className:"font-medium",children:a.name})]}),h&&s.jsxs("div",{"data-loc":"client/src/pages/Tags.tsx:112",className:"flex gap-1 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity shrink-0",children:[s.jsx(n,{"data-loc":"client/src/pages/Tags.tsx:113",variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>{l({id:a.id,name:a.name,color:a.color})},children:s.jsx(I,{"data-loc":"client/src/pages/Tags.tsx:115",className:"h-4 w-4"})}),s.jsx(n,{"data-loc":"client/src/pages/Tags.tsx:117",variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive",onClick:()=>{confirm("確定要刪除此標籤嗎?")&&O.mutate({orgId:c,id:a.id})},children:s.jsx(z,{"data-loc":"client/src/pages/Tags.tsx:119",className:"h-4 w-4"})})]})]})},a.id))}),s.jsx(v,{"data-loc":"client/src/pages/Tags.tsx:130",open:!!e,onOpenChange:a=>{a||l(null)},children:s.jsxs(w,{"data-loc":"client/src/pages/Tags.tsx:131",children:[s.jsx(C,{"data-loc":"client/src/pages/Tags.tsx:132",children:s.jsx(y,{"data-loc":"client/src/pages/Tags.tsx:132",children:"編輯標籤"})}),e&&s.jsxs("div",{"data-loc":"client/src/pages/Tags.tsx:134",className:"space-y-4",children:[s.jsxs("div",{"data-loc":"client/src/pages/Tags.tsx:135",className:"space-y-2",children:[s.jsx(o,{"data-loc":"client/src/pages/Tags.tsx:136",className:"text-sm font-medium",children:"標籤
1名稱"}),s.jsx(k,{"data-loc":"client/src/pages/Tags.tsx:137",value:e.name,onChange:a=>l({...e,name:a.target.value})})]}),s.jsxs("div",{"data-loc":"client/src/pages/Tags.tsx:139",className:"space-y-2",children:[s.jsx(o,{"data-loc":"client/src/pages/Tags.tsx:140",className:"text-sm font-medium",children:"標籤顏色"}),s.jsx("div",{"data-loc":"client/src/pages/Tags.tsx:141",className:"flex flex-wrap gap-2 mt-2",children:P.map(a=>s.jsx("button",{"data-loc":"client/src/pages/Tags.tsx:143",onClick:()=>l({...e,color:a}),className:`w-8 h-8 rounded-full border-2 transition-all ${e.color===a?"border-foreground scale-110":"border-transparent"}`,style:{backgroundColor:a}},a))})]}),s.jsx(n,{"data-loc":"client/src/pages/Tags.tsx:149",className:"w-full",onClick:()=>u.mutate({orgId:c,id:e.id,name:e.name,color:e.color}),disabled:!e.name.trim()||u.isPending,children:u.isPending?"更新中...":"更新標籤"})]})]})})]})})}export{X 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.