@kimuson/claude-code-viewer 0.4.4 → 0.4.6

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.
@@ -0,0 +1 @@
1
+ import{u as o}from"./index-Cl49R9Vk.js";function r(){o().navigate({to:"/projects"})}export{r as component};
@@ -0,0 +1,6 @@
1
+ import{c as f,a as N,p as m,b as v,j as e,C as y,d as w,e as C,f as b,g as j,T as s,B as l,L as P,r as o,h as k,i as _,k as D,t as u,l as L}from"./index-Cl49R9Vk.js";import{F as p,f as S,u as F,C as I,L as M,a as E,D as q,b as H,P as T,c as Q,d as $,e as A,g as R,h as B,i as G,G as K}from"./label-RSRHgdFZ.js";/**
2
+ * @license lucide-react v0.548.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 O=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],V=f("history",O),W=()=>N({queryKey:m.queryKey,queryFn:m.queryFn}),z=()=>{const{data:{projects:n}}=W(),{config:c}=v();return n.length,e.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:n.map(t=>e.jsxs(y,{className:"hover:shadow-md transition-shadow",children:[e.jsxs(w,{children:[e.jsxs(C,{className:"flex items-center gap-2",children:[e.jsx(p,{className:"w-5 h-5"}),e.jsx("span",{className:"truncate",children:t.meta.projectName??t.claudeProjectPath})]}),t.meta.projectPath?e.jsx(b,{children:t.meta.projectPath}):null]}),e.jsxs(j,{className:"space-y-2",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.jsx(s,{id:"project_list.last_modified"})," ",t.lastModifiedAt?S(t.lastModifiedAt,{locale:c.locale,target:"time"}):""]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[e.jsx(s,{id:"project_list.messages"})," ",t.meta.sessionCount]})]}),e.jsx(j,{className:"pt-0",children:e.jsx(l,{asChild:!0,className:"w-full",children:e.jsx(P,{to:"/projects/$projectId/session",params:{projectId:t.id},children:e.jsx(s,{id:"project_list.view_conversations"})})})})]},t.id))})},J=({onPathChange:n})=>{const[c,t]=o.useState(void 0),[d,x]=o.useState(!1),{data:r,isLoading:i}=F(k(c,d));o.useEffect(()=>{r?.currentPath&&n(r.currentPath)},[r?.currentPath,n]);const h=a=>{if(a===""){t(void 0);return}const g=`/${a}`;t(g)};return e.jsxs("div",{className:"border rounded-md",children:[e.jsx("div",{className:"p-3 border-b bg-muted/50",children:e.jsxs("p",{className:"text-sm font-medium",children:[e.jsx(s,{id:"directory_picker.current"})," ",e.jsx("span",{className:"font-mono",children:r?.currentPath||"~"})]})}),e.jsxs("div",{className:"p-3 border-b flex items-center gap-2",children:[e.jsx(I,{id:"show-hidden",checked:d,onCheckedChange:a=>x(a===!0)}),e.jsx(M,{htmlFor:"show-hidden",className:"text-sm cursor-pointer",children:e.jsx(s,{id:"directory_picker.show_hidden"})})]}),e.jsx("div",{className:"max-h-96 overflow-auto",children:i?e.jsx("div",{className:"p-8 text-center text-sm text-muted-foreground",children:e.jsx(s,{id:"directory_picker.loading"})}):r?.entries&&r.entries.length>0?e.jsx("div",{className:"divide-y",children:r.entries.filter(a=>a.type==="directory").filter(a=>d||a.name===".."||!a.name.startsWith(".")).map(a=>e.jsxs("button",{type:"button",onClick:()=>h(a.path),className:"w-full px-3 py-2 flex items-center gap-2 hover:bg-muted/50 transition-colors text-left",children:[a.name===".."?e.jsx(E,{className:"w-4 h-4 rotate-180"}):e.jsx(p,{className:"w-4 h-4 text-blue-500"}),e.jsx("span",{className:"text-sm",children:a.name})]},a.path))}):e.jsx("div",{className:"p-8 text-center text-sm text-muted-foreground",children:e.jsx(s,{id:"directory_picker.no_directories"})})})]})},U=()=>{const[n,c]=o.useState(!1),[t,d]=o.useState(""),x=_(),r=D({mutationFn:async()=>{const i=await L.api.projects.$post({json:{projectPath:t}});if(!i.ok)throw new Error("Failed to set up project");return await i.json()},onSuccess:i=>{u.success("Project set up successfully"),c(!1),x({to:"/projects/$projectId/session",params:{projectId:i.projectId},search:h=>({...h,sessionId:i.sessionId})})},onError:i=>{u.error(i instanceof Error?i.message:"Failed to set up project")}});return e.jsxs(q,{open:n,onOpenChange:c,children:[e.jsx(H,{asChild:!0,children:e.jsxs(l,{"data-testid":"new-project-button",children:[e.jsx(T,{className:"w-4 h-4 mr-2"}),e.jsx(s,{id:"project.new"})]})}),e.jsxs(Q,{className:"max-w-2xl","data-testid":"new-project-modal",children:[e.jsxs($,{children:[e.jsx(A,{children:e.jsx(s,{id:"project.setup.title"})}),e.jsx(R,{children:e.jsx(s,{id:"project.setup.description",components:{0:e.jsx("code",{className:"text-sm bg-muted px-1 py-0.5 rounded"})}})})]}),e.jsx("div",{className:"py-4",children:e.jsx(J,{onPathChange:d})}),e.jsxs(B,{children:[e.jsx(l,{variant:"outline",onClick:()=>c(!1),children:e.jsx(s,{id:"common.action.cancel"})}),e.jsx(l,{onClick:async()=>await r.mutateAsync(),disabled:!t||r.isPending,children:r.isPending?e.jsxs(e.Fragment,{children:[e.jsx(G,{className:"w-4 h-4 mr-2 animate-spin"}),e.jsx(s,{id:"project.setup.action.setting_up"})]}):e.jsx(s,{id:"project.setup.action.setup"})})]})]})]})},X=()=>e.jsxs("div",{className:"flex h-screen max-h-screen overflow-hidden",children:[e.jsx(K,{}),e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"container mx-auto px-4 py-8",children:[e.jsxs("header",{className:"mb-8",children:[e.jsxs("h1",{className:"text-3xl font-bold mb-2 flex items-center gap-2",children:[e.jsx(V,{className:"w-8 h-8"}),"Claude Code Viewer"]}),e.jsx("p",{className:"text-muted-foreground",children:e.jsx(s,{id:"projects.page.description"})})]}),e.jsx("main",{children:e.jsxs("section",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h2",{className:"text-xl font-semibold",children:e.jsx(s,{id:"projects.page.title"})}),e.jsx(U,{})]}),e.jsx(o.Suspense,{fallback:e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx("div",{className:"text-muted-foreground",children:e.jsx(s,{id:"projects.page.loading"})})}),children:e.jsx(z,{})})]})})]})})]});function ee(){return e.jsx(X,{})}export{ee as component};