@isardsat/editorial-admin 6.5.0 → 6.5.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/build/client/assets/{authSlice-DXFkOZ5W.js → authSlice-BC3X-Dze.js} +141 -141
- package/build/client/assets/{dashboard._collection._document-B0ZbqsBo.js → dashboard._collection._document-5DoDCjb9.js} +1 -1
- package/build/client/assets/{dashboard._collection.new-mErjJpgV.js → dashboard._collection.new-CZuGYJjj.js} +1 -1
- package/build/client/assets/{dashboard._layout-124HIuKq.js → dashboard._layout-D8eDuulk.js} +1 -1
- package/build/client/assets/{dashboard.files-BgTiS3Ze.js → dashboard.files-DzKr0fnV.js} +1 -1
- package/build/client/assets/files-BpDIfAek.js +26 -0
- package/build/client/assets/{home-l-obs5PE.js → home-BMO8Phzv.js} +1 -1
- package/build/client/assets/{index-Cl368BLL.js → index-DuwVf14f.js} +1 -1
- package/build/client/assets/{itemForm-D7gNDu4Q.js → itemForm-C5JHfZSI.js} +1 -1
- package/build/client/assets/{manifest-e71b8e01.js → manifest-d31f28c7.js} +1 -1
- package/build/client/assets/{root-vSnuIdRx.js → root-Bmrk0090.js} +1 -1
- package/build/client/index.html +2 -2
- package/package.json +2 -2
- package/build/client/assets/files-rJZM0-f6.js +0 -26
|
@@ -1 +1 @@
|
|
|
1
|
-
import{w as c,p as e}from"./chunk-EF7DTUVF-MlADC7xe.js";import{I as p}from"./itemForm-
|
|
1
|
+
import{w as c,p as e}from"./chunk-EF7DTUVF-MlADC7xe.js";import{I as p}from"./itemForm-C5JHfZSI.js";import{m as n,p as l}from"./utils-BdGM_Id-.js";import"./button-DYtHJlPL.js";import"./index-BCGL68Qt.js";import"./types-BFhFSnS8.js";import"./index-BhhxCYB_.js";import"./index-xBXWoUIa.js";import"./createLucideIcon-BJQzFwzJ.js";import"./index-DuwVf14f.js";import"./authSlice-BC3X-Dze.js";import"./upload-CopmcV94.js";import"./calendar-6ih_JEvR.js";import"./files-BpDIfAek.js";import"./trash-CN5HT_ZJ.js";import"./external-link-D1If5twJ.js";const N=c(function({params:r}){const{collectionId:t,documentId:i}=r,{data:o,isFetching:s}=n(t),{data:m,isFetching:a}=l({itemType:t,id:i});return!o||!m||(s||a)?null:e.jsx("div",{className:"overflow-auto scrollbar-stable",children:e.jsx("div",{className:"flex p-4 gap-4",children:e.jsx(p,{itemType:t,fields:o.fields,data:m},`${t}-${i}`)})})});export{N as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{w as e,p as o}from"./chunk-EF7DTUVF-MlADC7xe.js";import{I as m}from"./itemForm-
|
|
1
|
+
import{w as e,p as o}from"./chunk-EF7DTUVF-MlADC7xe.js";import{I as m}from"./itemForm-C5JHfZSI.js";import{m as p}from"./utils-BdGM_Id-.js";import"./button-DYtHJlPL.js";import"./index-BCGL68Qt.js";import"./types-BFhFSnS8.js";import"./index-BhhxCYB_.js";import"./index-xBXWoUIa.js";import"./createLucideIcon-BJQzFwzJ.js";import"./index-DuwVf14f.js";import"./authSlice-BC3X-Dze.js";import"./upload-CopmcV94.js";import"./calendar-6ih_JEvR.js";import"./files-BpDIfAek.js";import"./trash-CN5HT_ZJ.js";import"./external-link-D1If5twJ.js";const P=e(function({params:i}){const{collectionId:t}=i,{data:r}=p(t);return r?o.jsx("div",{className:"overflow-auto",children:o.jsx("div",{className:"flex p-4 gap-4",children:o.jsx(m,{itemType:t,fields:r.fields,isNew:!0})})}):null});export{P as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{p as e,a as d,x as y,y as U,v as le,z as ce,R as ue,w as he,O as pe}from"./chunk-EF7DTUVF-MlADC7xe.js";import{u as xe,e as D,h as fe}from"./authSlice-
|
|
1
|
+
import{p as e,a as d,x as y,y as U,v as le,z as ce,R as ue,w as he,O as pe}from"./chunk-EF7DTUVF-MlADC7xe.js";import{u as xe,e as D,h as fe}from"./authSlice-BC3X-Dze.js";import{a as r,b as W,d as be,f as ge,g as me,h as je,u as ve,i as we}from"./utils-BdGM_Id-.js";import{R as Q,C as X,a as Z,X as Y,T as J,D as ee,P as te,O as ae,b as ye,c as Ne,d as Ce,e as Se,f as ke,g as _e,A as Me,u as ze,h as De}from"./index-DuwVf14f.js";import{B as _}from"./button-DYtHJlPL.js";import{c as b}from"./createLucideIcon-BJQzFwzJ.js";import{S as E,c as Ee,u as Oe}from"./index-BCGL68Qt.js";import{u as Re,c as Ae,P as O,a as Pe,b as Ie,d as Te}from"./index-BhhxCYB_.js";import{C as L,U as Le}from"./upload-CopmcV94.js";import{E as $e}from"./external-link-D1If5twJ.js";import"./index-xBXWoUIa.js";/**
|
|
2
2
|
* @license lucide-react v0.487.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{w as e,p as o}from"./chunk-EF7DTUVF-MlADC7xe.js";import{F as r}from"./files-
|
|
1
|
+
import{w as e,p as o}from"./chunk-EF7DTUVF-MlADC7xe.js";import{F as r}from"./files-BpDIfAek.js";import"./authSlice-BC3X-Dze.js";import"./utils-BdGM_Id-.js";import"./index-BCGL68Qt.js";import"./upload-CopmcV94.js";import"./createLucideIcon-BJQzFwzJ.js";import"./trash-CN5HT_ZJ.js";const n=e(function(){return o.jsx("div",{className:"overflow-auto flex flex-1 p-4 gap-4",children:o.jsx("div",{className:"flex flex-col flex-1 gap-8",children:o.jsx(r,{})})})});export{n as default};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import{p as e,a as g,x as F}from"./chunk-EF7DTUVF-MlADC7xe.js";import{e as v,m as y}from"./authSlice-BC3X-Dze.js";import{a as j,q as z,v as C,w as $,x as M,u as D,y as U,o as _}from"./utils-BdGM_Id-.js";import{S as H,c as L}from"./index-BCGL68Qt.js";import{U as b,C as S}from"./upload-CopmcV94.js";import{F as T,T as I}from"./trash-CN5HT_ZJ.js";import{c as m}from"./createLucideIcon-BJQzFwzJ.js";/**
|
|
2
|
+
* @license lucide-react v0.487.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const V=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],P=m("copy",V);/**
|
|
7
|
+
* @license lucide-react v0.487.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const q=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],E=m("file-text",q);/**
|
|
12
|
+
* @license lucide-react v0.487.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const R=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]],Z=m("file",R);/**
|
|
17
|
+
* @license lucide-react v0.487.0 - ISC
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the ISC license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/const G=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Q=m("folder-open",G);/**
|
|
22
|
+
* @license lucide-react v0.487.0 - ISC
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the ISC license.
|
|
25
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/const W=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],B=m("folder",W),O=L("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function A({className:s,variant:i,asChild:l=!1,...o}){const n=l?H:"span";return e.jsx(n,{"data-slot":"badge",className:j(O({variant:i}),s),...o})}const J=["txt","md","html","pdf"],K=["svg","webp","png","jpeg","jpg"],X=[{Icon:T,test:s=>K.some(i=>s.name.endsWith(i))},{Icon:E,test:s=>J.some(i=>s.name.endsWith(i))}],Y={Icon:Z},N=({node:s,level:i=0,onDelete:l,onChange:o,disableActions:n,onUpload:p,onCreateFolder:u})=>{const[d,f]=g.useState(!1),{data:h}=D();v(y);const a=X.find(r=>r.test(s))??Y,t=s.type==="directory",c=t||o?"div":F,w=()=>{t&&f(!d)},k=r=>{const x=r.target.files;x&&p&&p(s.path,x)};return e.jsxs("div",{className:"select-none",children:[e.jsxs(c,{to:`/${s.relativePath}`,target:"_blank",className:"flex items-center gap-2 h-10 p-2 group hover:bg-muted/50 cursor-pointer",style:{paddingLeft:`calc(0.5rem + ${i*20}px)`},onClick:t?w:o?()=>o(s.isLarge?`${h?.largeFilesUrl}/${s.relativePath}`:s.relativePath):void 0,children:[t?e.jsx(S,{size:16,className:j("transition-transform",{"rotate-180":d})}):e.jsx("div",{className:"w-4"}),e.jsxs("div",{className:"flex flex-grow w-24 items-center gap-2 ml-2",children:[t?d?e.jsx(Q,{size:16,className:"text-yellow-500"}):e.jsx(B,{size:16,className:"text-yellow-500"}):e.jsx(a.Icon,{size:16,className:" text-gray-500"}),e.jsxs("span",{className:"flex gap-2 items-center text-sm whitespace-nowrap text-ellipsis overflow-hidden w-full",children:[!t&&s.isLarge&&e.jsx(A,{variant:"outline",children:"Large"}),s.name]})]}),e.jsx("div",{className:"flex w-24 justify-end gap-2",children:e.jsx("span",{className:"text-sm text-gray-500",children:t?"--":U(s.size)})}),!n&&e.jsxs("div",{className:"flex items-center gap-1 ml-4 group-hover:visible invisible z-50",children:[t&&e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"file",multiple:!0,onChange:k,className:"hidden",id:`dir-upload-${s.name}-${i}`}),e.jsxs("label",{htmlFor:`dir-upload-${s.name}-${i}`,className:"hover:text-blue-500 p-1 hover:bg-muted rounded-sm cursor-pointer",onClick:r=>{r.stopPropagation()},children:[e.jsx(b,{size:16}),e.jsx("span",{className:"sr-only",children:"Upload files to this folder"})]})]}),e.jsxs("button",{className:_("hover:text-yellow-500 p-1 hover:bg-muted rounded-sm",t&&"hidden"),onClick:r=>{r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(s.path)},children:[e.jsx(P,{size:16}),e.jsx("span",{className:"sr-only",children:"Copy file URL"})]}),e.jsxs("button",{className:"hover:text-red-500 p-1 hover:bg-muted rounded-sm",onClick:r=>{r.preventDefault(),r.stopPropagation(),l(s.path)},children:[e.jsx(I,{size:16}),e.jsxs("span",{className:"sr-only",children:["Delete this ",t?"folder":"file"]})]})]})]}),t&&d&&s.children&&e.jsx("div",{children:s.children.map((r,x)=>e.jsx(N,{node:r,level:i+1,onDelete:l,onChange:o,disableActions:n,onUpload:p,onCreateFolder:u},`${r.name}-${x}`))})]})};function le({disableActions:s,onChange:i}){const{data:l}=z(),[o]=C(),[n]=$(),[p]=M();v(y);const u=async a=>{const t=a.target.files;if(t)try{await n({files:t}).unwrap()}catch(c){console.error("Upload failed:",c)}},d=async(a,t)=>{try{await n({files:t,path:a}).unwrap()}catch(c){console.error("Upload failed:",c)}},f=async(a,t)=>{try{await p({name:t,path:a}).unwrap()}catch(c){console.error("Create folder failed:",c)}},h=g.useMemo(()=>l?.toSorted((a,t)=>a.type==="directory"&&t.type!=="directory"?-1:a.type!=="directory"&&t.type==="directory"?1:a.name.localeCompare(t.name)).map(a=>e.jsx(N,{node:a,onDelete:o,onChange:i,disableActions:s,onUpload:d,onCreateFolder:f},a.name)),[l,s,i]);return e.jsxs("div",{className:"overflow-auto h-full max-w-[800px] rounded-xl border",children:[e.jsxs("div",{className:"sticky top-0 bg-white flex items-center gap-2 py-1 px-2 border-b group",children:[e.jsx("div",{className:"w-4"}),e.jsx("div",{className:"flex flex-grow items-center gap-2 ml-2",children:e.jsx("span",{className:"text-sm font-semibold",children:"Name"})}),e.jsx("div",{className:"flex w-24 items-center gap-2 ml-2",children:e.jsx("span",{className:"text-sm font-semibold",children:"Size"})}),!s&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("input",{type:"file",multiple:!0,onChange:u,className:"hidden",id:"file-upload"}),e.jsxs("label",{htmlFor:"file-upload",className:"hover:text-blue-500 p-1 hover:bg-muted rounded-sm cursor-pointer",children:[e.jsx(b,{size:16}),e.jsx("span",{className:"sr-only",children:"Upload files"})]})]})]}),h]})}export{le as F};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as p,p as e,w as f,v as b}from"./chunk-EF7DTUVF-MlADC7xe.js";import{B as g}from"./button-DYtHJlPL.js";import{o as N,b as y,s as d,u as w,F,a as n,c as t,d as x,e as i,I as u,f as m,C as v,t as C}from"./types-BFhFSnS8.js";import{S as L}from"./spinner-C3uu_C2V.js";import{u as S,e as c,l as E}from"./authSlice-
|
|
1
|
+
import{a as p,p as e,w as f,v as b}from"./chunk-EF7DTUVF-MlADC7xe.js";import{B as g}from"./button-DYtHJlPL.js";import{o as N,b as y,s as d,u as w,F,a as n,c as t,d as x,e as i,I as u,f as m,C as v,t as C}from"./types-BFhFSnS8.js";import{S as L}from"./spinner-C3uu_C2V.js";import{u as S,e as c,l as E}from"./authSlice-BC3X-Dze.js";import"./index-BCGL68Qt.js";import"./utils-BdGM_Id-.js";import"./index-BhhxCYB_.js";import"./index-xBXWoUIa.js";import"./createLucideIcon-BJQzFwzJ.js";const k=N({email:d().nonempty("Please enter your email").email(),password:d().nonempty("Please enter your password"),remember:y()});function P(){"use no memo";const o=S(),r=c(s=>s.auth.isLoading),a=w({resolver:C(k),disabled:r,defaultValues:{email:"",password:"",remember:!1}}),l=p.useCallback(({email:s,password:h,remember:j})=>{o(E({email:s,password:h,remember:j}))},[o]);return e.jsx("div",{className:"flex flex-col",children:e.jsx(F,{...a,children:e.jsxs("form",{onSubmit:a.handleSubmit(l),className:"space-y-4",children:[e.jsx(n,{control:a.control,name:"email",rules:{required:!0},render:({field:s})=>e.jsxs(t,{children:[e.jsx(x,{className:"flex gap-1 items-baseline",children:"Email"}),e.jsx(i,{children:e.jsx(u,{placeholder:"callasmaria@example.com",...s})}),e.jsx(m,{})]})}),e.jsx(n,{name:"password",control:a.control,rules:{required:!0},render:({field:s})=>e.jsxs(t,{children:[e.jsx(x,{className:"flex gap-1 items-baseline",children:"Password"}),e.jsx(i,{children:e.jsx(u,{type:"password",...s})}),e.jsx(m,{})]})}),e.jsx(n,{name:"remember",control:a.control,render:({field:s})=>e.jsxs(t,{children:[e.jsx(i,{children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(v,{id:"remember",checked:s.value,onCheckedChange:s.onChange}),e.jsx("label",{htmlFor:"remember",className:"text-sm leading-none",children:"Remember me"})]})}),e.jsx(m,{})]})}),e.jsx(g,{type:"submit",disabled:!a.formState.isValid||r,className:"w-full",children:r?e.jsx(L,{className:"absolute"}):"Login"})]})})})}const z=f(function(){const r=b(),a=c(s=>s.auth.user),l=c(s=>s.auth.isLoading);return p.useEffect(()=>{a&&r("/admin/dashboard")},[r,a]),l||a?null:e.jsx("div",{className:"flex w-full h-full",children:e.jsxs("div",{className:"self-center space-y-8 w-72 mx-auto",children:[e.jsxs("div",{className:"flex flex-col space-y-2 text-center",children:[e.jsx("h1",{className:"text-2xl font-semibold tracking-tight leading-none",children:"Editorial Admin"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Enter your details below to login"})]}),e.jsx(P,{})]})})});export{z as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as Kt}from"./createLucideIcon-BJQzFwzJ.js";import{a as c,D as vr,p as C}from"./chunk-EF7DTUVF-MlADC7xe.js";import{d as Ne,P as F,a as j,f as mr,c as at,g as gr,u as qt,b as we,e as yr}from"./index-BhhxCYB_.js";import{u as K,a as wr,b as xr}from"./index-BCGL68Qt.js";import{_ as ee,j as Zt,k as br}from"./authSlice-
|
|
1
|
+
import{c as Kt}from"./createLucideIcon-BJQzFwzJ.js";import{a as c,D as vr,p as C}from"./chunk-EF7DTUVF-MlADC7xe.js";import{d as Ne,P as F,a as j,f as mr,c as at,g as gr,u as qt,b as we,e as yr}from"./index-BhhxCYB_.js";import{u as K,a as wr,b as xr}from"./index-BCGL68Qt.js";import{_ as ee,j as Zt,k as br}from"./authSlice-BC3X-Dze.js";import{R as Er,a as Cr}from"./index-xBXWoUIa.js";/**
|
|
2
2
|
* @license lucide-react v0.487.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{R as _,a as I,p as M,A as Ty,x as Xg,B as Qg,C as Jd}from"./chunk-EF7DTUVF-MlADC7xe.js";import{b as Ms,B as pi}from"./button-DYtHJlPL.js";import{I as mo,g as Iy,u as uc,h as Ny,s as Gr,b as My,l as Ay,o as Oy,F as Py,a as Qa,c as el,d as is,e as tl,f as nl,C as Fy,i as Kd,t as Ly}from"./types-BFhFSnS8.js";import{a as he,q as ep,r as Dy,t as Ry}from"./utils-BdGM_Id-.js";import{c as tp}from"./createLucideIcon-BJQzFwzJ.js";import{h as $y,i as ca,j as np,u as Oo,k as cc,l as rp,m as ip,n as op,o as sp,p as ap,F as lp,q as up,r as cp,s as dp,R as fp,W as By,C as hp,T as gp,D as Hy,a as dc,P as pp,O as mp,t as Vy,X as zy,v as xp,b as Wy,V as jy,c as yp,d as bp,e as vp,f as Cp,g as wp,A as Uy}from"./index-
|
|
1
|
+
import{R as _,a as I,p as M,A as Ty,x as Xg,B as Qg,C as Jd}from"./chunk-EF7DTUVF-MlADC7xe.js";import{b as Ms,B as pi}from"./button-DYtHJlPL.js";import{I as mo,g as Iy,u as uc,h as Ny,s as Gr,b as My,l as Ay,o as Oy,F as Py,a as Qa,c as el,d as is,e as tl,f as nl,C as Fy,i as Kd,t as Ly}from"./types-BFhFSnS8.js";import{a as he,q as ep,r as Dy,t as Ry}from"./utils-BdGM_Id-.js";import{c as tp}from"./createLucideIcon-BJQzFwzJ.js";import{h as $y,i as ca,j as np,u as Oo,k as cc,l as rp,m as ip,n as op,o as sp,p as ap,F as lp,q as up,r as cp,s as dp,R as fp,W as By,C as hp,T as gp,D as Hy,a as dc,P as pp,O as mp,t as Vy,X as zy,v as xp,b as Wy,V as jy,c as yp,d as bp,e as vp,f as Cp,g as wp,A as Uy}from"./index-DuwVf14f.js";import{C as Jy}from"./upload-CopmcV94.js";import{u as Pr,c as Kr,b as _p,P as Ue,a as we,d as or}from"./index-BhhxCYB_.js";import{u as ct,a as As,b as Ky}from"./index-BCGL68Qt.js";import{C as kp}from"./calendar-6ih_JEvR.js";import{F as Zy}from"./files-BpDIfAek.js";import{E as Sp}from"./external-link-D1If5twJ.js";import{a as Os}from"./index-xBXWoUIa.js";import{_ as Zd}from"./authSlice-BC3X-Dze.js";/**
|
|
2
2
|
* @license lucide-react v0.487.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
window.__reactRouterManifest={"entry":{"module":"/assets/entry.client-BI4QA1ti.js","imports":["/assets/chunk-EF7DTUVF-MlADC7xe.js","/assets/index-xBXWoUIa.js"],"css":[]},"routes":{"root":{"id":"root","path":"","hasAction":false,"hasLoader":false,"hasClientAction":false,"hasClientLoader":false,"hasClientMiddleware":false,"hasErrorBoundary":true,"module":"/assets/root-
|
|
1
|
+
window.__reactRouterManifest={"entry":{"module":"/assets/entry.client-BI4QA1ti.js","imports":["/assets/chunk-EF7DTUVF-MlADC7xe.js","/assets/index-xBXWoUIa.js"],"css":[]},"routes":{"root":{"id":"root","path":"","hasAction":false,"hasLoader":false,"hasClientAction":false,"hasClientLoader":false,"hasClientMiddleware":false,"hasErrorBoundary":true,"module":"/assets/root-Bmrk0090.js","imports":["/assets/chunk-EF7DTUVF-MlADC7xe.js","/assets/index-xBXWoUIa.js","/assets/authSlice-BC3X-Dze.js","/assets/utils-BdGM_Id-.js","/assets/spinner-C3uu_C2V.js","/assets/createLucideIcon-BJQzFwzJ.js"],"css":["/assets/root-DVVVBPEK.css"]},"routes/home":{"id":"routes/home","parentId":"root","path":"/admin","index":true,"hasAction":false,"hasLoader":false,"hasClientAction":false,"hasClientLoader":false,"hasClientMiddleware":false,"hasErrorBoundary":false,"module":"/assets/home-BMO8Phzv.js","imports":["/assets/chunk-EF7DTUVF-MlADC7xe.js","/assets/button-DYtHJlPL.js","/assets/types-BFhFSnS8.js","/assets/spinner-C3uu_C2V.js","/assets/authSlice-BC3X-Dze.js","/assets/index-BCGL68Qt.js","/assets/utils-BdGM_Id-.js","/assets/index-BhhxCYB_.js","/assets/index-xBXWoUIa.js","/assets/createLucideIcon-BJQzFwzJ.js"],"css":[]},"routes/dashboard._layout":{"id":"routes/dashboard._layout","parentId":"root","hasAction":false,"hasLoader":false,"hasClientAction":false,"hasClientLoader":false,"hasClientMiddleware":false,"hasErrorBoundary":false,"module":"/assets/dashboard._layout-D8eDuulk.js","imports":["/assets/chunk-EF7DTUVF-MlADC7xe.js","/assets/authSlice-BC3X-Dze.js","/assets/utils-BdGM_Id-.js","/assets/index-DuwVf14f.js","/assets/button-DYtHJlPL.js","/assets/createLucideIcon-BJQzFwzJ.js","/assets/index-BCGL68Qt.js","/assets/index-BhhxCYB_.js","/assets/upload-CopmcV94.js","/assets/external-link-D1If5twJ.js","/assets/index-xBXWoUIa.js"],"css":[]},"routes/dashboard":{"id":"routes/dashboard","parentId":"routes/dashboard._layout","path":"/admin/dashboard","hasAction":false,"hasLoader":false,"hasClientAction":false,"hasClientLoader":false,"hasClientMiddleware":false,"hasErrorBoundary":false,"module":"/assets/dashboard-eLqz7BO7.js","imports":["/assets/chunk-EF7DTUVF-MlADC7xe.js","/assets/utils-BdGM_Id-.js","/assets/index-Dycitln2.js"],"css":[]},"routes/dashboard.$collection.new":{"id":"routes/dashboard.$collection.new","parentId":"routes/dashboard._layout","path":"/admin/dashboard/:collectionId/new","hasAction":false,"hasLoader":false,"hasClientAction":false,"hasClientLoader":false,"hasClientMiddleware":false,"hasErrorBoundary":false,"module":"/assets/dashboard._collection.new-CZuGYJjj.js","imports":["/assets/chunk-EF7DTUVF-MlADC7xe.js","/assets/itemForm-C5JHfZSI.js","/assets/utils-BdGM_Id-.js","/assets/button-DYtHJlPL.js","/assets/index-BCGL68Qt.js","/assets/types-BFhFSnS8.js","/assets/index-BhhxCYB_.js","/assets/index-xBXWoUIa.js","/assets/createLucideIcon-BJQzFwzJ.js","/assets/index-DuwVf14f.js","/assets/authSlice-BC3X-Dze.js","/assets/upload-CopmcV94.js","/assets/calendar-6ih_JEvR.js","/assets/files-BpDIfAek.js","/assets/trash-CN5HT_ZJ.js","/assets/external-link-D1If5twJ.js"],"css":["/assets/itemForm-ya4bvPWM.css"]},"routes/dashboard.$collection":{"id":"routes/dashboard.$collection","parentId":"routes/dashboard._layout","path":"/admin/dashboard/:collectionId","hasAction":false,"hasLoader":false,"hasClientAction":false,"hasClientLoader":false,"hasClientMiddleware":false,"hasErrorBoundary":false,"module":"/assets/dashboard._collection-BBg-A9Sj.js","imports":["/assets/chunk-EF7DTUVF-MlADC7xe.js","/assets/button-DYtHJlPL.js","/assets/utils-BdGM_Id-.js","/assets/index-Dycitln2.js","/assets/createLucideIcon-BJQzFwzJ.js","/assets/calendar-6ih_JEvR.js","/assets/trash-CN5HT_ZJ.js","/assets/external-link-D1If5twJ.js","/assets/index-BCGL68Qt.js"],"css":[]},"routes/dashboard.$collection.$document":{"id":"routes/dashboard.$collection.$document","parentId":"routes/dashboard._layout","path":"/admin/dashboard/:collectionId/:documentId","hasAction":false,"hasLoader":false,"hasClientAction":false,"hasClientLoader":false,"hasClientMiddleware":false,"hasErrorBoundary":false,"module":"/assets/dashboard._collection._document-5DoDCjb9.js","imports":["/assets/chunk-EF7DTUVF-MlADC7xe.js","/assets/itemForm-C5JHfZSI.js","/assets/utils-BdGM_Id-.js","/assets/button-DYtHJlPL.js","/assets/index-BCGL68Qt.js","/assets/types-BFhFSnS8.js","/assets/index-BhhxCYB_.js","/assets/index-xBXWoUIa.js","/assets/createLucideIcon-BJQzFwzJ.js","/assets/index-DuwVf14f.js","/assets/authSlice-BC3X-Dze.js","/assets/upload-CopmcV94.js","/assets/calendar-6ih_JEvR.js","/assets/files-BpDIfAek.js","/assets/trash-CN5HT_ZJ.js","/assets/external-link-D1If5twJ.js"],"css":["/assets/itemForm-ya4bvPWM.css"]},"routes/dashboard.files":{"id":"routes/dashboard.files","parentId":"routes/dashboard._layout","path":"/admin/dashboard/files","hasAction":false,"hasLoader":false,"hasClientAction":false,"hasClientLoader":false,"hasClientMiddleware":false,"hasErrorBoundary":false,"module":"/assets/dashboard.files-DzKr0fnV.js","imports":["/assets/chunk-EF7DTUVF-MlADC7xe.js","/assets/files-BpDIfAek.js","/assets/authSlice-BC3X-Dze.js","/assets/utils-BdGM_Id-.js","/assets/index-BCGL68Qt.js","/assets/upload-CopmcV94.js","/assets/createLucideIcon-BJQzFwzJ.js","/assets/trash-CN5HT_ZJ.js"],"css":[]}},"url":"/assets/manifest-d31f28c7.js","version":"d31f28c7"};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as c,p as e,w as m,q as h,M as x,L as p,S as j,t as g,O as b,i as E}from"./chunk-EF7DTUVF-MlADC7xe.js";import{u as y,o as S,r as w,f as v,g as F,s as l,a as N,b as L,c as R,i as z,d as A}from"./authSlice-
|
|
1
|
+
import{a as c,p as e,w as m,q as h,M as x,L as p,S as j,t as g,O as b,i as E}from"./chunk-EF7DTUVF-MlADC7xe.js";import{u as y,o as S,r as w,f as v,g as F,s as l,a as N,b as L,c as R,i as z,d as A}from"./authSlice-BC3X-Dze.js";import{u,c as P,s as C,e as o,P as I}from"./utils-BdGM_Id-.js";import{S as k}from"./spinner-C3uu_C2V.js";import"./createLucideIcon-BJQzFwzJ.js";function q(){const s=y(),{data:t}=u();return c.useEffect(()=>{const a=S(R,async r=>{if(r&&t?.firebase){const i=r.email?.replace(/[.@]/g,"_"),n=w(v,`${t.firebase.dbUsersPath}/${i}`),f=(await F(n)).val();s(l({uid:r.uid,email:r.email})),s(N(f))}else s(l(void 0));s(L(!1))});return()=>a()},[s,t]),null}function B({children:s}){const[t,a]=c.useState(!1),{data:r,error:i,isLoading:n}=u();return c.useEffect(()=>{if(!n){if(i){console.error("Failed to fetch firebase config:",i);return}if(r)try{if(!r.firebase)throw new Error("Firebase configuration not found in admin config");z(r.firebase),a(!0)}catch(d){console.error("Failed to initialize Firebase:",d)}}},[r,i,n]),i?e.jsx("div",{className:"flex items-center justify-center min-h-screen",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h2",{className:"text-xl font-semibold text-red-600 mb-2",children:"Firebase Initialization Error"}),e.jsx("p",{className:"text-gray-600",children:i instanceof Error?i.message:"Failed to fetch admin config"})]})}):n||!t?e.jsxs("div",{className:"flex gap-1 items-center justify-center min-h-screen",children:[e.jsx(k,{size:"28px"}),e.jsx("p",{className:"text-gray-600",children:"Loading Editorial..."})]}):e.jsx(e.Fragment,{children:s})}function D(){const s=P({reducer:{auth:A,[o.reducerPath]:o.reducer},middleware:t=>t().concat(o.middleware)});return C(s.dispatch),s}function O({children:s}){const t=c.useRef(null);return t.current||(t.current=D(),t.current.dispatch(o.endpoints.getConfig.initiate())),e.jsx(I,{store:t.current,children:s})}const G=()=>[];function K({}){return[{title:"Editorial Admin"}]}function Q({children:s}){return e.jsxs("html",{lang:"en",className:"min-h-screen",children:[e.jsxs("head",{children:[e.jsx("meta",{charSet:"utf-8"}),e.jsx("meta",{name:"viewport",content:"width=device-width, initial-scale=1"}),e.jsx(x,{}),e.jsx(p,{})]}),e.jsxs("body",{className:"h-full min-h-screen bg-background font-sans antialiased",children:[e.jsx(O,{children:e.jsxs(B,{children:[e.jsx(q,{}),s]})}),e.jsx(j,{}),e.jsx(g,{})]})]})}const H=m(function(){return e.jsx(b,{})}),J=h(function({error:t}){let a="Oops!",r="An unexpected error occurred.",i;return E(t)&&(a=t.status===404?"404":"Error",r=t.status===404?"The requested page could not be found.":t.statusText||r),e.jsxs("main",{className:"pt-16 p-4 container mx-auto",children:[e.jsx("h1",{children:a}),e.jsx("p",{children:r}),i]})});export{J as ErrorBoundary,Q as Layout,H as default,G as links,K as meta};
|
package/build/client/index.html
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
<!DOCTYPE html><html lang="en" class="min-h-screen"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="modulepreload" href="/assets/manifest-
|
|
2
|
-
import * as route0 from "/assets/root-
|
|
1
|
+
<!DOCTYPE html><html lang="en" class="min-h-screen"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="modulepreload" href="/assets/manifest-d31f28c7.js"/><link rel="modulepreload" href="/assets/entry.client-BI4QA1ti.js"/><link rel="modulepreload" href="/assets/chunk-EF7DTUVF-MlADC7xe.js"/><link rel="modulepreload" href="/assets/index-xBXWoUIa.js"/><link rel="modulepreload" href="/assets/root-Bmrk0090.js"/><link rel="modulepreload" href="/assets/authSlice-BC3X-Dze.js"/><link rel="modulepreload" href="/assets/utils-BdGM_Id-.js"/><link rel="modulepreload" href="/assets/spinner-C3uu_C2V.js"/><link rel="modulepreload" href="/assets/createLucideIcon-BJQzFwzJ.js"/><title>Editorial Admin</title><link rel="stylesheet" href="/assets/root-DVVVBPEK.css"/></head><body class="h-full min-h-screen bg-background font-sans antialiased"><div class="flex gap-1 items-center justify-center min-h-screen"><svg xmlns="http://www.w3.org/2000/svg" width="28px" height="28px" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-loader-circle animate-spin"><path d="M21 12a9 9 0 1 1-6.219-8.56"></path></svg><p class="text-gray-600">Loading Editorial...</p></div><script>window.__reactRouterContext = {"basename":"/","future":{"unstable_middleware":false,"unstable_optimizeDeps":false,"unstable_splitRouteModules":false,"unstable_subResourceIntegrity":false,"unstable_viteEnvironmentApi":false},"routeDiscovery":{"mode":"initial"},"ssr":false,"isSpaMode":true};window.__reactRouterContext.stream = new ReadableStream({start(controller){window.__reactRouterContext.streamController = controller;}}).pipeThrough(new TextEncoderStream());</script><script type="module" async="">import "/assets/manifest-d31f28c7.js";
|
|
2
|
+
import * as route0 from "/assets/root-Bmrk0090.js";
|
|
3
3
|
|
|
4
4
|
window.__reactRouterRouteModules = {"root":route0};
|
|
5
5
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@isardsat/editorial-admin",
|
|
3
|
-
"version": "6.5.
|
|
3
|
+
"version": "6.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"tailwindcss-animate": "^1.0.7",
|
|
79
79
|
"vaul": "^1.1.2",
|
|
80
80
|
"zod": "^3",
|
|
81
|
-
"@isardsat/editorial-common": "^6.5.
|
|
81
|
+
"@isardsat/editorial-common": "^6.5.1"
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
84
|
"@react-router/dev": "^7.7.0",
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import{p as e,a as v,x as z}from"./chunk-EF7DTUVF-MlADC7xe.js";import{e as y,m as j}from"./authSlice-DXFkOZ5W.js";import{a as b,q as C,v as $,w as M,x as D,u as U,y as _,o as H}from"./utils-BdGM_Id-.js";import{S as L,c as S}from"./index-BCGL68Qt.js";import{U as N,C as T}from"./upload-CopmcV94.js";import{F as I,T as V}from"./trash-CN5HT_ZJ.js";import{c as m}from"./createLucideIcon-BJQzFwzJ.js";/**
|
|
2
|
-
* @license lucide-react v0.487.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const P=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],q=m("copy",P);/**
|
|
7
|
-
* @license lucide-react v0.487.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const E=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],R=m("file-text",E);/**
|
|
12
|
-
* @license lucide-react v0.487.0 - ISC
|
|
13
|
-
*
|
|
14
|
-
* This source code is licensed under the ISC license.
|
|
15
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const Z=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]],G=m("file",Z);/**
|
|
17
|
-
* @license lucide-react v0.487.0 - ISC
|
|
18
|
-
*
|
|
19
|
-
* This source code is licensed under the ISC license.
|
|
20
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const Q=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],W=m("folder-open",Q);/**
|
|
22
|
-
* @license lucide-react v0.487.0 - ISC
|
|
23
|
-
*
|
|
24
|
-
* This source code is licensed under the ISC license.
|
|
25
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/const B=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],O=m("folder",B),A=S("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function J({className:s,variant:i,asChild:l=!1,...o}){const n=l?L:"span";return e.jsx(n,{"data-slot":"badge",className:b(A({variant:i}),s),...o})}const K=["txt","md","html","pdf"],X=["svg","webp","png","jpeg","jpg"],Y=[{Icon:I,test:s=>X.some(i=>s.name.endsWith(i))},{Icon:R,test:s=>K.some(i=>s.name.endsWith(i))}],ee={Icon:G},w=({node:s,level:i=0,onDelete:l,onChange:o,disableActions:n,onUpload:p,onCreateFolder:u})=>{const[d,f]=v.useState(!1),{data:h}=U(),g=y(j),a=Y.find(r=>r.test(s))??ee,t=s.type==="directory",c=t||o?"div":z,k=()=>{t&&f(!d)},F=r=>{const x=r.target.files;x&&p&&p(s.path,x)};return e.jsxs("div",{className:"select-none",children:[e.jsxs(c,{to:`/${s.relativePath}`,target:"_blank",className:"flex items-center gap-2 h-10 p-2 group hover:bg-muted/50 cursor-pointer",style:{paddingLeft:`calc(0.5rem + ${i*20}px)`},onClick:t?k:o?()=>o(s.isLarge?`${h?.largeFilesUrl}/${s.relativePath}`:s.relativePath):void 0,children:[t?e.jsx(T,{size:16,className:b("transition-transform",{"rotate-180":d})}):e.jsx("div",{className:"w-4"}),e.jsxs("div",{className:"flex flex-grow w-24 items-center gap-2 ml-2",children:[t?d?e.jsx(W,{size:16,className:"text-yellow-500"}):e.jsx(O,{size:16,className:"text-yellow-500"}):e.jsx(a.Icon,{size:16,className:" text-gray-500"}),e.jsxs("span",{className:"flex gap-2 items-center text-sm whitespace-nowrap text-ellipsis overflow-hidden w-full",children:[!t&&s.isLarge&&e.jsx(J,{variant:"outline",children:"Large"}),s.name]})]}),e.jsx("div",{className:"flex w-24 justify-end gap-2",children:e.jsx("span",{className:"text-sm text-gray-500",children:t?"--":_(s.size)})}),g==="developer"&&!n&&e.jsxs("div",{className:"flex items-center gap-1 ml-4 group-hover:visible invisible z-50",children:[t&&e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"file",multiple:!0,onChange:F,className:"hidden",id:`dir-upload-${s.name}-${i}`}),e.jsxs("label",{htmlFor:`dir-upload-${s.name}-${i}`,className:"hover:text-blue-500 p-1 hover:bg-muted rounded-sm cursor-pointer",onClick:r=>{r.stopPropagation()},children:[e.jsx(N,{size:16}),e.jsx("span",{className:"sr-only",children:"Upload files to this folder"})]})]}),e.jsxs("button",{className:H("hover:text-yellow-500 p-1 hover:bg-muted rounded-sm",t&&"hidden"),onClick:r=>{r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(s.path)},children:[e.jsx(q,{size:16}),e.jsx("span",{className:"sr-only",children:"Copy file URL"})]}),e.jsxs("button",{className:"hover:text-red-500 p-1 hover:bg-muted rounded-sm",onClick:r=>{r.preventDefault(),r.stopPropagation(),l(s.path)},children:[e.jsx(V,{size:16}),e.jsxs("span",{className:"sr-only",children:["Delete this ",t?"folder":"file"]})]})]})]}),t&&d&&s.children&&e.jsx("div",{children:s.children.map((r,x)=>e.jsx(w,{node:r,level:i+1,onDelete:l,onChange:o,disableActions:n,onUpload:p,onCreateFolder:u},`${r.name}-${x}`))})]})};function ne({disableActions:s,onChange:i}){const{data:l}=C(),[o]=$(),[n]=M(),[p]=D(),u=y(j),d=async a=>{const t=a.target.files;if(t)try{await n({files:t}).unwrap()}catch(c){console.error("Upload failed:",c)}},f=async(a,t)=>{try{await n({files:t,path:a}).unwrap()}catch(c){console.error("Upload failed:",c)}},h=async(a,t)=>{try{await p({name:t,path:a}).unwrap()}catch(c){console.error("Create folder failed:",c)}},g=v.useMemo(()=>l?.toSorted((a,t)=>a.type==="directory"&&t.type!=="directory"?-1:a.type!=="directory"&&t.type==="directory"?1:a.name.localeCompare(t.name)).map(a=>e.jsx(w,{node:a,onDelete:o,onChange:i,disableActions:s,onUpload:f,onCreateFolder:h},a.name)),[l,s,i]);return e.jsxs("div",{className:"overflow-auto h-full max-w-[800px] rounded-xl border",children:[e.jsxs("div",{className:"sticky top-0 bg-white flex items-center gap-2 py-1 px-2 border-b group",children:[e.jsx("div",{className:"w-4"}),e.jsx("div",{className:"flex flex-grow items-center gap-2 ml-2",children:e.jsx("span",{className:"text-sm font-semibold",children:"Name"})}),e.jsx("div",{className:"flex w-24 items-center gap-2 ml-2",children:e.jsx("span",{className:"text-sm font-semibold",children:"Size"})}),u==="developer"&&!s&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("input",{type:"file",multiple:!0,onChange:d,className:"hidden",id:"file-upload"}),e.jsxs("label",{htmlFor:"file-upload",className:"hover:text-blue-500 p-1 hover:bg-muted rounded-sm cursor-pointer",children:[e.jsx(N,{size:16}),e.jsx("span",{className:"sr-only",children:"Upload files"})]})]})]}),g]})}export{ne as F};
|