@dendelion/paper-camp 0.14.0 → 0.15.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.
Files changed (91) hide show
  1. package/dist/app/assets/index-2ahHj0hk.js +7 -0
  2. package/dist/app/assets/index-2ahHj0hk.js.map +1 -0
  3. package/dist/app/assets/{index-D2zDC3YW.js → index-BSp1FE97.js} +2 -2
  4. package/dist/app/assets/{index-D2zDC3YW.js.map → index-BSp1FE97.js.map} +1 -1
  5. package/dist/app/assets/{index-C5as2mi1.js → index-BTyua-6D.js} +3 -3
  6. package/dist/app/assets/{index-C5as2mi1.js.map → index-BTyua-6D.js.map} +1 -1
  7. package/dist/app/assets/{index-DrOhvDGC.js → index-Bi4fur5H.js} +2 -2
  8. package/dist/app/assets/{index-DrOhvDGC.js.map → index-Bi4fur5H.js.map} +1 -1
  9. package/dist/app/assets/index-Bo0V9-3F.js +2 -0
  10. package/dist/app/assets/index-Bo0V9-3F.js.map +1 -0
  11. package/dist/app/assets/index-Cz9HEIaO.js +2 -0
  12. package/dist/app/assets/{index-BTh66TxZ.js.map → index-Cz9HEIaO.js.map} +1 -1
  13. package/dist/app/assets/{index-SjRbcqaJ.js → index-DKjtMMrA.js} +2 -2
  14. package/dist/app/assets/{index-SjRbcqaJ.js.map → index-DKjtMMrA.js.map} +1 -1
  15. package/dist/app/assets/main-BW24wv9K.js +207 -0
  16. package/dist/app/assets/main-BW24wv9K.js.map +1 -0
  17. package/dist/app/assets/main-C-ynmROL.css +1 -0
  18. package/dist/app/assets/{sidebar-section-BlseNbG8.js → sidebar-section-BHLbvk_X.js} +2 -2
  19. package/dist/app/assets/{sidebar-section-BlseNbG8.js.map → sidebar-section-BHLbvk_X.js.map} +1 -1
  20. package/dist/app/index.html +6 -6
  21. package/dist/app/toolbar.js +11684 -0
  22. package/dist/app/toolbar.js.map +1 -0
  23. package/dist/chunks/{scaffold.BL48Net9.js → parked-questions.BoAnCnQA.js} +814 -730
  24. package/dist/chunks/parked-questions.BoAnCnQA.js.map +1 -0
  25. package/dist/cli/index.js +7479 -7384
  26. package/dist/cli/index.js.map +1 -1
  27. package/dist/core/index.d.ts +2 -0
  28. package/dist/core/index.d.ts.map +1 -1
  29. package/dist/core/index.js +85 -78
  30. package/dist/core/parked-questions.d.ts +6 -0
  31. package/dist/core/parked-questions.d.ts.map +1 -0
  32. package/dist/core/parked-questions.test.d.ts +2 -0
  33. package/dist/core/parked-questions.test.d.ts.map +1 -0
  34. package/dist/core/parse/parser.d.ts.map +1 -1
  35. package/dist/core/parse/schemas.d.ts +1 -0
  36. package/dist/core/parse/schemas.d.ts.map +1 -1
  37. package/dist/core/readers.d.ts.map +1 -1
  38. package/dist/core/release-notes.d.ts +4 -0
  39. package/dist/core/release-notes.d.ts.map +1 -0
  40. package/dist/core/release-notes.test.d.ts +2 -0
  41. package/dist/core/release-notes.test.d.ts.map +1 -0
  42. package/dist/core/serialize/serializer.d.ts +1 -0
  43. package/dist/core/serialize/serializer.d.ts.map +1 -1
  44. package/dist/core/trail.d.ts +6 -0
  45. package/dist/core/trail.d.ts.map +1 -1
  46. package/dist/types/index.d.ts +24 -2
  47. package/dist/types/index.d.ts.map +1 -1
  48. package/dist/types/index.js +4 -4
  49. package/dist/types/index.js.map +1 -1
  50. package/dist/vite/index.d.ts.map +1 -1
  51. package/dist/vite/index.js +28 -27
  52. package/dist/vite/index.js.map +1 -1
  53. package/package.json +5 -3
  54. package/dist/app/assets/index-BTh66TxZ.js +0 -2
  55. package/dist/app/assets/index-CXl1uFWF.js +0 -2
  56. package/dist/app/assets/index-CXl1uFWF.js.map +0 -1
  57. package/dist/app/assets/main-BC7PxPmE.js +0 -207
  58. package/dist/app/assets/main-BC7PxPmE.js.map +0 -1
  59. package/dist/app/assets/main-uLU_O3GC.css +0 -1
  60. package/dist/chunks/helpers.CUQjsQwc.js +0 -9
  61. package/dist/chunks/helpers.CUQjsQwc.js.map +0 -1
  62. package/dist/chunks/scaffold.BL48Net9.js.map +0 -1
  63. package/dist/toolbar/focus-panel.d.ts +0 -7
  64. package/dist/toolbar/focus-panel.d.ts.map +0 -1
  65. package/dist/toolbar/index.d.ts +0 -2
  66. package/dist/toolbar/index.d.ts.map +0 -1
  67. package/dist/toolbar/runs-panel.d.ts +0 -12
  68. package/dist/toolbar/runs-panel.d.ts.map +0 -1
  69. package/dist/toolbar/scout-panel.d.ts +0 -10
  70. package/dist/toolbar/scout-panel.d.ts.map +0 -1
  71. package/dist/toolbar/ship-panel.d.ts +0 -6
  72. package/dist/toolbar/ship-panel.d.ts.map +0 -1
  73. package/dist/toolbar/toolbar-element.d.ts +0 -7
  74. package/dist/toolbar/toolbar-element.d.ts.map +0 -1
  75. package/dist/toolbar/toolbar-idle.d.ts +0 -4
  76. package/dist/toolbar/toolbar-idle.d.ts.map +0 -1
  77. package/dist/toolbar/toolbar-idle.test.d.ts +0 -2
  78. package/dist/toolbar/toolbar-idle.test.d.ts.map +0 -1
  79. package/dist/toolbar/toolbar-link.d.ts +0 -7
  80. package/dist/toolbar/toolbar-link.d.ts.map +0 -1
  81. package/dist/toolbar/toolbar-shell.d.ts +0 -15
  82. package/dist/toolbar/toolbar-shell.d.ts.map +0 -1
  83. package/dist/toolbar/toolbar-shell.test.d.ts +0 -2
  84. package/dist/toolbar/toolbar-shell.test.d.ts.map +0 -1
  85. package/dist/toolbar/toolbar.d.ts +0 -2
  86. package/dist/toolbar/toolbar.d.ts.map +0 -1
  87. package/dist/toolbar/use-toolbar-shell.d.ts +0 -8
  88. package/dist/toolbar/use-toolbar-shell.d.ts.map +0 -1
  89. package/dist/toolbar.d.ts +0 -1
  90. package/dist/toolbar.js +0 -27019
  91. package/dist/toolbar.js.map +0 -1
