@shumai-one/shumai 0.5.2 → 0.5.3
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/bin/{chunk-zf5cyxnt.js → chunk-03zkxckm.js} +1 -1
- package/bin/{chunk-2w6gve12.js → chunk-04nqnkzs.js} +3 -3
- package/bin/{chunk-rw5h0n0s.js → chunk-157axqz1.js} +1 -1
- package/bin/{chunk-w9z27p0m.js → chunk-1tesbv8w.js} +1 -1
- package/bin/{chunk-vzdgsfkf.js → chunk-24da4wg9.js} +1 -1
- package/bin/chunk-24nx3krz.js +2 -0
- package/bin/{chunk-twpc640e.js → chunk-26am2rzm.js} +1 -1
- package/bin/{chunk-8ayz61rc.js → chunk-2pt9h882.js} +3 -3
- package/bin/{chunk-mn108p93.js → chunk-2rrcdhkj.js} +1 -1
- package/bin/{chunk-ryepy5er.js → chunk-2w2bknn2.js} +4 -4
- package/bin/{chunk-ypkkfwfb.js → chunk-3ahax79y.js} +2 -2
- package/bin/{chunk-zdzkjp4q.js → chunk-3fjgf7eb.js} +2 -2
- package/bin/{chunk-rmvhyqyb.js → chunk-3wcvema0.js} +3 -3
- package/bin/{chunk-kvwec0p3.js → chunk-40tmh04g.js} +2 -2
- package/bin/chunk-45p7d22e.js +2 -0
- package/bin/chunk-461gcgrs.js +2 -0
- package/bin/{chunk-p0j4wpa5.js → chunk-4bc3gqmn.js} +1 -1
- package/bin/{chunk-8tzfcqtb.js → chunk-4nkwe7dz.js} +1 -1
- package/bin/{chunk-eqr0znmc.js → chunk-59ayg5am.js} +1 -1
- package/bin/{chunk-8zgq5sav.js → chunk-5ebb2pdf.js} +2 -2
- package/bin/{chunk-n76w2wcr.js → chunk-5y3kx4kk.js} +1 -1
- package/bin/{chunk-d2dgazjj.js → chunk-68xsb3t8.js} +1 -1
- package/bin/{chunk-n9vp9nbg.js → chunk-6hs63sva.js} +30 -30
- package/bin/{chunk-bpxw19ez.js → chunk-6pwf7qa6.js} +1 -1
- package/bin/{chunk-f5z3096k.js → chunk-6sq6dfa1.js} +2 -2
- package/bin/chunk-87secbzy.js +1 -0
- package/bin/chunk-8pykp70z.js +1 -0
- package/bin/{chunk-3pm6q6kg.js → chunk-8ts3xkme.js} +1 -1
- package/bin/{chunk-rza95y4z.js → chunk-909h3qzp.js} +2 -2
- package/bin/{chunk-0v9srsdz.js → chunk-929abwgr.js} +1 -1
- package/bin/{chunk-j53sjkxt.js → chunk-9ca8a5f2.js} +1 -1
- package/bin/{chunk-2pw7xcrn.js → chunk-9fyb95r5.js} +1 -1
- package/bin/{chunk-mneeg71d.js → chunk-axeq2pq5.js} +2 -2
- package/bin/{chunk-r249n1xe.js → chunk-b3tkvdfk.js} +2 -2
- package/bin/{chunk-9ggwc289.js → chunk-b6dbqs39.js} +1 -1
- package/bin/{chunk-w73v578p.js → chunk-b88tdt79.js} +2 -2
- package/bin/{chunk-19q13a80.js → chunk-bcyvxp1c.js} +4 -4
- package/bin/{chunk-7qvvf0yd.js → chunk-bn0taqr3.js} +2 -2
- package/bin/chunk-cb37q6t0.js +1 -0
- package/bin/chunk-cfqny70c.js +3 -0
- package/bin/{chunk-ffj9cq9y.js → chunk-cqnected.js} +1 -1
- package/bin/{chunk-98mg3dpd.js → chunk-cvfznrnt.js} +4 -4
- package/bin/{chunk-951r2rx1.js → chunk-d1q1tn36.js} +1 -1
- package/bin/{chunk-0asthrjf.js → chunk-d1rjpbgv.js} +2 -2
- package/bin/{chunk-81dawvn4.js → chunk-eshwjf91.js} +2 -2
- package/bin/{chunk-04avc4fn.js → chunk-fa9yq17g.js} +26 -26
- package/bin/{chunk-m6v8vt2b.js → chunk-fnkkwna8.js} +2 -2
- package/bin/{chunk-3q5qkfkc.js → chunk-fpjvr3qw.js} +1 -1
- package/bin/{chunk-ggfx2b0f.js → chunk-fsr83nb1.js} +1 -1
- package/bin/{chunk-kzr6ecke.js → chunk-fznchvm7.js} +1 -1
- package/bin/chunk-g2z0c39g.js +1 -0
- package/bin/{chunk-5vqbzsjv.js → chunk-gvcjqcjf.js} +1 -1
- package/bin/{chunk-0ge2mm8j.js → chunk-hbnpx0a5.js} +1 -1
- package/bin/{chunk-tvkekn4z.js → chunk-hgy9rqt1.js} +1 -1
- package/bin/chunk-hk659cg2.css +1 -0
- package/bin/{chunk-8ny7wvzb.js → chunk-hn2g40r6.js} +1 -1
- package/bin/{chunk-0y4zq3y4.js → chunk-hsx4pns6.js} +1 -1
- package/bin/{chunk-bbcmhcvc.js → chunk-hy5ncvpf.js} +2 -2
- package/bin/{chunk-5nqvqvqp.js → chunk-j420aqk8.js} +3 -3
- package/bin/{chunk-t1yamxgk.js → chunk-k3ds96cb.js} +1 -1
- package/bin/{chunk-dppfek34.js → chunk-m41tbrvt.js} +2 -2
- package/bin/chunk-m9f21ye9.js +1 -0
- package/bin/chunk-md7pgk86.js +2 -0
- package/bin/chunk-me3zmpj5.js +14 -0
- package/bin/chunk-mg6sybt0.js +1 -0
- package/bin/{chunk-jgfye6nf.js → chunk-mzme3m82.js} +1 -1
- package/bin/{chunk-ce0bhc72.js → chunk-n08h1jgx.js} +1 -1
- package/bin/{chunk-ae6zgjhd.js → chunk-ncv8v6mj.js} +2 -2
- package/bin/{chunk-cx32wsa1.js → chunk-nmd1901j.js} +1 -1
- package/bin/{chunk-wnqxyqrg.js → chunk-np39aknv.js} +2 -2
- package/bin/{chunk-dche0gy0.js → chunk-p7zw53ep.js} +1 -1
- package/bin/{chunk-xr2v0d6y.js → chunk-ppb4aj0y.js} +4 -4
- package/bin/{chunk-15vsw36h.js → chunk-pwq6dbb5.js} +5 -5
- package/bin/chunk-q1gfypy3.js +2 -0
- package/bin/{chunk-0j22699g.js → chunk-q4qqmes7.js} +2 -2
- package/bin/{chunk-vm2pz2hm.js → chunk-q7t5zs7n.js} +2 -2
- package/bin/{chunk-e439kt05.js → chunk-qcpeefhr.js} +1 -1
- package/bin/{chunk-6rn094yj.js → chunk-qjdvs1s5.js} +1 -1
- package/bin/{chunk-9zgqjdx1.js → chunk-qqapw198.js} +2 -2
- package/bin/chunk-qx553512.js +211 -0
- package/bin/chunk-r3s1x5wp.js +1 -0
- package/bin/{chunk-rtaya5wc.js → chunk-rh8dy99a.js} +2 -2
- package/bin/{chunk-5rzxekn4.js → chunk-s0vfj06y.js} +1 -1
- package/bin/{chunk-4zksqvwj.js → chunk-s6g2mzpn.js} +2 -2
- package/bin/{chunk-zckxc8m6.js → chunk-s9sf37dv.js} +2 -2
- package/bin/{chunk-19jpn3r6.js → chunk-scvepfv8.js} +1 -1
- package/bin/chunk-sjbvt3wa.js +2 -0
- package/bin/{chunk-mn208vrv.js → chunk-srmx5z3v.js} +2 -2
- package/bin/{chunk-r776bhsg.js → chunk-srv5kvm4.js} +1 -1
- package/bin/{chunk-qmrg2jhs.js → chunk-t1h12r3q.js} +5 -5
- package/bin/{chunk-gvas3xkp.js → chunk-t6myw0jf.js} +1 -1
- package/bin/{chunk-z8e4wc59.js → chunk-t8jfp3vx.js} +1 -1
- package/bin/{chunk-15w79661.js → chunk-tqdde9bj.js} +1 -1
- package/bin/chunk-vk9ecq8n.js +2 -0
- package/bin/{chunk-d5hbzp7t.js → chunk-vsnq4381.js} +1 -1
- package/bin/{chunk-1nvj833s.js → chunk-w4adkd0a.js} +5 -5
- package/bin/{chunk-qxscgcn9.js → chunk-wbmqbpgm.js} +1 -1
- package/bin/{chunk-v034sfw8.js → chunk-wperd2h9.js} +2 -2
- package/bin/{chunk-y2dhf3p0.js → chunk-xbw7ffrz.js} +2 -2
- package/bin/{chunk-9bakwac0.js → chunk-xdrpahym.js} +4 -4
- package/bin/{chunk-6jkjx0n2.js → chunk-xfmnfcv2.js} +3 -3
- package/bin/chunk-xhngtwn9.js +1 -0
- package/bin/chunk-xjnehexk.js +2 -0
- package/bin/chunk-xzb0t8mx.js +1 -0
- package/bin/{chunk-k3prp6c6.js → chunk-y5h5d5gx.js} +4 -4
- package/bin/{chunk-wwkhskce.js → chunk-y6xyc4wp.js} +2 -2
- package/bin/{chunk-93p27bbm.js → chunk-zpk87b33.js} +5 -5
- package/bin/{chunk-asy868kq.js → chunk-zq5j9wsc.js} +1 -1
- package/bin/{chunk-grjek810.js → chunk-zsg61vr0.js} +2 -2
- package/bin/chunk-zts21ft7.js +1 -0
- package/bin/{chunk-cpj562n6.js → chunk-zzbn0b6c.js} +1 -1
- package/bin/shumai-app.html +1 -1
- package/bin/shumai-app.js +350 -333
- package/package.json +7 -7
- package/prisma/migrations/20261014054332_add_embedding_768/migration.sql +8 -0
- package/prisma/schema.prisma +10 -8
- package/bin/chunk-2gf95tj0.js +0 -1
- package/bin/chunk-2tk5w3jc.js +0 -1
- package/bin/chunk-301e7g3z.js +0 -2
- package/bin/chunk-3kmjbc3m.js +0 -2
- package/bin/chunk-3td60k1m.js +0 -2
- package/bin/chunk-42hrvk6k.js +0 -211
- package/bin/chunk-5bk16qdp.js +0 -2
- package/bin/chunk-8abhmarc.js +0 -2
- package/bin/chunk-965102pf.js +0 -3
- package/bin/chunk-acn3r2m2.js +0 -1
- package/bin/chunk-ce75dw3k.css +0 -1
- package/bin/chunk-d9qpgkek.js +0 -2
- package/bin/chunk-dv6p6n5e.js +0 -1
- package/bin/chunk-qb178ntp.js +0 -2
- package/bin/chunk-s4r6e6ms.js +0 -1
- package/bin/chunk-syjjke3f.js +0 -1
- package/bin/chunk-tgfxe0sb.js +0 -1
- package/bin/chunk-tjretpx8.js +0 -1
- package/bin/chunk-w4yjgez6.js +0 -14
- package/bin/chunk-wjcebkpb.js +0 -1
- package/bin/chunk-ws71fg50.js +0 -2
- package/bin/chunk-yfp3q4da.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Oe,mr}from"./chunk-
|
|
2
|
+
import{Oe,mr}from"./chunk-srmx5z3v.js";import{Bn,Xr,Cn}from"./chunk-b88tdt79.js";var n=class{get supportsCreateIfNotExists(){return!0}get supportsTransactionalDdl(){return!1}get supportsReturning(){return!0}async acquireMigrationLock(){}async releaseMigrationLock(){}get supportsOutput(){return!0}},s=class{#e;#t=new o;#r;#a;constructor(e){this.#e={...e}}async init(){if(this.#r=this.#e.database,this.#a=new i(this.#r),this.#e.onCreateConnection)await this.#e.onCreateConnection(this.#a)}async acquireConnection(){return await this.#t.lock(),this.#a}async beginTransaction(e){await e.executeQuery(mr.raw("begin"))}async commitTransaction(e){await e.executeQuery(mr.raw("commit"))}async rollbackTransaction(e){await e.executeQuery(mr.raw("rollback"))}async releaseConnection(){this.#t.unlock()}async destroy(){this.#r?.close()}},i=class{#e;constructor(e){this.#e=e}executeQuery(e){let{sql:r,parameters:a}=e,t=this.#e.prepare(r).all(...a);return Promise.resolve({rows:t})}async*streamQuery(){throw Error("Streaming query is not supported by SQLite driver.")}},o=class{#e;#t;async lock(){while(this.#e!==void 0)await this.#e;this.#e=new Promise((e)=>{this.#t=e})}unlock(){let e=this.#t;this.#e=void 0,this.#t=void 0,e?.()}},c=class{#e;constructor(e){this.#e=e}async getSchemas(){return[]}async getTables(e={withInternalKyselyTables:!1}){let r=this.#e.selectFrom("sqlite_schema").where("type","=","table").where("name","not like","sqlite_%").select("name").$castTo();if(!e.withInternalKyselyTables)r=r.where("name","!=",Xr).where("name","!=",Cn);let a=await r.execute();return Promise.all(a.map(({name:t})=>this.#t(t)))}async getMetadata(e){return{tables:await this.getTables(e)}}async#t(e){let r=this.#e,a=(await r.selectFrom("sqlite_master").where("name","=",e).select("sql").$castTo().execute())[0]?.sql?.split(/[\(\),]/)?.find((t)=>t.toLowerCase().includes("autoincrement"))?.split(/\s+/)?.[0]?.replace(/["`]/g,"");return{name:e,columns:(await r.selectFrom(Oe`pragma_table_info(${e})`.as("table_info")).select(["name","type","notnull","dflt_value"]).execute()).map((t)=>({name:t.name,dataType:t.type,isNullable:!t.notnull,isAutoIncrementing:t.name===a,hasDefaultValue:t.dflt_value!=null})),isView:!0}}},l=class extends Bn{getCurrentParameterPlaceholder(){return"?"}getLeftIdentifierWrapper(){return'"'}getRightIdentifierWrapper(){return'"'}getAutoIncrement(){return"autoincrement"}},m=class{#e;constructor(e){this.#e={...e}}createDriver(){return new s(this.#e)}createQueryCompiler(){return new l}createAdapter(){return new n}createIntrospector(e){return new c(e)}};export{m as NodeSqliteDialect};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{I}from"./chunk-
|
|
2
|
-
export{
|
|
1
|
+
import{I}from"./chunk-qx553512.js";var a=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],dn=I("sparkles",a);
|
|
2
|
+
export{dn};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{m,S,t,Z,ze,A,ut,Ct,rm}from"./chunk-qx553512.js";import"./chunk-fa9yq17g.js";import"./chunk-me3zmpj5.js";import"./chunk-1tesbv8w.js";import"./chunk-cqnected.js";import"./chunk-np39aknv.js";import"./chunk-2w2bknn2.js";import"./chunk-s9sf37dv.js";import"./chunk-909h3qzp.js";import"./chunk-461gcgrs.js";import"./chunk-d1rjpbgv.js";import"./chunk-2pt9h882.js";import"./chunk-xfmnfcv2.js";import"./chunk-6pwf7qa6.js";import{Qn}from"./chunk-n08h1jgx.js";import{tr}from"./chunk-md7pgk86.js";import"./chunk-y6xyc4wp.js";import"./chunk-tqdde9bj.js";import"./chunk-03zkxckm.js";import"./chunk-4nkwe7dz.js";import"./chunk-qqapw198.js";import"./chunk-wbmqbpgm.js";import"./chunk-zsg61vr0.js";import"./chunk-68xsb3t8.js";S();function l(){let{projectId:o}=c.useParams(),{teamId:r,ensureTeamIdForProject:a}=ut();m(()=>{a(o)},[o,a]);let{data:s}=tr(rm(o)),e=s?.rootFolder,{data:i}=Z({queryKey:["folders",e],queryFn:async()=>{let n=await A.api.folders[":folderId"].$get({param:{folderId:e}});if(!n.ok)throw Error("failed to fetch folder");return await n.json()},enabled:!!e});if(!r||!e||!i)return t(Ct,{});return t(Qn,{teamId:r,projectId:o,projectName:s.name??"",assetId:e,rootFolderId:e})}var c=ze("/projects/$projectId/")({component:l});export{c as Route};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m,_,u,S,L,t,o,V,Ta,Z,B,Re,ze,A,I,or,O,Pe,de,Ne,E,C,Ce,Ie,Te,ge,Ae,_e,K,KA,WA,d_,De,ty,_y,wy,Of,ct,Xy,eb,lb,Hb,hv,gv,Hc,Qw,OS,TE,PE,FE,LE,ZE,BE,UE,Rg,zE,RC,Gs,Qc,Pl,aT,Nl,Kc,Wc,cT,Yc,dT,ZT,I1,k1,P1,N1,Yp,Jc,Xe,et,tt,rt,nt,ot,st,it,ue,ae,pe,qe,le,Mt,z,Ot,M,FA,W,Me,_r}from"./chunk-42hrvk6k.js";import{Kl}from"./chunk-5bk16qdp.js";import{zl}from"./chunk-8abhmarc.js";import{ga}from"./chunk-j53sjkxt.js";import{uo}from"./chunk-qxscgcn9.js";import{fn}from"./chunk-grjek810.js";import"./chunk-d2dgazjj.js";var $e=[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M11 4h10",key:"1w87gc"}],["path",{d:"M11 8h7",key:"djye34"}],["path",{d:"M11 12h4",key:"q8tih4"}]],te=I("arrow-down-wide-narrow",$e);var Le=[["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M12 21v-9",key:"17s77i"}],["path",{d:"M12 8V3",key:"13r4qs"}],["path",{d:"M17 16h4",key:"h1uq16"}],["path",{d:"M19 12V3",key:"o1uvq1"}],["path",{d:"M19 21v-5",key:"qua636"}],["path",{d:"M3 14h4",key:"bcjad9"}],["path",{d:"M5 10V3",key:"cb8scm"}],["path",{d:"M5 21v-7",key:"1w1uti"}]],ne=I("sliders-vertical",Le);S();function ce({open:a,onOpenChange:c,mode:d,teamId:h,project:l}){let g=V(),f=Re(),[n,b]=u(""),[k,x]=u(!0),[T,w]=u(void 0),[F,y]=u(void 0),[v,P]=u(!1),N=_(null);m(()=>{if(a)if(d==="edit"&&l)b(l.name||""),w(l.coverImageKey),y(l.coverImage),x(l.enableNotification!==!1);else b(""),w(void 0),y(void 0),x(!0)},[a,d,l]);let q=A.api.teams[":teamId"].projects.$post,{mutate:Y}=B({mutationFn:async(i)=>{let s=await q({param:{teamId:h},json:i});if(!s.ok)throw Error(Hb());return await s.json()},onSuccess:(i)=>{g.invalidateQueries({queryKey:["teams",h,"projects"]}),c(!1);let s=i;if(s&&typeof s.id==="string")f({to:"/projects/$projectId",params:{projectId:s.id}})}}),R=A.api.projects[":projectId"].$put,{mutate:G}=B({mutationFn:async(i)=>{let s=await R({param:{projectId:l.id},json:i});if(!s.ok)throw Error(hv());return await s.json()},onSuccess:()=>{g.invalidateQueries({queryKey:["teams",h,"projects"]}),c(!1)}}),J=A.api.teams[":teamId"].files.$post,{mutate:U}=B({mutationFn:async({file:i})=>{let s=await J({param:{teamId:h},form:{file:i}});if(!s.ok)throw Error(Hc());return await s.json()},onSuccess:(i)=>{let s=i;if(s&&typeof s.key==="string")w(s.key);P(!1)},onError:()=>{P(!1)}}),p=(i)=>{let s=i.target.files?.[0];if(s){P(!0);let ee=URL.createObjectURL(s);y(ee),U({file:s})}},D=()=>{N.current?.click()},Q=(i)=>{i.stopPropagation(),w(void 0),y(void 0)},j=()=>{if(!n.trim())return;if(d==="create")Y({name:n.trim(),coverImageKey:T,enableNotification:k});else if(d==="edit"&&l?.id)G({name:n.trim(),coverImageKey:T,enableNotification:k})};return t(ue,{open:a,onOpenChange:c,children:o(ae,{className:"sm:max-w-[550px] overflow-hidden rounded-2xl border border-border/60 bg-background/95 backdrop-blur-md shadow-2xl p-0 gap-0",children:[o(pe,{className:"relative overflow-hidden bg-gradient-to-br from-primary/5 to-transparent p-6 border-b border-border/40",children:[t("div",{className:"absolute top-0 right-0 w-24 h-24 bg-primary/10 rounded-full blur-2xl pointer-events-none"}),t("div",{className:"absolute bottom-0 left-10 w-32 h-12 bg-primary/5 rounded-full blur-xl pointer-events-none"}),t("div",{className:"flex items-center gap-3",children:o("div",{children:[t(le,{className:"text-xl font-semibold tracking-tight text-foreground",children:d==="create"?wy():Rg()}),t(Mt,{className:"text-xs text-muted-foreground/80 mt-1",children:d==="create"?ty():Qw()})]})})]}),o("div",{className:"space-y-6 p-6 max-h-[75vh] overflow-y-auto",children:[o("div",{className:"space-y-2",children:[t(W,{htmlFor:"name",className:"text-sm font-semibold tracking-tight text-foreground",children:FE()}),o("div",{className:"relative",children:[t(z,{id:"name",value:n,onChange:(i)=>b(i.target.value),placeholder:ZE(),className:"h-11 px-4 rounded-xl border-border/80 focus-visible:ring-ring/25 focus-visible:border-primary transition-all shadow-xs pr-10"}),n.trim()&&t("div",{className:"absolute inset-y-0 right-3 flex items-center",children:t(Pe,{className:"w-4 h-4 text-primary"})})]}),t("p",{className:"text-[11px] text-muted-foreground",children:LE()})]}),o("div",{className:"space-y-3 border-t border-border/40 pt-5",children:[o("div",{className:"flex items-center justify-between",children:[o(W,{className:"text-sm font-semibold tracking-tight text-foreground flex items-center gap-1.5",children:[t(fn,{className:"w-4 h-4 text-primary"}),PE()]}),F&&o("button",{type:"button",onClick:Q,className:"text-xs text-muted-foreground hover:text-destructive hover:bg-destructive/5 px-2.5 py-1 rounded-lg transition-all flex items-center gap-1 font-medium",children:[t(Ne,{className:"w-3.5 h-3.5"}),RC()]})]}),o("div",{className:"relative aspect-square w-48 mx-auto rounded-2xl border border-dashed border-border flex items-center justify-center cursor-pointer overflow-hidden group shadow-inner bg-muted/20 transition-all duration-300 hover:border-primary/50 hover:bg-muted/40",onClick:D,children:[t("input",{type:"file",ref:N,className:"hidden",accept:"image/*",onChange:p}),v&&t("div",{className:"absolute inset-0 bg-background/70 backdrop-blur-xs flex flex-col items-center justify-center gap-2 z-20",children:o("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-background border rounded-full shadow-lg",children:[t(O,{className:"w-4 h-4 animate-spin text-primary"}),t("span",{className:"text-xs font-semibold text-foreground",children:Jc()})]})}),F?o(L,{children:[t("img",{src:F,alt:_y(),className:"w-full h-full object-cover transition-transform duration-500 group-hover:scale-105"}),o("div",{className:"absolute inset-0 bg-black/45 opacity-0 group-hover:opacity-100 transition-opacity duration-300 flex flex-col items-center justify-center gap-1.5 text-white z-10",children:[t(uo,{className:"w-5 h-5 transform translate-y-1 group-hover:translate-y-0 transition-transform duration-300"}),t("span",{className:"text-xs font-semibold",children:Yp()})]})]}):o("div",{className:"flex flex-col items-center gap-2 text-center p-4",children:[t("div",{className:"p-2.5 rounded-full bg-background border shadow-xs group-hover:scale-110 transition-transform duration-300",children:t(uo,{className:"w-4 h-4 text-muted-foreground"})}),o("div",{children:[t("p",{className:"text-xs font-medium text-foreground",children:P1()}),t("p",{className:"text-[11px] text-muted-foreground mt-0.5 max-w-[140px] mx-auto leading-normal",children:N1()})]})]})]})]}),o("div",{className:"space-y-3 border-t border-border/40 pt-5",children:[o(W,{className:"text-sm font-semibold tracking-tight text-foreground flex items-center gap-1.5",children:[t(ne,{className:"w-4 h-4 text-primary"}),UE()]}),o("div",{className:"flex items-start justify-between rounded-xl border border-border/50 bg-muted/10 p-4 transition-all duration-300 hover:bg-muted/20",children:[o("div",{className:"space-y-1 pr-4",children:[o("div",{className:"text-sm font-semibold flex items-center gap-2 text-foreground",children:[t(ga,{className:"w-4 h-4 text-primary"}),KA()]}),t("p",{className:"text-xs text-muted-foreground leading-normal",children:WA()})]}),t(Me,{checked:k,onCheckedChange:x,disabled:v,className:"mt-0.5"})]})]})]}),o(qe,{className:"flex items-center justify-end gap-3 px-6 py-4 bg-muted/20 border-t border-border/40",children:[t(C,{type:"button",variant:"ghost",onClick:()=>c(!1),disabled:v,className:"rounded-xl h-10 px-4 hover:bg-muted font-medium text-sm text-muted-foreground hover:text-foreground transition-colors",children:De()}),t(C,{type:"submit",onClick:j,disabled:!n.trim()||v,className:"rounded-xl h-10 px-5 bg-primary text-primary-foreground hover:bg-primary/90 font-semibold text-sm shadow-lg shadow-primary/10 hover:shadow-primary/20 active:scale-98 transition-all flex items-center gap-2",children:v?o(L,{children:[t(O,{className:"w-4 h-4 animate-spin"}),TE()]}):d==="create"?Of():Gs()})]})]})})}function me({sortBy:a,sortDirection:c,onSortChange:d}){let h=(n)=>{d(n,c)},l=()=>{d(a,c==="asc"?"desc":"asc")},g=(n)=>{switch(n){case"name":return Nl();case"created_at":return aT();case"updated_at":return cT();default:return n}},f=c==="asc";return o(ge,{children:[t(Ae,{asChild:!0,children:o(C,{variant:"outline",className:"gap-2 bg-muted/50",children:[t("span",{className:"text-muted-foreground",children:dT()}),t("span",{className:"font-medium text-foreground",children:g(a)})]})}),o(_e,{align:"end",className:"w-56 p-2",children:[t("div",{className:"text-xs font-semibold text-muted-foreground mb-2 px-2",children:Pl()}),o(ge,{children:[t(Ae,{asChild:!0,children:o(C,{variant:"ghost",className:"w-full justify-between font-normal px-2 h-10 bg-muted/50 hover:bg-muted mb-2 border",children:[t("span",{children:g(a)}),t(te,{className:"h-4 w-4 opacity-50"})]})}),t(_e,{className:"w-52",children:["name","created_at","updated_at"].map((n)=>o(K,{onClick:()=>h(n),className:"justify-between",children:[g(n),a===n&&t(Pe,{className:"h-4 w-4"})]},n))})]}),o(C,{variant:"ghost",className:"w-full justify-between font-normal px-2 h-10 bg-muted/50 hover:bg-muted border",onClick:l,children:[t("span",{className:"text-muted-foreground",children:a==="name"?f?t(L,{children:Qc()}):t(L,{children:Yc()}):f?t(L,{children:Wc()}):t(L,{children:Kc()})}),f?t(zl,{className:"h-4 w-4 opacity-50"}):t(te,{className:"h-4 w-4 opacity-50"})]})]})]})}S();function Ke(){let{teamId:a}=Ue.useParams(),{canEdit:c,canAdmin:d}=Ot(),h=Re(),l=V(),[g,f]=u(null),[n,b]=u(!1),[k,x]=u("create"),[T,w]=u(void 0),[F,y]=u(!1),[v,P]=u(void 0),[N,q]=u(""),[Y,R]=u(!1),{metadata:G,setMetadata:J}=_r(),U=`team:${a}:projects:sort`,p=G[U],[D,Q]=u(()=>p?.sortBy||"name"),[j,i]=u(()=>p?.sortDirection||"asc");m(()=>{if(p?.sortBy&&p.sortBy!==D)Q(p.sortBy);if(p?.sortDirection&&p.sortDirection!==j)i(p.sortDirection)},[p]);let s=A.api.teams[":teamId"].projects.$get,{data:ee}=Z({queryKey:["teams",a,"projects",D,j],queryFn:async()=>{let e=await s({param:{teamId:a},query:{sortBy:D,sortDirection:j}});if(!e.ok)throw Error("Failed to fetch projects");return await e.json()},placeholderData:Ta}),{data:oe}=Z({queryKey:["teams",a,"members"],queryFn:async()=>{let e=await A.api.teams[":teamId"].members.$get({param:{teamId:a},query:{}});if(!e.ok)throw Error("Failed to fetch members");return await e.json()}}),{data:re}=Z({queryKey:["teams",a,"me"],queryFn:async()=>{let e=await A.api.teams[":teamId"].me.$get({param:{teamId:a}});if(!e.ok)throw Error("Failed to fetch me");return await e.json()}}),fe=A.api.teams[":teamId"].invite.$post,ve=B({mutationFn:async(e)=>{let r=await fe(e);if(!r.ok)throw Error("Failed to invite");return await r.json()}}),H=B({mutationFn:async(e)=>{if(!(await A.api.projects[":projectId"].$delete({param:{projectId:e}})).ok)throw Error("Failed to delete project")},onSuccess:()=>{l.invalidateQueries({queryKey:["teams",a,"projects"]})}}),he=B({mutationFn:async(e)=>{let r=await A.api.projects[":projectId"].$put({param:{projectId:e.id},json:{enableNotification:!e.enableNotification}});if(!r.ok)throw Error("Failed to update project notification settings");return await r.json()},onSuccess:()=>{l.invalidateQueries({queryKey:["teams",a,"projects"]}),M.success(BE())},onError:(e)=>{M.error(e instanceof Error?e.message:gv())}}),se=()=>{x("create"),w(void 0),b(!0)},ye=()=>{f("create"),setTimeout(()=>{f(null)},100),setTimeout(()=>{se()},200)},be=(e)=>{x("edit"),w(e),b(!0)},we=(e)=>{P(e),q(""),y(!0)},xe=async()=>{if(v&&N==="delete")try{await H.mutateAsync(v.id),y(!1)}catch(e){console.error(e)}},je=(e,r)=>{if(r.detail>1)return;f(e),setTimeout(()=>{f(null)},100),setTimeout(()=>{h({to:"/projects/$projectId",params:{projectId:e}})},200)},ke=async(e)=>(await ve.mutateAsync({param:{teamId:a},json:{role:e}})).code,Fe=B({mutationFn:async({userId:e,role:r})=>{if(!(await A.api.teams[":teamId"].members[":userId"].$patch({param:{teamId:a,userId:e},json:{role:r}})).ok)throw Error("Failed to update member role")},onSuccess:()=>{l.invalidateQueries({queryKey:["teams",a,"members"]})}}),Ee=B({mutationFn:async(e)=>{if(!(await A.api.teams[":teamId"].members[":userId"].$delete({param:{teamId:a,userId:e}})).ok)throw Error("Failed to remove member")},onSuccess:()=>{l.invalidateQueries({queryKey:["teams",a,"members"]})}}),Be=(e)=>{if(!e)return"??";return e.split(" ").map((r)=>r[0]).slice(0,2).join("").toUpperCase()},Se=(e,r)=>{Q(e),i(r),J(a,U,{sortBy:e,sortDirection:r})},X=Array.isArray(oe)?oe:[];return o("div",{className:"flex-1 overflow-y-auto p-4",children:[o("div",{className:"flex flex-wrap items-center justify-between mb-4 gap-4",children:[t("h1",{className:"text-2xl font-bold",children:zE()}),o("div",{className:"flex flex-wrap items-center gap-4",children:[o("div",{className:"flex items-center -space-x-2 cursor-pointer hover:opacity-90",onClick:()=>R(!0),"data-testid":"team-members-trigger",children:[X.slice(0,3).map((e)=>o(Ce,{className:"border-2 border-background w-8 h-8",children:[e.image&&t(Ie,{src:e.image,alt:e.name,className:"object-cover"}),t(Te,{className:"text-[10px]",children:Be(e.name)})]},e.id)),X.length>3&&o("div",{className:"flex items-center justify-center w-8 h-8 rounded-full border-2 border-background bg-muted text-[10px] font-medium",children:["+",X.length-3]})]}),t(me,{sortBy:D,sortDirection:j,onSortChange:Se}),c&&o(C,{className:"bg-orange-600 hover:bg-orange-700 text-white gap-2",onClick:se,children:[t(de,{className:"w-4 h-4"}),Of()]})]})]}),o("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-6 gap-4",children:[ee?.data?.map((e)=>t("div",{className:E("shadow-md relative border rounded-xl overflow-hidden cursor-pointer transition-transform duration-100 ease-in-out",g===e.id?"scale-95":"scale-100"),onClick:(r)=>je(e.id,r),children:o("div",{className:"flex flex-col",children:[o("div",{className:"relative w-full h-full aspect-square flex items-center justify-center bg-zinc-400/20",children:[e.coverImage?t("img",{src:e.coverImage,alt:e.name,className:"w-full h-full object-cover rounded"}):o("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 180.95 164.7",preserveAspectRatio:"xMidYMid slice",className:"w-full h-full object-cover rounded",children:[t("polygon",{fill:"#FC9F8E",points:"0 18.5 0 76.0 151.69 164.7 180.95 164.7 180.95 113.6"}),t("polygon",{fill:"#FEBAB8",points:"0 0 74.58 61.5 90.53 51.6 110.33 63.9 180.95 18.9 180.95 0"}),t("polyline",{fill:"#FAA5A5",points:"0 18.5 74.58 61.5 90.53 51.6 110.33 63.9 180.95 18.9 180.95 0 0 0"}),t("polygon",{fill:"#EC5B6C",points:"0 76.0 0 164.7 151.69 164.7"}),t("polygon",{fill:"#E85C71",points:"180.95 18.9 110.33 63.9 117.37 68.0 117.26 73.4 180.95 113.6"}),t("polygon",{fill:"#C8405B",points:"117.26 73.4 117.37 99.0 90.53 114.9 174.35 164.7 180.95 164.7 180.95 113.6"}),t("polygon",{fill:"#FFCCBE",points:"90.53 51.6 63.69 68.1 90.53 83.4"}),t("path",{fill:"#FB9991",d:"M 90.53 51.6 L 90.53 61.3 L 100.87 67.4 L 90.53 73.5 L 90.53 83.4 L 117.37 68.0 C 117.15 67.6 90.53 51.6 90.53 51.6 Z"}),t("path",{fill:"#FFEACD",d:"M 63.69 68.1 C 63.47 68.5 64.02 99.3 64.02 99.3 C 64.02 99.3 64.46 99.6 64.9 99.9 L 90.53 83.4 L 63.69 68.1 Z"}),t("polygon",{fill:"#FFCFB5",points:"64.02 99.3 90.53 114.9 90.53 83.4"}),t("path",{fill:"#F67D73",d:"M 90.53 83.4 L 90.53 114.9 L 117.37 99.0 Z"}),t("path",{fill:"#F26560",d:"M 90.53 83.4 L 117.37 99.0 L 117.37 68.0 Z"}),t("polygon",{fill:"#EB5F5B",points:"80.08 67.5 90.53 73.5 90.53 61.3"}),t("polygon",{fill:"#DB4D50",points:"90.53 61.3 90.53 73.5 100.87 67.4"})]}),t("div",{className:"absolute bottom-0 left-0 w-full h-[65%] bg-linear-to-t from-black/35 to-black/0"}),t("p",{className:"absolute left-1 bottom-2 text-white",children:e.name})]}),o("div",{className:"px-2 h-10 flex justify-between items-center",children:[o("p",{className:"truncate pr-1 text-xs text-muted-foreground",children:[k1()," ",FA(e.updatedAt??"")]}),t("div",{onClick:(r)=>r.stopPropagation(),children:o(ge,{modal:!1,children:[t(Ae,{asChild:!0,children:t("button",{className:"hover:bg-muted outline-none flex px-1",children:t(or,{className:"w-5 h-5 text-muted-foreground"})})}),o(_e,{align:"end",children:[c&&t(K,{onClick:(r)=>{r.stopPropagation(),be(e)},children:Rg()}),o(K,{className:"flex items-center justify-between gap-4 cursor-pointer",onSelect:(r)=>{r.preventDefault(),he.mutate(e)},children:[t("span",{children:OS()}),t(Me,{checked:e.enableNotification??!0,className:"pointer-events-none"})]}),d&&t(K,{className:"text-destructive focus:text-destructive",onClick:()=>we(e),children:ct()})]})]})})]})]})},e.id)),c&&t("div",{className:E("shadow-md relative border rounded-xl overflow-hidden cursor-pointer transition-transform duration-100 ease-in-out border-dashed hover:border-orange-600/50 group",g==="create"?"scale-95":"scale-100"),onClick:ye,children:o("div",{className:"flex flex-col",children:[t("div",{className:"relative w-full aspect-square flex items-center justify-center bg-zinc-400/5 group-hover:bg-orange-600/5 transition-colors",children:t(de,{className:"w-8 h-8 text-zinc-400 group-hover:text-orange-600 transition-colors"})}),t("div",{className:"px-2 h-10 flex items-center justify-center bg-zinc-400/10 border-t group-hover:bg-orange-600/10 transition-colors",children:t("p",{className:"text-sm text-muted-foreground group-hover:text-orange-600 transition-colors",children:Of()})})]})})]}),t(ce,{open:n,onOpenChange:b,mode:k,teamId:a,project:T}),t(Xe,{open:F,onOpenChange:y,children:o(et,{children:[o(tt,{children:[t(nt,{children:d_()}),o(ot,{children:[eb({name:v?.name??""}),o("div",{className:"mt-4 flex flex-col gap-2 text-foreground",children:[t("span",{className:"text-sm font-medium",children:I1()}),t(z,{value:N,onChange:(e)=>q(e.target.value),placeholder:Xy(),className:"h-9",autoFocus:!0})]})]})]}),o(rt,{children:[t(it,{disabled:H.isPending,children:De()}),t(st,{onClick:(e)=>{e.preventDefault(),xe()},disabled:N!=="delete"||H.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:H.isPending?lb():ct()})]})]})}),t(Kl,{open:Y,onOpenChange:R,title:ZT(),type:"team",members:X,isOwner:re?.role==="owner",onInvite:ke,onUpdateRole:async(e,r)=>{await Fe.mutateAsync({userId:e,role:r})},onRemoveMember:async(e)=>{await Ee.mutateAsync(e)},currentUserId:re?.id})]})}var Ue=ze("/teams/$teamId/")({component:Ke});export{Ue as Route};
|
|
1
|
+
import{m,_,u,S,L,t,o,V,Ta,Z,B,Re,ze,A,I,rr,O,Pe,de,Ne,C,E,Ce,Ie,Te,ge,Ae,_e,K,QA,KA,f_,De,ry,yy,xy,Of,ct,eb,tb,cb,$b,gv,Av,Gc,Kw,OS,TE,PE,FE,LE,ZE,BE,UE,kg,zE,RC,Vs,Wc,Ol,iT,Fl,Yc,Jc,lT,Xc,uT,LT,C1,M1,R1,P1,Yp,eu,Xe,et,tt,rt,nt,ot,st,it,ue,ae,pe,qe,le,Mt,z,Ot,M,OA,W,Me,_r}from"./chunk-qx553512.js";import{Jl}from"./chunk-461gcgrs.js";import{Hl}from"./chunk-24nx3krz.js";import{ga}from"./chunk-9ca8a5f2.js";import{uo}from"./chunk-wbmqbpgm.js";import{dn}from"./chunk-zsg61vr0.js";import"./chunk-68xsb3t8.js";var $e=[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M11 4h10",key:"1w87gc"}],["path",{d:"M11 8h7",key:"djye34"}],["path",{d:"M11 12h4",key:"q8tih4"}]],te=I("arrow-down-wide-narrow",$e);var Le=[["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M12 21v-9",key:"17s77i"}],["path",{d:"M12 8V3",key:"13r4qs"}],["path",{d:"M17 16h4",key:"h1uq16"}],["path",{d:"M19 12V3",key:"o1uvq1"}],["path",{d:"M19 21v-5",key:"qua636"}],["path",{d:"M3 14h4",key:"bcjad9"}],["path",{d:"M5 10V3",key:"cb8scm"}],["path",{d:"M5 21v-7",key:"1w1uti"}]],ne=I("sliders-vertical",Le);S();function ce({open:a,onOpenChange:c,mode:d,teamId:h,project:l}){let g=V(),f=Re(),[n,b]=u(""),[k,x]=u(!0),[T,w]=u(void 0),[F,y]=u(void 0),[v,P]=u(!1),N=_(null);m(()=>{if(a)if(d==="edit"&&l)b(l.name||""),w(l.coverImageKey),y(l.coverImage),x(l.enableNotification!==!1);else b(""),w(void 0),y(void 0),x(!0)},[a,d,l]);let q=A.api.teams[":teamId"].projects.$post,{mutate:Y}=B({mutationFn:async(i)=>{let s=await q({param:{teamId:h},json:i});if(!s.ok)throw Error($b());return await s.json()},onSuccess:(i)=>{g.invalidateQueries({queryKey:["teams",h,"projects"]}),c(!1);let s=i;if(s&&typeof s.id==="string")f({to:"/projects/$projectId",params:{projectId:s.id}})}}),R=A.api.projects[":projectId"].$put,{mutate:G}=B({mutationFn:async(i)=>{let s=await R({param:{projectId:l.id},json:i});if(!s.ok)throw Error(gv());return await s.json()},onSuccess:()=>{g.invalidateQueries({queryKey:["teams",h,"projects"]}),c(!1)}}),J=A.api.teams[":teamId"].files.$post,{mutate:U}=B({mutationFn:async({file:i})=>{let s=await J({param:{teamId:h},form:{file:i}});if(!s.ok)throw Error(Gc());return await s.json()},onSuccess:(i)=>{let s=i;if(s&&typeof s.key==="string")w(s.key);P(!1)},onError:()=>{P(!1)}}),p=(i)=>{let s=i.target.files?.[0];if(s){P(!0);let ee=URL.createObjectURL(s);y(ee),U({file:s})}},D=()=>{N.current?.click()},Q=(i)=>{i.stopPropagation(),w(void 0),y(void 0)},j=()=>{if(!n.trim())return;if(d==="create")Y({name:n.trim(),coverImageKey:T,enableNotification:k});else if(d==="edit"&&l?.id)G({name:n.trim(),coverImageKey:T,enableNotification:k})};return t(ue,{open:a,onOpenChange:c,children:o(ae,{className:"sm:max-w-[550px] overflow-hidden rounded-2xl border border-border/60 bg-background/95 backdrop-blur-md shadow-2xl p-0 gap-0",children:[o(pe,{className:"relative overflow-hidden bg-gradient-to-br from-primary/5 to-transparent p-6 border-b border-border/40",children:[t("div",{className:"absolute top-0 right-0 w-24 h-24 bg-primary/10 rounded-full blur-2xl pointer-events-none"}),t("div",{className:"absolute bottom-0 left-10 w-32 h-12 bg-primary/5 rounded-full blur-xl pointer-events-none"}),t("div",{className:"flex items-center gap-3",children:o("div",{children:[t(le,{className:"text-xl font-semibold tracking-tight text-foreground",children:d==="create"?xy():kg()}),t(Mt,{className:"text-xs text-muted-foreground/80 mt-1",children:d==="create"?ry():Kw()})]})})]}),o("div",{className:"space-y-6 p-6 max-h-[75vh] overflow-y-auto",children:[o("div",{className:"space-y-2",children:[t(W,{htmlFor:"name",className:"text-sm font-semibold tracking-tight text-foreground",children:FE()}),o("div",{className:"relative",children:[t(z,{id:"name",value:n,onChange:(i)=>b(i.target.value),placeholder:ZE(),className:"h-11 px-4 rounded-xl border-border/80 focus-visible:ring-ring/25 focus-visible:border-primary transition-all shadow-xs pr-10"}),n.trim()&&t("div",{className:"absolute inset-y-0 right-3 flex items-center",children:t(Pe,{className:"w-4 h-4 text-primary"})})]}),t("p",{className:"text-[11px] text-muted-foreground",children:LE()})]}),o("div",{className:"space-y-3 border-t border-border/40 pt-5",children:[o("div",{className:"flex items-center justify-between",children:[o(W,{className:"text-sm font-semibold tracking-tight text-foreground flex items-center gap-1.5",children:[t(dn,{className:"w-4 h-4 text-primary"}),PE()]}),F&&o("button",{type:"button",onClick:Q,className:"text-xs text-muted-foreground hover:text-destructive hover:bg-destructive/5 px-2.5 py-1 rounded-lg transition-all flex items-center gap-1 font-medium",children:[t(Ne,{className:"w-3.5 h-3.5"}),RC()]})]}),o("div",{className:"relative aspect-square w-48 mx-auto rounded-2xl border border-dashed border-border flex items-center justify-center cursor-pointer overflow-hidden group shadow-inner bg-muted/20 transition-all duration-300 hover:border-primary/50 hover:bg-muted/40",onClick:D,children:[t("input",{type:"file",ref:N,className:"hidden",accept:"image/*",onChange:p}),v&&t("div",{className:"absolute inset-0 bg-background/70 backdrop-blur-xs flex flex-col items-center justify-center gap-2 z-20",children:o("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-background border rounded-full shadow-lg",children:[t(O,{className:"w-4 h-4 animate-spin text-primary"}),t("span",{className:"text-xs font-semibold text-foreground",children:eu()})]})}),F?o(L,{children:[t("img",{src:F,alt:yy(),className:"w-full h-full object-cover transition-transform duration-500 group-hover:scale-105"}),o("div",{className:"absolute inset-0 bg-black/45 opacity-0 group-hover:opacity-100 transition-opacity duration-300 flex flex-col items-center justify-center gap-1.5 text-white z-10",children:[t(uo,{className:"w-5 h-5 transform translate-y-1 group-hover:translate-y-0 transition-transform duration-300"}),t("span",{className:"text-xs font-semibold",children:Yp()})]})]}):o("div",{className:"flex flex-col items-center gap-2 text-center p-4",children:[t("div",{className:"p-2.5 rounded-full bg-background border shadow-xs group-hover:scale-110 transition-transform duration-300",children:t(uo,{className:"w-4 h-4 text-muted-foreground"})}),o("div",{children:[t("p",{className:"text-xs font-medium text-foreground",children:R1()}),t("p",{className:"text-[11px] text-muted-foreground mt-0.5 max-w-[140px] mx-auto leading-normal",children:P1()})]})]})]})]}),o("div",{className:"space-y-3 border-t border-border/40 pt-5",children:[o(W,{className:"text-sm font-semibold tracking-tight text-foreground flex items-center gap-1.5",children:[t(ne,{className:"w-4 h-4 text-primary"}),UE()]}),o("div",{className:"flex items-start justify-between rounded-xl border border-border/50 bg-muted/10 p-4 transition-all duration-300 hover:bg-muted/20",children:[o("div",{className:"space-y-1 pr-4",children:[o("div",{className:"text-sm font-semibold flex items-center gap-2 text-foreground",children:[t(ga,{className:"w-4 h-4 text-primary"}),QA()]}),t("p",{className:"text-xs text-muted-foreground leading-normal",children:KA()})]}),t(Me,{checked:k,onCheckedChange:x,disabled:v,className:"mt-0.5"})]})]})]}),o(qe,{className:"flex items-center justify-end gap-3 px-6 py-4 bg-muted/20 border-t border-border/40",children:[t(E,{type:"button",variant:"ghost",onClick:()=>c(!1),disabled:v,className:"rounded-xl h-10 px-4 hover:bg-muted font-medium text-sm text-muted-foreground hover:text-foreground transition-colors",children:De()}),t(E,{type:"submit",onClick:j,disabled:!n.trim()||v,className:"rounded-xl h-10 px-5 bg-primary text-primary-foreground hover:bg-primary/90 font-semibold text-sm shadow-lg shadow-primary/10 hover:shadow-primary/20 active:scale-98 transition-all flex items-center gap-2",children:v?o(L,{children:[t(O,{className:"w-4 h-4 animate-spin"}),TE()]}):d==="create"?Of():Vs()})]})]})})}function me({sortBy:a,sortDirection:c,onSortChange:d}){let h=(n)=>{d(n,c)},l=()=>{d(a,c==="asc"?"desc":"asc")},g=(n)=>{switch(n){case"name":return Fl();case"created_at":return iT();case"updated_at":return lT();default:return n}},f=c==="asc";return o(ge,{children:[t(Ae,{asChild:!0,children:o(E,{variant:"outline",className:"gap-2 bg-muted/50",children:[t("span",{className:"text-muted-foreground",children:uT()}),t("span",{className:"font-medium text-foreground",children:g(a)})]})}),o(_e,{align:"end",className:"w-56 p-2",children:[t("div",{className:"text-xs font-semibold text-muted-foreground mb-2 px-2",children:Ol()}),o(ge,{children:[t(Ae,{asChild:!0,children:o(E,{variant:"ghost",className:"w-full justify-between font-normal px-2 h-10 bg-muted/50 hover:bg-muted mb-2 border",children:[t("span",{children:g(a)}),t(te,{className:"h-4 w-4 opacity-50"})]})}),t(_e,{className:"w-52",children:["name","created_at","updated_at"].map((n)=>o(K,{onClick:()=>h(n),className:"justify-between",children:[g(n),a===n&&t(Pe,{className:"h-4 w-4"})]},n))})]}),o(E,{variant:"ghost",className:"w-full justify-between font-normal px-2 h-10 bg-muted/50 hover:bg-muted border",onClick:l,children:[t("span",{className:"text-muted-foreground",children:a==="name"?f?t(L,{children:Wc()}):t(L,{children:Xc()}):f?t(L,{children:Jc()}):t(L,{children:Yc()})}),f?t(Hl,{className:"h-4 w-4 opacity-50"}):t(te,{className:"h-4 w-4 opacity-50"})]})]})]})}S();function Ke(){let{teamId:a}=Ue.useParams(),{canEdit:c,canAdmin:d}=Ot(),h=Re(),l=V(),[g,f]=u(null),[n,b]=u(!1),[k,x]=u("create"),[T,w]=u(void 0),[F,y]=u(!1),[v,P]=u(void 0),[N,q]=u(""),[Y,R]=u(!1),{metadata:G,setMetadata:J}=_r(),U=`team:${a}:projects:sort`,p=G[U],[D,Q]=u(()=>p?.sortBy||"name"),[j,i]=u(()=>p?.sortDirection||"asc");m(()=>{if(p?.sortBy&&p.sortBy!==D)Q(p.sortBy);if(p?.sortDirection&&p.sortDirection!==j)i(p.sortDirection)},[p]);let s=A.api.teams[":teamId"].projects.$get,{data:ee}=Z({queryKey:["teams",a,"projects",D,j],queryFn:async()=>{let e=await s({param:{teamId:a},query:{sortBy:D,sortDirection:j}});if(!e.ok)throw Error("Failed to fetch projects");return await e.json()},placeholderData:Ta}),{data:oe}=Z({queryKey:["teams",a,"members"],queryFn:async()=>{let e=await A.api.teams[":teamId"].members.$get({param:{teamId:a},query:{}});if(!e.ok)throw Error("Failed to fetch members");return await e.json()}}),{data:re}=Z({queryKey:["teams",a,"me"],queryFn:async()=>{let e=await A.api.teams[":teamId"].me.$get({param:{teamId:a}});if(!e.ok)throw Error("Failed to fetch me");return await e.json()}}),fe=A.api.teams[":teamId"].invite.$post,ve=B({mutationFn:async(e)=>{let r=await fe(e);if(!r.ok)throw Error("Failed to invite");return await r.json()}}),H=B({mutationFn:async(e)=>{if(!(await A.api.projects[":projectId"].$delete({param:{projectId:e}})).ok)throw Error("Failed to delete project")},onSuccess:()=>{l.invalidateQueries({queryKey:["teams",a,"projects"]})}}),he=B({mutationFn:async(e)=>{let r=await A.api.projects[":projectId"].$put({param:{projectId:e.id},json:{enableNotification:!e.enableNotification}});if(!r.ok)throw Error("Failed to update project notification settings");return await r.json()},onSuccess:()=>{l.invalidateQueries({queryKey:["teams",a,"projects"]}),M.success(BE())},onError:(e)=>{M.error(e instanceof Error?e.message:Av())}}),se=()=>{x("create"),w(void 0),b(!0)},ye=()=>{f("create"),setTimeout(()=>{f(null)},100),setTimeout(()=>{se()},200)},be=(e)=>{x("edit"),w(e),b(!0)},we=(e)=>{P(e),q(""),y(!0)},xe=async()=>{if(v&&N==="delete")try{await H.mutateAsync(v.id),y(!1)}catch(e){console.error(e)}},je=(e,r)=>{if(r.detail>1)return;f(e),setTimeout(()=>{f(null)},100),setTimeout(()=>{h({to:"/projects/$projectId",params:{projectId:e}})},200)},ke=async(e)=>(await ve.mutateAsync({param:{teamId:a},json:{role:e}})).code,Fe=B({mutationFn:async({userId:e,role:r})=>{if(!(await A.api.teams[":teamId"].members[":userId"].$patch({param:{teamId:a,userId:e},json:{role:r}})).ok)throw Error("Failed to update member role")},onSuccess:()=>{l.invalidateQueries({queryKey:["teams",a,"members"]})}}),Ee=B({mutationFn:async(e)=>{if(!(await A.api.teams[":teamId"].members[":userId"].$delete({param:{teamId:a,userId:e}})).ok)throw Error("Failed to remove member")},onSuccess:()=>{l.invalidateQueries({queryKey:["teams",a,"members"]})}}),Be=(e)=>{if(!e)return"??";return e.split(" ").map((r)=>r[0]).slice(0,2).join("").toUpperCase()},Se=(e,r)=>{Q(e),i(r),J(a,U,{sortBy:e,sortDirection:r})},X=Array.isArray(oe)?oe:[];return o("div",{className:"flex-1 overflow-y-auto p-4",children:[o("div",{className:"flex flex-wrap items-center justify-between mb-4 gap-4",children:[t("h1",{className:"text-2xl font-bold",children:zE()}),o("div",{className:"flex flex-wrap items-center gap-4",children:[o("div",{className:"flex items-center -space-x-2 cursor-pointer hover:opacity-90",onClick:()=>R(!0),"data-testid":"team-members-trigger",children:[X.slice(0,3).map((e)=>o(Ce,{className:"border-2 border-background w-8 h-8",children:[e.image&&t(Ie,{src:e.image,alt:e.name,className:"object-cover"}),t(Te,{className:"text-[10px]",children:Be(e.name)})]},e.id)),X.length>3&&o("div",{className:"flex items-center justify-center w-8 h-8 rounded-full border-2 border-background bg-muted text-[10px] font-medium",children:["+",X.length-3]})]}),t(me,{sortBy:D,sortDirection:j,onSortChange:Se}),c&&o(E,{className:"bg-orange-600 hover:bg-orange-700 text-white gap-2",onClick:se,children:[t(de,{className:"w-4 h-4"}),Of()]})]})]}),o("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-6 gap-4",children:[ee?.data?.map((e)=>t("div",{className:C("shadow-md relative border rounded-xl overflow-hidden cursor-pointer transition-transform duration-100 ease-in-out",g===e.id?"scale-95":"scale-100"),onClick:(r)=>je(e.id,r),children:o("div",{className:"flex flex-col",children:[o("div",{className:"relative w-full h-full aspect-square flex items-center justify-center bg-zinc-400/20",children:[e.coverImage?t("img",{src:e.coverImage,alt:e.name,className:"w-full h-full object-cover rounded"}):o("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 180.95 164.7",preserveAspectRatio:"xMidYMid slice",className:"w-full h-full object-cover rounded",children:[t("polygon",{fill:"#FC9F8E",points:"0 18.5 0 76.0 151.69 164.7 180.95 164.7 180.95 113.6"}),t("polygon",{fill:"#FEBAB8",points:"0 0 74.58 61.5 90.53 51.6 110.33 63.9 180.95 18.9 180.95 0"}),t("polyline",{fill:"#FAA5A5",points:"0 18.5 74.58 61.5 90.53 51.6 110.33 63.9 180.95 18.9 180.95 0 0 0"}),t("polygon",{fill:"#EC5B6C",points:"0 76.0 0 164.7 151.69 164.7"}),t("polygon",{fill:"#E85C71",points:"180.95 18.9 110.33 63.9 117.37 68.0 117.26 73.4 180.95 113.6"}),t("polygon",{fill:"#C8405B",points:"117.26 73.4 117.37 99.0 90.53 114.9 174.35 164.7 180.95 164.7 180.95 113.6"}),t("polygon",{fill:"#FFCCBE",points:"90.53 51.6 63.69 68.1 90.53 83.4"}),t("path",{fill:"#FB9991",d:"M 90.53 51.6 L 90.53 61.3 L 100.87 67.4 L 90.53 73.5 L 90.53 83.4 L 117.37 68.0 C 117.15 67.6 90.53 51.6 90.53 51.6 Z"}),t("path",{fill:"#FFEACD",d:"M 63.69 68.1 C 63.47 68.5 64.02 99.3 64.02 99.3 C 64.02 99.3 64.46 99.6 64.9 99.9 L 90.53 83.4 L 63.69 68.1 Z"}),t("polygon",{fill:"#FFCFB5",points:"64.02 99.3 90.53 114.9 90.53 83.4"}),t("path",{fill:"#F67D73",d:"M 90.53 83.4 L 90.53 114.9 L 117.37 99.0 Z"}),t("path",{fill:"#F26560",d:"M 90.53 83.4 L 117.37 99.0 L 117.37 68.0 Z"}),t("polygon",{fill:"#EB5F5B",points:"80.08 67.5 90.53 73.5 90.53 61.3"}),t("polygon",{fill:"#DB4D50",points:"90.53 61.3 90.53 73.5 100.87 67.4"})]}),t("div",{className:"absolute bottom-0 left-0 w-full h-[65%] bg-linear-to-t from-black/35 to-black/0"}),t("p",{className:"absolute left-1 bottom-2 text-white",children:e.name})]}),o("div",{className:"px-2 h-10 flex justify-between items-center",children:[o("p",{className:"truncate pr-1 text-xs text-muted-foreground",children:[M1()," ",OA(e.updatedAt??"")]}),t("div",{onClick:(r)=>r.stopPropagation(),children:o(ge,{modal:!1,children:[t(Ae,{asChild:!0,children:t("button",{className:"hover:bg-muted outline-none flex px-1",children:t(rr,{className:"w-5 h-5 text-muted-foreground"})})}),o(_e,{align:"end",children:[c&&t(K,{onClick:(r)=>{r.stopPropagation(),be(e)},children:kg()}),o(K,{className:"flex items-center justify-between gap-4 cursor-pointer",onSelect:(r)=>{r.preventDefault(),he.mutate(e)},children:[t("span",{children:OS()}),t(Me,{checked:e.enableNotification??!0,className:"pointer-events-none"})]}),d&&t(K,{className:"text-destructive focus:text-destructive",onClick:()=>we(e),children:ct()})]})]})})]})]})},e.id)),c&&t("div",{className:C("shadow-md relative border rounded-xl overflow-hidden cursor-pointer transition-transform duration-100 ease-in-out border-dashed hover:border-orange-600/50 group",g==="create"?"scale-95":"scale-100"),onClick:ye,children:o("div",{className:"flex flex-col",children:[t("div",{className:"relative w-full aspect-square flex items-center justify-center bg-zinc-400/5 group-hover:bg-orange-600/5 transition-colors",children:t(de,{className:"w-8 h-8 text-zinc-400 group-hover:text-orange-600 transition-colors"})}),t("div",{className:"px-2 h-10 flex items-center justify-center bg-zinc-400/10 border-t group-hover:bg-orange-600/10 transition-colors",children:t("p",{className:"text-sm text-muted-foreground group-hover:text-orange-600 transition-colors",children:Of()})})]})})]}),t(ce,{open:n,onOpenChange:b,mode:k,teamId:a,project:T}),t(Xe,{open:F,onOpenChange:y,children:o(et,{children:[o(tt,{children:[t(nt,{children:f_()}),o(ot,{children:[tb({name:v?.name??""}),o("div",{className:"mt-4 flex flex-col gap-2 text-foreground",children:[t("span",{className:"text-sm font-medium",children:C1()}),t(z,{value:N,onChange:(e)=>q(e.target.value),placeholder:eb(),className:"h-9",autoFocus:!0})]})]})]}),o(rt,{children:[t(it,{disabled:H.isPending,children:De()}),t(st,{onClick:(e)=>{e.preventDefault(),xe()},disabled:N!=="delete"||H.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:H.isPending?cb():ct()})]})]})}),t(Jl,{open:Y,onOpenChange:R,title:LT(),type:"team",members:X,isOwner:re?.role==="owner",onInvite:ke,onUpdateRole:async(e,r)=>{await Fe.mutateAsync({userId:e,role:r})},onRemoveMember:async(e)=>{await Ee.mutateAsync(e)},currentUserId:re?.id})]})}var Ue=ze("/teams/$teamId/")({component:Ke});export{Ue as Route};
|
package/bin/shumai-app.html
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
<meta name="theme-color" content="#ffffff" />
|
|
26
26
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
27
27
|
<title>Shumai</title>
|
|
28
|
-
<link rel="stylesheet" crossorigin href="./chunk-
|
|
28
|
+
<link rel="stylesheet" crossorigin href="./chunk-hk659cg2.css"><script type="module" crossorigin src="./chunk-qx553512.js"></script></head>
|
|
29
29
|
<body>
|
|
30
30
|
<div id="root"></div>
|
|
31
31
|
|