@kimuson/claude-code-viewer 0.6.1-beta.4 → 0.7.0

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.
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{d as t,f as n}from"./markdown-parser-vendor-D9j1a-bm.js";import{E as r,F as i,P as a,b as o,c as s,ot as c,st as l}from"./AuthProvider-BKc7q7ka.js";import{$ as u,N as d,P as f,Y as p,Z as m,c as h,d as g,f as _,i as v,l as y,n as b,o as x,s as S,u as C}from"./dist-DiGJ7VFi.js";import{n as w}from"./dist-CG2L4mx5.js";import{b as T,n as E,r as D,t as O,v as k,y as A}from"./ProtectedRoute-DtqWc34B.js";import{a as j,i as M,n as N,o as P,r as F,t as I}from"./card-DGrqtTaC.js";import{t as L}from"./label-Cw6sZ5kQ.js";var R=e(n(),1),z=()=>i({queryKey:o.queryKey,queryFn:o.queryFn}),B=t(),V=()=>{let{data:{projects:e}}=z(),{config:t}=f();return e.length,(0,B.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 lg:grid-cols-3`,children:e.map(e=>(0,B.jsxs)(I,{className:`hover:shadow-md transition-shadow`,children:[(0,B.jsxs)(M,{children:[(0,B.jsxs)(j,{className:`flex items-center gap-2 justify-start items-start`,children:[(0,B.jsx)(A,{className:`w-5 h-5 flex-shrink-0`}),(0,B.jsx)(`span`,{className:`text-wrap flex-1`,children:e.meta.projectName??e.claudeProjectPath})]}),e.meta.projectPath!==void 0&&e.meta.projectPath!==``?(0,B.jsx)(F,{children:e.meta.projectPath}):null]}),(0,B.jsxs)(N,{className:`space-y-2`,children:[(0,B.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[(0,B.jsx)(w,{id:`project_list.last_modified`}),` `,e.lastModifiedAt?d(e.lastModifiedAt,{locale:t.locale,target:`time`}):``]}),(0,B.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[(0,B.jsx)(w,{id:`project_list.messages`}),` `,e.meta.sessionCount]})]}),(0,B.jsx)(N,{className:`pt-0`,children:(0,B.jsx)(P,{asChild:!0,className:`w-full`,children:(0,B.jsx)(u,{to:`/projects/$projectId/session`,params:{projectId:e.id},children:(0,B.jsx)(w,{id:`project_list.view_conversations`})})})})]},e.id))})},H=({onPathChange:e})=>{let[t,n]=(0,R.useState)(void 0),[r,i]=(0,R.useState)(!1),{data:a,isLoading:o}=p(s(t,r));(0,R.useEffect)(()=>{a?.currentPath!==void 0&&a.currentPath!==``&&e(a.currentPath)},[a?.currentPath,e]);let c=e=>{if(e===``){n(void 0);return}n(`/${e}`)};return(0,B.jsxs)(`div`,{className:`border rounded-md`,children:[(0,B.jsx)(`div`,{className:`p-3 border-b bg-muted/50`,children:(0,B.jsxs)(`p`,{className:`text-sm font-medium`,children:[(0,B.jsx)(w,{id:`directory_picker.current`}),` `,(0,B.jsx)(`span`,{className:`font-mono`,children:a?.currentPath??`~`})]})}),(0,B.jsxs)(`div`,{className:`p-3 border-b flex items-center gap-2`,children:[(0,B.jsx)(E,{id:`show-hidden`,checked:r,onCheckedChange:e=>i(e===!0)}),(0,B.jsx)(L,{htmlFor:`show-hidden`,className:`text-sm cursor-pointer`,children:(0,B.jsx)(w,{id:`directory_picker.show_hidden`})})]}),(0,B.jsx)(`div`,{className:`max-h-96 overflow-auto`,children:o?(0,B.jsx)(`div`,{className:`p-8 text-center text-sm text-muted-foreground`,children:(0,B.jsx)(w,{id:`directory_picker.loading`})}):a?.entries&&a.entries.length>0?(0,B.jsx)(`div`,{className:`divide-y`,children:a.entries.filter(e=>e.type===`directory`).filter(e=>r||e.name===`..`||!e.name.startsWith(`.`)).map(e=>(0,B.jsxs)(`button`,{type:`button`,onClick:()=>c(e.path),className:`w-full px-3 py-2 flex items-center gap-2 hover:bg-muted/50 transition-colors text-left`,children:[e.name===`..`?(0,B.jsx)(T,{className:`w-4 h-4 rotate-180`}):(0,B.jsx)(A,{className:`w-4 h-4 text-blue-500`}),(0,B.jsx)(`span`,{className:`text-sm`,children:e.name})]},e.path))}):(0,B.jsx)(`div`,{className:`p-8 text-center text-sm text-muted-foreground`,children:(0,B.jsx)(w,{id:`directory_picker.no_directories`})})})]})},U=()=>{let[e,t]=(0,R.useState)(!1),[n,i]=(0,R.useState)(``),o=l(),s=a({mutationFn:async()=>{let e=await r.api.projects.$post({json:{projectPath:n}});if(!e.ok)throw Error(`Failed to set up project`);return await e.json()},onSuccess:e=>{b.success(`Project set up successfully`),t(!1),o({to:`/projects/$projectId/session`,params:{projectId:e.projectId},search:{sessionId:e.sessionId}})},onError:e=>{b.error(e instanceof Error?e.message:`Failed to set up project`)}});return(0,B.jsxs)(x,{open:e,onOpenChange:t,children:[(0,B.jsx)(_,{asChild:!0,children:(0,B.jsxs)(P,{"data-testid":`new-project-button`,children:[(0,B.jsx)(k,{className:`w-4 h-4 mr-2`}),(0,B.jsx)(w,{id:`project.new`})]})}),(0,B.jsxs)(S,{className:`max-w-2xl`,"data-testid":`new-project-modal`,children:[(0,B.jsxs)(C,{children:[(0,B.jsx)(g,{children:(0,B.jsx)(w,{id:`project.setup.title`})}),(0,B.jsx)(h,{children:(0,B.jsx)(w,{id:`project.setup.description`,components:{0:(0,B.jsx)(`code`,{className:`text-sm bg-muted px-1 py-0.5 rounded`})}})})]}),(0,B.jsx)(`div`,{className:`py-4`,children:(0,B.jsx)(H,{onPathChange:i})}),(0,B.jsxs)(y,{children:[(0,B.jsx)(P,{variant:`outline`,onClick:()=>t(!1),children:(0,B.jsx)(w,{id:`common.action.cancel`})}),(0,B.jsx)(P,{onClick:()=>{s.mutateAsync()},disabled:n===``||s.isPending,children:s.isPending?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(c,{className:`w-4 h-4 mr-2 animate-spin`}),(0,B.jsx)(w,{id:`project.setup.action.setting_up`})]}):(0,B.jsx)(w,{id:`project.setup.action.setup`})})]})]})]})},W=()=>{let{openSearch:e}=v();return(0,B.jsxs)(`div`,{className:`flex flex-col h-screen max-h-screen overflow-hidden`,children:[(0,B.jsxs)(`header`,{className:`h-(--spacing-header-height) flex items-center justify-between px-3 bg-muted/30 border-b border-border/40 text-xs flex-shrink-0 select-none`,children:[(0,B.jsx)(`span`,{className:`text-sm font-semibold text-foreground`,children:`claude-code-viewer`}),(0,B.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,B.jsx)(`button`,{type:`button`,onClick:e,className:`w-11 h-11 md:w-7 md:h-7 flex items-center justify-center rounded transition-colors hover:bg-muted text-muted-foreground hover:text-foreground`,"aria-label":`Search`,children:(0,B.jsx)(m,{className:`w-3.5 h-3.5`})}),(0,B.jsx)(D,{})]})]}),(0,B.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,B.jsxs)(`div`,{className:`container mx-auto px-4 py-8`,children:[(0,B.jsx)(`header`,{className:`mb-8`,children:(0,B.jsx)(`p`,{className:`text-muted-foreground`,children:(0,B.jsx)(w,{id:`projects.page.description`})})}),(0,B.jsx)(`main`,{children:(0,B.jsxs)(`section`,{children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,B.jsx)(`h2`,{className:`text-xl font-semibold`,children:(0,B.jsx)(w,{id:`projects.page.title`})}),(0,B.jsx)(U,{})]}),(0,B.jsx)(R.Suspense,{fallback:(0,B.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,B.jsx)(`div`,{className:`text-muted-foreground`,children:(0,B.jsx)(w,{id:`projects.page.loading`})})}),children:(0,B.jsx)(V,{})})]})})]})})]})},G=()=>(0,B.jsx)(O,{children:(0,B.jsx)(W,{})});export{G as component};