create-fullstack-scaffold 0.4.2 → 0.4.4

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 (156) hide show
  1. package/dist/cli/index.js +513 -122
  2. package/dist/cli/index.js.map +1 -1
  3. package/package.json +1 -1
  4. package/template/dist/cli/index.js +237 -94
  5. package/template/dist/cli/index.js.map +1 -1
  6. package/template/dist/client/admin.html +15 -10
  7. package/template/dist/client/assets/App-BpFUIC-5.js +114 -0
  8. package/template/dist/client/assets/{CartPage-DESSHkaG.js → CartPage-DgDZP-R5.js} +2 -2
  9. package/template/dist/client/assets/{CategoriesPage-DqLZ_Mom.js → CategoriesPage-fuYNiSmE.js} +2 -2
  10. package/template/dist/client/assets/ContentDetailPage-BvvFU1Mr.js +1 -0
  11. package/template/dist/client/assets/ContentListPage-ShPxo6WG.js +1 -0
  12. package/template/dist/client/assets/DashboardPage-C1rZzZo4.js +11 -0
  13. package/template/dist/client/assets/{DeveloperDashboardPage-Cum7zFwO.js → DeveloperDashboardPage-_WtmbVoA.js} +2 -2
  14. package/template/dist/client/assets/{EmptyState-BK7ttK8D.js → EmptyState-DEyOQjbY.js} +1 -1
  15. package/template/dist/client/assets/LoadingSpinner-BcHjaM1m.js +6 -0
  16. package/template/dist/client/assets/LoginPage-CjeQqDdO.js +1 -0
  17. package/template/dist/client/assets/LogoutOutlined-ColFAHdd.js +1 -0
  18. package/template/dist/client/assets/NotificationPage-DRkEv02s.js +1 -0
  19. package/template/dist/client/assets/OrdersPage-7I3vPWLP.js +11 -0
  20. package/template/dist/client/assets/{PluginDetailPage-Br24YS4P.js → PluginDetailPage-CWyxdVCg.js} +3 -13
  21. package/template/dist/client/assets/PluginsPage-DRgWLeJT.js +6 -0
  22. package/template/dist/client/assets/ProfilePage-2FFkaii8.js +16 -0
  23. package/template/dist/client/assets/PublishPage-DW7yvROx.js +1 -0
  24. package/template/dist/client/assets/{RegisterPage-rPFG4Sry.js → RegisterPage-Dvaf9b0e.js} +2 -2
  25. package/template/dist/client/assets/SaveOutlined-CLQ2tsSY.js +2 -0
  26. package/template/dist/client/assets/{SearchPage-DQl1U5Uy.js → SearchPage-DvnEyswS.js} +2 -2
  27. package/template/dist/client/assets/{SettingsPage-DaYE80wj.js → SettingsPage-IrU-L9Zr.js} +2 -2
  28. package/template/dist/client/assets/{StatusBadge-BJ3W2Zc7.js → StatusBadge-CG7wVqpu.js} +1 -1
  29. package/template/dist/client/assets/{TodoPage-zC5wWNBa.js → TodoPage-B7D-bl65.js} +3 -3
  30. package/template/dist/client/assets/TopicsPage-CYCNr-mn.js +6 -0
  31. package/template/dist/client/assets/{WebSocketPage-B4NLdz1w.js → WebSocketPage-CGEg6QJE.js} +2 -2
  32. package/template/dist/client/assets/{activity-B94BUAsD.js → activity-CgTz9Mrd.js} +1 -1
  33. package/template/dist/client/assets/admin-D2iHWNOg.js +1 -0
  34. package/template/dist/client/assets/api-request-DIJocPxr.js +356 -0
  35. package/template/dist/client/assets/{arrow-left-H5JH0iU1.js → arrow-left-DtLQ3tTk.js} +1 -1
  36. package/template/dist/client/assets/{chevron-down-DwRh_wjD.js → chevron-down-CpIAV_yr.js} +1 -1
  37. package/template/dist/client/assets/{chevron-right-CpIWaqAL.js → chevron-right-CnU7oPQs.js} +1 -1
  38. package/template/dist/client/assets/{circle-check-big-CSElLscG.js → circle-check-big-CrZdwS75.js} +1 -1
  39. package/template/dist/client/assets/{circle-x-CYxr4RAw.js → circle-x-CvN9r3fW.js} +1 -1
  40. package/template/dist/client/assets/{clock-BseUJ7ex.js → clock-CTeSZBiH.js} +1 -1
  41. package/template/dist/client/assets/{download-BsGC_Xhq.js → download-OSVfVuNV.js} +1 -1
  42. package/template/dist/client/assets/{external-link-UTDzdjq8.js → external-link-fBsuHMby.js} +1 -1
  43. package/template/dist/client/assets/{eye-nR10ui7i.js → eye-CwlZZEsj.js} +1 -1
  44. package/template/dist/client/assets/index-09IqiOaE.css +1 -0
  45. package/template/dist/client/assets/index-B3CRby6r.js +51 -0
  46. package/template/dist/client/assets/index-CC_zy73y.js +17 -0
  47. package/template/dist/client/assets/main-Cn4IDo2I.js +92 -0
  48. package/template/dist/client/assets/merchant-DDDN9bMu.js +40 -0
  49. package/template/dist/client/assets/{message-square-CwWGL-Bh.js → message-square-BRaZfgbJ.js} +1 -1
  50. package/template/dist/client/assets/pluginStore-DDsWJPe6.js +1 -0
  51. package/template/dist/client/assets/{plus-pZld_nUL.js → plus-DDZfPiDJ.js} +1 -1
  52. package/template/dist/client/assets/sse-client-DGQ072hl.js +64 -0
  53. package/template/dist/client/assets/star-C7tO6w4H.js +11 -0
  54. package/template/dist/client/assets/{tag-DsiUPF90.js → tag-DBfpQDuJ.js} +1 -1
  55. package/template/dist/client/assets/tenant-CizbLaLJ.js +1 -0
  56. package/template/dist/client/assets/{trash-2-DRblNbnA.js → trash-2-BP7fkd5b.js} +1 -1
  57. package/template/dist/client/assets/{triangle-alert-D1CLh-Vd.js → triangle-alert-CrOQEdJ2.js} +1 -1
  58. package/template/dist/client/assets/{wifi-BwXjnCqI.js → wifi-CwYSE0J4.js} +1 -1
  59. package/template/dist/client/assets/{x-BH2rJdFq.js → x-t615pnNR.js} +1 -1
  60. package/template/dist/client/content/index.html +5 -4
  61. package/template/dist/client/index.html +4 -3
  62. package/template/dist/client/merchant.html +18 -0
  63. package/template/dist/client/notifications/index.html +6 -5
  64. package/template/dist/client/tenant.html +18 -0
  65. package/template/dist/client/todos/index.html +6 -5
  66. package/template/dist/client/websocket/index.html +6 -5
  67. package/template/dist/cloudflare/chunk-HX7DVRDX.js +1 -0
  68. package/template/dist/cloudflare/{chunk-QBHAPWIA.js → chunk-IXJL2LE4.js} +1 -1
  69. package/template/dist/cloudflare/chunk-Q34AN3RF.js +14 -0
  70. package/template/dist/cloudflare/{chunk-BHPTQ4K2.js → chunk-ZAMVL4EG.js} +2 -2
  71. package/template/dist/cloudflare/cloudflare.js +35 -29
  72. package/template/dist/cloudflare/db-4AQOSFAX.js +1 -0
  73. package/template/dist/cloudflare/{migrator-2ZYYKNI5.js → migrator-TEPBVUFO.js} +1 -1
  74. package/template/dist/cloudflare/permission-service-impl-RE7NPW3Q.js +1 -0
  75. package/template/dist/cloudflare/schema-DVEMT3X2.js +1 -0
  76. package/template/dist/cloudflare/test-setup-Z2RYE5B4.js +265 -0
  77. package/template/dist/server/chunk-27SIJSPF.js +1 -0
  78. package/template/dist/server/chunk-37QNGBQU.js +1 -0
  79. package/template/dist/server/chunk-FIY4CGJJ.js +1 -0
  80. package/template/dist/server/chunk-HZUDBIT4.js +1 -0
  81. package/template/dist/server/chunk-I6OBDFDU.js +1 -0
  82. package/template/dist/server/chunk-JHNYLNG7.js +1 -0
  83. package/template/dist/server/chunk-MDOVVKKD.js +1 -0
  84. package/template/dist/server/chunk-NSOCT7E5.js +1 -0
  85. package/template/dist/server/chunk-OU5IGVVO.js +1 -0
  86. package/template/dist/server/chunk-OYCBNRMK.js +1 -0
  87. package/template/dist/server/chunk-P2RJNNGD.js +1 -0
  88. package/template/dist/server/chunk-UMAQLNPE.js +1 -0
  89. package/template/dist/server/chunk-XZZTSRSN.js +1 -0
  90. package/template/dist/server/content-service-5QVHDR5X.js +1 -0
  91. package/template/dist/server/db-FLI5L5DD.js +1 -0
  92. package/template/dist/server/dispute-service-E2FCYUEM.js +1 -0
  93. package/template/dist/server/init-72JXJV3I.js +46 -0
  94. package/template/dist/server/init-FWYXSKPX.js +46 -0
  95. package/template/dist/server/node.js +34 -28
  96. package/template/dist/server/order-service-TKGG5S5K.js +1 -0
  97. package/template/dist/server/permission-service-impl-M3AKEYNY.js +1 -0
  98. package/template/dist/server/schema-V4UG7HMU.js +1 -0
  99. package/template/dist/server/tenant-service-JG6UUWXQ.js +1 -0
  100. package/template/dist/server/tenant-service-XJWZSEDX.js +1 -0
  101. package/template/dist/{cloudflare/test-setup-NMZJZLRV.js → server/test-setup-VFOPBGYM.js} +83 -2
  102. package/template/dist/server/ticket-service-3RSW7V2Z.js +1 -0
  103. package/template/dist/server/todo-service-S6BGIO7D.js +1 -0
  104. package/template/package.json +1 -1
  105. package/template/src/client/App.tsx +3 -1
  106. package/template/src/client/pages/ContentListPage.tsx +36 -4
  107. package/template/src/client/pages/PluginsPage.tsx +112 -20
  108. package/template/src/client/pages/TodoPage.tsx +9 -1
  109. package/template/src/client/preset-ui-config.ts +79 -2
  110. package/template/src/merchant/pages/DisputesPage.tsx +11 -11
  111. package/template/src/merchant/pages/OrdersPage.tsx +4 -3
  112. package/template/src/merchant/pages/ProductsPage.tsx +2 -2
  113. package/template/src/merchant/stores/merchantStore.ts +11 -6
  114. package/template/src/server/db/init.ts +5 -253
  115. package/template/src/server/module-content/routes/topics-routes.ts +250 -0
  116. package/template/src/server/module-content/services/content-service.ts +1 -1
  117. package/template/src/server/module-plugin/services/plugin-seed-service.ts +623 -0
  118. package/template/src/server/module-tenant/routes/tenant-routes.ts +2 -2
  119. package/template/src/server/module-tenant/services/tenant-service.ts +63 -17
  120. package/template/src/server/module-todos/services/todo-service.ts +1 -1
  121. package/template/src/shared/modules/merchant/index.ts +9 -0
  122. package/template/src/shared/modules/merchant/schemas.ts +37 -0
  123. package/template/src/shared/modules/tenant/index.ts +2 -0
  124. package/template/src/shared/schemas/index.ts +27 -0
  125. package/template/src/tenant/layouts/Header.tsx +1 -1
  126. package/template/src/tenant/layouts/Sidebar.tsx +1 -1
  127. package/template/src/tenant/pages/SettingsPage.tsx +4 -8
  128. package/template/src/tenant/stores/tenantStore.ts +41 -302
  129. package/template/tsconfig.json +1 -0
  130. package/template/tsup.config.ts +11 -3
  131. package/template/dist/client/assets/ContentDetailPage-DdltMANL.js +0 -1
  132. package/template/dist/client/assets/ContentListPage-B63sUB6N.js +0 -1
  133. package/template/dist/client/assets/DashboardPage-tUMilc7Z.js +0 -11
  134. package/template/dist/client/assets/LoadingSpinner-DVYOLSRM.js +0 -6
  135. package/template/dist/client/assets/LoginPage-g9mSLIMC.js +0 -6
  136. package/template/dist/client/assets/NotificationPage-COTzp-HD.js +0 -1
  137. package/template/dist/client/assets/OrdersPage-BsPh4oEI.js +0 -11
  138. package/template/dist/client/assets/PluginsPage-BNtAe_yo.js +0 -6
  139. package/template/dist/client/assets/ProfilePage-dL_iSuZN.js +0 -16
  140. package/template/dist/client/assets/PublishPage-D96FnbLA.js +0 -1
  141. package/template/dist/client/assets/TopicsPage-DyLjZa4D.js +0 -6
  142. package/template/dist/client/assets/admin-Bh1vfz_L.js +0 -486
  143. package/template/dist/client/assets/index-1bA-ixFv.js +0 -114
  144. package/template/dist/client/assets/index-CWh3vXC_.css +0 -1
  145. package/template/dist/client/assets/main-DHnArIp_.js +0 -82
  146. package/template/dist/client/assets/pluginStore-XQfsm3iR.js +0 -1
  147. package/template/dist/client/content/content-1/index.html +0 -18
  148. package/template/dist/client/content/content-13/index.html +0 -18
  149. package/template/dist/client/content/content-14/index.html +0 -18
  150. package/template/dist/client/content/content-15/index.html +0 -18
  151. package/template/dist/client/content/content-19/index.html +0 -18
  152. package/template/dist/client/content/content-2/index.html +0 -18
  153. package/template/dist/client/content/content-20/index.html +0 -18
  154. package/template/dist/cloudflare/chunk-YY6FRMAQ.js +0 -14
  155. package/template/dist/cloudflare/db-7J42RQ3T.js +0 -1
  156. package/template/dist/cloudflare/permission-service-impl-TGXVSSSA.js +0 -1