@@ -0,0 +1,7 @@
1
+ import{u as o,a as x,j as e,J as w,r as p,f as C,d as m,M as b,b as S,y as v,P as V,o as $,i as D}from"./main-BW24wv9K.js";import{S as g}from"./sidebar-section-BHLbvk_X.js";const N=(s,i)=>s.toLowerCase().includes(i.toLowerCase()),L=(s,i,a=120)=>{const l=s.toLowerCase().indexOf(i.toLowerCase());if(l===-1)return s.slice(0,a);const n=Math.max(0,l-40),d=Math.min(s.length,l+i.length+40);let r=s.slice(n,d);return n>0&&(r=`…${r}`),d<s.length&&(r=`${r}…`),r},T=({query:s})=>{const i=o(c=>c.repoDocs),a=o(c=>c.setActiveDocTitle),l=o(c=>c.setDocSearchQuery),n=x(),d=[];for(const c of i)(N(c.name,s)||N(c.content,s))&&d.push({title:c.name,snippet:L(c.content,s)});const r=c=>{n({to:"/docs/$section",params:{section:"repo-docs"}}),a(c),l("")};return d.length===0?e.jsxs("p",{className:"opacity-50",children:['No results found for "',s,'".']}):e.jsxs("div",{children:[e.jsxs("p",{className:"mb-3 text-sm opacity-50",children:[d.length," result",d.length===1?"":"s",' for "',s,'"']}),e.jsx("div",{className:"flex flex-col gap-1",children:d.map(c=>e.jsx(w,{variant:"ghost",size:"small",fullWidth:!0,onClick:()=>r(c.title),className:"justify-start px-3 py-2",children:e.jsxs("span",{className:"text-left",children:[e.jsx("span",{className:"mb-[0.2rem] block font-display-luminari text-[0.95rem] font-semibold",children:c.title}),e.jsx("span",{className:"text-sm opacity-60",children:c.snippet})]})},c.title))})]})},A=s=>{const[i,a]=p.useState(null);return p.useEffect(()=>{if(a(null),!s)return;let l=!1;return C(s).then(n=>{l||a(n)}).catch(()=>{}),()=>{l=!0}},[s]),i},Q=()=>{const s=o(l=>l.activeReleaseVersion),i=A(s);if(!s)return null;if(!i)return e.jsxs("div",{children:[e.jsx("h2",{className:`${m} m-0 mb-4`,children:s}),e.jsxs("p",{className:"opacity-50",children:["No release notes found for ",s,"."]})]});if(i.length===0)return e.jsxs("div",{children:[e.jsx("h2",{className:`${m} m-0 mb-4`,children:s}),e.jsx("p",{className:"opacity-50",children:"No ideas could be resolved for this release."})]});const a=i.map(l=>`### ${l.label}
2
+
3
+ ${l.ideas.map(n=>`- ${n.title} (${n.id})`).join(`
4
+ `)}`).join(`
5
+
6
+ `);return e.jsxs("div",{children:[e.jsx("h2",{className:`${m} m-0 mb-4`,children:s}),e.jsx("div",{className:"text-base leading-[1.7] text-ink-900",children:e.jsx(b,{children:a})})]})},E=()=>{const s=o(n=>n.repoDocs),i=o(n=>n.activeDocTitle),a=s.find(n=>n.name===i);if(!a)return null;const l=a.name.endsWith(".md");return e.jsxs("div",{children:[e.jsx("h2",{className:`${m} m-0 mb-4`,children:a.name}),l?e.jsx("div",{className:"text-base leading-[1.7] text-ink-900",children:e.jsx(b,{children:a.content})}):e.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap rounded-md bg-black/[4%] p-4 font-mono text-xs leading-normal",children:a.content})]})},J=()=>{const s=o(r=>r.docSearchQuery),i=o(r=>r.activeDocTitle),a=o(r=>r.activeReleaseVersion),l=x(),n=S(),d=()=>l({to:"/docs"});return s.trim()?e.jsx("div",{children:e.jsx(T,{query:s})}):n==="repo-docs"&&i?e.jsxs("div",{children:[e.jsx("div",{className:"mb-4",children:e.jsx(v,{items:[{id:"docs",label:"Docs",onClick:d},{id:"repo-doc",label:i}]})}),e.jsx(E,{})]}):n==="release-notes"&&a?e.jsxs("div",{children:[e.jsx("div",{className:"mb-4",children:e.jsx(v,{items:[{id:"docs",label:"Docs",onClick:d},{id:"release-notes",label:a}]})}),e.jsx(Q,{})]}):e.jsxs("div",{children:[e.jsx(V,{children:"Docs"}),e.jsx("p",{className:"opacity-50",children:"Pick a doc from the sidebar — start with a repo doc if you're new here."})]})},M=s=>s.charAt(0).toUpperCase()+s.slice(1).toLowerCase(),h=({children:s})=>e.jsx("span",{className:"block px-3 py-1 text-sm italic opacity-[0.35]",children:s}),W=()=>{const s=o(t=>t.repoDocs),i=o(t=>t.repoDocsLoading),a=o(t=>t.loadRepoDocs),l=o(t=>t.activeDocTitle),n=o(t=>t.setActiveDocTitle),d=o(t=>t.docSearchQuery),r=o(t=>t.setDocSearchQuery),c=o(t=>t.releaseVersions),y=o(t=>t.releaseVersionsLoading),u=o(t=>t.loadReleaseVersions),R=o(t=>t.activeReleaseVersion),k=o(t=>t.setActiveReleaseVersion),j=S(),f=x();return p.useEffect(()=>{a()},[a]),p.useEffect(()=>{u()},[u]),e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mb-4",children:e.jsx($,{size:"small","aria-label":"Search docs",placeholder:"Search docs…",value:d,onChange:t=>r(t.target.value)})}),e.jsx(g,{label:"Repo Docs",children:i&&s.length===0?e.jsx(h,{children:"Loading…"}):s.length>0?s.map(t=>e.jsx(D,{size:"small",active:j==="repo-docs"&&l===t.name,onClick:()=>{f({to:"/docs/$section",params:{section:"repo-docs"}}),n(t.name)},children:M(t.name)},t.name)):e.jsx(h,{children:"No repo docs found"})}),e.jsx(g,{label:"Releases",children:y&&c.length===0?e.jsx(h,{children:"Loading…"}):c.length>0?c.map(t=>e.jsx(D,{size:"small",active:j==="release-notes"&&R===t,onClick:()=>{f({to:"/docs/$section",params:{section:"release-notes"}}),k(t)},children:t},t)):e.jsx(h,{children:"No releases yet"})})]})};export{J as DocsPage,W as DocsSidebar};
7
+ //# sourceMappingURL=index-2ahHj0hk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-2ahHj0hk.js","sources":["../../../src/app/features/docs/components/docs-search.tsx","../../../src/app/features/docs/hooks/use-release-notes.ts","../../../src/app/features/docs/components/release-notes-detail.tsx","../../../src/app/features/docs/components/repo-doc-detail.tsx","../../../src/app/features/docs/docs-page.tsx","../../../src/app/features/docs/components/docs-sidebar.tsx"],"sourcesContent":["import { useAppStore } from '@/app/stores/app-store';\nimport { Button } from '@dendelion/paper-ui';\nimport { useNavigate } from '@tanstack/react-router';\n\ninterface SearchMatch {\n title: string;\n snippet: string;\n}\n\ninterface DocsSearchProps {\n query: string;\n}\n\nconst searchIn = (text: string, query: string): boolean =>\n text.toLowerCase().includes(query.toLowerCase());\n\nconst snippet = (text: string, query: string, maxLen = 120): string => {\n const idx = text.toLowerCase().indexOf(query.toLowerCase());\n if (idx === -1) return text.slice(0, maxLen);\n const start = Math.max(0, idx - 40);\n const end = Math.min(text.length, idx + query.length + 40);\n let s = text.slice(start, end);\n if (start > 0) s = `…${s}`;\n if (end < text.length) s = `${s}…`;\n return s;\n};\n\nexport const DocsSearch = ({ query }: DocsSearchProps) => {\n const repoDocs = useAppStore((s) => s.repoDocs);\n const setActiveDocTitle = useAppStore((s) => s.setActiveDocTitle);\n const setDocSearchQuery = useAppStore((s) => s.setDocSearchQuery);\n const navigate = useNavigate();\n\n const results: SearchMatch[] = [];\n\n for (const f of repoDocs) {\n if (searchIn(f.name, query) || searchIn(f.content, query)) {\n results.push({\n title: f.name,\n snippet: snippet(f.content, query),\n });\n }\n }\n\n const handleSelect = (title: string) => {\n navigate({ to: '/docs/$section', params: { section: 'repo-docs' } });\n setActiveDocTitle(title);\n setDocSearchQuery('');\n };\n\n if (results.length === 0) {\n return <p className=\"opacity-50\">No results found for \"{query}\".</p>;\n }\n\n return (\n <div>\n <p className=\"mb-3 text-sm opacity-50\">\n {results.length} result{results.length === 1 ? '' : 's'} for \"{query}\"\n </p>\n <div className=\"flex flex-col gap-1\">\n {results.map((m) => (\n <Button\n key={m.title}\n variant=\"ghost\"\n size=\"small\"\n fullWidth\n onClick={() => handleSelect(m.title)}\n className=\"justify-start px-3 py-2\"\n >\n <span className=\"text-left\">\n <span className=\"mb-[0.2rem] block font-display-luminari text-[0.95rem] font-semibold\">\n {m.title}\n </span>\n <span className=\"text-sm opacity-60\">{m.snippet}</span>\n </span>\n </Button>\n ))}\n </div>\n </div>\n );\n};\n","import { fetchReleaseNotes } from '@/app/services/release-notes-api';\nimport type { ReleaseNoteSection } from '@/types/index';\nimport { useEffect, useState } from 'react';\n\nexport const useReleaseNotes = (version: string | null): ReleaseNoteSection[] | null => {\n const [sections, setSections] = useState<ReleaseNoteSection[] | null>(null);\n\n useEffect(() => {\n setSections(null);\n if (!version) return;\n let cancelled = false;\n fetchReleaseNotes(version)\n .then((result) => {\n if (!cancelled) setSections(result);\n })\n .catch(() => {});\n return () => {\n cancelled = true;\n };\n }, [version]);\n\n return sections;\n};\n","import { detailHeadingClassName } from '@/app/components/detail-heading-style';\nimport { Markdown } from '@/app/components/markdown';\nimport { useAppStore } from '@/app/stores/app-store';\nimport { useReleaseNotes } from '../hooks/use-release-notes';\n\nexport const ReleaseNotesDetail = () => {\n const version = useAppStore((s) => s.activeReleaseVersion);\n const sections = useReleaseNotes(version);\n if (!version) return null;\n\n if (!sections) {\n return (\n <div>\n <h2 className={`${detailHeadingClassName} m-0 mb-4`}>{version}</h2>\n <p className=\"opacity-50\">No release notes found for {version}.</p>\n </div>\n );\n }\n\n if (sections.length === 0) {\n return (\n <div>\n <h2 className={`${detailHeadingClassName} m-0 mb-4`}>{version}</h2>\n <p className=\"opacity-50\">No ideas could be resolved for this release.</p>\n </div>\n );\n }\n\n const markdown = sections\n .map(\n (section) =>\n `### ${section.label}\\n\\n${section.ideas.map((idea) => `- ${idea.title} (${idea.id})`).join('\\n')}`,\n )\n .join('\\n\\n');\n\n return (\n <div>\n <h2 className={`${detailHeadingClassName} m-0 mb-4`}>{version}</h2>\n <div className=\"text-base leading-[1.7] text-ink-900\">\n <Markdown>{markdown}</Markdown>\n </div>\n </div>\n );\n};\n","import { detailHeadingClassName } from '@/app/components/detail-heading-style';\nimport { Markdown } from '@/app/components/markdown';\nimport { useAppStore } from '@/app/stores/app-store';\n\nexport const RepoDocDetail = () => {\n const repoDocs = useAppStore((s) => s.repoDocs);\n const activeDocTitle = useAppStore((s) => s.activeDocTitle);\n\n const file = repoDocs.find((f) => f.name === activeDocTitle);\n if (!file) return null;\n\n const isMarkdown = file.name.endsWith('.md');\n\n return (\n <div>\n <h2 className={`${detailHeadingClassName} m-0 mb-4`}>{file.name}</h2>\n\n {isMarkdown ? (\n <div className=\"text-base leading-[1.7] text-ink-900\">\n <Markdown>{file.content}</Markdown>\n </div>\n ) : (\n <pre className=\"overflow-x-auto whitespace-pre-wrap rounded-md bg-black/[4%] p-4 font-mono text-xs leading-normal\">\n {file.content}\n </pre>\n )}\n </div>\n );\n};\n","import { PageTitle } from '@/app/components/page-title';\nimport { useResolvedDocSection } from '@/app/hooks';\nimport { useAppStore } from '@/app/stores/app-store';\nimport { Breadcrumb } from '@dendelion/paper-ui';\nimport { useNavigate } from '@tanstack/react-router';\nimport { DocsSearch } from './components/docs-search';\nimport { ReleaseNotesDetail } from './components/release-notes-detail';\nimport { RepoDocDetail } from './components/repo-doc-detail';\n\nexport const DocsPage = () => {\n const docSearchQuery = useAppStore((s) => s.docSearchQuery);\n const activeDocTitle = useAppStore((s) => s.activeDocTitle);\n const activeReleaseVersion = useAppStore((s) => s.activeReleaseVersion);\n const navigate = useNavigate();\n const activeDocSection = useResolvedDocSection();\n\n const handleBackToDocs = () => navigate({ to: '/docs' });\n\n if (docSearchQuery.trim()) {\n return (\n <div>\n <DocsSearch query={docSearchQuery} />\n </div>\n );\n }\n\n if (activeDocSection === 'repo-docs' && activeDocTitle) {\n return (\n <div>\n <div className=\"mb-4\">\n <Breadcrumb\n items={[\n { id: 'docs', label: 'Docs', onClick: handleBackToDocs },\n { id: 'repo-doc', label: activeDocTitle },\n ]}\n />\n </div>\n <RepoDocDetail />\n </div>\n );\n }\n\n if (activeDocSection === 'release-notes' && activeReleaseVersion) {\n return (\n <div>\n <div className=\"mb-4\">\n <Breadcrumb\n items={[\n { id: 'docs', label: 'Docs', onClick: handleBackToDocs },\n { id: 'release-notes', label: activeReleaseVersion },\n ]}\n />\n </div>\n <ReleaseNotesDetail />\n </div>\n );\n }\n\n return (\n <div>\n <PageTitle>Docs</PageTitle>\n <p className=\"opacity-50\">\n Pick a doc from the sidebar — start with a repo doc if you're new here.\n </p>\n </div>\n );\n};\n","import { useResolvedDocSection } from '@/app/hooks';\nimport { useAppStore } from '@/app/stores/app-store';\nimport { Input, ListItem } from '@dendelion/paper-ui';\nimport { useNavigate } from '@tanstack/react-router';\nimport { useEffect } from 'react';\nimport { SidebarSection } from '../../plans/components/sidebar-section';\n\nconst simplecaseLabel = (name: string) =>\n name.charAt(0).toUpperCase() + name.slice(1).toLowerCase();\n\nconst EmptyState = ({ children }: { children: React.ReactNode }) => (\n <span className=\"block px-3 py-1 text-sm italic opacity-[0.35]\">{children}</span>\n);\n\nexport const DocsSidebar = () => {\n const repoDocs = useAppStore((s) => s.repoDocs);\n const repoDocsLoading = useAppStore((s) => s.repoDocsLoading);\n const loadRepoDocs = useAppStore((s) => s.loadRepoDocs);\n const activeDocTitle = useAppStore((s) => s.activeDocTitle);\n const setActiveDocTitle = useAppStore((s) => s.setActiveDocTitle);\n const docSearchQuery = useAppStore((s) => s.docSearchQuery);\n const setDocSearchQuery = useAppStore((s) => s.setDocSearchQuery);\n const releaseVersions = useAppStore((s) => s.releaseVersions);\n const releaseVersionsLoading = useAppStore((s) => s.releaseVersionsLoading);\n const loadReleaseVersions = useAppStore((s) => s.loadReleaseVersions);\n const activeReleaseVersion = useAppStore((s) => s.activeReleaseVersion);\n const setActiveReleaseVersion = useAppStore((s) => s.setActiveReleaseVersion);\n const activeDocSection = useResolvedDocSection();\n const navigate = useNavigate();\n\n useEffect(() => {\n loadRepoDocs();\n }, [loadRepoDocs]);\n\n useEffect(() => {\n loadReleaseVersions();\n }, [loadReleaseVersions]);\n\n return (\n <>\n <div className=\"mb-4\">\n <Input\n size=\"small\"\n aria-label=\"Search docs\"\n placeholder=\"Search docs…\"\n value={docSearchQuery}\n onChange={(e) => setDocSearchQuery(e.target.value)}\n />\n </div>\n\n <SidebarSection label=\"Repo Docs\">\n {repoDocsLoading && repoDocs.length === 0 ? (\n <EmptyState>Loading…</EmptyState>\n ) : repoDocs.length > 0 ? (\n repoDocs.map((f) => (\n <ListItem\n key={f.name}\n size=\"small\"\n active={activeDocSection === 'repo-docs' && activeDocTitle === f.name}\n onClick={() => {\n navigate({ to: '/docs/$section', params: { section: 'repo-docs' } });\n setActiveDocTitle(f.name);\n }}\n >\n {simplecaseLabel(f.name)}\n </ListItem>\n ))\n ) : (\n <EmptyState>No repo docs found</EmptyState>\n )}\n </SidebarSection>\n\n <SidebarSection label=\"Releases\">\n {releaseVersionsLoading && releaseVersions.length === 0 ? (\n <EmptyState>Loading…</EmptyState>\n ) : releaseVersions.length > 0 ? (\n releaseVersions.map((version) => (\n <ListItem\n key={version}\n size=\"small\"\n active={activeDocSection === 'release-notes' && activeReleaseVersion === version}\n onClick={() => {\n navigate({ to: '/docs/$section', params: { section: 'release-notes' } });\n setActiveReleaseVersion(version);\n }}\n >\n {version}\n </ListItem>\n ))\n ) : (\n <EmptyState>No releases yet</EmptyState>\n )}\n </SidebarSection>\n </>\n );\n};\n"],"names":["searchIn","text","query","snippet","maxLen","idx","start","end","s","DocsSearch","repoDocs","useAppStore","setActiveDocTitle","setDocSearchQuery","navigate","useNavigate","results","f","handleSelect","title","jsxs","m","jsx","Button","useReleaseNotes","version","sections","setSections","useState","useEffect","cancelled","fetchReleaseNotes","result","ReleaseNotesDetail","detailHeadingClassName","markdown","section","idea","Markdown","RepoDocDetail","activeDocTitle","file","isMarkdown","DocsPage","docSearchQuery","activeReleaseVersion","activeDocSection","useResolvedDocSection","handleBackToDocs","Breadcrumb","PageTitle","simplecaseLabel","name","EmptyState","children","DocsSidebar","repoDocsLoading","loadRepoDocs","releaseVersions","releaseVersionsLoading","loadReleaseVersions","setActiveReleaseVersion","Fragment","Input","e","SidebarSection","ListItem"],"mappings":"6KAaA,MAAMA,EAAW,CAACC,EAAcC,IAC9BD,EAAK,cAAc,SAASC,EAAM,aAAa,EAE3CC,EAAU,CAACF,EAAcC,EAAeE,EAAS,MAAgB,CACrE,MAAMC,EAAMJ,EAAK,YAAA,EAAc,QAAQC,EAAM,aAAa,EAC1D,GAAIG,IAAQ,GAAI,OAAOJ,EAAK,MAAM,EAAGG,CAAM,EAC3C,MAAME,EAAQ,KAAK,IAAI,EAAGD,EAAM,EAAE,EAC5BE,EAAM,KAAK,IAAIN,EAAK,OAAQI,EAAMH,EAAM,OAAS,EAAE,EACzD,IAAIM,EAAIP,EAAK,MAAMK,EAAO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QAAS,IAAM,CACbX,EAAS,CAAE,GAAI,iBAAkB,OAAQ,CAAE,QAAS,eAAA,EAAmB,EACvE+C,EAAwBpC,CAAO,CACjC,EAEC,SAAAA,CAAA,EARIA,CAAA,CAUR,EAEDH,EAAAA,IAAC+B,EAAA,CAAW,2BAAe,CAAA,CAE/B,CAAA,EACF,CAEJ"}
@@ -1,6 +1,6 @@
1
- import{j as e,w as m,U as h,i as f,a as j,r as d,O as u,y as g}from"./main-BC7PxPmE.js";function N(s){if(!s)return[];const t=(s.endsWith(`
1
+ import{j as e,w as m,U as h,i as f,a as j,r as d,Q as u,y as g}from"./main-BW24wv9K.js";function N(s){if(!s)return[];const t=(s.endsWith(`
2
2
  `)?s.slice(0,-1):s).split(`
3
3
  `),a=[];let l=null;for(const i of t){if(i.startsWith("@@ ")){l={header:i,lines:[]},a.push(l);continue}l&&(i.startsWith("+")?l.lines.push({type:"add",text:i.slice(1)}):i.startsWith("-")?l.lines.push({type:"remove",text:i.slice(1)}):l.lines.push({type:"context",text:i.startsWith(" ")?i.slice(1):i}))}return a}function w(s){return s?[{header:"",lines:(s.endsWith(`
4
4
  `)?s.slice(0,-1):s).split(`
5
5
  `).map(a=>({type:"add",text:a}))}]:[]}const v={add:"bg-watercolor-green/[18%] text-watercolor-green-dark",remove:"bg-watercolor-rose/[18%] text-watercolor-rose-dark",context:""},b={add:"+",remove:"-",context:" "},k=({additions:s,deletions:t})=>e.jsxs("span",{className:"inline-flex shrink-0 gap-2 font-mono text-2xs",children:[e.jsxs("span",{className:"text-watercolor-green-dark",children:["+",s]}),e.jsxs("span",{className:"text-watercolor-rose-dark",children:["-",t]})]}),C=({entry:s})=>e.jsxs("div",{className:"flex w-full min-w-0 items-center justify-between gap-3",children:[e.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap font-mono text-xs",children:s.renameSource?`${s.renameSource} → ${s.path}`:s.path}),e.jsxs("span",{className:"flex shrink-0 items-center gap-2",children:[s.staged&&e.jsx(h,{size:"small",children:"staged"}),!s.binary&&e.jsx(k,{additions:s.additions,deletions:s.deletions})]})]}),S=({entry:s})=>{if(s.binary)return e.jsx("p",{className:"m-0 opacity-60",children:"Binary file not shown."});if(s.contentKind==="too-large")return e.jsx("p",{className:"m-0 opacity-60",children:"File too large to preview."});const t=s.contentKind==="raw"?w(s.patch):N(s.patch);return t.length===0?s.renameSource?e.jsx("p",{className:"m-0 opacity-60",children:s.additions===0&&s.deletions===0?"Renamed, no content changes.":"Renamed with unrelated content — diff omitted."}):e.jsx("p",{className:"m-0 opacity-60",children:"No changes to preview."}):e.jsx("div",{className:"flex flex-col gap-3",children:t.map((a,l)=>e.jsxs("div",{children:[a.header&&e.jsx("div",{className:"mb-1 font-mono text-2xs opacity-50",children:a.header}),e.jsx("pre",{className:"m-0 overflow-x-auto font-mono text-2xs",children:a.lines.map((i,c)=>e.jsxs("span",{className:`block ${v[i.type]}`,children:[b[i.type],i.text]},`${i.type}-${c}`))})]},`${a.header}-${l}`))})},F=({entry:s,sectionRef:t})=>e.jsx("div",{ref:t,className:"scroll-mt-4",children:e.jsxs(m,{children:[e.jsx("div",{className:"mb-3",children:e.jsx(C,{entry:s})}),e.jsx(S,{entry:s})]})}),$=({additions:s,deletions:t})=>e.jsxs("span",{className:"inline-flex gap-2 font-mono text-2xs",children:[e.jsxs("span",{className:"text-watercolor-green-dark",children:["+",s]}),e.jsxs("span",{className:"text-watercolor-rose-dark",children:["-",t]})]}),R=({files:s,onSelect:t})=>e.jsx("div",{className:"sticky top-4 flex w-[288px] shrink-0 flex-col gap-1 max-h-page overflow-y-auto",children:s.map(a=>e.jsx(f,{size:"small",onClick:()=>t(a.path),action:e.jsxs("span",{className:"flex items-center gap-2",children:[a.staged&&e.jsx(h,{size:"small",children:"staged"}),!a.binary&&e.jsx($,{additions:a.additions,deletions:a.deletions})]}),children:e.jsx("span",{className:"block overflow-hidden text-ellipsis whitespace-nowrap font-mono text-2xs",children:a.path})},a.path))}),L=()=>{const s=j(),[t,a]=d.useState(null),[l,i]=d.useState(!1),c=d.useRef(new Map);d.useEffect(()=>{u().then(a).catch(()=>i(!0))},[]);const x=e.jsx("div",{className:"mb-4",children:e.jsx(g,{items:[{id:"plans",label:"Plans",onClick:()=>s({to:"/"})},{id:"changes",label:"Changes"}]})}),r="min-h-page";if(l)return e.jsxs("div",{children:[x,e.jsx("div",{className:r,children:e.jsx("p",{className:"opacity-50",children:"Couldn't load the working-tree diff."})})]});if(!t)return e.jsxs("div",{children:[x,e.jsx("div",{className:r,children:e.jsx("p",{className:"opacity-50",children:"Loading…"})})]});const p=n=>{var o;(o=c.current.get(n))==null||o.scrollIntoView({behavior:"smooth",block:"start"})};return e.jsxs("div",{children:[x,t.length===0?e.jsx("div",{className:r,children:e.jsx("p",{className:"opacity-50",children:"No changed files."})}):e.jsxs("div",{className:`flex items-start gap-6 ${r}`,children:[e.jsx(R,{files:t,onSelect:p}),e.jsx("div",{className:"flex min-w-0 flex-1 flex-col gap-6",children:t.map(n=>e.jsx(F,{entry:n,sectionRef:o=>{o?c.current.set(n.path,o):c.current.delete(n.path)}},n.path))})]})]})};export{L as DiffPage};
6
- //# sourceMappingURL=index-D2zDC3YW.js.map
6
+ //# sourceMappingURL=index-BSp1FE97.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-D2zDC3YW.js","sources":["../../../src/app/utils/parse-diff.ts","../../../src/app/features/diff/file-diff-card.tsx","../../../src/app/features/diff/file-list-sidebar.tsx","../../../src/app/features/diff/diff-page.tsx"],"sourcesContent":["export type DiffLineType = 'add' | 'remove' | 'context';\n\nexport interface DiffLine {\n type: DiffLineType;\n text: string;\n}\n\nexport interface DiffHunk {\n header: string;\n lines: DiffLine[];\n}\n\n// Parses a unified diff (git.ts getWorkingDiff, contentKind: 'diff'). A real diff\n// with no hunks (pure rename, mode-only change) is just the preamble, so it yields [].\nexport function parsePatch(patch: string): DiffHunk[] {\n if (!patch) return [];\n const lines = (patch.endsWith('\\n') ? patch.slice(0, -1) : patch).split('\\n');\n\n const hunks: DiffHunk[] = [];\n let current: DiffHunk | null = null;\n for (const line of lines) {\n if (line.startsWith('@@ ')) {\n current = { header: line, lines: [] };\n hunks.push(current);\n continue;\n }\n if (!current) continue; // preamble: diff --git / index / --- / +++\n if (line.startsWith('+')) current.lines.push({ type: 'add', text: line.slice(1) });\n else if (line.startsWith('-')) current.lines.push({ type: 'remove', text: line.slice(1) });\n else current.lines.push({ type: 'context', text: line.startsWith(' ') ? line.slice(1) : line });\n }\n return hunks;\n}\n\n// Untracked files store raw content, not a diff (git.ts getWorkingDiff, contentKind:\n// 'raw') — synthesize a single all-added hunk so the renderer only has one shape to draw.\nexport function rawContentHunks(content: string): DiffHunk[] {\n if (!content) return [];\n const lines = (content.endsWith('\\n') ? content.slice(0, -1) : content).split('\\n');\n return [{ header: '', lines: lines.map((text) => ({ type: 'add', text })) }];\n}\n","import { type DiffLineType, parsePatch, rawContentHunks } from '@/app/utils/parse-diff';\nimport type { FileDiffEntry } from '@/types/index';\nimport { Card, Stamp } from '@dendelion/paper-ui';\n\nconst LINE_CLASS: Record<DiffLineType, string> = {\n add: 'bg-watercolor-green/[18%] text-watercolor-green-dark',\n remove: 'bg-watercolor-rose/[18%] text-watercolor-rose-dark',\n context: '',\n};\n\nconst LINE_PREFIX: Record<DiffLineType, string> = { add: '+', remove: '-', context: ' ' };\n\ninterface CountBadgeProps {\n additions: number;\n deletions: number;\n}\n\nconst CountBadge = ({ additions, deletions }: CountBadgeProps) => (\n <span className=\"inline-flex shrink-0 gap-2 font-mono text-2xs\">\n <span className=\"text-watercolor-green-dark\">+{additions}</span>\n <span className=\"text-watercolor-rose-dark\">-{deletions}</span>\n </span>\n);\n\ninterface CardTitleProps {\n entry: FileDiffEntry;\n}\n\nconst CardTitle = ({ entry }: CardTitleProps) => (\n <div className=\"flex w-full min-w-0 items-center justify-between gap-3\">\n <span className=\"overflow-hidden text-ellipsis whitespace-nowrap font-mono text-xs\">\n {entry.renameSource ? `${entry.renameSource} → ${entry.path}` : entry.path}\n </span>\n <span className=\"flex shrink-0 items-center gap-2\">\n {entry.staged && <Stamp size=\"small\">staged</Stamp>}\n {!entry.binary && <CountBadge additions={entry.additions} deletions={entry.deletions} />}\n </span>\n </div>\n);\n\ninterface DiffBodyProps {\n entry: FileDiffEntry;\n}\n\nconst DiffBody = ({ entry }: DiffBodyProps) => {\n if (entry.binary) {\n return <p className=\"m-0 opacity-60\">Binary file not shown.</p>;\n }\n if (entry.contentKind === 'too-large') {\n return <p className=\"m-0 opacity-60\">File too large to preview.</p>;\n }\n const hunks =\n entry.contentKind === 'raw' ? rawContentHunks(entry.patch) : parsePatch(entry.patch);\n if (hunks.length === 0) {\n if (entry.renameSource) {\n return (\n <p className=\"m-0 opacity-60\">\n {entry.additions === 0 && entry.deletions === 0\n ? 'Renamed, no content changes.'\n : 'Renamed with unrelated content — diff omitted.'}\n </p>\n );\n }\n return <p className=\"m-0 opacity-60\">No changes to preview.</p>;\n }\n return (\n <div className=\"flex flex-col gap-3\">\n {hunks.map((hunk, i) => (\n <div key={`${hunk.header}-${i}`}>\n {hunk.header && <div className=\"mb-1 font-mono text-2xs opacity-50\">{hunk.header}</div>}\n {/* paper-ui's CodeBlock has no per-line add/remove styling. */}\n <pre className=\"m-0 overflow-x-auto font-mono text-2xs\">\n {hunk.lines.map((line, j) => (\n <span key={`${line.type}-${j}`} className={`block ${LINE_CLASS[line.type]}`}>\n {LINE_PREFIX[line.type]}\n {line.text}\n </span>\n ))}\n </pre>\n </div>\n ))}\n </div>\n );\n};\n\ninterface FileDiffSectionProps {\n entry: FileDiffEntry;\n sectionRef: (el: HTMLDivElement | null) => void;\n}\n\nexport const FileDiffSection = ({ entry, sectionRef }: FileDiffSectionProps) => (\n <div ref={sectionRef} className=\"scroll-mt-4\">\n <Card>\n <div className=\"mb-3\">\n <CardTitle entry={entry} />\n </div>\n <DiffBody entry={entry} />\n </Card>\n </div>\n);\n","import type { FileDiffEntry } from '@/types/index';\nimport { ListItem, Stamp } from '@dendelion/paper-ui';\n\ninterface CountBadgeProps {\n additions: number;\n deletions: number;\n}\n\nconst CountBadge = ({ additions, deletions }: CountBadgeProps) => (\n <span className=\"inline-flex gap-2 font-mono text-2xs\">\n <span className=\"text-watercolor-green-dark\">+{additions}</span>\n <span className=\"text-watercolor-rose-dark\">-{deletions}</span>\n </span>\n);\n\ninterface FileListSidebarProps {\n files: FileDiffEntry[];\n onSelect: (path: string) => void;\n}\n\nexport const FileListSidebar = ({ files, onSelect }: FileListSidebarProps) => (\n <div className=\"sticky top-4 flex w-[288px] shrink-0 flex-col gap-1 max-h-page overflow-y-auto\">\n {files.map((entry) => (\n <ListItem\n key={entry.path}\n size=\"small\"\n onClick={() => onSelect(entry.path)}\n action={\n <span className=\"flex items-center gap-2\">\n {entry.staged && <Stamp size=\"small\">staged</Stamp>}\n {!entry.binary && (\n <CountBadge additions={entry.additions} deletions={entry.deletions} />\n )}\n </span>\n }\n >\n <span className=\"block overflow-hidden text-ellipsis whitespace-nowrap font-mono text-2xs\">\n {entry.path}\n </span>\n </ListItem>\n ))}\n </div>\n);\n","import { fetchFileDiffs } from '@/app/services/git-api';\nimport type { FileDiffEntry } from '@/types/index';\nimport { Breadcrumb } from '@dendelion/paper-ui';\nimport { useNavigate } from '@tanstack/react-router';\nimport { useEffect, useRef, useState } from 'react';\nimport { FileDiffSection } from './file-diff-card';\nimport { FileListSidebar } from './file-list-sidebar';\n\nexport const DiffPage = () => {\n const navigate = useNavigate();\n const [files, setFiles] = useState<FileDiffEntry[] | null>(null);\n const [loadFailed, setLoadFailed] = useState(false);\n const sectionRefs = useRef(new Map<string, HTMLDivElement>());\n\n useEffect(() => {\n fetchFileDiffs()\n .then(setFiles)\n .catch(() => setLoadFailed(true));\n }, []);\n\n const breadcrumb = (\n <div className=\"mb-4\">\n <Breadcrumb\n items={[\n { id: 'plans', label: 'Plans', onClick: () => navigate({ to: '/' }) },\n { id: 'changes', label: 'Changes' },\n ]}\n />\n </div>\n );\n\n const contentClass = 'min-h-page';\n\n if (loadFailed) {\n return (\n <div>\n {breadcrumb}\n <div className={contentClass}>\n <p className=\"opacity-50\">Couldn't load the working-tree diff.</p>\n </div>\n </div>\n );\n }\n\n if (!files) {\n return (\n <div>\n {breadcrumb}\n <div className={contentClass}>\n <p className=\"opacity-50\">Loading…</p>\n </div>\n </div>\n );\n }\n\n const scrollToFile = (path: string) => {\n sectionRefs.current.get(path)?.scrollIntoView({ behavior: 'smooth', block: 'start' });\n };\n\n return (\n <div>\n {breadcrumb}\n {files.length === 0 ? (\n <div className={contentClass}>\n <p className=\"opacity-50\">No changed files.</p>\n </div>\n ) : (\n <div className={`flex items-start gap-6 ${contentClass}`}>\n <FileListSidebar files={files} onSelect={scrollToFile} />\n <div className=\"flex min-w-0 flex-1 flex-col gap-6\">\n {files.map((entry) => (\n <FileDiffSection\n key={entry.path}\n entry={entry}\n sectionRef={(el) => {\n if (el) sectionRefs.current.set(entry.path, el);\n else sectionRefs.current.delete(entry.path);\n }}\n />\n ))}\n </div>\n </div>\n )}\n </div>\n );\n};\n"],"names":["parsePatch","patch","lines","hunks","current","line","rawContentHunks","content","text","LINE_CLASS","LINE_PREFIX","CountBadge","additions","deletions","jsxs","CardTitle","entry","jsx","Stamp","DiffBody","hunk","i","j","FileDiffSection","sectionRef","Card","FileListSidebar","files","onSelect","ListItem","DiffPage","navigate","useNavigate","setFiles","useState","loadFailed","setLoadFailed","sectionRefs","useRef","useEffect","fetchFileDiffs","breadcrumb","Breadcrumb","contentClass","scrollToFile","path","_a","el"],"mappings":"wFAcO,SAASA,EAAWC,EAA2B,CACpD,GAAI,CAACA,EAAO,MAAO,CAAA,EACnB,MAAMC,GAASD,EAAM,SAAS;AAAA,CAAI,EAAIA,EAAM,MAAM,EAAG,EAAE,EAAIA,GAAO,MAAM;AAAA,CAAI,EAEtEE,EAAoB,CAAA,EAC1B,IAAIC,EAA2B,KAC/B,UAAWC,KAAQH,EAAO,CACxB,GAAIG,EAAK,WAAW,KAAK,EAAG,CAC1BD,EAAU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CAAI,UAAU,qCACZ,SAAAjB,EAAM,IAAKX,GACVC,EAAAA,IAACM,EAAA,CAEC,MAAAP,EACA,WAAa+B,GAAO,CACdA,EAAIV,EAAY,QAAQ,IAAIrB,EAAM,KAAM+B,CAAE,EACzCV,EAAY,QAAQ,OAAOrB,EAAM,IAAI,CAC5C,CAAA,EALKA,EAAM,IAAA,CAOd,CAAA,CACH,CAAA,CAAA,CACF,CAAA,EAEJ,CAEJ"}
1
+ {"version":3,"file":"index-BSp1FE97.js","sources":["../../../src/app/utils/parse-diff.ts","../../../src/app/features/diff/file-diff-card.tsx","../../../src/app/features/diff/file-list-sidebar.tsx","../../../src/app/features/diff/diff-page.tsx"],"sourcesContent":["export type DiffLineType = 'add' | 'remove' | 'context';\n\nexport interface DiffLine {\n type: DiffLineType;\n text: string;\n}\n\nexport interface DiffHunk {\n header: string;\n lines: DiffLine[];\n}\n\n// Parses a unified diff (git.ts getWorkingDiff, contentKind: 'diff'). A real diff\n// with no hunks (pure rename, mode-only change) is just the preamble, so it yields [].\nexport function parsePatch(patch: string): DiffHunk[] {\n if (!patch) return [];\n const lines = (patch.endsWith('\\n') ? patch.slice(0, -1) : patch).split('\\n');\n\n const hunks: DiffHunk[] = [];\n let current: DiffHunk | null = null;\n for (const line of lines) {\n if (line.startsWith('@@ ')) {\n current = { header: line, lines: [] };\n hunks.push(current);\n continue;\n }\n if (!current) continue; // preamble: diff --git / index / --- / +++\n if (line.startsWith('+')) current.lines.push({ type: 'add', text: line.slice(1) });\n else if (line.startsWith('-')) current.lines.push({ type: 'remove', text: line.slice(1) });\n else current.lines.push({ type: 'context', text: line.startsWith(' ') ? line.slice(1) : line });\n }\n return hunks;\n}\n\n// Untracked files store raw content, not a diff (git.ts getWorkingDiff, contentKind:\n// 'raw') — synthesize a single all-added hunk so the renderer only has one shape to draw.\nexport function rawContentHunks(content: string): DiffHunk[] {\n if (!content) return [];\n const lines = (content.endsWith('\\n') ? content.slice(0, -1) : content).split('\\n');\n return [{ header: '', lines: lines.map((text) => ({ type: 'add', text })) }];\n}\n","import { type DiffLineType, parsePatch, rawContentHunks } from '@/app/utils/parse-diff';\nimport type { FileDiffEntry } from '@/types/index';\nimport { Card, Stamp } from '@dendelion/paper-ui';\n\nconst LINE_CLASS: Record<DiffLineType, string> = {\n add: 'bg-watercolor-green/[18%] text-watercolor-green-dark',\n remove: 'bg-watercolor-rose/[18%] text-watercolor-rose-dark',\n context: '',\n};\n\nconst LINE_PREFIX: Record<DiffLineType, string> = { add: '+', remove: '-', context: ' ' };\n\ninterface CountBadgeProps {\n additions: number;\n deletions: number;\n}\n\nconst CountBadge = ({ additions, deletions }: CountBadgeProps) => (\n <span className=\"inline-flex shrink-0 gap-2 font-mono text-2xs\">\n <span className=\"text-watercolor-green-dark\">+{additions}</span>\n <span className=\"text-watercolor-rose-dark\">-{deletions}</span>\n </span>\n);\n\ninterface CardTitleProps {\n entry: FileDiffEntry;\n}\n\nconst CardTitle = ({ entry }: CardTitleProps) => (\n <div className=\"flex w-full min-w-0 items-center justify-between gap-3\">\n <span className=\"overflow-hidden text-ellipsis whitespace-nowrap font-mono text-xs\">\n {entry.renameSource ? `${entry.renameSource} → ${entry.path}` : entry.path}\n </span>\n <span className=\"flex shrink-0 items-center gap-2\">\n {entry.staged && <Stamp size=\"small\">staged</Stamp>}\n {!entry.binary && <CountBadge additions={entry.additions} deletions={entry.deletions} />}\n </span>\n </div>\n);\n\ninterface DiffBodyProps {\n entry: FileDiffEntry;\n}\n\nconst DiffBody = ({ entry }: DiffBodyProps) => {\n if (entry.binary) {\n return <p className=\"m-0 opacity-60\">Binary file not shown.</p>;\n }\n if (entry.contentKind === 'too-large') {\n return <p className=\"m-0 opacity-60\">File too large to preview.</p>;\n }\n const hunks =\n entry.contentKind === 'raw' ? rawContentHunks(entry.patch) : parsePatch(entry.patch);\n if (hunks.length === 0) {\n if (entry.renameSource) {\n return (\n <p className=\"m-0 opacity-60\">\n {entry.additions === 0 && entry.deletions === 0\n ? 'Renamed, no content changes.'\n : 'Renamed with unrelated content — diff omitted.'}\n </p>\n );\n }\n return <p className=\"m-0 opacity-60\">No changes to preview.</p>;\n }\n return (\n <div className=\"flex flex-col gap-3\">\n {hunks.map((hunk, i) => (\n <div key={`${hunk.header}-${i}`}>\n {hunk.header && <div className=\"mb-1 font-mono text-2xs opacity-50\">{hunk.header}</div>}\n {/* paper-ui's CodeBlock has no per-line add/remove styling. */}\n <pre className=\"m-0 overflow-x-auto font-mono text-2xs\">\n {hunk.lines.map((line, j) => (\n <span key={`${line.type}-${j}`} className={`block ${LINE_CLASS[line.type]}`}>\n {LINE_PREFIX[line.type]}\n {line.text}\n </span>\n ))}\n </pre>\n </div>\n ))}\n </div>\n );\n};\n\ninterface FileDiffSectionProps {\n entry: FileDiffEntry;\n sectionRef: (el: HTMLDivElement | null) => void;\n}\n\nexport const FileDiffSection = ({ entry, sectionRef }: FileDiffSectionProps) => (\n <div ref={sectionRef} className=\"scroll-mt-4\">\n <Card>\n <div className=\"mb-3\">\n <CardTitle entry={entry} />\n </div>\n <DiffBody entry={entry} />\n </Card>\n </div>\n);\n","import type { FileDiffEntry } from '@/types/index';\nimport { ListItem, Stamp } from '@dendelion/paper-ui';\n\ninterface CountBadgeProps {\n additions: number;\n deletions: number;\n}\n\nconst CountBadge = ({ additions, deletions }: CountBadgeProps) => (\n <span className=\"inline-flex gap-2 font-mono text-2xs\">\n <span className=\"text-watercolor-green-dark\">+{additions}</span>\n <span className=\"text-watercolor-rose-dark\">-{deletions}</span>\n </span>\n);\n\ninterface FileListSidebarProps {\n files: FileDiffEntry[];\n onSelect: (path: string) => void;\n}\n\nexport const FileListSidebar = ({ files, onSelect }: FileListSidebarProps) => (\n <div className=\"sticky top-4 flex w-[288px] shrink-0 flex-col gap-1 max-h-page overflow-y-auto\">\n {files.map((entry) => (\n <ListItem\n key={entry.path}\n size=\"small\"\n onClick={() => onSelect(entry.path)}\n action={\n <span className=\"flex items-center gap-2\">\n {entry.staged && <Stamp size=\"small\">staged</Stamp>}\n {!entry.binary && (\n <CountBadge additions={entry.additions} deletions={entry.deletions} />\n )}\n </span>\n }\n >\n <span className=\"block overflow-hidden text-ellipsis whitespace-nowrap font-mono text-2xs\">\n {entry.path}\n </span>\n </ListItem>\n ))}\n </div>\n);\n","import { fetchFileDiffs } from '@/app/services/git-api';\nimport type { FileDiffEntry } from '@/types/index';\nimport { Breadcrumb } from '@dendelion/paper-ui';\nimport { useNavigate } from '@tanstack/react-router';\nimport { useEffect, useRef, useState } from 'react';\nimport { FileDiffSection } from './file-diff-card';\nimport { FileListSidebar } from './file-list-sidebar';\n\nexport const DiffPage = () => {\n const navigate = useNavigate();\n const [files, setFiles] = useState<FileDiffEntry[] | null>(null);\n const [loadFailed, setLoadFailed] = useState(false);\n const sectionRefs = useRef(new Map<string, HTMLDivElement>());\n\n useEffect(() => {\n fetchFileDiffs()\n .then(setFiles)\n .catch(() => setLoadFailed(true));\n }, []);\n\n const breadcrumb = (\n <div className=\"mb-4\">\n <Breadcrumb\n items={[\n { id: 'plans', label: 'Plans', onClick: () => navigate({ to: '/' }) },\n { id: 'changes', label: 'Changes' },\n ]}\n />\n </div>\n );\n\n const contentClass = 'min-h-page';\n\n if (loadFailed) {\n return (\n <div>\n {breadcrumb}\n <div className={contentClass}>\n <p className=\"opacity-50\">Couldn't load the working-tree diff.</p>\n </div>\n </div>\n );\n }\n\n if (!files) {\n return (\n <div>\n {breadcrumb}\n <div className={contentClass}>\n <p className=\"opacity-50\">Loading…</p>\n </div>\n </div>\n );\n }\n\n const scrollToFile = (path: string) => {\n sectionRefs.current.get(path)?.scrollIntoView({ behavior: 'smooth', block: 'start' });\n };\n\n return (\n <div>\n {breadcrumb}\n {files.length === 0 ? (\n <div className={contentClass}>\n <p className=\"opacity-50\">No changed files.</p>\n </div>\n ) : (\n <div className={`flex items-start gap-6 ${contentClass}`}>\n <FileListSidebar files={files} onSelect={scrollToFile} />\n <div className=\"flex min-w-0 flex-1 flex-col gap-6\">\n {files.map((entry) => (\n <FileDiffSection\n key={entry.path}\n entry={entry}\n sectionRef={(el) => {\n if (el) sectionRefs.current.set(entry.path, el);\n else sectionRefs.current.delete(entry.path);\n }}\n />\n ))}\n </div>\n </div>\n )}\n </div>\n );\n};\n"],"names":["parsePatch","patch","lines","hunks","current","line","rawContentHunks","content","text","LINE_CLASS","LINE_PREFIX","CountBadge","additions","deletions","jsxs","CardTitle","entry","jsx","Stamp","DiffBody","hunk","i","j","FileDiffSection","sectionRef","Card","FileListSidebar","files","onSelect","ListItem","DiffPage","navigate","useNavigate","setFiles","useState","loadFailed","setLoadFailed","sectionRefs","useRef","useEffect","fetchFileDiffs","breadcrumb","Breadcrumb","contentClass","scrollToFile","path","_a","el"],"mappings":"wFAcO,SAASA,EAAWC,EAA2B,CACpD,GAAI,CAACA,EAAO,MAAO,CAAA,EACnB,MAAMC,GAASD,EAAM,SAAS;AAAA,CAAI,EAAIA,EAAM,MAAM,EAAG,EAAE,EAAIA,GAAO,MAAM;AAAA,CAAI,EAEtEE,EAAoB,CAAA,EAC1B,IAAIC,EAA2B,KAC/B,UAAWC,KAAQH,EAAO,CACxB,GAAIG,EAAK,WAAW,KAAK,EAAG,CAC1BD,EAAU,CAAE,OAAQC,EAAM,MAAO,CAAA,CAAC,EAClCF,EAAM,KAAKC,CAAO,EAClB,QACF,CACKA,IACDC,EAAK,WAAW,GAAG,IAAW,MAAM,KAAK,CAAE,KAAM,MAAO,KAAMA,EAAK,MAAM,CAAC,EAAG,EACxEA,EAAK,WAAW,GAAG,IAAW,MAAM,KAAK,CAAE,KAAM,SAAU,KAAMA,EAAK,MAAM,CAAC,EAAG,IAC5E,MAAM,KAAK,CAAE,KAAM,UAAW,KAAMA,EAAK,WAAW,GAAG,EAAIA,EAAK,MAAM,CAAC,EAAIA,EAAM,EAChG,CACA,OAAOF,CACT,CAIO,SAASG,EAAgBC,EAA6B,CAC3D,OAAKA,EAEE,CAAC,CAAE,OAAQ,GAAI,OADPA,EAAQ,SAAS;AAAA,CAAI,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R,EACF,cACG,MAAA,CACE,SAAA,CAAAM,EACDxB,EAAAA,IAAC,OAAI,UAAW0B,EACd,eAAC,IAAA,CAAE,UAAU,aAAa,SAAA,sCAAA,CAAoC,CAAA,CAChE,CAAA,EACF,EAIJ,GAAI,CAAChB,EACH,cACG,MAAA,CACE,SAAA,CAAAc,EACDxB,EAAAA,IAAC,OAAI,UAAW0B,EACd,eAAC,IAAA,CAAE,UAAU,aAAa,SAAA,UAAA,CAAQ,CAAA,CACpC,CAAA,EACF,EAIJ,MAAMC,EAAgBC,GAAiB,QACrCC,EAAAT,EAAY,QAAQ,IAAIQ,CAAI,IAA5B,MAAAC,EAA+B,eAAe,CAAE,SAAU,SAAU,MAAO,SAC7E,EAEA,cACG,MAAA,CACE,SAAA,CAAAL,EACAd,EAAM,SAAW,QACf,MAAA,CAAI,UAAWgB,EACd,SAAA1B,MAAC,IAAA,CAAE,UAAU,aAAa,SAAA,mBAAA,CAAiB,EAC7C,EAEAH,EAAAA,KAAC,OAAI,UAAW,0BAA0B6B,CAAY,GACpD,SAAA,CAAA1B,EAAAA,IAACS,EAAA,CAAgB,MAAAC,EAAc,SAAUiB,CAAA,CAAc,QACtD,MAAA,CAAI,UAAU,qCACZ,SAAAjB,EAAM,IAAKX,GACVC,EAAAA,IAACM,EAAA,CAEC,MAAAP,EACA,WAAa+B,GAAO,CACdA,EAAIV,EAAY,QAAQ,IAAIrB,EAAM,KAAM+B,CAAE,EACzCV,EAAY,QAAQ,OAAOrB,EAAM,IAAI,CAC5C,CAAA,EALKA,EAAM,IAAA,CAOd,CAAA,CACH,CAAA,CAAA,CACF,CAAA,EAEJ,CAEJ"}
@@ -1,3 +1,3 @@
1
- import{u as h,z as v,r,j as e,P as L,w as u,x as y,U as S,B as A,J as T}from"./main-BC7PxPmE.js";import{c as f}from"./tokens-C3C44lLs.js";const b={phase:"Phase run",audit:"Audit","batch-reconcile":"Batch reconcile","run-all":"Run all phases",draft:"Draft",extend:"Extend",suggest:"Suggest ideas","commit-suggest":"Commit suggest","overlap-check":"Overlap check",prioritise:"Prioritise queue",sync:"Sync",reconcile:"Reconcile","fix-review":"Fix review","resolve-conflict":"Resolve conflict",feedback:"Feedback reply"},m=s=>String(s).padStart(2,"0"),_=s=>{const a=new Date(s);return`${a.getFullYear()}-${m(a.getMonth()+1)}-${m(a.getDate())}`},D=s=>new Date(s).toLocaleDateString(void 0,{weekday:"long",year:"numeric",month:"long",day:"numeric"}),k=s=>{const a=new Date(s);return`${m(a.getHours())}:${m(a.getMinutes())}:${m(a.getSeconds())}`},p="text-sm font-semibold whitespace-nowrap overflow-hidden",N="grid grid-cols-[20px_116px_minmax(0,1fr)_88px_150px_72px] gap-2.5 items-center max-lg:grid-cols-[20px_116px_minmax(0,1fr)_88px_72px] max-[480px]:grid-cols-1 max-[480px]:gap-1",E=({id:s})=>{const[a,c]=r.useState(null),[l,i]=r.useState(!1),[o,x]=r.useState(0);r.useEffect(()=>{let n=!1,d;c(null),i(!1);const g=j=>{A(s).then(w=>{n||c(w.lines??[])}).catch(()=>{if(!n){if(j>0){d=setTimeout(()=>g(j-1),700);return}i(!0),c([])}})};return g(3),()=>{n=!0,d&&clearTimeout(d)}},[s,o]);const t=e.jsx(T,{variant:"ghost",size:"small",onClick:()=>x(n=>n+1),children:"Retry"});return a===null?e.jsx("p",{className:"opacity-50 m-0",children:"Loading…"}):l?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"opacity-50 m-0",children:"Couldn't load this task's output."}),t]}):a.length===0?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"opacity-50 m-0",children:"No output recorded."}),t]}):e.jsx("pre",{className:"font-mono text-xs m-0 max-h-[320px] overflow-y-auto whitespace-pre-wrap",children:a.join(`
2
- `)})},R=({size:s=14,className:a})=>e.jsx("svg",{width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:a,children:e.jsx("polyline",{points:"9 18 15 12 9 6"})}),$=({entry:s,highlighted:a})=>{const[c,l]=r.useState(a);r.useEffect(()=>{a&&l(!0)},[a]);const i=()=>l(o=>!o);return e.jsxs("div",{className:a?"task-row-highlighted flex flex-col gap-1 rounded-[10px] outline outline-2 outline-offset-[-2px] outline-[rgba(200,154,90,0.5)]":"flex flex-col gap-1 rounded-[10px]",children:[e.jsx("div",{role:"button",tabIndex:0,"aria-expanded":c,onClick:i,onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),i())},className:"group cursor-pointer rounded-[10px]",children:e.jsx(u,{size:"small",texture:"canvas",className:"plan-row-card",children:e.jsxs("div",{className:N,children:[e.jsx("span",{className:"inline-flex items-center opacity-50",children:e.jsx(R,{className:"transition-transform duration-150 ease-out group-aria-expanded:rotate-90"})}),e.jsx("span",{className:"font-semibold whitespace-nowrap overflow-hidden",children:b[s.taskKind]??s.taskKind}),e.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap opacity-70",children:s.planTitle}),e.jsx("span",{className:"text-sm opacity-50 whitespace-nowrap",children:y[s.agentId]}),e.jsxs("span",{className:"max-lg:hidden font-mono text-xs opacity-[0.55] whitespace-nowrap",children:[k(s.startedAt),"–",k(s.endedAt)]}),e.jsx("div",{className:"flex items-center",children:e.jsx(S,{size:"small",fillColor:s.outcome==="done"?"rgba(143, 185, 150, 0.25)":s.outcome==="superseded"?"rgba(212, 163, 115, 0.25)":"rgba(201, 139, 139, 0.25)",textColor:s.outcome==="done"?f.accentGreenDark:s.outcome==="superseded"?f.accentAmberDark:f.accentRoseDark,children:s.outcome})})]})})}),c&&e.jsxs(u,{size:"small",texture:"kraft",className:"plan-row-card",children:[s.outcome==="error"&&s.reason&&e.jsx("p",{className:"m-0 mb-2 text-sm text-state-danger",children:s.reason}),e.jsx(E,{id:s.id})]})]})},K=()=>{const s=h(t=>t.taskLog),a=h(t=>t.taskLogLoading),c=h(t=>t.loadTaskLog),{taskId:l}=v({from:"/tasks"}),i=r.useRef(null);r.useEffect(()=>{c()},[c]),r.useEffect(()=>{var n;if(!l)return;const t=(n=i.current)==null?void 0:n.querySelector(".task-row-highlighted");t==null||t.scrollIntoView({behavior:"smooth",block:"center"})},[l]);const o=[...s].sort((t,n)=>n.endedAt.localeCompare(t.endedAt)),x=[];for(const t of o){const n=_(t.endedAt),d=x.at(-1);(d==null?void 0:d.key)===n?d.entries.push(t):x.push({key:n,entries:[t]})}return e.jsxs("div",{ref:i,children:[e.jsx(L,{children:"Tasks"}),a&&e.jsx("p",{className:"opacity-50",children:"Loading…"}),!a&&o.length===0&&e.jsx("p",{className:"opacity-50",children:"No tasks have run yet."}),!a&&o.length>0&&e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(u,{size:"small",texture:"kraft",className:"plan-row-card",children:e.jsxs("div",{className:N,children:[e.jsx("span",{}),e.jsx("span",{className:`${p} opacity-60`,children:"Task"}),e.jsx("span",{className:`${p} opacity-60`,children:"Plan"}),e.jsx("span",{className:`${p} opacity-60`,children:"Agent"}),e.jsx("span",{className:`max-lg:hidden ${p} opacity-60`,children:"Time"}),e.jsx("span",{className:`${p} opacity-60`,children:"Outcome"})]})}),x.map(t=>e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(u,{size:"small",texture:"kraft",className:"plan-row-card",children:e.jsx("span",{className:`${p} opacity-75`,children:D(t.entries[0].endedAt)})}),t.entries.map(n=>e.jsx($,{entry:n,highlighted:n.id===l},n.id))]},t.key))]})]})};export{K as TasksPage};
3
- //# sourceMappingURL=index-C5as2mi1.js.map
1
+ import{u as h,B as v,r,j as e,P as L,w as u,z as y,U as S,C as A,J as T}from"./main-BW24wv9K.js";import{c as f}from"./tokens-C3C44lLs.js";const b={phase:"Phase run",audit:"Audit","batch-reconcile":"Batch reconcile","run-all":"Run all phases",draft:"Draft",extend:"Extend",suggest:"Suggest ideas","commit-suggest":"Commit suggest","overlap-check":"Overlap check",prioritise:"Prioritise queue",sync:"Sync",reconcile:"Reconcile","fix-review":"Fix review","resolve-conflict":"Resolve conflict",feedback:"Feedback reply"},m=s=>String(s).padStart(2,"0"),_=s=>{const a=new Date(s);return`${a.getFullYear()}-${m(a.getMonth()+1)}-${m(a.getDate())}`},D=s=>new Date(s).toLocaleDateString(void 0,{weekday:"long",year:"numeric",month:"long",day:"numeric"}),k=s=>{const a=new Date(s);return`${m(a.getHours())}:${m(a.getMinutes())}:${m(a.getSeconds())}`},p="text-sm font-semibold whitespace-nowrap overflow-hidden",N="grid grid-cols-[20px_116px_minmax(0,1fr)_88px_150px_72px] gap-2.5 items-center max-lg:grid-cols-[20px_116px_minmax(0,1fr)_88px_72px] max-[480px]:grid-cols-1 max-[480px]:gap-1",C=({id:s})=>{const[a,c]=r.useState(null),[l,i]=r.useState(!1),[o,x]=r.useState(0);r.useEffect(()=>{let n=!1,d;c(null),i(!1);const g=j=>{A(s).then(w=>{n||c(w.lines??[])}).catch(()=>{if(!n){if(j>0){d=setTimeout(()=>g(j-1),700);return}i(!0),c([])}})};return g(3),()=>{n=!0,d&&clearTimeout(d)}},[s,o]);const t=e.jsx(T,{variant:"ghost",size:"small",onClick:()=>x(n=>n+1),children:"Retry"});return a===null?e.jsx("p",{className:"opacity-50 m-0",children:"Loading…"}):l?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"opacity-50 m-0",children:"Couldn't load this task's output."}),t]}):a.length===0?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"opacity-50 m-0",children:"No output recorded."}),t]}):e.jsx("pre",{className:"font-mono text-xs m-0 max-h-[320px] overflow-y-auto whitespace-pre-wrap",children:a.join(`
2
+ `)})},E=({size:s=14,className:a})=>e.jsx("svg",{width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:a,children:e.jsx("polyline",{points:"9 18 15 12 9 6"})}),R=({entry:s,highlighted:a})=>{const[c,l]=r.useState(a);r.useEffect(()=>{a&&l(!0)},[a]);const i=()=>l(o=>!o);return e.jsxs("div",{className:a?"task-row-highlighted flex flex-col gap-1 rounded-[10px] outline outline-2 outline-offset-[-2px] outline-[rgba(200,154,90,0.5)]":"flex flex-col gap-1 rounded-[10px]",children:[e.jsx("div",{role:"button",tabIndex:0,"aria-expanded":c,onClick:i,onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),i())},className:"group cursor-pointer rounded-[10px]",children:e.jsx(u,{size:"small",texture:"canvas",className:"plan-row-card",children:e.jsxs("div",{className:N,children:[e.jsx("span",{className:"inline-flex items-center opacity-50",children:e.jsx(E,{className:"transition-transform duration-150 ease-out group-aria-expanded:rotate-90"})}),e.jsx("span",{className:"font-semibold whitespace-nowrap overflow-hidden",children:b[s.taskKind]??s.taskKind}),e.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap opacity-70",children:s.planTitle}),e.jsx("span",{className:"text-sm opacity-50 whitespace-nowrap",children:y[s.agentId]}),e.jsxs("span",{className:"max-lg:hidden font-mono text-xs opacity-[0.55] whitespace-nowrap",children:[k(s.startedAt),"–",k(s.endedAt)]}),e.jsx("div",{className:"flex items-center",children:e.jsx(S,{size:"small",fillColor:s.outcome==="done"?"rgba(143, 185, 150, 0.25)":s.outcome==="superseded"?"rgba(212, 163, 115, 0.25)":"rgba(201, 139, 139, 0.25)",textColor:s.outcome==="done"?f.accentGreenDark:s.outcome==="superseded"?f.accentAmberDark:f.accentRoseDark,children:s.outcome})})]})})}),c&&e.jsxs(u,{size:"small",texture:"kraft",className:"plan-row-card",children:[s.outcome==="error"&&s.reason&&e.jsx("p",{className:"m-0 mb-2 text-sm text-state-danger",children:s.reason}),e.jsx(C,{id:s.id})]})]})},K=()=>{const s=h(t=>t.taskLog),a=h(t=>t.taskLogLoading),c=h(t=>t.loadTaskLog),{taskId:l}=v({from:"/tasks"}),i=r.useRef(null);r.useEffect(()=>{c()},[c]),r.useEffect(()=>{var n;if(!l)return;const t=(n=i.current)==null?void 0:n.querySelector(".task-row-highlighted");t==null||t.scrollIntoView({behavior:"smooth",block:"center"})},[l]);const o=[...s].sort((t,n)=>n.endedAt.localeCompare(t.endedAt)),x=[];for(const t of o){const n=_(t.endedAt),d=x.at(-1);(d==null?void 0:d.key)===n?d.entries.push(t):x.push({key:n,entries:[t]})}return e.jsxs("div",{ref:i,children:[e.jsx(L,{children:"Tasks"}),a&&e.jsx("p",{className:"opacity-50",children:"Loading…"}),!a&&o.length===0&&e.jsx("p",{className:"opacity-50",children:"No tasks have run yet."}),!a&&o.length>0&&e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(u,{size:"small",texture:"kraft",className:"plan-row-card",children:e.jsxs("div",{className:N,children:[e.jsx("span",{}),e.jsx("span",{className:`${p} opacity-60`,children:"Task"}),e.jsx("span",{className:`${p} opacity-60`,children:"Plan"}),e.jsx("span",{className:`${p} opacity-60`,children:"Agent"}),e.jsx("span",{className:`max-lg:hidden ${p} opacity-60`,children:"Time"}),e.jsx("span",{className:`${p} opacity-60`,children:"Outcome"})]})}),x.map(t=>e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(u,{size:"small",texture:"kraft",className:"plan-row-card",children:e.jsx("span",{className:`${p} opacity-75`,children:D(t.entries[0].endedAt)})}),t.entries.map(n=>e.jsx(R,{entry:n,highlighted:n.id===l},n.id))]},t.key))]})]})};export{K as TasksPage};
3
+ //# sourceMappingURL=index-BTyua-6D.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-C5as2mi1.js","sources":["../../../src/app/features/tasks/tasks-page.tsx"],"sourcesContent":["import { PageTitle } from '@/app/components/page-title';\nimport { fetchTaskLogLines } from '@/app/services/content/docs-api';\nimport { useAppStore } from '@/app/stores/app-store';\nimport { color } from '@/app/styles/tokens';\nimport { AGENT_LABELS, type TaskKind, type TaskLogEntry } from '@/types/index';\nimport { Button, Card, Stamp } from '@dendelion/paper-ui';\nimport { useSearch } from '@tanstack/react-router';\nimport { useEffect, useRef, useState } from 'react';\n\nconst TASK_KIND_LABELS: Record<TaskKind, string> = {\n phase: 'Phase run',\n audit: 'Audit',\n 'batch-reconcile': 'Batch reconcile',\n 'run-all': 'Run all phases',\n draft: 'Draft',\n extend: 'Extend',\n suggest: 'Suggest ideas',\n 'commit-suggest': 'Commit suggest',\n 'overlap-check': 'Overlap check',\n prioritise: 'Prioritise queue',\n sync: 'Sync',\n reconcile: 'Reconcile',\n 'fix-review': 'Fix review',\n 'resolve-conflict': 'Resolve conflict',\n feedback: 'Feedback reply',\n};\n\nconst pad = (n: number) => String(n).padStart(2, '0');\n\nconst dayKey = (iso: string) => {\n const d = new Date(iso);\n return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;\n};\n\nconst formatDayHeader = (iso: string) =>\n new Date(iso).toLocaleDateString(undefined, {\n weekday: 'long',\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n });\n\nconst formatTime = (iso: string) => {\n const d = new Date(iso);\n return `${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`;\n};\n\nconst headerLabelClassName = 'text-sm font-semibold whitespace-nowrap overflow-hidden';\n\nconst TASK_ROWS_GRID_CLASS =\n 'grid grid-cols-[20px_116px_minmax(0,1fr)_88px_150px_72px] gap-2.5 items-center max-lg:grid-cols-[20px_116px_minmax(0,1fr)_88px_72px] max-[480px]:grid-cols-1 max-[480px]:gap-1';\n\nconst TaskLogLines = ({ id }: { id: string }) => {\n const [lines, setLines] = useState<string[] | null>(null);\n const [failed, setFailed] = useState(false);\n const [attempt, setAttempt] = useState(0);\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: attempt is the retry trigger (re-runs the fetch), not a value read in the body.\n useEffect(() => {\n let cancelled = false;\n let timer: ReturnType<typeof setTimeout> | undefined;\n setLines(null);\n setFailed(false);\n // Auto-retry first (dev server briefly drops requests on hot reload); manual Retry only if it stays down.\n const load = (remaining: number) => {\n fetchTaskLogLines(id)\n .then((data) => {\n if (cancelled) return;\n setLines(data.lines ?? []);\n })\n .catch(() => {\n if (cancelled) return;\n if (remaining > 0) {\n timer = setTimeout(() => load(remaining - 1), 700);\n return;\n }\n // Empty result != failed request: conflating them mislabels a fetch error as \"no output\".\n setFailed(true);\n setLines([]);\n });\n };\n load(3);\n return () => {\n cancelled = true;\n if (timer) clearTimeout(timer);\n };\n }, [id, attempt]);\n\n const retry = (\n <Button variant=\"ghost\" size=\"small\" onClick={() => setAttempt((n) => n + 1)}>\n Retry\n </Button>\n );\n\n if (lines === null) return <p className=\"opacity-50 m-0\">Loading…</p>;\n if (failed)\n return (\n <div className=\"flex items-center gap-2\">\n <p className=\"opacity-50 m-0\">Couldn't load this task's output.</p>\n {retry}\n </div>\n );\n if (lines.length === 0)\n return (\n <div className=\"flex items-center gap-2\">\n <p className=\"opacity-50 m-0\">No output recorded.</p>\n {retry}\n </div>\n );\n return (\n <pre className=\"font-mono text-xs m-0 max-h-[320px] overflow-y-auto whitespace-pre-wrap\">\n {lines.join('\\n')}\n </pre>\n );\n};\n\nconst ChevronRightIcon = ({ size = 14, className }: { size?: number; className?: string }) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n className={className}\n >\n <polyline points=\"9 18 15 12 9 6\" />\n </svg>\n);\n\nconst TaskRow = ({ entry, highlighted }: { entry: TaskLogEntry; highlighted: boolean }) => {\n const [expanded, setExpanded] = useState(highlighted);\n useEffect(() => {\n if (highlighted) setExpanded(true);\n }, [highlighted]);\n const toggle = () => setExpanded((v) => !v);\n\n return (\n <div\n className={\n highlighted\n ? 'task-row-highlighted flex flex-col gap-1 rounded-[10px] outline outline-2 outline-offset-[-2px] outline-[rgba(200,154,90,0.5)]'\n : 'flex flex-col gap-1 rounded-[10px]'\n }\n >\n {/* biome-ignore lint/a11y/useSemanticElements: the clickable row wraps a Card whose block layout a native <button> would break; keyboard toggling is wired on the div. */}\n <div\n role=\"button\"\n tabIndex={0}\n aria-expanded={expanded}\n onClick={toggle}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n toggle();\n }\n }}\n className=\"group cursor-pointer rounded-[10px]\"\n >\n <Card size=\"small\" texture=\"canvas\" className=\"plan-row-card\">\n <div className={TASK_ROWS_GRID_CLASS}>\n <span className=\"inline-flex items-center opacity-50\">\n <ChevronRightIcon className=\"transition-transform duration-150 ease-out group-aria-expanded:rotate-90\" />\n </span>\n <span className=\"font-semibold whitespace-nowrap overflow-hidden\">\n {TASK_KIND_LABELS[entry.taskKind] ?? entry.taskKind}\n </span>\n <span className=\"overflow-hidden text-ellipsis whitespace-nowrap opacity-70\">\n {entry.planTitle}\n </span>\n <span className=\"text-sm opacity-50 whitespace-nowrap\">\n {AGENT_LABELS[entry.agentId]}\n </span>\n <span className=\"max-lg:hidden font-mono text-xs opacity-[0.55] whitespace-nowrap\">\n {formatTime(entry.startedAt)}–{formatTime(entry.endedAt)}\n </span>\n <div className=\"flex items-center\">\n <Stamp\n size=\"small\"\n fillColor={\n entry.outcome === 'done'\n ? 'rgba(143, 185, 150, 0.25)'\n : entry.outcome === 'superseded'\n ? 'rgba(212, 163, 115, 0.25)'\n : 'rgba(201, 139, 139, 0.25)'\n }\n textColor={\n entry.outcome === 'done'\n ? color.accentGreenDark\n : entry.outcome === 'superseded'\n ? color.accentAmberDark\n : color.accentRoseDark\n }\n >\n {entry.outcome}\n </Stamp>\n </div>\n </div>\n </Card>\n </div>\n {expanded && (\n <Card size=\"small\" texture=\"kraft\" className=\"plan-row-card\">\n {entry.outcome === 'error' && entry.reason && (\n <p className=\"m-0 mb-2 text-sm text-state-danger\">{entry.reason}</p>\n )}\n <TaskLogLines id={entry.id} />\n </Card>\n )}\n </div>\n );\n};\n\nexport const TasksPage = () => {\n const taskLog = useAppStore((s) => s.taskLog);\n const taskLogLoading = useAppStore((s) => s.taskLogLoading);\n const loadTaskLog = useAppStore((s) => s.loadTaskLog);\n const { taskId } = useSearch({ from: '/tasks' });\n const containerRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n loadTaskLog();\n }, [loadTaskLog]);\n\n useEffect(() => {\n if (!taskId) return;\n const row = containerRef.current?.querySelector('.task-row-highlighted');\n row?.scrollIntoView({ behavior: 'smooth', block: 'center' });\n }, [taskId]);\n\n const sorted = [...taskLog].sort((a, b) => b.endedAt.localeCompare(a.endedAt));\n\n const groups: { key: string; entries: TaskLogEntry[] }[] = [];\n for (const entry of sorted) {\n const key = dayKey(entry.endedAt);\n const group = groups.at(-1);\n if (group?.key === key) group.entries.push(entry);\n else groups.push({ key, entries: [entry] });\n }\n\n return (\n <div ref={containerRef}>\n <PageTitle>Tasks</PageTitle>\n {taskLogLoading && <p className=\"opacity-50\">Loading…</p>}\n {!taskLogLoading && sorted.length === 0 && (\n <p className=\"opacity-50\">No tasks have run yet.</p>\n )}\n {!taskLogLoading && sorted.length > 0 && (\n <div className=\"flex flex-col gap-1\">\n <Card size=\"small\" texture=\"kraft\" className=\"plan-row-card\">\n <div className={TASK_ROWS_GRID_CLASS}>\n <span />\n <span className={`${headerLabelClassName} opacity-60`}>Task</span>\n <span className={`${headerLabelClassName} opacity-60`}>Plan</span>\n <span className={`${headerLabelClassName} opacity-60`}>Agent</span>\n <span className={`max-lg:hidden ${headerLabelClassName} opacity-60`}>Time</span>\n <span className={`${headerLabelClassName} opacity-60`}>Outcome</span>\n </div>\n </Card>\n {groups.map((group) => (\n <div key={group.key} className=\"flex flex-col gap-1\">\n <Card size=\"small\" texture=\"kraft\" className=\"plan-row-card\">\n <span className={`${headerLabelClassName} opacity-75`}>\n {formatDayHeader(group.entries[0].endedAt)}\n </span>\n </Card>\n {group.entries.map((entry) => (\n <TaskRow key={entry.id} entry={entry} highlighted={entry.id === taskId} />\n ))}\n </div>\n ))}\n </div>\n )}\n </div>\n );\n};\n"],"names":["TASK_KIND_LABELS","pad","n","dayKey","iso","d","formatDayHeader","formatTime","headerLabelClassName","TASK_ROWS_GRID_CLASS","TaskLogLines","id","lines","setLines","useState","failed","setFailed","attempt","setAttempt","useEffect","cancelled","timer","load","remaining","fetchTaskLogLines","data","retry","jsx","Button","jsxs","ChevronRightIcon","size","className","TaskRow","entry","highlighted","expanded","setExpanded","toggle","v","e","Card","AGENT_LABELS","Stamp","color","TasksPage","taskLog","useAppStore","s","taskLogLoading","loadTaskLog","taskId","useSearch","containerRef","useRef","row","_a","sorted","a","b","groups","key","group","PageTitle"],"mappings":"0IASA,MAAMA,EAA6C,CACjD,MAAO,YACP,MAAO,QACP,kBAAmB,kBACnB,UAAW,iBACX,MAAO,QACP,OAAQ,SACR,QAAS,gBACT,iBAAkB,iBAClB,gBAAiB,gBACjB,WAAY,mBACZ,KAAM,OACN,UAAW,YACX,aAAc,aACd,mBAAoB,mBACpB,SAAU,gBACZ,EAEMC,EAAOC,GAAc,OAAOA,CAAC,EAAE,SAAS,EAAG,GAAG,EAE9CC,EAAUC,GAAgB,CAC9B,MAAMC,EAAI,IAAI,KAAKD,CAAG,EACtB,MAAO,GAAGC,EAAE,YAAA,CAAa,IAAIJ,EAAII,EAAE,SAAA,EAAa,CAAC,CAAC,IAAIJ,EAAII,EAAE,QAAA,CAAS,CAAC,EACxE,EAEMC,EAAmBF,GACvB,IAAI,KAAKA,CAAG,EAAE,mBAAmB,OAAW,CAC1C,QAAS,OACT,KAAM,UACN,MAAO,OACP,IAAK,SACP,CAAC,EAEGG,EAAcH,GAAgB,CAClC,MAAMC,EAAI,IAAI,KAAKD,CAAG,EACtB,MAAO,GAAGH,EAAII,EAAE,SAAA,CAAU,CAAC,IAAIJ,EAAII,EAAE,WAAA,CAAY,CAAC,IAAIJ,EAAII,EAAE,WAAA,CAAY,CAAC,EAC3E,EAEMG,EAAuB,0DAEvBC,EACJ,iLAEIC,EAAe,CAAC,CAAE,GAAAC,KAAyB,CAC/C,KAAM,CAACC,EAAOC,CAAQ,EA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Q,UAAU,gBAC3C,eAAC,OAAA,CAAK,UAAW,GAAGjC,CAAoB,cACrC,WAAgBsD,EAAM,QAAQ,CAAC,EAAE,OAAO,EAC3C,CAAA,CACF,EACCA,EAAM,QAAQ,IAAK5B,GAClBP,EAAAA,IAACM,EAAA,CAAuB,MAAAC,EAAc,YAAaA,EAAM,KAAOiB,CAAA,EAAlDjB,EAAM,EAAoD,CACzE,CAAA,CAAA,EARO4B,EAAM,GAShB,CACD,CAAA,CAAA,CACH,CAAA,EAEJ,CAEJ"}
1
+ {"version":3,"file":"index-BTyua-6D.js","sources":["../../../src/app/features/tasks/tasks-page.tsx"],"sourcesContent":["import { PageTitle } from '@/app/components/page-title';\nimport { fetchTaskLogLines } from '@/app/services/content/docs-api';\nimport { useAppStore } from '@/app/stores/app-store';\nimport { color } from '@/app/styles/tokens';\nimport { AGENT_LABELS, type TaskKind, type TaskLogEntry } from '@/types/index';\nimport { Button, Card, Stamp } from '@dendelion/paper-ui';\nimport { useSearch } from '@tanstack/react-router';\nimport { useEffect, useRef, useState } from 'react';\n\nconst TASK_KIND_LABELS: Record<TaskKind, string> = {\n phase: 'Phase run',\n audit: 'Audit',\n 'batch-reconcile': 'Batch reconcile',\n 'run-all': 'Run all phases',\n draft: 'Draft',\n extend: 'Extend',\n suggest: 'Suggest ideas',\n 'commit-suggest': 'Commit suggest',\n 'overlap-check': 'Overlap check',\n prioritise: 'Prioritise queue',\n sync: 'Sync',\n reconcile: 'Reconcile',\n 'fix-review': 'Fix review',\n 'resolve-conflict': 'Resolve conflict',\n feedback: 'Feedback reply',\n};\n\nconst pad = (n: number) => String(n).padStart(2, '0');\n\nconst dayKey = (iso: string) => {\n const d = new Date(iso);\n return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;\n};\n\nconst formatDayHeader = (iso: string) =>\n new Date(iso).toLocaleDateString(undefined, {\n weekday: 'long',\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n });\n\nconst formatTime = (iso: string) => {\n const d = new Date(iso);\n return `${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`;\n};\n\nconst headerLabelClassName = 'text-sm font-semibold whitespace-nowrap overflow-hidden';\n\nconst TASK_ROWS_GRID_CLASS =\n 'grid grid-cols-[20px_116px_minmax(0,1fr)_88px_150px_72px] gap-2.5 items-center max-lg:grid-cols-[20px_116px_minmax(0,1fr)_88px_72px] max-[480px]:grid-cols-1 max-[480px]:gap-1';\n\nconst TaskLogLines = ({ id }: { id: string }) => {\n const [lines, setLines] = useState<string[] | null>(null);\n const [failed, setFailed] = useState(false);\n const [attempt, setAttempt] = useState(0);\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: attempt is the retry trigger (re-runs the fetch), not a value read in the body.\n useEffect(() => {\n let cancelled = false;\n let timer: ReturnType<typeof setTimeout> | undefined;\n setLines(null);\n setFailed(false);\n // Auto-retry first (dev server briefly drops requests on hot reload); manual Retry only if it stays down.\n const load = (remaining: number) => {\n fetchTaskLogLines(id)\n .then((data) => {\n if (cancelled) return;\n setLines(data.lines ?? []);\n })\n .catch(() => {\n if (cancelled) return;\n if (remaining > 0) {\n timer = setTimeout(() => load(remaining - 1), 700);\n return;\n }\n // Empty result != failed request: conflating them mislabels a fetch error as \"no output\".\n setFailed(true);\n setLines([]);\n });\n };\n load(3);\n return () => {\n cancelled = true;\n if (timer) clearTimeout(timer);\n };\n }, [id, attempt]);\n\n const retry = (\n <Button variant=\"ghost\" size=\"small\" onClick={() => setAttempt((n) => n + 1)}>\n Retry\n </Button>\n );\n\n if (lines === null) return <p className=\"opacity-50 m-0\">Loading…</p>;\n if (failed)\n return (\n <div className=\"flex items-center gap-2\">\n <p className=\"opacity-50 m-0\">Couldn't load this task's output.</p>\n {retry}\n </div>\n );\n if (lines.length === 0)\n return (\n <div className=\"flex items-center gap-2\">\n <p className=\"opacity-50 m-0\">No output recorded.</p>\n {retry}\n </div>\n );\n return (\n <pre className=\"font-mono text-xs m-0 max-h-[320px] overflow-y-auto whitespace-pre-wrap\">\n {lines.join('\\n')}\n </pre>\n );\n};\n\nconst ChevronRightIcon = ({ size = 14, className }: { size?: number; className?: string }) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n className={className}\n >\n <polyline points=\"9 18 15 12 9 6\" />\n </svg>\n);\n\nconst TaskRow = ({ entry, highlighted }: { entry: TaskLogEntry; highlighted: boolean }) => {\n const [expanded, setExpanded] = useState(highlighted);\n useEffect(() => {\n if (highlighted) setExpanded(true);\n }, [highlighted]);\n const toggle = () => setExpanded((v) => !v);\n\n return (\n <div\n className={\n highlighted\n ? 'task-row-highlighted flex flex-col gap-1 rounded-[10px] outline outline-2 outline-offset-[-2px] outline-[rgba(200,154,90,0.5)]'\n : 'flex flex-col gap-1 rounded-[10px]'\n }\n >\n {/* biome-ignore lint/a11y/useSemanticElements: the clickable row wraps a Card whose block layout a native <button> would break; keyboard toggling is wired on the div. */}\n <div\n role=\"button\"\n tabIndex={0}\n aria-expanded={expanded}\n onClick={toggle}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n toggle();\n }\n }}\n className=\"group cursor-pointer rounded-[10px]\"\n >\n <Card size=\"small\" texture=\"canvas\" className=\"plan-row-card\">\n <div className={TASK_ROWS_GRID_CLASS}>\n <span className=\"inline-flex items-center opacity-50\">\n <ChevronRightIcon className=\"transition-transform duration-150 ease-out group-aria-expanded:rotate-90\" />\n </span>\n <span className=\"font-semibold whitespace-nowrap overflow-hidden\">\n {TASK_KIND_LABELS[entry.taskKind] ?? entry.taskKind}\n </span>\n <span className=\"overflow-hidden text-ellipsis whitespace-nowrap opacity-70\">\n {entry.planTitle}\n </span>\n <span className=\"text-sm opacity-50 whitespace-nowrap\">\n {AGENT_LABELS[entry.agentId]}\n </span>\n <span className=\"max-lg:hidden font-mono text-xs opacity-[0.55] whitespace-nowrap\">\n {formatTime(entry.startedAt)}–{formatTime(entry.endedAt)}\n </span>\n <div className=\"flex items-center\">\n <Stamp\n size=\"small\"\n fillColor={\n entry.outcome === 'done'\n ? 'rgba(143, 185, 150, 0.25)'\n : entry.outcome === 'superseded'\n ? 'rgba(212, 163, 115, 0.25)'\n : 'rgba(201, 139, 139, 0.25)'\n }\n textColor={\n entry.outcome === 'done'\n ? color.accentGreenDark\n : entry.outcome === 'superseded'\n ? color.accentAmberDark\n : color.accentRoseDark\n }\n >\n {entry.outcome}\n </Stamp>\n </div>\n </div>\n </Card>\n </div>\n {expanded && (\n <Card size=\"small\" texture=\"kraft\" className=\"plan-row-card\">\n {entry.outcome === 'error' && entry.reason && (\n <p className=\"m-0 mb-2 text-sm text-state-danger\">{entry.reason}</p>\n )}\n <TaskLogLines id={entry.id} />\n </Card>\n )}\n </div>\n );\n};\n\nexport const TasksPage = () => {\n const taskLog = useAppStore((s) => s.taskLog);\n const taskLogLoading = useAppStore((s) => s.taskLogLoading);\n const loadTaskLog = useAppStore((s) => s.loadTaskLog);\n const { taskId } = useSearch({ from: '/tasks' });\n const containerRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n loadTaskLog();\n }, [loadTaskLog]);\n\n useEffect(() => {\n if (!taskId) return;\n const row = containerRef.current?.querySelector('.task-row-highlighted');\n row?.scrollIntoView({ behavior: 'smooth', block: 'center' });\n }, [taskId]);\n\n const sorted = [...taskLog].sort((a, b) => b.endedAt.localeCompare(a.endedAt));\n\n const groups: { key: string; entries: TaskLogEntry[] }[] = [];\n for (const entry of sorted) {\n const key = dayKey(entry.endedAt);\n const group = groups.at(-1);\n if (group?.key === key) group.entries.push(entry);\n else groups.push({ key, entries: [entry] });\n }\n\n return (\n <div ref={containerRef}>\n <PageTitle>Tasks</PageTitle>\n {taskLogLoading && <p className=\"opacity-50\">Loading…</p>}\n {!taskLogLoading && sorted.length === 0 && (\n <p className=\"opacity-50\">No tasks have run yet.</p>\n )}\n {!taskLogLoading && sorted.length > 0 && (\n <div className=\"flex flex-col gap-1\">\n <Card size=\"small\" texture=\"kraft\" className=\"plan-row-card\">\n <div className={TASK_ROWS_GRID_CLASS}>\n <span />\n <span className={`${headerLabelClassName} opacity-60`}>Task</span>\n <span className={`${headerLabelClassName} opacity-60`}>Plan</span>\n <span className={`${headerLabelClassName} opacity-60`}>Agent</span>\n <span className={`max-lg:hidden ${headerLabelClassName} opacity-60`}>Time</span>\n <span className={`${headerLabelClassName} opacity-60`}>Outcome</span>\n </div>\n </Card>\n {groups.map((group) => (\n <div key={group.key} className=\"flex flex-col gap-1\">\n <Card size=\"small\" texture=\"kraft\" className=\"plan-row-card\">\n <span className={`${headerLabelClassName} opacity-75`}>\n {formatDayHeader(group.entries[0].endedAt)}\n </span>\n </Card>\n {group.entries.map((entry) => (\n <TaskRow key={entry.id} entry={entry} highlighted={entry.id === taskId} />\n ))}\n </div>\n ))}\n </div>\n )}\n </div>\n );\n};\n"],"names":["TASK_KIND_LABELS","pad","n","dayKey","iso","d","formatDayHeader","formatTime","headerLabelClassName","TASK_ROWS_GRID_CLASS","TaskLogLines","id","lines","setLines","useState","failed","setFailed","attempt","setAttempt","useEffect","cancelled","timer","load","remaining","fetchTaskLogLines","data","retry","jsx","Button","jsxs","ChevronRightIcon","size","className","TaskRow","entry","highlighted","expanded","setExpanded","toggle","v","e","Card","AGENT_LABELS","Stamp","color","TasksPage","taskLog","useAppStore","s","taskLogLoading","loadTaskLog","taskId","useSearch","containerRef","useRef","row","_a","sorted","a","b","groups","key","group","PageTitle"],"mappings":"0IASA,MAAMA,EAA6C,CACjD,MAAO,YACP,MAAO,QACP,kBAAmB,kBACnB,UAAW,iBACX,MAAO,QACP,OAAQ,SACR,QAAS,gBACT,iBAAkB,iBAClB,gBAAiB,gBACjB,WAAY,mBACZ,KAAM,OACN,UAAW,YACX,aAAc,aACd,mBAAoB,mBACpB,SAAU,gBACZ,EAEMC,EAAOC,GAAc,OA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A,CAAI,UAAU,sBACb,SAAA,CAAAF,EAAAA,IAACc,EAAA,CAAK,KAAK,QAAQ,QAAQ,QAAQ,UAAU,gBAC3C,SAAAZ,EAAAA,KAAC,MAAA,CAAI,UAAWpB,EACd,SAAA,CAAAkB,EAAAA,IAAC,OAAA,EAAK,QACL,OAAA,CAAK,UAAW,GAAGnB,CAAoB,cAAe,SAAA,OAAI,QAC1D,OAAA,CAAK,UAAW,GAAGA,CAAoB,cAAe,SAAA,OAAI,QAC1D,OAAA,CAAK,UAAW,GAAGA,CAAoB,cAAe,SAAA,QAAK,QAC3D,OAAA,CAAK,UAAW,iBAAiBA,CAAoB,cAAe,SAAA,OAAI,QACxE,OAAA,CAAK,UAAW,GAAGA,CAAoB,cAAe,SAAA,SAAA,CAAO,CAAA,CAAA,CAChE,CAAA,CACF,EACCoD,EAAO,IAAKE,GACXjC,EAAAA,KAAC,MAAA,CAAoB,UAAU,sBAC7B,SAAA,CAAAF,EAAAA,IAACc,EAAA,CAAK,KAAK,QAAQ,QAAQ,QAAQ,UAAU,gBAC3C,eAAC,OAAA,CAAK,UAAW,GAAGjC,CAAoB,cACrC,WAAgBsD,EAAM,QAAQ,CAAC,EAAE,OAAO,EAC3C,CAAA,CACF,EACCA,EAAM,QAAQ,IAAK5B,GAClBP,EAAAA,IAACM,EAAA,CAAuB,MAAAC,EAAc,YAAaA,EAAM,KAAOiB,CAAA,EAAlDjB,EAAM,EAAoD,CACzE,CAAA,CAAA,EARO4B,EAAM,GAShB,CACD,CAAA,CAAA,CACH,CAAA,EAEJ,CAEJ"}
@@ -1,4 +1,4 @@
1
- import{u as S,h as z,r as d,k as L,j as e,C as T,t as D,J as v,E as O,F as M,a as B,z as U,G as C,P as E,M as $,w as _,U as y,S as b,H as V,o as I,I as F,g as G,K as H,L as q}from"./main-BC7PxPmE.js";import{N as fe}from"./main-BC7PxPmE.js";const w="__no-subject__",K=({horizonTitle:a,item:s,candidateName:t,onClose:r,onPromoted:l})=>{const c=S(n=>n.promoteRoadmapItem),o=S(n=>n.launchIdeaExtend),{subjects:f,available:p}=z(),[h,u]=d.useState(w),[j,g]=d.useState(!1),[x,N]=d.useState(null),{toast:R}=L();d.useEffect(()=>{s&&(u(t?s.name:w),g(!1),N(null))},[s,t]);const k=async()=>{if(!(!s||!a)){g(!0),N(null);try{const n=await c(a,s,h===w?void 0:h,t??void 0),i=S.getState().ideaEntries.find(m=>m.id===n);if(i)try{await o(n,O(i,a))}catch(m){R({title:"Idea created, but the refine agent failed to launch",description:M(m.message),variant:"error"})}l(),r()}catch(n){N(n.message)}finally{g(!1)}}};return e.jsx(T,{open:s!==null,onClose:r,title:t??(s==null?void 0:s.name)??"",size:"small",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[!t&&e.jsx("p",{className:"m-0 opacity-80",children:s==null?void 0:s.description}),e.jsx("div",{children:e.jsx(D,{size:"small",value:h,onChange:u,disabled:j||!p,options:[{value:w,label:"No subject"},...!p&&h!==w?[{value:h,label:h}]:[],...f.map(n=>({value:n,label:n}))]})}),x&&e.jsx("p",{className:"m-0 text-watercolor-rose-dark text-sm",children:x}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(v,{type:"button",variant:"ghost",onClick:r,disabled:j,children:"Cancel"}),e.jsx(v,{type:"button",variant:"primary",onClick:k,disabled:j,children:j?"Promoting…":"Promote to idea"})]})]})})},J=a=>({shipped:a.filter(s=>s.status==="done").length,queued:a.filter(s=>s.status!=="done"&&s.status!=="dropped").length}),A="font-handwritten text-md font-semibold opacity-70 leading-none pt-2 px-1 pb-0",W="text-2xs font-normal px-1 py-0 opacity-50",Z=({size:a=14})=>e.jsx("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("polyline",{points:"9 18 15 12 9 6"})}),Q=({name:a,onPromote:s})=>e.jsx(_,{size:"small",texture:"kraft",className:"plan-row-card",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"flex-1",children:a}),e.jsx(v,{type:"button",variant:"ghost",size:"small",onClick:s,children:"Promote to idea"})]})}),X=({onAdd:a})=>{const[s,t]=d.useState(""),[r,l]=d.useState(!1),c=async()=>{if(s.trim()){l(!0);try{await a(s.trim()),t("")}finally{l(!1)}}};return e.jsxs("div",{className:"flex gap-2",children:[e.jsx(I,{size:"small",value:s,onChange:o=>t(o.target.value),onKeyDown:o=>{o.key==="Enter"&&c()},placeholder:"Add option…",disabled:r,className:"flex-1"}),e.jsx(v,{type:"button",variant:"ghost",size:"small",onClick:c,disabled:r||!s.trim(),children:"Add"})]})},Y=({onAdd:a})=>{const[s,t]=d.useState(!1),[r,l]=d.useState(""),[c,o]=d.useState(""),[f,p]=d.useState(!1),h=async()=>{if(r.trim()){p(!0);try{await a(r.trim(),c.trim()),l(""),o(""),t(!1)}finally{p(!1)}}};return s?e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(I,{size:"small",value:r,onChange:u=>l(u.target.value),placeholder:"Item name…",disabled:f,autoFocus:!0}),e.jsx(I,{size:"small",value:c,onChange:u=>o(u.target.value),onKeyDown:u=>{u.key==="Enter"&&h()},placeholder:"Description…",disabled:f}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(v,{type:"button",variant:"ghost",size:"small",onClick:()=>t(!1),disabled:f,children:"Cancel"}),e.jsx(v,{type:"button",size:"small",onClick:h,disabled:f||!r.trim(),children:"Add"})]})]}):e.jsx(v,{type:"button",variant:"ghost",size:"small",onClick:()=>t(!0),children:"+ Add item"})},ee=(a,s)=>`${a} ${s}${a===1?"":"s"}`,ae=({link:a})=>e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(G,{content:`${ee(a.taskRuns,"task run")}${a.released?" · released":""}`,children:e.jsx(y,{size:"small",fillColor:b[a.status].fill,textColor:b[a.status].text,children:a.id})}),a.pr&&e.jsx(H,{pr:a.pr})]}),se=({plan:a,onOpen:s})=>e.jsx(_,{size:"small",texture:"kraft",className:"plan-row-card",children:e.jsxs("button",{type:"button",onClick:s,className:"flex items-center gap-3 w-full bg-transparent border-none p-0 cursor-pointer [font:inherit] text-inherit text-left",children:[e.jsx("span",{className:"flex-1 overflow-hidden text-ellipsis whitespace-nowrap",children:a.title}),e.jsx(y,{size:"small",fillColor:b[a.status].fill,textColor:b[a.status].text,children:q[a.status]})]})}),te=({item:a,graduated:s,highlighted:t,onPromote:r,onPromoteCandidate:l,onAddCandidate:c,onViewGraduated:o,onOpenGraduated:f})=>{const[p,h]=d.useState(t),u=a.candidates.length>0,{shipped:j,queued:g}=J(s);return e.jsxs("div",{className:`flex flex-col gap-1 ${t?"roadmap-item-highlighted outline outline-2 outline-offset-[-2px] outline-[rgba(200,154,90,0.5)]":""}`,children:[e.jsx(_,{size:"small",texture:"canvas",className:"plan-row-card",children:e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button","aria-expanded":p,"aria-label":p?"Collapse item":"Expand item",onClick:()=>h(x=>!x),className:`inline-flex items-center bg-transparent border-none cursor-pointer opacity-50 p-0 ${p?"rotate-90":""}`,children:e.jsx(Z,{})}),e.jsx("span",{className:"font-semibold flex-1",children:a.name}),e.jsx(v,{type:"button",variant:"ghost",size:"small",onClick:r,children:"Promote to idea"})]}),e.jsx("span",{className:`text-sm opacity-70 ${p?"":"line-clamp-2"}`,children:a.description}),e.jsxs("div",{className:"flex items-center gap-1",children:[(g>0||j>0)&&e.jsxs("button",{type:"button",onClick:o,className:"flex items-center gap-1 bg-transparent border-none p-0 cursor-pointer",children:[g>0&&e.jsxs(y,{size:"small",fillColor:b.planned.fill,textColor:b.planned.text,children:[g," in queue"]}),j>0&&e.jsxs(y,{size:"small",fillColor:b.done.fill,textColor:b.done.text,children:[j," shipped"]})]}),u&&e.jsxs(y,{size:"small",fillColor:"rgba(0, 0, 0, 0.06)",textColor:"rgba(0, 0, 0, 0.55)",children:[a.candidates.length," candidate",a.candidates.length===1?"":"s"]}),a.rollup.total>0&&e.jsxs(y,{size:"small",fillColor:b.planned.fill,textColor:b.planned.text,children:[a.rollup.done,"/",a.rollup.total," done"]})]}),a.links.length>0&&e.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:a.links.map(x=>e.jsx(ae,{link:x},x.id))})]})}),p&&e.jsxs("div",{className:"flex flex-col gap-1 pl-6",children:[a.candidates.map(x=>e.jsx(Q,{name:x,onPromote:()=>l(x)},x)),s.map(x=>e.jsx(se,{plan:x,onOpen:()=>f(x.title)},x.title)),e.jsx(X,{onAdd:c})]})]})},le=({goal:a})=>{const[s,t]=d.useState(!1),[r,...l]=a.split(/\n{2,}/),c=l.length>0;return e.jsxs("div",{className:"mb-6 pb-4 border-b border-black/[8%]",children:[e.jsx("span",{className:"font-handwritten text-xs font-semibold opacity-[0.55]",children:"The goal"}),e.jsxs("div",{className:"font-display-luminari text-lg leading-[1.4] mt-2",children:[e.jsx("div",{className:s?void 0:"line-clamp-1",children:e.jsx($,{children:r})}),s&&c&&e.jsx($,{children:l.join(`
1
+ import{u as S,m as L,r as d,k as T,j as e,E as z,v as D,J as v,F as O,G as M,a as B,B as U,H as C,P as E,M as $,w as _,U as y,S as b,I as V,o as I,K as F,g as G,L as H,N as q}from"./main-BW24wv9K.js";import{O as fe}from"./main-BW24wv9K.js";const w="__no-subject__",K=({horizonTitle:a,item:s,candidateName:t,onClose:r,onPromoted:l})=>{const c=S(n=>n.promoteRoadmapItem),o=S(n=>n.launchIdeaExtend),{subjects:f,available:p}=L(),[h,u]=d.useState(w),[j,g]=d.useState(!1),[x,N]=d.useState(null),{toast:R}=T();d.useEffect(()=>{s&&(u(t?s.name:w),g(!1),N(null))},[s,t]);const k=async()=>{if(!(!s||!a)){g(!0),N(null);try{const n=await c(a,s,h===w?void 0:h,t??void 0),i=S.getState().ideaEntries.find(m=>m.id===n);if(i)try{await o(n,O(i,a))}catch(m){R({title:"Idea created, but the refine agent failed to launch",description:M(m.message),variant:"error"})}l(),r()}catch(n){N(n.message)}finally{g(!1)}}};return e.jsx(z,{open:s!==null,onClose:r,title:t??(s==null?void 0:s.name)??"",size:"small",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[!t&&e.jsx("p",{className:"m-0 opacity-80",children:s==null?void 0:s.description}),e.jsx("div",{children:e.jsx(D,{size:"small",value:h,onChange:u,disabled:j||!p,options:[{value:w,label:"No subject"},...!p&&h!==w?[{value:h,label:h}]:[],...f.map(n=>({value:n,label:n}))]})}),x&&e.jsx("p",{className:"m-0 text-watercolor-rose-dark text-sm",children:x}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(v,{type:"button",variant:"ghost",onClick:r,disabled:j,children:"Cancel"}),e.jsx(v,{type:"button",variant:"primary",onClick:k,disabled:j,children:j?"Promoting…":"Promote to idea"})]})]})})},J=a=>({shipped:a.filter(s=>s.status==="done").length,queued:a.filter(s=>s.status!=="done"&&s.status!=="dropped").length}),A="font-handwritten text-md font-semibold opacity-70 leading-none pt-2 px-1 pb-0",W="text-2xs font-normal px-1 py-0 opacity-50",Z=({size:a=14})=>e.jsx("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("polyline",{points:"9 18 15 12 9 6"})}),Q=({name:a,onPromote:s})=>e.jsx(_,{size:"small",texture:"kraft",className:"plan-row-card",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"flex-1",children:a}),e.jsx(v,{type:"button",variant:"ghost",size:"small",onClick:s,children:"Promote to idea"})]})}),X=({onAdd:a})=>{const[s,t]=d.useState(""),[r,l]=d.useState(!1),c=async()=>{if(s.trim()){l(!0);try{await a(s.trim()),t("")}finally{l(!1)}}};return e.jsxs("div",{className:"flex gap-2",children:[e.jsx(I,{size:"small",value:s,onChange:o=>t(o.target.value),onKeyDown:o=>{o.key==="Enter"&&c()},placeholder:"Add option…",disabled:r,className:"flex-1"}),e.jsx(v,{type:"button",variant:"ghost",size:"small",onClick:c,disabled:r||!s.trim(),children:"Add"})]})},Y=({onAdd:a})=>{const[s,t]=d.useState(!1),[r,l]=d.useState(""),[c,o]=d.useState(""),[f,p]=d.useState(!1),h=async()=>{if(r.trim()){p(!0);try{await a(r.trim(),c.trim()),l(""),o(""),t(!1)}finally{p(!1)}}};return s?e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(I,{size:"small",value:r,onChange:u=>l(u.target.value),placeholder:"Item name…",disabled:f,autoFocus:!0}),e.jsx(I,{size:"small",value:c,onChange:u=>o(u.target.value),onKeyDown:u=>{u.key==="Enter"&&h()},placeholder:"Description…",disabled:f}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(v,{type:"button",variant:"ghost",size:"small",onClick:()=>t(!1),disabled:f,children:"Cancel"}),e.jsx(v,{type:"button",size:"small",onClick:h,disabled:f||!r.trim(),children:"Add"})]})]}):e.jsx(v,{type:"button",variant:"ghost",size:"small",onClick:()=>t(!0),children:"+ Add item"})},ee=(a,s)=>`${a} ${s}${a===1?"":"s"}`,ae=({link:a})=>e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(G,{content:`${ee(a.taskRuns,"task run")}${a.released?" · released":""}`,children:e.jsx(y,{size:"small",fillColor:b[a.status].fill,textColor:b[a.status].text,children:a.id})}),a.pr&&e.jsx(H,{pr:a.pr})]}),se=({plan:a,onOpen:s})=>e.jsx(_,{size:"small",texture:"kraft",className:"plan-row-card",children:e.jsxs("button",{type:"button",onClick:s,className:"flex items-center gap-3 w-full bg-transparent border-none p-0 cursor-pointer [font:inherit] text-inherit text-left",children:[e.jsx("span",{className:"flex-1 overflow-hidden text-ellipsis whitespace-nowrap",children:a.title}),e.jsx(y,{size:"small",fillColor:b[a.status].fill,textColor:b[a.status].text,children:q[a.status]})]})}),te=({item:a,graduated:s,highlighted:t,onPromote:r,onPromoteCandidate:l,onAddCandidate:c,onViewGraduated:o,onOpenGraduated:f})=>{const[p,h]=d.useState(t),u=a.candidates.length>0,{shipped:j,queued:g}=J(s);return e.jsxs("div",{className:`flex flex-col gap-1 ${t?"roadmap-item-highlighted outline outline-2 outline-offset-[-2px] outline-[rgba(200,154,90,0.5)]":""}`,children:[e.jsx(_,{size:"small",texture:"canvas",className:"plan-row-card",children:e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button","aria-expanded":p,"aria-label":p?"Collapse item":"Expand item",onClick:()=>h(x=>!x),className:`inline-flex items-center bg-transparent border-none cursor-pointer opacity-50 p-0 ${p?"rotate-90":""}`,children:e.jsx(Z,{})}),e.jsx("span",{className:"font-semibold flex-1",children:a.name}),e.jsx(v,{type:"button",variant:"ghost",size:"small",onClick:r,children:"Promote to idea"})]}),e.jsx("span",{className:`text-sm opacity-70 ${p?"":"line-clamp-2"}`,children:a.description}),e.jsxs("div",{className:"flex items-center gap-1",children:[(g>0||j>0)&&e.jsxs("button",{type:"button",onClick:o,className:"flex items-center gap-1 bg-transparent border-none p-0 cursor-pointer",children:[g>0&&e.jsxs(y,{size:"small",fillColor:b.planned.fill,textColor:b.planned.text,children:[g," in queue"]}),j>0&&e.jsxs(y,{size:"small",fillColor:b.done.fill,textColor:b.done.text,children:[j," shipped"]})]}),u&&e.jsxs(y,{size:"small",fillColor:"rgba(0, 0, 0, 0.06)",textColor:"rgba(0, 0, 0, 0.55)",children:[a.candidates.length," candidate",a.candidates.length===1?"":"s"]}),a.rollup.total>0&&e.jsxs(y,{size:"small",fillColor:b.planned.fill,textColor:b.planned.text,children:[a.rollup.done,"/",a.rollup.total," done"]})]}),a.links.length>0&&e.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:a.links.map(x=>e.jsx(ae,{link:x},x.id))})]})}),p&&e.jsxs("div",{className:"flex flex-col gap-1 pl-6",children:[a.candidates.map(x=>e.jsx(Q,{name:x,onPromote:()=>l(x)},x)),s.map(x=>e.jsx(se,{plan:x,onOpen:()=>f(x.title)},x.title)),e.jsx(X,{onAdd:c})]})]})},le=({goal:a})=>{const[s,t]=d.useState(!1),[r,...l]=a.split(/\n{2,}/),c=l.length>0;return e.jsxs("div",{className:"mb-6 pb-4 border-b border-black/[8%]",children:[e.jsx("span",{className:"font-handwritten text-xs font-semibold opacity-[0.55]",children:"The goal"}),e.jsxs("div",{className:"font-display-luminari text-lg leading-[1.4] mt-2",children:[e.jsx("div",{className:s?void 0:"line-clamp-1",children:e.jsx($,{children:r})}),s&&c&&e.jsx($,{children:l.join(`
2
2
 
3
3
  `)})]}),c&&e.jsx("button",{type:"button",onClick:()=>t(o=>!o),className:"bg-transparent border-none p-0 mt-2 cursor-pointer text-2xs opacity-[0.65] underline",children:s?"Show less":"Show more"})]})},ne=[{id:"tree",label:"Outline"},{id:"map",label:"Board"},{id:"timeline",label:"Timeline"}],re=({mode:a,onChange:s})=>e.jsx("nav",{"aria-label":"Roadmap view",className:"flex gap-1 mb-4",children:ne.map(t=>e.jsx(v,{type:"button",variant:"ghost",size:"small",isActive:a===t.id,"aria-pressed":a===t.id,onClick:()=>s(t.id),children:t.label},t.id))}),P=({items:a,graduatedByItem:s})=>{const t=a.filter(l=>s(l).length>0).length,r=a.length-t;return e.jsxs("div",{className:W,children:[t," graduated · ",r," charted"]})},oe={created:"bg-watercolor-slate","task-run":"bg-watercolor-amber"},ie=({events:a,rangeStart:s,rangeEnd:t})=>{const r=t-s||1;return e.jsx("div",{className:"relative h-8 mx-1 border-b border-black/10",children:a.map((l,c)=>e.jsx("button",{type:"button",className:`absolute top-1/2 w-2.5 h-2.5 p-0 border-none rounded-full -translate-x-1/2 -translate-y-1/2 cursor-pointer ${oe[l.kind]}`,style:{left:`${(Date.parse(l.date)-s)/r*100}%`},title:`${l.itemName} — ${l.label} (${l.date})`,"aria-label":`${l.itemName} — ${l.label} (${l.date})`},`${l.entityId}-${l.kind}-${c}`))})},de=({item:a})=>{const s=a.rollup.total>0?Math.round(a.rollup.done/a.rollup.total*100):0;return e.jsxs("div",{className:"flex flex-col gap-1 py-2 px-2.5",children:[e.jsx("div",{className:"font-semibold text-sm",children:a.name}),e.jsx("div",{className:"h-1.5 rounded-full bg-black/[0.08] overflow-hidden",children:e.jsx("div",{className:`h-full rounded-full ${a.rollup.total>0?"bg-watercolor-green":"bg-transparent"}`,style:{width:`${s}%`}})}),e.jsx("div",{className:"text-2xs opacity-50",children:a.rollup.total>0?`${a.rollup.done}/${a.rollup.total} done`:"not started"})]})},ce=({roadmap:a,graduatedByItem:s})=>e.jsx("div",{className:"flex flex-col gap-6",children:a.horizons.map(t=>e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("div",{className:A,children:t.title}),e.jsx(P,{items:t.items,graduatedByItem:s})]}),e.jsx("div",{className:"flex flex-wrap items-start gap-2.5",children:t.items.map(r=>e.jsx("div",{className:"flex-[1_1_240px] max-w-[320px] max-[480px]:flex-[1_1_100%] max-[480px]:max-w-none",children:e.jsx(de,{item:r})},r.name))})]},t.title))}),xe=({roadmap:a})=>{if(a.events.length===0)return e.jsx("p",{className:"opacity-50",children:"No dated events yet."});const s=a.events.map(l=>Date.parse(l.date)),t=Math.min(...s),r=Math.max(...s);return e.jsxs("div",{className:"flex flex-col gap-6",children:[a.horizons.map(l=>{const c=a.events.filter(o=>o.horizonTitle===l.title);return e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("div",{className:A,children:l.title}),c.length===0?e.jsx("div",{className:"text-2xs font-normal px-1 py-0 opacity-40",children:"No events yet"}):e.jsx(ie,{events:c,rangeStart:t,rangeEnd:r})]},l.title)}),e.jsxs("div",{className:"flex justify-between text-2xs opacity-50",children:[e.jsx("span",{children:new Date(t).toLocaleDateString()}),e.jsx("span",{children:new Date(r).toLocaleDateString()})]})]})},me=()=>{const[a,s]=d.useState(null),[t,r]=d.useState(!0),[l,c]=d.useState(!1),[o,f]=d.useState(null),[p,h]=d.useState("tree"),u=S(n=>n.plans),j=B(),{item:g}=U({from:"/roadmap"}),x=d.useRef(null);if(d.useEffect(()=>{C().then(s).catch(()=>c(!0)).finally(()=>r(!1))},[]),d.useEffect(()=>{var i;if(!g||t)return;const n=(i=x.current)==null?void 0:i.querySelector(".roadmap-item-highlighted");n==null||n.scrollIntoView({behavior:"smooth",block:"center"})},[g,t]),t)return e.jsxs("div",{children:[e.jsx(E,{children:"Roadmap"}),e.jsx("p",{className:"opacity-50",children:"Loading…"})]});if(l)return e.jsxs("div",{children:[e.jsx(E,{children:"Roadmap"}),e.jsx("p",{className:"opacity-50",children:"Couldn't load the roadmap — the server may need a restart to pick up new routes."})]});if(!a||a.horizons.length===0)return e.jsxs("div",{children:[e.jsx(E,{children:"Roadmap"}),e.jsx("p",{className:"opacity-50",children:"No `ROADMAP.md` found at the project root."})]});const N=n=>(u==null?void 0:u.entries.filter(i=>i.subject===n.name))??[],R=async(n,i,m)=>{await F(n,i,m),s(await C())},k=async(n,i,m)=>{await V(n,i,m),s(await C())};return e.jsxs("div",{ref:x,children:[e.jsx(le,{goal:a.goal}),e.jsx(re,{mode:p,onChange:h}),p==="tree"&&e.jsx("div",{className:"flex flex-col gap-6",children:a.horizons.map(n=>e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("div",{className:A,children:n.title}),e.jsx(P,{items:n.items,graduatedByItem:N})]}),e.jsxs("div",{className:"flex flex-wrap items-start gap-2.5",children:[n.items.map(i=>e.jsx("div",{className:"flex-[1_1_240px] max-w-[320px] max-[480px]:flex-[1_1_100%] max-[480px]:max-w-none",children:e.jsx(te,{item:i,graduated:N(i),highlighted:i.name===g,onPromote:()=>f({horizonTitle:n.title,item:i}),onPromoteCandidate:m=>f({horizonTitle:n.title,item:i,candidateName:m}),onAddCandidate:m=>k(n.title,i.name,m),onViewGraduated:()=>j({to:"/",search:{subject:i.name}}),onOpenGraduated:m=>j({to:"/plans/$planId",params:{planId:encodeURIComponent(m)}})})},i.name)),e.jsx("div",{className:"flex-[1_1_240px] max-w-[320px] max-[480px]:flex-[1_1_100%] max-[480px]:max-w-none",children:e.jsx(Y,{onAdd:(i,m)=>R(n.title,i,m)})})]})]},n.title))}),p==="map"&&e.jsx(ce,{roadmap:a,graduatedByItem:N}),p==="timeline"&&e.jsx(xe,{roadmap:a}),e.jsx(K,{horizonTitle:(o==null?void 0:o.horizonTitle)??null,item:(o==null?void 0:o.item)??null,candidateName:o==null?void 0:o.candidateName,onClose:()=>f(null),onPromoted:()=>C().then(s)})]})};export{me as RoadmapPage,fe as useRoadmapItemNames};
4
- //# sourceMappingURL=index-DrOhvDGC.js.map
4
+ //# sourceMappingURL=index-Bi4fur5H.js.map