@@ -1,6 +1,6 @@
1
- import{c as w,r as h,j as e,L as k}from"./index-1bA-ixFv.js";import{H as S,c as n}from"./main-DHnArIp_.js";import{u as s}from"./pluginStore-XQfsm3iR.js";import{S as C}from"./StatusBadge-BJ3W2Zc7.js";import{L as b}from"./LoadingSpinner-DVYOLSRM.js";import{E as f}from"./EmptyState-BK7ttK8D.js";import{D as M}from"./download-BsGC_Xhq.js";import{T as P}from"./tag-DsiUPF90.js";import{C as z,a as E}from"./chevron-right-CpIWaqAL.js";/**
1
+ import{r as h,j as e,L as w}from"./index-B3CRby6r.js";import{H as k,c as n}from"./main-Cn4IDo2I.js";import{u as s}from"./pluginStore-DDsWJPe6.js";import{S}from"./StatusBadge-CG7wVqpu.js";import{L as b}from"./LoadingSpinner-BcHjaM1m.js";import{E as f}from"./EmptyState-DEyOQjbY.js";import{c as C}from"./sse-client-DGQ072hl.js";import{D as M}from"./download-OSVfVuNV.js";import{T as P}from"./tag-DBfpQDuJ.js";import{C as z,a as E}from"./chevron-right-CnU7oPQs.js";/**
2
2
  * @license lucide-react v0.576.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const H=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],L=w("sliders-horizontal",H),V=()=>{const l=s(t=>t.plugins),d=s(t=>t.loading),x=s(t=>t.error),r=s(t=>t.searchQuery),y=s(t=>t.categories),c=s(t=>t.selectedCategory),a=s(t=>t.pagination),i=s(t=>t.searchPlugins),g=s(t=>t.fetchCategories),j=s(t=>t.setSearchQuery),p=s(t=>t.setSelectedCategory),[o,v]=h.useState(r);h.useEffect(()=>{g()},[g]),h.useEffect(()=>{r&&i(r,1)},[c]);const N=t=>{t.preventDefault(),o.trim()&&(j(o.trim()),i(o.trim(),1))},m=Math.ceil(a.total/a.limit);return e.jsxs("div",{className:"min-h-screen","data-testid":"search-page",children:[e.jsxs(S,{children:[e.jsx("title",{children:"Search Plugins - Plugin Marketplace"}),e.jsx("meta",{name:"description",content:"Search for plugins"})]}),e.jsx("div",{className:"bg-gradient-to-br from-slate-900 via-purple-900 to-slate-900 pt-12 pb-20 px-6",children:e.jsxs("div",{className:"max-w-3xl mx-auto",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[e.jsx("div",{className:"p-2.5 bg-gradient-to-br from-violet-500 to-fuchsia-500 rounded-xl shadow-lg shadow-violet-500/25",children:e.jsx(n,{className:"w-6 h-6 text-white"})}),e.jsx("h1",{className:"text-3xl font-bold text-white tracking-tight",children:"Search Plugins"})]}),e.jsx("form",{onSubmit:N,children:e.jsxs("div",{className:"relative",children:[e.jsx(n,{className:"absolute left-4 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),e.jsx("input",{type:"text",value:o,onChange:t=>v(t.target.value),placeholder:"Search for plugins by name, tag, or keyword...",className:"w-full pl-12 pr-36 py-4 bg-white/10 backdrop-blur-md border border-white/20 rounded-2xl focus:ring-2 focus:ring-violet-400 focus:border-transparent outline-none text-white placeholder-purple-200/40 text-base"}),e.jsx("button",{type:"submit",disabled:!o.trim()||d,className:"absolute right-2 top-1/2 -translate-y-1/2 px-6 py-2.5 bg-gradient-to-r from-violet-500 to-fuchsia-500 text-white rounded-xl hover:from-violet-400 hover:to-fuchsia-400 disabled:from-gray-600 disabled:to-gray-600 disabled:cursor-not-allowed transition-all font-semibold text-sm shadow-md",children:d?e.jsx(b,{size:"sm",color:"text-white"}):"Search"})]})})]})}),e.jsxs("div",{className:"max-w-3xl mx-auto px-6 -mt-6 pb-16",children:[e.jsx("div",{className:"bg-white rounded-2xl shadow-xl shadow-black/5 border border-gray-100 p-4 mb-6",children:e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsx(L,{className:"w-4 h-4 text-gray-400 shrink-0"}),e.jsx("button",{onClick:()=>p(null),className:`px-3.5 py-1.5 text-sm rounded-lg transition-all font-medium ${c?"bg-gray-100 text-gray-600 hover:bg-gray-200":"bg-gradient-to-r from-violet-500 to-fuchsia-500 text-white shadow-sm"}`,children:"All"}),y.map(t=>e.jsxs("button",{onClick:()=>p(t.slug),className:`px-3.5 py-1.5 text-sm rounded-lg transition-all font-medium ${c===t.slug?"bg-gradient-to-r from-violet-500 to-fuchsia-500 text-white shadow-sm":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:[t.icon&&e.jsx("span",{className:"mr-1",children:t.icon}),t.name]},t.id))]})}),x&&e.jsx("div",{className:"mb-6 p-4 bg-red-500/10 border border-red-500/20 text-red-600 rounded-2xl",children:x}),d&&l.length===0?e.jsx("div",{className:"flex items-center justify-center py-20",children:e.jsx(b,{size:"lg"})}):l.length===0&&r?e.jsx(f,{icon:n,title:`No results for "${r}"`,description:"Try a different search term"}):l.length===0?e.jsx(f,{icon:n,title:"Start searching for plugins"}):e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-sm text-gray-500 mb-4",children:["Found ",e.jsx("span",{className:"font-semibold text-gray-700",children:a.total})," results"]}),e.jsx("div",{className:"space-y-3",children:l.map(t=>e.jsxs(k,{to:`/plugins/${t.slug}`,className:"group flex items-start gap-4 p-5 bg-white rounded-2xl border border-gray-100 hover:border-violet-200 hover:shadow-lg hover:shadow-violet-500/5 transition-all duration-300",children:[e.jsx("div",{className:"w-11 h-11 rounded-xl bg-gradient-to-br from-violet-100 to-fuchsia-100 flex items-center justify-center text-lg font-bold text-violet-600 shrink-0",children:t.name.charAt(0).toUpperCase()}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"text-base font-semibold text-gray-900 group-hover:text-violet-700 transition-colors",children:t.name}),e.jsx(C,{label:`v${t.version}`,colorScheme:"purple"})]}),e.jsxs("p",{className:"text-sm text-gray-500 mt-0.5",children:["by ",t.authorName]}),e.jsx("p",{className:"text-sm text-gray-600 mt-1.5 line-clamp-2 leading-relaxed",children:t.description}),e.jsxs("div",{className:"mt-2.5 flex items-center gap-4 text-xs text-gray-400",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(M,{className:"w-3.5 h-3.5"}),t.downloadCount]}),t.tags&&t.tags.slice(0,3).map(u=>e.jsxs("span",{className:"inline-flex items-center px-2 py-0.5 bg-gray-50 text-gray-500 rounded-md",children:[e.jsx(P,{className:"w-2.5 h-2.5 mr-0.5 opacity-50"}),u]},u))]})]})]},t.id))}),m>1&&e.jsxs("div",{className:"mt-10 flex items-center justify-center gap-3",children:[e.jsx("button",{onClick:()=>i(r,a.page-1),disabled:a.page<=1,className:"p-2.5 rounded-xl bg-white border border-gray-200 hover:border-violet-300 hover:shadow-md disabled:opacity-30 disabled:cursor-not-allowed transition-all",children:e.jsx(z,{className:"w-5 h-5 text-gray-600"})}),e.jsxs("div",{className:"px-4 py-2 bg-white rounded-xl border border-gray-200 text-sm text-gray-600",children:[e.jsx("span",{className:"font-semibold text-gray-900",children:a.page}),e.jsx("span",{className:"mx-1.5 text-gray-300",children:"/"}),m]}),e.jsx("button",{onClick:()=>i(r,a.page+1),disabled:a.page>=m,className:"p-2.5 rounded-xl bg-white border border-gray-200 hover:border-violet-300 hover:shadow-md disabled:opacity-30 disabled:cursor-not-allowed transition-all",children:e.jsx(E,{className:"w-5 h-5 text-gray-600"})})]})]})]})]})};export{V as SearchPage};
6
+ */const H=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],L=C("sliders-horizontal",H),_=()=>{const l=s(t=>t.plugins),d=s(t=>t.loading),x=s(t=>t.error),r=s(t=>t.searchQuery),y=s(t=>t.categories),c=s(t=>t.selectedCategory),a=s(t=>t.pagination),i=s(t=>t.searchPlugins),g=s(t=>t.fetchCategories),j=s(t=>t.setSearchQuery),p=s(t=>t.setSelectedCategory),[o,v]=h.useState(r);h.useEffect(()=>{g()},[g]),h.useEffect(()=>{r&&i(r,1)},[c]);const N=t=>{t.preventDefault(),o.trim()&&(j(o.trim()),i(o.trim(),1))},m=Math.ceil(a.total/a.limit);return e.jsxs("div",{className:"min-h-screen","data-testid":"search-page",children:[e.jsxs(k,{children:[e.jsx("title",{children:"Search Plugins - Plugin Marketplace"}),e.jsx("meta",{name:"description",content:"Search for plugins"})]}),e.jsx("div",{className:"bg-gradient-to-br from-slate-900 via-purple-900 to-slate-900 pt-12 pb-20 px-6",children:e.jsxs("div",{className:"max-w-3xl mx-auto",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[e.jsx("div",{className:"p-2.5 bg-gradient-to-br from-violet-500 to-fuchsia-500 rounded-xl shadow-lg shadow-violet-500/25",children:e.jsx(n,{className:"w-6 h-6 text-white"})}),e.jsx("h1",{className:"text-3xl font-bold text-white tracking-tight",children:"Search Plugins"})]}),e.jsx("form",{onSubmit:N,children:e.jsxs("div",{className:"relative",children:[e.jsx(n,{className:"absolute left-4 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),e.jsx("input",{type:"text",value:o,onChange:t=>v(t.target.value),placeholder:"Search for plugins by name, tag, or keyword...",className:"w-full pl-12 pr-36 py-4 bg-white/10 backdrop-blur-md border border-white/20 rounded-2xl focus:ring-2 focus:ring-violet-400 focus:border-transparent outline-none text-white placeholder-purple-200/40 text-base"}),e.jsx("button",{type:"submit",disabled:!o.trim()||d,className:"absolute right-2 top-1/2 -translate-y-1/2 px-6 py-2.5 bg-gradient-to-r from-violet-500 to-fuchsia-500 text-white rounded-xl hover:from-violet-400 hover:to-fuchsia-400 disabled:from-gray-600 disabled:to-gray-600 disabled:cursor-not-allowed transition-all font-semibold text-sm shadow-md",children:d?e.jsx(b,{size:"sm",color:"text-white"}):"Search"})]})})]})}),e.jsxs("div",{className:"max-w-3xl mx-auto px-6 -mt-6 pb-16",children:[e.jsx("div",{className:"bg-white rounded-2xl shadow-xl shadow-black/5 border border-gray-100 p-4 mb-6",children:e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsx(L,{className:"w-4 h-4 text-gray-400 shrink-0"}),e.jsx("button",{onClick:()=>p(null),className:`px-3.5 py-1.5 text-sm rounded-lg transition-all font-medium ${c?"bg-gray-100 text-gray-600 hover:bg-gray-200":"bg-gradient-to-r from-violet-500 to-fuchsia-500 text-white shadow-sm"}`,children:"All"}),y.map(t=>e.jsxs("button",{onClick:()=>p(t.slug),className:`px-3.5 py-1.5 text-sm rounded-lg transition-all font-medium ${c===t.slug?"bg-gradient-to-r from-violet-500 to-fuchsia-500 text-white shadow-sm":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:[t.icon&&e.jsx("span",{className:"mr-1",children:t.icon}),t.name]},t.id))]})}),x&&e.jsx("div",{className:"mb-6 p-4 bg-red-500/10 border border-red-500/20 text-red-600 rounded-2xl",children:x}),d&&l.length===0?e.jsx("div",{className:"flex items-center justify-center py-20",children:e.jsx(b,{size:"lg"})}):l.length===0&&r?e.jsx(f,{icon:n,title:`No results for "${r}"`,description:"Try a different search term"}):l.length===0?e.jsx(f,{icon:n,title:"Start searching for plugins"}):e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-sm text-gray-500 mb-4",children:["Found ",e.jsx("span",{className:"font-semibold text-gray-700",children:a.total})," results"]}),e.jsx("div",{className:"space-y-3",children:l.map(t=>e.jsxs(w,{to:`/plugins/${t.slug}`,className:"group flex items-start gap-4 p-5 bg-white rounded-2xl border border-gray-100 hover:border-violet-200 hover:shadow-lg hover:shadow-violet-500/5 transition-all duration-300",children:[e.jsx("div",{className:"w-11 h-11 rounded-xl bg-gradient-to-br from-violet-100 to-fuchsia-100 flex items-center justify-center text-lg font-bold text-violet-600 shrink-0",children:t.name.charAt(0).toUpperCase()}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"text-base font-semibold text-gray-900 group-hover:text-violet-700 transition-colors",children:t.name}),e.jsx(S,{label:`v${t.version}`,colorScheme:"purple"})]}),e.jsxs("p",{className:"text-sm text-gray-500 mt-0.5",children:["by ",t.authorName]}),e.jsx("p",{className:"text-sm text-gray-600 mt-1.5 line-clamp-2 leading-relaxed",children:t.description}),e.jsxs("div",{className:"mt-2.5 flex items-center gap-4 text-xs text-gray-400",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(M,{className:"w-3.5 h-3.5"}),t.downloadCount]}),t.tags&&t.tags.slice(0,3).map(u=>e.jsxs("span",{className:"inline-flex items-center px-2 py-0.5 bg-gray-50 text-gray-500 rounded-md",children:[e.jsx(P,{className:"w-2.5 h-2.5 mr-0.5 opacity-50"}),u]},u))]})]})]},t.id))}),m>1&&e.jsxs("div",{className:"mt-10 flex items-center justify-center gap-3",children:[e.jsx("button",{onClick:()=>i(r,a.page-1),disabled:a.page<=1,className:"p-2.5 rounded-xl bg-white border border-gray-200 hover:border-violet-300 hover:shadow-md disabled:opacity-30 disabled:cursor-not-allowed transition-all",children:e.jsx(z,{className:"w-5 h-5 text-gray-600"})}),e.jsxs("div",{className:"px-4 py-2 bg-white rounded-xl border border-gray-200 text-sm text-gray-600",children:[e.jsx("span",{className:"font-semibold text-gray-900",children:a.page}),e.jsx("span",{className:"mx-1.5 text-gray-300",children:"/"}),m]}),e.jsx("button",{onClick:()=>i(r,a.page+1),disabled:a.page>=m,className:"p-2.5 rounded-xl bg-white border border-gray-200 hover:border-violet-300 hover:shadow-md disabled:opacity-30 disabled:cursor-not-allowed transition-all",children:e.jsx(E,{className:"w-5 h-5 text-gray-600"})})]})]})]})]})};export{_ as SearchPage};
@@ -1,4 +1,4 @@
1
- import{c as n,r as s,j as e,b,B as f}from"./index-1bA-ixFv.js";import{H as v}from"./main-DHnArIp_.js";/**
1
+ import{r as s,j as e}from"./index-B3CRby6r.js";import{H as b}from"./main-Cn4IDo2I.js";import{c as n,a as f,B as v}from"./sse-client-DGQ072hl.js";/**
2
2
  * @license lucide-react v0.576.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -18,4 +18,4 @@ import{c as n,r as s,j as e,b,B as f}from"./index-1bA-ixFv.js";import{H as v}fro
18
18
  *
19
19
  * This source code is licensed under the ISC license.
20
20
  * See the LICENSE file in the root directory of this source tree.
21
- */const C=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],z=n("users",C),r=[{id:"general",label:"General",icon:b},{id:"team",label:"Team",icon:z},{id:"billing",label:"Billing",icon:N},{id:"api-keys",label:"API Keys",icon:w},{id:"notifications",label:"Notifications",icon:f}],M=["UTC","America/New_York","America/Chicago","America/Denver","America/Los_Angeles","Europe/London","Europe/Paris","Asia/Tokyo","Asia/Shanghai","Australia/Sydney"],_=["English","Chinese (Simplified)","Chinese (Traditional)","Japanese","Korean","Spanish","French","German"],E=()=>{var i;const[a,l]=s.useState("general"),[o,c]=s.useState("Acme Corp"),[d,g]=s.useState("acme-corp"),[m,x]=s.useState("America/New_York"),[h,u]=s.useState("English");return e.jsxs("div",{className:"min-h-screen bg-gray-50 p-4 sm:p-6 lg:p-8","data-testid":"settings-page",children:[e.jsxs(v,{children:[e.jsx("title",{children:"Settings - SaaS Admin"}),e.jsx("meta",{name:"description",content:"Manage organization settings"})]}),e.jsxs("div",{className:"max-w-7xl mx-auto",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold text-gray-900",children:"Settings"}),e.jsx("p",{className:"mt-1 text-sm text-gray-500",children:"Manage your organization settings"})]}),e.jsxs("div",{className:"flex flex-col lg:flex-row gap-6",children:[e.jsx("nav",{className:"flex lg:flex-col gap-1 lg:w-56 shrink-0 overflow-x-auto lg:overflow-visible","data-testid":"settings-tabs",children:r.map(t=>{const p=t.icon,y=a===t.id;return e.jsxs("button",{onClick:()=>l(t.id),"data-testid":`tab-${t.id}`,className:`flex items-center gap-3 px-4 py-2.5 rounded-lg text-sm font-medium whitespace-nowrap transition-colors ${y?"bg-gray-800 text-white":"text-gray-600 hover:bg-gray-100 hover:text-gray-900"}`,children:[e.jsx(p,{className:"w-4 h-4"}),t.label]},t.id)})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[a==="general"&&e.jsxs("div",{className:"bg-white rounded-lg border border-gray-200 p-5 sm:p-6","data-testid":"general-settings-content",children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-900 mb-6",children:"General Settings"}),e.jsxs("div",{className:"space-y-5 max-w-lg",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"org-name",className:"block text-sm font-medium text-gray-700 mb-1.5",children:"Organization Name"}),e.jsx("input",{id:"org-name",type:"text",value:o,onChange:t=>c(t.target.value),"data-testid":"input-org-name",className:"w-full px-3.5 py-2.5 text-sm border border-gray-300 rounded-lg focus:ring-2 focus:ring-gray-800 focus:border-transparent outline-none transition-all"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"org-url",className:"block text-sm font-medium text-gray-700 mb-1.5",children:"Organization URL"}),e.jsxs("div",{className:"flex",children:[e.jsx("span",{className:"inline-flex items-center px-3.5 rounded-l-lg border border-r-0 border-gray-300 bg-gray-50 text-sm text-gray-500",children:"https://"}),e.jsx("input",{id:"org-url",type:"text",value:d,onChange:t=>g(t.target.value),"data-testid":"input-org-url",className:"flex-1 px-3.5 py-2.5 text-sm border border-gray-300 rounded-r-lg focus:ring-2 focus:ring-gray-800 focus:border-transparent outline-none transition-all"})]}),e.jsx("p",{className:"mt-1 text-xs text-gray-400",children:"This will be your organization's public URL"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"timezone",className:"block text-sm font-medium text-gray-700 mb-1.5",children:"Timezone"}),e.jsx("select",{id:"timezone",value:m,onChange:t=>x(t.target.value),"data-testid":"select-timezone",className:"w-full px-3.5 py-2.5 text-sm border border-gray-300 rounded-lg focus:ring-2 focus:ring-gray-800 focus:border-transparent outline-none transition-all bg-white",children:M.map(t=>e.jsx("option",{value:t,children:t},t))})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"language",className:"block text-sm font-medium text-gray-700 mb-1.5",children:"Language"}),e.jsx("select",{id:"language",value:h,onChange:t=>u(t.target.value),"data-testid":"select-language",className:"w-full px-3.5 py-2.5 text-sm border border-gray-300 rounded-lg focus:ring-2 focus:ring-gray-800 focus:border-transparent outline-none transition-all bg-white",children:_.map(t=>e.jsx("option",{value:t,children:t},t))})]}),e.jsx("div",{className:"pt-4",children:e.jsxs("button",{"data-testid":"save-settings",className:"inline-flex items-center gap-2 px-5 py-2.5 text-sm font-medium text-white bg-gray-800 rounded-lg hover:bg-gray-700 transition-colors",children:[e.jsx(A,{className:"w-4 h-4"}),"Save Changes"]})})]})]}),a!=="general"&&e.jsxs("div",{className:"bg-white rounded-lg border border-gray-200 p-5 sm:p-6","data-testid":`${a}-settings-content`,children:[e.jsxs("h2",{className:"text-lg font-semibold text-gray-900 mb-2",children:[(i=r.find(t=>t.id===a))==null?void 0:i.label," Settings"]}),e.jsxs("p",{className:"text-sm text-gray-500",children:[a==="team"&&"Manage team members and permissions.",a==="billing"&&"Manage billing and subscription details.",a==="api-keys"&&"Manage API keys for integrations.",a==="notifications"&&"Configure notification preferences."]})]})]})]})]})]})};export{E as SettingsPage};
21
+ */const C=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],z=n("users",C),r=[{id:"general",label:"General",icon:f},{id:"team",label:"Team",icon:z},{id:"billing",label:"Billing",icon:N},{id:"api-keys",label:"API Keys",icon:w},{id:"notifications",label:"Notifications",icon:v}],M=["UTC","America/New_York","America/Chicago","America/Denver","America/Los_Angeles","Europe/London","Europe/Paris","Asia/Tokyo","Asia/Shanghai","Australia/Sydney"],_=["English","Chinese (Simplified)","Chinese (Traditional)","Japanese","Korean","Spanish","French","German"],U=()=>{var i;const[a,l]=s.useState("general"),[o,c]=s.useState("Acme Corp"),[d,g]=s.useState("acme-corp"),[m,x]=s.useState("America/New_York"),[h,u]=s.useState("English");return e.jsxs("div",{className:"min-h-screen bg-gray-50 p-4 sm:p-6 lg:p-8","data-testid":"settings-page",children:[e.jsxs(b,{children:[e.jsx("title",{children:"Settings - SaaS Admin"}),e.jsx("meta",{name:"description",content:"Manage organization settings"})]}),e.jsxs("div",{className:"max-w-7xl mx-auto",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold text-gray-900",children:"Settings"}),e.jsx("p",{className:"mt-1 text-sm text-gray-500",children:"Manage your organization settings"})]}),e.jsxs("div",{className:"flex flex-col lg:flex-row gap-6",children:[e.jsx("nav",{className:"flex lg:flex-col gap-1 lg:w-56 shrink-0 overflow-x-auto lg:overflow-visible","data-testid":"settings-tabs",children:r.map(t=>{const p=t.icon,y=a===t.id;return e.jsxs("button",{onClick:()=>l(t.id),"data-testid":`tab-${t.id}`,className:`flex items-center gap-3 px-4 py-2.5 rounded-lg text-sm font-medium whitespace-nowrap transition-colors ${y?"bg-gray-800 text-white":"text-gray-600 hover:bg-gray-100 hover:text-gray-900"}`,children:[e.jsx(p,{className:"w-4 h-4"}),t.label]},t.id)})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[a==="general"&&e.jsxs("div",{className:"bg-white rounded-lg border border-gray-200 p-5 sm:p-6","data-testid":"general-settings-content",children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-900 mb-6",children:"General Settings"}),e.jsxs("div",{className:"space-y-5 max-w-lg",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"org-name",className:"block text-sm font-medium text-gray-700 mb-1.5",children:"Organization Name"}),e.jsx("input",{id:"org-name",type:"text",value:o,onChange:t=>c(t.target.value),"data-testid":"input-org-name",className:"w-full px-3.5 py-2.5 text-sm border border-gray-300 rounded-lg focus:ring-2 focus:ring-gray-800 focus:border-transparent outline-none transition-all"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"org-url",className:"block text-sm font-medium text-gray-700 mb-1.5",children:"Organization URL"}),e.jsxs("div",{className:"flex",children:[e.jsx("span",{className:"inline-flex items-center px-3.5 rounded-l-lg border border-r-0 border-gray-300 bg-gray-50 text-sm text-gray-500",children:"https://"}),e.jsx("input",{id:"org-url",type:"text",value:d,onChange:t=>g(t.target.value),"data-testid":"input-org-url",className:"flex-1 px-3.5 py-2.5 text-sm border border-gray-300 rounded-r-lg focus:ring-2 focus:ring-gray-800 focus:border-transparent outline-none transition-all"})]}),e.jsx("p",{className:"mt-1 text-xs text-gray-400",children:"This will be your organization's public URL"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"timezone",className:"block text-sm font-medium text-gray-700 mb-1.5",children:"Timezone"}),e.jsx("select",{id:"timezone",value:m,onChange:t=>x(t.target.value),"data-testid":"select-timezone",className:"w-full px-3.5 py-2.5 text-sm border border-gray-300 rounded-lg focus:ring-2 focus:ring-gray-800 focus:border-transparent outline-none transition-all bg-white",children:M.map(t=>e.jsx("option",{value:t,children:t},t))})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"language",className:"block text-sm font-medium text-gray-700 mb-1.5",children:"Language"}),e.jsx("select",{id:"language",value:h,onChange:t=>u(t.target.value),"data-testid":"select-language",className:"w-full px-3.5 py-2.5 text-sm border border-gray-300 rounded-lg focus:ring-2 focus:ring-gray-800 focus:border-transparent outline-none transition-all bg-white",children:_.map(t=>e.jsx("option",{value:t,children:t},t))})]}),e.jsx("div",{className:"pt-4",children:e.jsxs("button",{"data-testid":"save-settings",className:"inline-flex items-center gap-2 px-5 py-2.5 text-sm font-medium text-white bg-gray-800 rounded-lg hover:bg-gray-700 transition-colors",children:[e.jsx(A,{className:"w-4 h-4"}),"Save Changes"]})})]})]}),a!=="general"&&e.jsxs("div",{className:"bg-white rounded-lg border border-gray-200 p-5 sm:p-6","data-testid":`${a}-settings-content`,children:[e.jsxs("h2",{className:"text-lg font-semibold text-gray-900 mb-2",children:[(i=r.find(t=>t.id===a))==null?void 0:i.label," Settings"]}),e.jsxs("p",{className:"text-sm text-gray-500",children:[a==="team"&&"Manage team members and permissions.",a==="billing"&&"Manage billing and subscription details.",a==="api-keys"&&"Manage API keys for integrations.",a==="notifications"&&"Configure notification preferences."]})]})]})]})]})]})};export{U as SettingsPage};
@@ -1 +1 @@
1
- import{j as e}from"./index-1bA-ixFv.js";const n={gray:{bg:"bg-gray-500",text:"text-gray-500"},blue:{bg:"bg-blue-500",text:"text-blue-500"},green:{bg:"bg-green-500",text:"text-green-500"},red:{bg:"bg-red-500",text:"text-red-500"},yellow:{bg:"bg-yellow-500",text:"text-yellow-500"},purple:{bg:"bg-purple-500",text:"text-purple-500"},orange:{bg:"bg-orange-500",text:"text-orange-500"},cyan:{bg:"bg-cyan-500",text:"text-cyan-500"},indigo:{bg:"bg-indigo-500",text:"text-indigo-500"}},o=({label:g,icon:t,colorScheme:x="gray",className:r=""})=>{const a=n[x];return e.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-medium text-white ${a.bg} ${r}`,"data-testid":"status-badge",children:[t&&e.jsx(t,{className:"w-3 h-3"}),g]})};export{o as S};
1
+ import{j as e}from"./index-B3CRby6r.js";const n={gray:{bg:"bg-gray-500",text:"text-gray-500"},blue:{bg:"bg-blue-500",text:"text-blue-500"},green:{bg:"bg-green-500",text:"text-green-500"},red:{bg:"bg-red-500",text:"text-red-500"},yellow:{bg:"bg-yellow-500",text:"text-yellow-500"},purple:{bg:"bg-purple-500",text:"text-purple-500"},orange:{bg:"bg-orange-500",text:"text-orange-500"},cyan:{bg:"bg-cyan-500",text:"text-cyan-500"},indigo:{bg:"bg-indigo-500",text:"text-indigo-500"}},o=({label:g,icon:t,colorScheme:x="gray",className:r=""})=>{const a=n[x];return e.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-medium text-white ${a.bg} ${r}`,"data-testid":"status-badge",children:[t&&e.jsx(t,{className:"w-3 h-3"}),g]})};export{o as S};
@@ -1,11 +1,11 @@
1
- import{c as U,a as K,r as u,j as t}from"./index-1bA-ixFv.js";import{b as g,H as X}from"./main-DHnArIp_.js";import{L as A}from"./LoadingSpinner-DVYOLSRM.js";import{E as q}from"./EmptyState-BK7ttK8D.js";import{C as S}from"./circle-check-big-CSElLscG.js";import{P as G}from"./plus-pZld_nUL.js";import{C as J}from"./clock-BseUJ7ex.js";import{T as O}from"./trash-2-DRblNbnA.js";import{U as Q,X as V}from"./x-BH2rJdFq.js";import{D as W}from"./download-BsGC_Xhq.js";/**
1
+ import{c as K,r as u,j as t}from"./index-B3CRby6r.js";import{b as g,H as X}from"./main-Cn4IDo2I.js";import{L as k}from"./LoadingSpinner-BcHjaM1m.js";import{E as q}from"./EmptyState-DEyOQjbY.js";import{C as S}from"./circle-check-big-CrZdwS75.js";import{P as G}from"./plus-DDZfPiDJ.js";import{C as J}from"./clock-CTeSZBiH.js";import{c as E}from"./sse-client-DGQ072hl.js";import{T as O}from"./trash-2-BP7fkd5b.js";import{U as Q,X as V}from"./x-t615pnNR.js";import{D as W}from"./download-OSVfVuNV.js";/**
2
2
  * @license lucide-react v0.576.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const Y=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],D=U("circle",Y);/**
6
+ */const Y=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],D=E("circle",Y);/**
7
7
  * @license lucide-react v0.576.0 - ISC
8
8
  *
9
9
  * This source code is licensed under the ISC license.
10
10
  * See the LICENSE file in the root directory of this source tree.
11
- */const Z=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],E=U("paperclip",Z),c=K(s=>({todos:[],loading:!1,error:null,attachments:new Map,fetchTodos:async()=>{s({loading:!0,error:null});try{const o=await(await g.api.todos.$get()).json();o.success?s({todos:o.data,loading:!1}):s({error:o.error,loading:!1})}catch(a){s({error:a instanceof Error?a.message:"Unknown error",loading:!1})}},createTodo:async a=>{s({loading:!0,error:null});try{const r=await(await g.api.todos.$post({json:a})).json();r.success?s(n=>({todos:[r.data,...n.todos],loading:!1})):s({error:r.error,loading:!1})}catch(o){s({error:o instanceof Error?o.message:"Unknown error",loading:!1})}},updateTodo:async(a,o)=>{s({loading:!0,error:null});try{const n=await(await g.api.todos[":id"].$put({param:{id:a.toString()},json:o})).json();n.success?s(d=>({todos:d.todos.map(l=>l.id===a?n.data:l),loading:!1})):s({error:n.error,loading:!1})}catch(r){s({error:r instanceof Error?r.message:"Unknown error",loading:!1})}},deleteTodo:async a=>{s({loading:!0,error:null});try{const r=await(await g.api.todos[":id"].$delete({param:{id:a.toString()}})).json();r.success?s(n=>{const d=new Map(n.attachments);return d.delete(a),{todos:n.todos.filter(l=>l.id!==a),attachments:d,loading:!1}}):s({error:r.error,loading:!1})}catch(o){s({error:o instanceof Error?o.message:"Unknown error",loading:!1})}},uploadAttachment:async(a,o)=>{s({loading:!0,error:null});try{const n=await(await g.api.todos[":id"].attachments.$post({param:{id:a.toString()},form:{file:o}})).json();return n.success&&n.data?(s(d=>{const l=new Map(d.attachments),x=l.get(a)||[];return l.set(a,[...x,n.data]),{attachments:l,loading:!1}}),n.data):(s({error:n.error||"Upload failed",loading:!1}),null)}catch(r){return s({error:r instanceof Error?r.message:"Unknown error",loading:!1}),null}},fetchAttachments:async a=>{try{const r=await(await g.api.todos[":id"].attachments.$get({param:{id:a.toString()}})).json();r.success&&s(n=>{const d=new Map(n.attachments);return d.set(a,r.data),{attachments:d}})}catch(o){console.error("Failed to fetch attachments:",o)}},deleteAttachment:async(a,o)=>{s({loading:!0,error:null});try{const n=await(await g.api.todos[":todoId"].attachments[":attachmentId"].$delete({param:{todoId:a.toString(),attachmentId:o.toString()}})).json();n.success?s(d=>{const l=new Map(d.attachments),x=l.get(a)||[];return l.set(a,x.filter(y=>y.id!==o)),{attachments:l,loading:!1}}):s({error:n.error,loading:!1})}catch(r){s({error:r instanceof Error?r.message:"Unknown error",loading:!1})}},setError:a=>{s({error:a})}})),ce=()=>{const s=c(e=>e.todos),a=c(e=>e.loading),o=c(e=>e.error),r=c(e=>e.attachments),n=c(e=>e.fetchTodos),d=c(e=>e.createTodo),l=c(e=>e.updateTodo),x=c(e=>e.deleteTodo),y=c(e=>e.uploadAttachment),M=c(e=>e.fetchAttachments),P=c(e=>e.deleteAttachment),[b,v]=u.useState(""),[T,C]=u.useState(""),[p,j]=u.useState("all"),[w,$]=u.useState(null),_=u.useRef(new Map);u.useEffect(()=>{n()},[n]);const L=async e=>{e.preventDefault(),b.trim()&&(await d({title:b,description:T||void 0}),v(""),C(""))},R=async(e,m)=>{await l(e.id,{status:m})},B=async e=>{await x(e)},F=async e=>{w===e?$(null):($(e),r.has(e)||await M(e))},z=async(e,m)=>{var f;const h=(f=m.target.files)==null?void 0:f[0];h&&(await y(e,h),m.target.value="")},H=async(e,m)=>{await P(e,m)},I=e=>e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`,k=s.filter(e=>p==="all"?!0:e.status===p),N={pending:{icon:D,color:"text-gray-400",bg:"bg-gray-100"},in_progress:{icon:J,color:"text-blue-500",bg:"bg-blue-50"},completed:{icon:S,color:"text-green-500",bg:"bg-green-50"}};return t.jsxs("div",{className:"max-w-3xl mx-auto p-6","data-testid":"todo-page",children:[t.jsxs(X,{children:[t.jsx("title",{children:"Todo List - Biomimic App"}),t.jsx("meta",{name:"description",content:"Manage your todo items with full CRUD operations"}),t.jsx("meta",{property:"og:title",content:"Todo List - Biomimic App"}),t.jsx("meta",{property:"og:description",content:"Manage your todo items with full CRUD operations"})]}),t.jsxs("div",{className:"mb-8",children:[t.jsxs("h1",{className:"text-3xl font-bold text-gray-900 flex items-center gap-2","data-testid":"todo-title",children:[t.jsx(S,{className:"w-8 h-8 text-blue-500"}),"Todo List"]}),t.jsx("p",{className:"text-gray-500 mt-2",children:"Demonstrates CRUD operations with Hono RPC type inference"})]}),t.jsxs("form",{onSubmit:L,className:"mb-8 p-6 bg-white rounded-xl shadow-sm border border-gray-200","data-testid":"todo-form",children:[t.jsx("div",{className:"mb-4",children:t.jsx("input",{type:"text",value:b,onChange:e=>v(e.target.value),placeholder:"Todo title...","data-testid":"todo-title-input",className:"w-full px-4 py-3 text-base border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent outline-none transition-all"})}),t.jsx("div",{className:"mb-4",children:t.jsx("textarea",{value:T,onChange:e=>C(e.target.value),placeholder:"Description (optional)...","data-testid":"todo-description-input",className:"w-full px-4 py-3 text-base border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent outline-none transition-all resize-none min-h-[100px]"})}),t.jsxs("button",{type:"submit",disabled:!b.trim()||a,"data-testid":"add-todo-button",className:"flex items-center gap-2 px-6 py-3 text-base font-medium text-white bg-blue-500 rounded-lg hover:bg-blue-600 disabled:bg-gray-300 disabled:cursor-not-allowed transition-colors",children:[a?t.jsx(A,{size:"sm",color:"text-white"}):t.jsx(G,{className:"w-5 h-5"}),"Add Todo"]})]}),o&&t.jsx("div",{className:"mb-6 p-4 bg-red-50 border border-red-200 text-red-700 rounded-lg","data-testid":"error-message",children:o}),a&&s.length===0&&t.jsx("div",{className:"flex items-center justify-center py-12","data-testid":"loading-indicator",children:t.jsx(A,{size:"lg"})}),s.length>0&&t.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-2","data-testid":"todo-count",children:[t.jsx("span",{className:"text-sm text-gray-500",children:"Total:"}),t.jsx("span",{className:"text-sm font-medium text-gray-900",children:s.length})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{onClick:()=>j("all"),"data-testid":"filter-all",className:`px-3 py-1.5 text-sm rounded-lg transition-colors ${p==="all"?"bg-blue-500 text-white":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:"All"}),t.jsx("button",{onClick:()=>j("pending"),"data-testid":"filter-pending",className:`px-3 py-1.5 text-sm rounded-lg transition-colors ${p==="pending"?"bg-blue-500 text-white":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:"Pending"}),t.jsx("button",{onClick:()=>j("in_progress"),"data-testid":"filter-in-progress",className:`px-3 py-1.5 text-sm rounded-lg transition-colors ${p==="in_progress"?"bg-blue-500 text-white":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:"In Progress"}),t.jsx("button",{onClick:()=>j("completed"),"data-testid":"filter-completed",className:`px-3 py-1.5 text-sm rounded-lg transition-colors ${p==="completed"?"bg-blue-500 text-white":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:"Completed"})]})]}),t.jsx("div",{className:"space-y-4","data-testid":"todo-list",children:k.map(e=>{var h,f;const m=N[e.status].icon;return t.jsxs("div",{"data-testid":"todo-item",className:`p-5 rounded-xl border transition-all ${e.status==="completed"?"bg-green-50 border-green-200":"bg-white border-gray-200 hover:shadow-md"}`,children:[t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("h3",{className:`text-lg font-medium ${e.status==="completed"?"line-through text-gray-400":"text-gray-900"}`,"data-testid":"todo-item-title",children:e.title}),e.description&&t.jsx("p",{className:"mt-1 text-gray-500 text-sm","data-testid":"todo-item-description",children:e.description}),t.jsxs("div",{className:"mt-3 flex items-center gap-3",children:[t.jsxs("select",{value:e.status,onChange:i=>R(e,i.target.value),"data-testid":"todo-status",className:`px-3 py-1.5 text-sm rounded-lg border focus:ring-2 focus:ring-blue-500 outline-none ${N[e.status].bg}`,children:[t.jsx("option",{value:"pending",children:"Pending"}),t.jsx("option",{value:"in_progress",children:"In Progress"}),t.jsx("option",{value:"completed",children:"Completed"})]}),t.jsx("span",{className:"text-xs text-gray-400",children:new Date(e.createdAt).toLocaleString()})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{onClick:()=>F(e.id),"data-testid":"toggle-attachments-button",className:`p-2 rounded-lg transition-colors ${w===e.id?"text-blue-500 bg-blue-50":"text-gray-400 hover:text-blue-500 hover:bg-blue-50"}`,title:"Toggle attachments",children:t.jsx(E,{className:"w-5 h-5"})}),t.jsx(m,{className:`w-6 h-6 ${N[e.status].color}`}),t.jsx("button",{onClick:()=>B(e.id),"data-testid":"delete-button",className:"p-2 text-gray-400 hover:text-red-500 hover:bg-red-50 rounded-lg transition-colors",children:t.jsx(O,{className:"w-5 h-5"})})]})]}),w===e.id&&t.jsxs("div",{className:"mt-4 pt-4 border-t border-gray-100","data-testid":"attachments-section",children:[t.jsxs("div",{className:"flex items-center justify-between mb-3",children:[t.jsx("h4",{className:"text-sm font-medium text-gray-700",children:"Attachments"}),t.jsxs("label",{className:"flex items-center gap-1 px-3 py-1.5 text-sm text-blue-500 hover:bg-blue-50 rounded-lg cursor-pointer transition-colors","data-testid":"upload-button",children:[t.jsx(Q,{className:"w-4 h-4"}),"Upload",t.jsx("input",{ref:i=>{i&&_.current.set(e.id,i)},type:"file",accept:".jpg,.jpeg,.png,.gif,.webp,.pdf,.txt,.csv,.json,.xlsx,.docx",onChange:i=>z(e.id,i),className:"hidden"})]})]}),(h=r.get(e.id))!=null&&h.length?t.jsx("div",{className:"space-y-2",children:(f=r.get(e.id))==null?void 0:f.map(i=>t.jsxs("div",{className:"flex items-center justify-between p-2 bg-gray-50 rounded-lg","data-testid":"attachment-item",children:[t.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[t.jsx(E,{className:"w-4 h-4 text-gray-400 flex-shrink-0"}),t.jsx("a",{href:`/files/public/todos/${i.fileName}`,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-blue-600 hover:text-blue-800 hover:underline truncate flex-1",title:i.originalName,children:i.originalName}),t.jsxs("span",{className:"text-xs text-gray-400 flex-shrink-0",children:["(",I(i.size),")"]})]}),t.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[t.jsx("a",{href:`/files/public/todos/${i.fileName}`,download:i.originalName,className:"p-1 text-gray-400 hover:text-blue-500 rounded transition-colors",title:"Download","data-testid":"download-attachment-button",children:t.jsx(W,{className:"w-4 h-4"})}),t.jsx("button",{onClick:()=>H(e.id,i.id),className:"p-1 text-gray-400 hover:text-red-500 rounded transition-colors","data-testid":"delete-attachment-button",children:t.jsx(V,{className:"w-4 h-4"})})]})]},i.id))}):t.jsx("p",{className:"text-sm text-gray-400",children:"No attachments yet"})]})]},e.id)})}),!a&&k.length===0&&t.jsx(q,{icon:D,title:"No todos yet. Add one above!",className:"py-12"})]})};export{ce as TodoPage};
11
+ */const Z=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],U=E("paperclip",Z),c=K(s=>({todos:[],loading:!1,error:null,attachments:new Map,fetchTodos:async()=>{s({loading:!0,error:null});try{const n=await(await g.api.todos.$get()).json();n.success?s({todos:n.data,loading:!1}):s({error:n.error,loading:!1})}catch(a){s({error:a instanceof Error?a.message:"Unknown error",loading:!1})}},createTodo:async a=>{s({loading:!0,error:null});try{const r=await(await g.api.todos.$post({json:a})).json();r.success?s(o=>({todos:[r.data,...o.todos],loading:!1})):s({error:r.error,loading:!1})}catch(n){s({error:n instanceof Error?n.message:"Unknown error",loading:!1})}},updateTodo:async(a,n)=>{s({loading:!0,error:null});try{const o=await(await g.api.todos[":id"].$put({param:{id:a.toString()},json:n})).json();o.success?s(d=>({todos:d.todos.map(l=>l.id===a?o.data:l),loading:!1})):s({error:o.error,loading:!1})}catch(r){s({error:r instanceof Error?r.message:"Unknown error",loading:!1})}},deleteTodo:async a=>{s({loading:!0,error:null});try{const r=await(await g.api.todos[":id"].$delete({param:{id:a.toString()}})).json();r.success?s(o=>{const d=new Map(o.attachments);return d.delete(a),{todos:o.todos.filter(l=>l.id!==a),attachments:d,loading:!1}}):s({error:r.error,loading:!1})}catch(n){s({error:n instanceof Error?n.message:"Unknown error",loading:!1})}},uploadAttachment:async(a,n)=>{s({loading:!0,error:null});try{const o=await(await g.api.todos[":id"].attachments.$post({param:{id:a.toString()},form:{file:n}})).json();return o.success&&o.data?(s(d=>{const l=new Map(d.attachments),x=l.get(a)||[];return l.set(a,[...x,o.data]),{attachments:l,loading:!1}}),o.data):(s({error:o.error||"Upload failed",loading:!1}),null)}catch(r){return s({error:r instanceof Error?r.message:"Unknown error",loading:!1}),null}},fetchAttachments:async a=>{try{const r=await(await g.api.todos[":id"].attachments.$get({param:{id:a.toString()}})).json();r.success&&s(o=>{const d=new Map(o.attachments);return d.set(a,r.data),{attachments:d}})}catch(n){console.error("Failed to fetch attachments:",n)}},deleteAttachment:async(a,n)=>{s({loading:!0,error:null});try{const o=await(await g.api.todos[":todoId"].attachments[":attachmentId"].$delete({param:{todoId:a.toString(),attachmentId:n.toString()}})).json();o.success?s(d=>{const l=new Map(d.attachments),x=l.get(a)||[];return l.set(a,x.filter(y=>y.id!==n)),{attachments:l,loading:!1}}):s({error:o.error,loading:!1})}catch(r){s({error:r instanceof Error?r.message:"Unknown error",loading:!1})}},setError:a=>{s({error:a})}})),me=()=>{const s=c(e=>e.todos),a=c(e=>e.loading),n=c(e=>e.error),r=c(e=>e.attachments),o=c(e=>e.fetchTodos),d=c(e=>e.createTodo),l=c(e=>e.updateTodo),x=c(e=>e.deleteTodo),y=c(e=>e.uploadAttachment),M=c(e=>e.fetchAttachments),P=c(e=>e.deleteAttachment),[b,v]=u.useState(""),[T,C]=u.useState(""),[p,j]=u.useState("all"),[w,A]=u.useState(null),_=u.useRef(new Map);u.useEffect(()=>{o()},[o]);const L=async e=>{e.preventDefault(),b.trim()&&(await d({title:b,description:T||void 0}),v(""),C(""))},R=async(e,m)=>{await l(e.id,{status:m})},B=async e=>{await x(e)},F=async e=>{w===e?A(null):(A(e),r.has(e)||await M(e))},z=async(e,m)=>{var f;const h=(f=m.target.files)==null?void 0:f[0];h&&(await y(e,h),m.target.value="")},H=async(e,m)=>{await P(e,m)},I=e=>e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`,$=s.filter(e=>p==="all"?!0:e.status===p),N={pending:{icon:D,color:"text-gray-400",bg:"bg-gray-100"},in_progress:{icon:J,color:"text-blue-500",bg:"bg-blue-50"},completed:{icon:S,color:"text-green-500",bg:"bg-green-50"}};return t.jsxs("div",{className:"max-w-3xl mx-auto p-6","data-testid":"todo-page",children:[t.jsxs(X,{children:[t.jsx("title",{children:"Todo List - Biomimic App"}),t.jsx("meta",{name:"description",content:"Manage your todo items with full CRUD operations"}),t.jsx("meta",{property:"og:title",content:"Todo List - Biomimic App"}),t.jsx("meta",{property:"og:description",content:"Manage your todo items with full CRUD operations"})]}),t.jsxs("div",{className:"mb-8",children:[t.jsxs("h1",{className:"text-3xl font-bold text-gray-900 flex items-center gap-2","data-testid":"todo-title",children:[t.jsx(S,{className:"w-8 h-8 text-blue-500"}),"Todo List"]}),t.jsx("p",{className:"text-gray-500 mt-2",children:"Demonstrates CRUD operations with Hono RPC type inference"})]}),t.jsxs("form",{onSubmit:L,className:"mb-8 p-6 bg-white rounded-xl shadow-sm border border-gray-200","data-testid":"todo-form",children:[t.jsx("div",{className:"mb-4",children:t.jsx("input",{type:"text",value:b,onChange:e=>v(e.target.value),placeholder:"Todo title...","data-testid":"todo-title-input",className:"w-full px-4 py-3 text-base border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent outline-none transition-all"})}),t.jsx("div",{className:"mb-4",children:t.jsx("textarea",{value:T,onChange:e=>C(e.target.value),placeholder:"Description (optional)...","data-testid":"todo-description-input",className:"w-full px-4 py-3 text-base border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent outline-none transition-all resize-none min-h-[100px]"})}),t.jsxs("button",{type:"submit",disabled:!b.trim()||a,"data-testid":"add-todo-button",className:"flex items-center gap-2 px-6 py-3 text-base font-medium text-white bg-blue-500 rounded-lg hover:bg-blue-600 disabled:bg-gray-300 disabled:cursor-not-allowed transition-colors",children:[a?t.jsx(k,{size:"sm",color:"text-white"}):t.jsx(G,{className:"w-5 h-5"}),"Add Todo"]})]}),n&&t.jsx("div",{className:"mb-6 p-4 bg-red-50 border border-red-200 text-red-700 rounded-lg","data-testid":"error-message",children:n}),a&&s.length===0&&t.jsx("div",{className:"flex items-center justify-center py-12","data-testid":"loading-indicator",children:t.jsx(k,{size:"lg"})}),s.length>0&&t.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-2","data-testid":"todo-count",children:[t.jsx("span",{className:"text-sm text-gray-500",children:"Total:"}),t.jsx("span",{className:"text-sm font-medium text-gray-900",children:s.length})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{onClick:()=>j("all"),"data-testid":"filter-all",className:`px-3 py-1.5 text-sm rounded-lg transition-colors ${p==="all"?"bg-blue-500 text-white":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:"All"}),t.jsx("button",{onClick:()=>j("pending"),"data-testid":"filter-pending",className:`px-3 py-1.5 text-sm rounded-lg transition-colors ${p==="pending"?"bg-blue-500 text-white":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:"Pending"}),t.jsx("button",{onClick:()=>j("in_progress"),"data-testid":"filter-in-progress",className:`px-3 py-1.5 text-sm rounded-lg transition-colors ${p==="in_progress"?"bg-blue-500 text-white":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:"In Progress"}),t.jsx("button",{onClick:()=>j("completed"),"data-testid":"filter-completed",className:`px-3 py-1.5 text-sm rounded-lg transition-colors ${p==="completed"?"bg-blue-500 text-white":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:"Completed"})]})]}),t.jsx("div",{className:"space-y-4","data-testid":"todo-list",children:$.map(e=>{var h,f;const m=N[e.status].icon;return t.jsxs("div",{"data-testid":"todo-item",className:`p-5 rounded-xl border transition-all ${e.status==="completed"?"bg-green-50 border-green-200":"bg-white border-gray-200 hover:shadow-md"}`,children:[t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("h3",{className:`text-lg font-medium ${e.status==="completed"?"line-through text-gray-400":"text-gray-900"}`,"data-testid":"todo-item-title",children:e.title}),e.description&&t.jsx("p",{className:"mt-1 text-gray-500 text-sm","data-testid":"todo-item-description",children:e.description}),t.jsxs("div",{className:"mt-3 flex items-center gap-3",children:[t.jsxs("select",{value:e.status,onChange:i=>R(e,i.target.value),"data-testid":"todo-status",className:`px-3 py-1.5 text-sm rounded-lg border focus:ring-2 focus:ring-blue-500 outline-none ${N[e.status].bg}`,children:[t.jsx("option",{value:"pending",children:"Pending"}),t.jsx("option",{value:"in_progress",children:"In Progress"}),t.jsx("option",{value:"completed",children:"Completed"})]}),t.jsxs("span",{className:"text-xs text-gray-400",children:[new Date(e.createdAt).toLocaleString(),e.updatedAt&&e.updatedAt!==e.createdAt&&t.jsxs("span",{className:"ml-2",children:["· Updated ",new Date(e.updatedAt).toLocaleString()]})]})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{onClick:()=>F(e.id),"data-testid":"toggle-attachments-button",className:`p-2 rounded-lg transition-colors ${w===e.id?"text-blue-500 bg-blue-50":"text-gray-400 hover:text-blue-500 hover:bg-blue-50"}`,title:"Toggle attachments",children:t.jsx(U,{className:"w-5 h-5"})}),t.jsx(m,{className:`w-6 h-6 ${N[e.status].color}`}),t.jsx("button",{onClick:()=>B(e.id),"data-testid":"delete-button",className:"p-2 text-gray-400 hover:text-red-500 hover:bg-red-50 rounded-lg transition-colors",children:t.jsx(O,{className:"w-5 h-5"})})]})]}),w===e.id&&t.jsxs("div",{className:"mt-4 pt-4 border-t border-gray-100","data-testid":"attachments-section",children:[t.jsxs("div",{className:"flex items-center justify-between mb-3",children:[t.jsx("h4",{className:"text-sm font-medium text-gray-700",children:"Attachments"}),t.jsxs("label",{className:"flex items-center gap-1 px-3 py-1.5 text-sm text-blue-500 hover:bg-blue-50 rounded-lg cursor-pointer transition-colors","data-testid":"upload-button",children:[t.jsx(Q,{className:"w-4 h-4"}),"Upload",t.jsx("input",{ref:i=>{i&&_.current.set(e.id,i)},type:"file",accept:".jpg,.jpeg,.png,.gif,.webp,.pdf,.txt,.csv,.json,.xlsx,.docx",onChange:i=>z(e.id,i),className:"hidden"})]})]}),(h=r.get(e.id))!=null&&h.length?t.jsx("div",{className:"space-y-2",children:(f=r.get(e.id))==null?void 0:f.map(i=>t.jsxs("div",{className:"flex items-center justify-between p-2 bg-gray-50 rounded-lg","data-testid":"attachment-item",children:[t.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[t.jsx(U,{className:"w-4 h-4 text-gray-400 flex-shrink-0"}),t.jsx("a",{href:`/files/public/todos/${i.fileName}`,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-blue-600 hover:text-blue-800 hover:underline truncate flex-1",title:i.originalName,children:i.originalName}),t.jsxs("span",{className:"text-xs text-gray-400 flex-shrink-0",children:["(",I(i.size),")"]})]}),t.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[t.jsx("a",{href:`/files/public/todos/${i.fileName}`,download:i.originalName,className:"p-1 text-gray-400 hover:text-blue-500 rounded transition-colors",title:"Download","data-testid":"download-attachment-button",children:t.jsx(W,{className:"w-4 h-4"})}),t.jsx("button",{onClick:()=>H(e.id,i.id),className:"p-1 text-gray-400 hover:text-red-500 rounded transition-colors","data-testid":"delete-attachment-button",children:t.jsx(V,{className:"w-4 h-4"})})]})]},i.id))}):t.jsx("p",{className:"text-sm text-gray-400",children:"No attachments yet"})]})]},e.id)})}),!a&&$.length===0&&t.jsx(q,{icon:D,title:"No todos yet. Add one above!",className:"py-12"})]})};export{me as TodoPage};
@@ -0,0 +1,6 @@
1
+ import{r as a,j as e,N as v}from"./index-B3CRby6r.js";import{H as y,c as w,b as m}from"./main-Cn4IDo2I.js";import{L as N}from"./LoadingSpinner-BcHjaM1m.js";import{P as b}from"./plus-DDZfPiDJ.js";import{M as x}from"./message-square-BRaZfgbJ.js";import{c as C}from"./sse-client-DGQ072hl.js";import{C as S}from"./chevron-down-CpIAV_yr.js";import{E as L}from"./eye-CwlZZEsj.js";/**
2
+ * @license lucide-react v0.576.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const k=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],A=C("chevron-up",k),E=[{value:"all",label:"All"},{value:"hot",label:"Hot"},{value:"unanswered",label:"Unanswered"},{value:"solved",label:"Solved"}],I=()=>{const[r,h]=a.useState(""),[l,p]=a.useState("all"),[n,u]=a.useState([]),[g,f]=a.useState(!0);a.useEffect(()=>{async function s(){try{const d=await(await(l==="hot"?m.api.topics.popular:m.api.topics).$get()).json();if(d.success){const i=d.data;u(Array.isArray(i)?i:i.topics??[])}}finally{f(!1)}}s()},[l]);const o=a.useMemo(()=>{if(!r.trim())return n;const s=r.toLowerCase();return n.filter(t=>t.title.toLowerCase().includes(s)||t.excerpt.toLowerCase().includes(s)||t.tags.some(c=>c.label.toLowerCase().includes(s)))},[r,n]),j=s=>s>0?"text-emerald-600":s<0?"text-red-500":"text-gray-400";return e.jsxs("div",{className:"min-h-screen bg-white","data-testid":"topics-page",children:[e.jsxs(y,{children:[e.jsx("title",{children:"Community Forum"}),e.jsx("meta",{name:"description",content:"Browse and discuss community topics"})]}),e.jsx("div",{className:"bg-gradient-to-b from-emerald-50 to-white pt-12 pb-10 px-4 sm:px-6",children:e.jsx("div",{className:"max-w-4xl mx-auto",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-gray-900 tracking-tight",children:"Community Forum"}),e.jsx("p",{className:"mt-1 text-gray-500",children:"Ask questions, share knowledge, connect with others"})]}),e.jsxs("button",{className:"inline-flex items-center gap-2 px-5 py-2.5 bg-emerald-500 hover:bg-emerald-600 text-white font-medium rounded-xl shadow-sm shadow-emerald-500/25 transition-colors self-start sm:self-auto",children:[e.jsx(b,{className:"w-4 h-4"}),"Ask Question"]})]})})}),e.jsxs("div",{className:"max-w-4xl mx-auto px-4 sm:px-6 -mt-4 pb-16",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mb-6",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(w,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),e.jsx("input",{type:"text",value:r,onChange:s=>h(s.target.value),placeholder:"Search topics...",className:"w-full pl-10 pr-4 py-2.5 bg-white border border-gray-200 rounded-xl focus:ring-2 focus:ring-emerald-500 focus:border-transparent outline-none transition-shadow text-sm"})]}),e.jsx("div",{className:"flex gap-2 flex-wrap",children:E.map(s=>e.jsx("button",{onClick:()=>p(s.value),className:`px-4 py-2 rounded-xl text-sm font-medium transition-colors ${l===s.value?"bg-emerald-500 text-white shadow-sm shadow-emerald-500/25":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:s.label},s.value))})]}),g?e.jsx("div",{className:"flex items-center justify-center py-20","data-testid":"topics-loading",children:e.jsx(N,{size:"lg"})}):o.length===0?e.jsxs("div",{className:"text-center py-20",children:[e.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 bg-gray-100 rounded-full mb-4",children:e.jsx(x,{className:"w-7 h-7 text-gray-400"})}),e.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-1",children:"No topics found"}),e.jsx("p",{className:"text-gray-500 text-sm",children:"Try adjusting your search or filter"})]}):e.jsx("div",{className:"space-y-3",children:o.map(s=>e.jsxs(v,{to:`/topics/${s.id}`,className:"flex gap-4 p-4 bg-white rounded-2xl border border-gray-100 hover:border-emerald-200 hover:shadow-md hover:shadow-emerald-500/5 transition-all group",children:[e.jsxs("div",{className:"flex flex-col items-center gap-0.5 pt-0.5 min-w-[48px]",children:[e.jsx(A,{className:"w-4 h-4 text-gray-400 hover:text-emerald-500 cursor-pointer"}),e.jsx("span",{className:`text-sm font-bold ${j(s.votes)}`,children:s.votes}),e.jsx(S,{className:"w-4 h-4 text-gray-400 hover:text-red-400 cursor-pointer"})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"font-semibold text-gray-900 group-hover:underline decoration-emerald-400 underline-offset-2 leading-snug",children:s.title}),e.jsx("p",{className:"mt-1 text-sm text-gray-500 line-clamp-2 leading-relaxed",children:s.excerpt}),e.jsxs("div",{className:"mt-2.5 flex flex-wrap items-center gap-2",children:[s.tags.map(t=>e.jsx("span",{className:`px-2.5 py-0.5 rounded-lg text-xs font-medium ${t.color}`,children:t.label},t.label)),e.jsx("span",{className:"text-xs text-gray-400 mx-1",children:"·"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"w-5 h-5 rounded-full bg-emerald-100 text-emerald-700 text-[10px] font-bold flex items-center justify-center",children:s.author.initials}),e.jsx("span",{className:"text-xs text-gray-600",children:s.author.name}),e.jsx("span",{className:"text-xs text-gray-400",children:s.createdAt})]})]})]}),e.jsxs("div",{className:"hidden sm:flex flex-col items-end justify-center gap-1 text-xs text-gray-400 min-w-[80px]",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(x,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:s.replyCount})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(L,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:s.viewCount})]})]})]},s.id))})]})]})};export{I as TopicsPage};
@@ -1,4 +1,4 @@
1
- import{c as k,j as e,a as D,r as N,B as R}from"./index-1bA-ixFv.js";import{b as _,H as P}from"./main-DHnArIp_.js";import{L as $}from"./LoadingSpinner-DVYOLSRM.js";import{E as T}from"./EmptyState-BK7ttK8D.js";import{W as h,a as C,S}from"./wifi-BwXjnCqI.js";import{T as q}from"./trash-2-DRblNbnA.js";import{M as y}from"./message-square-CwWGL-Bh.js";import{A as v}from"./activity-B94BUAsD.js";/**
1
+ import{j as e,c as D,r as N}from"./index-B3CRby6r.js";import{b as R,H as _}from"./main-Cn4IDo2I.js";import{L as P}from"./LoadingSpinner-BcHjaM1m.js";import{E as $}from"./EmptyState-DEyOQjbY.js";import{c as k,B as T}from"./sse-client-DGQ072hl.js";import{W as h,a as C,S}from"./wifi-CwYSE0J4.js";import{T as q}from"./trash-2-BP7fkd5b.js";import{M as y}from"./message-square-BRaZfgbJ.js";import{A as v}from"./activity-CgTz9Mrd.js";/**
2
2
  * @license lucide-react v0.576.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -8,4 +8,4 @@ import{c as k,j as e,a as D,r as N,B as R}from"./index-1bA-ixFv.js";import{b as
8
8
  *
9
9
  * This source code is licensed under the ISC license.
10
10
  * See the LICENSE file in the root directory of this source tree.
11
- */const B=[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],U=k("radio",B),V={gray:{bg:"bg-gray-500"},blue:{bg:"bg-blue-500"},green:{bg:"bg-green-500"},red:{bg:"bg-red-500"},yellow:{bg:"bg-yellow-500"},purple:{bg:"bg-purple-500"},orange:{bg:"bg-orange-500"},cyan:{bg:"bg-cyan-500"},indigo:{bg:"bg-indigo-500"}},z=({type:t,payload:r,timestamp:s,icon:a,colorScheme:n="gray",borderColor:d,className:p="","data-testid":g="message-card"})=>{const x=V[n],c=t.includes("_")?t.toUpperCase().replace("_"," "):t.toUpperCase();return e.jsxs("div",{className:`p-4 bg-white rounded-lg border-l-4 shadow-sm ${p}`,style:{borderLeftColor:d||void 0},"data-testid":g,children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-medium text-white ${x.bg}`,children:[a&&e.jsx(a,{className:"w-3 h-3"}),c]}),s&&e.jsx("span",{className:"text-xs text-gray-400",children:new Date(s).toLocaleTimeString()})]}),e.jsx("pre",{className:"text-sm text-gray-700 whitespace-pre-wrap break-words font-mono",children:JSON.stringify(r,null,2)})]})};let o=null;const H=D((t,r)=>({status:"closed",messages:[],error:null,connect:()=>{o||(o=_.api.chat.ws.$ws(),o&&(o.onStatusChange(s=>{t({status:s})}),o.on("notification",s=>{const a=s;t(n=>({messages:[...n.messages,{type:"notification",payload:a,timestamp:a.timestamp}]}))}),o.on("broadcast",s=>{const a=s;t(n=>({messages:[...n.messages,{type:"broadcast",payload:a,timestamp:a.timestamp}]}))}),o.on("connected",s=>{const a=s;t(n=>({messages:[...n.messages,{type:"connected",payload:a,timestamp:a.timestamp}]}))})))},disconnect:()=>{o&&(o.close(),o=null,t({status:"closed"}))},echo:async s=>{if(!(!o||r().status!=="open")){t(a=>({messages:[...a.messages,{type:"echo_request",payload:s,timestamp:Date.now()}]}));try{const a=await o.call("echo",s),n=a;t(d=>({messages:[...d.messages,{type:"echo_response",payload:a,timestamp:n.timestamp}]}))}catch(a){console.error("Echo failed:",a),t({error:a instanceof Error?a.message:"Echo failed"})}}},ping:async()=>{if(!(!o||r().status!=="open"))try{const s=await o.call("ping",{}),a=s;t(n=>({messages:[...n.messages,{type:"pong",payload:s,timestamp:a.timestamp}]}))}catch(s){console.error("Ping failed:",s),t({error:s instanceof Error?s.message:"Ping failed"})}},broadcast:s=>{!o||r().status!=="open"||o.emit("broadcast",s)},notification:s=>{!o||r().status!=="open"||o.emit("notification",s)},clearMessages:()=>{t({messages:[]})},clearError:()=>{t({error:null})}})),Y=()=>{const{status:t,messages:r,connect:s,disconnect:a,echo:n,ping:d,broadcast:p,notification:g,clearMessages:x}=H(),[c,f]=N.useState(""),[l,M]=N.useState("echo"),w=async()=>{if(!(!c.trim()&&l!=="ping")){switch(l){case"echo":await n({message:c});break;case"ping":await d();break;case"broadcast":p({message:c,timestamp:Date.now()});break;case"notification":g({title:"User Notification",body:c,timestamp:Date.now()});break}f("")}},E={ping:{colorScheme:"cyan",icon:v,borderColor:"#06b6d4"},pong:{colorScheme:"cyan",icon:v,borderColor:"#06b6d4"},echo_request:{colorScheme:"purple",icon:S,borderColor:"#a78bfa"},echo_response:{colorScheme:"purple",icon:y,borderColor:"#9333ea"},broadcast:{colorScheme:"orange",icon:U,borderColor:"#f97316"},notification:{colorScheme:"green",icon:R,borderColor:"#22c55e"},connected:{colorScheme:"blue",icon:h,borderColor:"#3b82f6"}},j={connecting:"text-yellow-500",open:"text-green-600",closed:"text-red-500",reconnecting:"text-orange-500"},m=t,b=m==="connecting"||m==="reconnecting";return e.jsxs("div",{className:"max-w-3xl mx-auto p-6","data-testid":"websocket-container",children:[e.jsxs(P,{children:[e.jsx("title",{children:"WebSocket Demo - Biomimic App"}),e.jsx("meta",{name:"description",content:"Real-time WebSocket communication demo with type-safe RPC"}),e.jsx("meta",{property:"og:title",content:"WebSocket Demo - Biomimic App"}),e.jsx("meta",{property:"og:description",content:"Real-time WebSocket communication demo with type-safe RPC"})]}),e.jsxs("div",{className:"mb-8",children:[e.jsxs("h1",{className:"text-3xl font-bold text-gray-900 flex items-center gap-2",children:[e.jsx(A,{className:"w-8 h-8 text-indigo-500"}),"WebSocket Demo"]}),e.jsx("p",{className:"text-gray-500 mt-2",children:"Demonstrates WebSocket with type inference using useWSStore"})]}),e.jsxs("div",{className:"mb-6 p-4 bg-white rounded-xl shadow-sm border border-gray-200 flex flex-wrap items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-gray-700",children:"Status:"}),e.jsxs("span",{className:`flex items-center gap-1 ${j[m]}`,"data-testid":`ws-status-${t}`,children:[b?e.jsx($,{size:"sm",color:j[m]}):t==="open"?e.jsx(h,{className:"w-4 h-4"}):e.jsx(C,{className:"w-4 h-4"}),t.charAt(0).toUpperCase()+t.slice(1)]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:s,disabled:t==="open"||b,className:`flex items-center gap-1.5 px-4 py-2 rounded-lg text-sm font-medium transition-colors ${t==="open"||b?"bg-gray-100 text-gray-400 cursor-not-allowed":"bg-green-500 text-white hover:bg-green-600"}`,"data-testid":"connect-ws-button",children:[e.jsx(h,{className:"w-4 h-4"}),"Connect"]}),e.jsxs("button",{onClick:a,disabled:t==="closed",className:`flex items-center gap-1.5 px-4 py-2 rounded-lg text-sm font-medium transition-colors ${t==="closed"?"bg-gray-100 text-gray-400 cursor-not-allowed":"bg-red-500 text-white hover:bg-red-600"}`,"data-testid":"disconnect-ws-button",children:[e.jsx(C,{className:"w-4 h-4"}),"Disconnect"]})]})]}),e.jsx("div",{className:"mb-6 p-6 bg-white rounded-xl shadow-sm border border-gray-200",children:e.jsxs("div",{className:"flex gap-4",children:[e.jsxs("select",{value:l,onChange:i=>M(i.target.value),className:"px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 outline-none","data-testid":"ws-message-type-select",children:[e.jsx("option",{value:"echo",children:"Echo (RPC)"}),e.jsx("option",{value:"ping",children:"Ping (RPC)"}),e.jsx("option",{value:"broadcast",children:"Broadcast (Event)"}),e.jsx("option",{value:"notification",children:"Notification (Event)"})]}),e.jsx("input",{type:"text",value:c,onChange:i=>f(i.target.value),onKeyDown:i=>i.key==="Enter"&&w(),placeholder:l==="ping"?"No message needed for ping":"Type a message...",disabled:t!=="open"||l==="ping",className:"flex-1 px-4 py-3 text-base border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-transparent outline-none disabled:bg-gray-100 disabled:cursor-not-allowed","data-testid":"ws-message-input"}),e.jsxs("button",{onClick:w,disabled:t!=="open"||l!=="ping"&&!c.trim(),className:`flex items-center gap-2 px-6 py-3 text-base font-medium rounded-lg transition-colors ${t!=="open"||l!=="ping"&&!c.trim()?"bg-gray-300 text-gray-500 cursor-not-allowed":"bg-indigo-500 text-white hover:bg-indigo-600"}`,"data-testid":"send-message-button",children:[e.jsx(S,{className:"w-5 h-5"}),"Send"]})]})}),e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h3",{className:"text-lg font-medium text-gray-900","data-testid":"message-count",children:["Messages (",r.length,")"]}),e.jsxs("button",{onClick:x,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm text-gray-500 hover:text-red-500 hover:bg-red-50 rounded-lg transition-colors","data-testid":"clear-messages-button",children:[e.jsx(q,{className:"w-4 h-4"}),"Clear"]})]}),e.jsx("div",{className:"border border-gray-200 rounded-xl bg-gray-50 h-[400px] overflow-y-auto p-4 space-y-3",children:r.length===0?e.jsx(T,{icon:y,title:"No messages yet. Connect and send a message!"}):r.map((i,W)=>{const u=E[i.type]||{colorScheme:"gray",icon:y,borderColor:"#6b7280"};return e.jsx(z,{type:i.type,payload:i.payload,timestamp:i.timestamp,icon:u.icon,colorScheme:u.colorScheme,borderColor:u.borderColor,"data-testid":"message-item"},W)})})]})};export{Y as WebSocketPage};
11
+ */const B=[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],U=k("radio",B),V={gray:{bg:"bg-gray-500"},blue:{bg:"bg-blue-500"},green:{bg:"bg-green-500"},red:{bg:"bg-red-500"},yellow:{bg:"bg-yellow-500"},purple:{bg:"bg-purple-500"},orange:{bg:"bg-orange-500"},cyan:{bg:"bg-cyan-500"},indigo:{bg:"bg-indigo-500"}},z=({type:t,payload:n,timestamp:s,icon:a,colorScheme:r="gray",borderColor:d,className:p="","data-testid":g="message-card"})=>{const x=V[r],c=t.includes("_")?t.toUpperCase().replace("_"," "):t.toUpperCase();return e.jsxs("div",{className:`p-4 bg-white rounded-lg border-l-4 shadow-sm ${p}`,style:{borderLeftColor:d||void 0},"data-testid":g,children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-medium text-white ${x.bg}`,children:[a&&e.jsx(a,{className:"w-3 h-3"}),c]}),s&&e.jsx("span",{className:"text-xs text-gray-400",children:new Date(s).toLocaleTimeString()})]}),e.jsx("pre",{className:"text-sm text-gray-700 whitespace-pre-wrap break-words font-mono",children:JSON.stringify(n,null,2)})]})};let o=null;const H=D((t,n)=>({status:"closed",messages:[],error:null,connect:()=>{o||(o=R.api.chat.ws.$ws(),o&&(o.onStatusChange(s=>{t({status:s})}),o.on("notification",s=>{const a=s;t(r=>({messages:[...r.messages,{type:"notification",payload:a,timestamp:a.timestamp}]}))}),o.on("broadcast",s=>{const a=s;t(r=>({messages:[...r.messages,{type:"broadcast",payload:a,timestamp:a.timestamp}]}))}),o.on("connected",s=>{const a=s;t(r=>({messages:[...r.messages,{type:"connected",payload:a,timestamp:a.timestamp}]}))})))},disconnect:()=>{o&&(o.close(),o=null,t({status:"closed"}))},echo:async s=>{if(!(!o||n().status!=="open")){t(a=>({messages:[...a.messages,{type:"echo_request",payload:s,timestamp:Date.now()}]}));try{const a=await o.call("echo",s),r=a;t(d=>({messages:[...d.messages,{type:"echo_response",payload:a,timestamp:r.timestamp}]}))}catch(a){console.error("Echo failed:",a),t({error:a instanceof Error?a.message:"Echo failed"})}}},ping:async()=>{if(!(!o||n().status!=="open"))try{const s=await o.call("ping",{}),a=s;t(r=>({messages:[...r.messages,{type:"pong",payload:s,timestamp:a.timestamp}]}))}catch(s){console.error("Ping failed:",s),t({error:s instanceof Error?s.message:"Ping failed"})}},broadcast:s=>{!o||n().status!=="open"||o.emit("broadcast",s)},notification:s=>{!o||n().status!=="open"||o.emit("notification",s)},clearMessages:()=>{t({messages:[]})},clearError:()=>{t({error:null})}})),Z=()=>{const{status:t,messages:n,connect:s,disconnect:a,echo:r,ping:d,broadcast:p,notification:g,clearMessages:x}=H(),[c,f]=N.useState(""),[l,M]=N.useState("echo"),w=async()=>{if(!(!c.trim()&&l!=="ping")){switch(l){case"echo":await r({message:c});break;case"ping":await d();break;case"broadcast":p({message:c,timestamp:Date.now()});break;case"notification":g({title:"User Notification",body:c,timestamp:Date.now()});break}f("")}},E={ping:{colorScheme:"cyan",icon:v,borderColor:"#06b6d4"},pong:{colorScheme:"cyan",icon:v,borderColor:"#06b6d4"},echo_request:{colorScheme:"purple",icon:S,borderColor:"#a78bfa"},echo_response:{colorScheme:"purple",icon:y,borderColor:"#9333ea"},broadcast:{colorScheme:"orange",icon:U,borderColor:"#f97316"},notification:{colorScheme:"green",icon:T,borderColor:"#22c55e"},connected:{colorScheme:"blue",icon:h,borderColor:"#3b82f6"}},j={connecting:"text-yellow-500",open:"text-green-600",closed:"text-red-500",reconnecting:"text-orange-500"},m=t,b=m==="connecting"||m==="reconnecting";return e.jsxs("div",{className:"max-w-3xl mx-auto p-6","data-testid":"websocket-container",children:[e.jsxs(_,{children:[e.jsx("title",{children:"WebSocket Demo - Biomimic App"}),e.jsx("meta",{name:"description",content:"Real-time WebSocket communication demo with type-safe RPC"}),e.jsx("meta",{property:"og:title",content:"WebSocket Demo - Biomimic App"}),e.jsx("meta",{property:"og:description",content:"Real-time WebSocket communication demo with type-safe RPC"})]}),e.jsxs("div",{className:"mb-8",children:[e.jsxs("h1",{className:"text-3xl font-bold text-gray-900 flex items-center gap-2",children:[e.jsx(A,{className:"w-8 h-8 text-indigo-500"}),"WebSocket Demo"]}),e.jsx("p",{className:"text-gray-500 mt-2",children:"Demonstrates WebSocket with type inference using useWSStore"})]}),e.jsxs("div",{className:"mb-6 p-4 bg-white rounded-xl shadow-sm border border-gray-200 flex flex-wrap items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-gray-700",children:"Status:"}),e.jsxs("span",{className:`flex items-center gap-1 ${j[m]}`,"data-testid":`ws-status-${t}`,children:[b?e.jsx(P,{size:"sm",color:j[m]}):t==="open"?e.jsx(h,{className:"w-4 h-4"}):e.jsx(C,{className:"w-4 h-4"}),t.charAt(0).toUpperCase()+t.slice(1)]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:s,disabled:t==="open"||b,className:`flex items-center gap-1.5 px-4 py-2 rounded-lg text-sm font-medium transition-colors ${t==="open"||b?"bg-gray-100 text-gray-400 cursor-not-allowed":"bg-green-500 text-white hover:bg-green-600"}`,"data-testid":"connect-ws-button",children:[e.jsx(h,{className:"w-4 h-4"}),"Connect"]}),e.jsxs("button",{onClick:a,disabled:t==="closed",className:`flex items-center gap-1.5 px-4 py-2 rounded-lg text-sm font-medium transition-colors ${t==="closed"?"bg-gray-100 text-gray-400 cursor-not-allowed":"bg-red-500 text-white hover:bg-red-600"}`,"data-testid":"disconnect-ws-button",children:[e.jsx(C,{className:"w-4 h-4"}),"Disconnect"]})]})]}),e.jsx("div",{className:"mb-6 p-6 bg-white rounded-xl shadow-sm border border-gray-200",children:e.jsxs("div",{className:"flex gap-4",children:[e.jsxs("select",{value:l,onChange:i=>M(i.target.value),className:"px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 outline-none","data-testid":"ws-message-type-select",children:[e.jsx("option",{value:"echo",children:"Echo (RPC)"}),e.jsx("option",{value:"ping",children:"Ping (RPC)"}),e.jsx("option",{value:"broadcast",children:"Broadcast (Event)"}),e.jsx("option",{value:"notification",children:"Notification (Event)"})]}),e.jsx("input",{type:"text",value:c,onChange:i=>f(i.target.value),onKeyDown:i=>i.key==="Enter"&&w(),placeholder:l==="ping"?"No message needed for ping":"Type a message...",disabled:t!=="open"||l==="ping",className:"flex-1 px-4 py-3 text-base border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-transparent outline-none disabled:bg-gray-100 disabled:cursor-not-allowed","data-testid":"ws-message-input"}),e.jsxs("button",{onClick:w,disabled:t!=="open"||l!=="ping"&&!c.trim(),className:`flex items-center gap-2 px-6 py-3 text-base font-medium rounded-lg transition-colors ${t!=="open"||l!=="ping"&&!c.trim()?"bg-gray-300 text-gray-500 cursor-not-allowed":"bg-indigo-500 text-white hover:bg-indigo-600"}`,"data-testid":"send-message-button",children:[e.jsx(S,{className:"w-5 h-5"}),"Send"]})]})}),e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h3",{className:"text-lg font-medium text-gray-900","data-testid":"message-count",children:["Messages (",n.length,")"]}),e.jsxs("button",{onClick:x,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm text-gray-500 hover:text-red-500 hover:bg-red-50 rounded-lg transition-colors","data-testid":"clear-messages-button",children:[e.jsx(q,{className:"w-4 h-4"}),"Clear"]})]}),e.jsx("div",{className:"border border-gray-200 rounded-xl bg-gray-50 h-[400px] overflow-y-auto p-4 space-y-3",children:n.length===0?e.jsx($,{icon:y,title:"No messages yet. Connect and send a message!"}):n.map((i,W)=>{const u=E[i.type]||{colorScheme:"gray",icon:y,borderColor:"#6b7280"};return e.jsx(z,{type:i.type,payload:i.payload,timestamp:i.timestamp,icon:u.icon,colorScheme:u.colorScheme,borderColor:u.borderColor,"data-testid":"message-item"},W)})})]})};export{Z as WebSocketPage};
@@ -1,4 +1,4 @@
1
- import{c as t}from"./index-1bA-ixFv.js";/**
1
+ import{c as t}from"./sse-client-DGQ072hl.js";/**
2
2
  * @license lucide-react v0.576.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -0,0 +1 @@
1
+ import{c as r,e as a,j as i,R as n}from"./index-B3CRby6r.js";import{App as s}from"./App-BpFUIC-5.js";import{s as m,a as p}from"./api-request-DIJocPxr.js";import"./SaveOutlined-CLQ2tsSY.js";import"./sse-client-DGQ072hl.js";import"./triangle-alert-CrOQEdJ2.js";import"./circle-check-big-CrZdwS75.js";import"./circle-x-CvN9r3fW.js";import"./index-CC_zy73y.js";import"./clock-CTeSZBiH.js";import"./activity-CgTz9Mrd.js";import"./eye-CwlZZEsj.js";import"./plus-DDZfPiDJ.js";const d=r(t=>({count:0,isLoading:!1,loadingText:void 0,startLoading:o=>t(e=>({count:e.count+1,isLoading:!0,loadingText:o})),stopLoading:()=>t(o=>({count:Math.max(0,o.count-1),isLoading:o.count-1>0,loadingText:o.count-1>0?o.loadingText:void 0}))}));m({loadingStore:d.getState(),messageApi:p});a.createRoot(document.getElementById("root")).render(i.jsx(n.StrictMode,{children:i.jsx(s,{})}));