@stacksjs/defaults 0.75.529 → 0.75.537

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 (248) hide show
  1. package/ai/skills/stacks-actions/SKILL.md +1 -1
  2. package/ai/skills/stacks-build/SKILL.md +1 -1
  3. package/ai/skills/stacks-dashboard/SKILL.md +2 -2
  4. package/ai/skills/stacks-database/SKILL.md +1 -1
  5. package/ai/skills/stacks-migrations/SKILL.md +2 -2
  6. package/ai/skills/stacks-native/CATALOG.md +6 -6
  7. package/app/Actions/Dashboard/Commerce/CommerceCouponsAction.ts +27 -15
  8. package/app/Actions/Dashboard/Commerce/CommerceCouponsExportAction.ts +45 -0
  9. package/app/Actions/Dashboard/Commerce/CommerceCustomersAction.ts +22 -12
  10. package/app/Actions/Dashboard/Commerce/CommerceCustomersExportAction.ts +44 -0
  11. package/app/Actions/Dashboard/Commerce/CommercePosCheckoutAction.ts +9 -29
  12. package/app/Actions/Dashboard/Commerce/CommercePrintDevicesAction.ts +7 -9
  13. package/app/Actions/Dashboard/Commerce/CommerceProductDetailAction.ts +9 -8
  14. package/app/Actions/Dashboard/Commerce/CommerceTaxesAction.ts +7 -9
  15. package/app/Actions/Dashboard/Commerce/ManufacturerIndexAction.ts +8 -20
  16. package/app/Actions/Dashboard/Commerce/commerce-coupon-list.test.ts +203 -0
  17. package/app/Actions/Dashboard/Commerce/commerce-coupon-list.ts +248 -0
  18. package/app/Actions/Dashboard/Commerce/commerce-customer-list.test.ts +183 -0
  19. package/app/Actions/Dashboard/Commerce/commerce-customer-list.ts +186 -0
  20. package/app/Actions/Dashboard/Commerce/commerce-customer-records.test.ts +1 -34
  21. package/app/Actions/Dashboard/Commerce/commerce-customer-records.ts +0 -11
  22. package/app/Actions/Dashboard/Commerce/commerce-manufacturer-list.test.ts +118 -0
  23. package/app/Actions/Dashboard/Commerce/commerce-manufacturer-list.ts +41 -0
  24. package/app/Actions/Dashboard/Commerce/commerce-pos-catalog.test.ts +17 -5
  25. package/app/Actions/Dashboard/Commerce/commerce-pos-catalog.ts +17 -3
  26. package/app/Actions/Dashboard/Commerce/commerce-print-device-list.test.ts +99 -0
  27. package/app/Actions/Dashboard/Commerce/commerce-print-device-list.ts +18 -0
  28. package/app/Actions/Dashboard/Commerce/commerce-product-list.ts +5 -5
  29. package/app/Actions/Dashboard/Commerce/commerce-product-options.test.ts +81 -0
  30. package/app/Actions/Dashboard/Commerce/commerce-tax-rate-list.test.ts +99 -0
  31. package/app/Actions/Dashboard/Commerce/commerce-tax-rate-list.ts +18 -0
  32. package/app/Actions/Dashboard/Commerce/coupon-records.test.ts +1 -16
  33. package/app/Actions/Dashboard/Commerce/coupon-records.ts +6 -10
  34. package/app/Actions/Dashboard/Commerce/manufacturer-records.test.ts +5 -17
  35. package/app/Actions/Dashboard/Commerce/manufacturer-records.ts +0 -29
  36. package/app/Actions/Dashboard/Email/captured-mail.test.ts +16 -0
  37. package/app/Actions/Dashboard/Email/captured-mail.ts +9 -1
  38. package/app/Actions/Dashboard/Models/model-write.ts +36 -3
  39. package/app/Actions/Dashboard/Notifications/NotificationDeliveryHistoryAction.ts +13 -58
  40. package/app/Actions/Dashboard/Notifications/notification-delivery-history.ts +74 -0
  41. package/app/Actions/SitemapAction.ts +3 -1
  42. package/app/Models/Notification.ts +3 -1
  43. package/app/Models/NotificationDelivery.ts +4 -0
  44. package/app/Models/User.ts +10 -1
  45. package/bootstrap.ts +10 -2
  46. package/functions/commerce/tax-types.ts +21 -0
  47. package/functions/dashboard-list.test.ts +16 -0
  48. package/functions/dashboard-list.ts +14 -6
  49. package/functions/dashboard-model-record.test.ts +139 -0
  50. package/functions/dashboard-model-record.ts +353 -0
  51. package/functions/monitoring/errors.ts +22 -103
  52. package/functions/notifications/deliveries.ts +7 -38
  53. package/functions/queries.ts +7 -10
  54. package/ide/vscode/package.json +1 -1
  55. package/package.json +5 -5
  56. package/resources/components/Dashboard/Analytics/AnalyticsHub.stx +2 -2
  57. package/resources/components/Dashboard/Analytics/CampaignAnalytics.stx +22 -28
  58. package/resources/components/Dashboard/Analytics/EventAnalytics.stx +26 -34
  59. package/resources/components/Dashboard/Analytics/SalesAnalytics.stx +29 -37
  60. package/resources/components/Dashboard/Analytics/WebAnalyticsBreakdown.stx +12 -16
  61. package/resources/components/Dashboard/Analytics/WebAnalyticsDashboard.stx +43 -53
  62. package/resources/components/Dashboard/App/RequestsOverview.stx +2 -1
  63. package/resources/components/Dashboard/App/SourceInventory.stx +2 -1
  64. package/resources/components/Dashboard/Auth/AccessTokens.stx +3 -5
  65. package/resources/components/Dashboard/Billing/BillingPaymentMethodsPanel.stx +9 -11
  66. package/resources/components/Dashboard/Billing/BillingSettings.stx +1 -1
  67. package/resources/components/Dashboard/Buddy/BuddyAssistant.stx +4 -6
  68. package/resources/components/Dashboard/Commerce/CommerceCategoriesDashboard.stx +2 -2
  69. package/resources/components/Dashboard/Commerce/CommerceCategoriesTable.stx +3 -3
  70. package/resources/components/Dashboard/Commerce/CommerceCategoryDialog.stx +2 -2
  71. package/resources/components/Dashboard/Commerce/CommerceCategoryHierarchy.stx +3 -5
  72. package/resources/components/Dashboard/Commerce/CommerceCouponBreakdown.stx +17 -13
  73. package/resources/components/Dashboard/Commerce/CommerceCouponDialog.stx +1 -1
  74. package/resources/components/Dashboard/Commerce/CommerceCouponsDashboard.stx +57 -85
  75. package/resources/components/Dashboard/Commerce/CommerceCouponsTable.stx +32 -9
  76. package/resources/components/Dashboard/Commerce/CommerceCustomerDialog.stx +1 -1
  77. package/resources/components/Dashboard/Commerce/CommerceCustomersDashboard.stx +49 -83
  78. package/resources/components/Dashboard/Commerce/CommerceCustomersTable.stx +32 -9
  79. package/resources/components/Dashboard/Commerce/CommerceGiftCardBreakdown.stx +9 -15
  80. package/resources/components/Dashboard/Commerce/CommerceGiftCardDialog.stx +1 -1
  81. package/resources/components/Dashboard/Commerce/CommerceGiftCardsDashboard.stx +35 -119
  82. package/resources/components/Dashboard/Commerce/CommerceGiftCardsTable.stx +3 -3
  83. package/resources/components/Dashboard/Commerce/CommerceManufacturerDialog.stx +1 -1
  84. package/resources/components/Dashboard/Commerce/CommerceManufacturersDashboard.stx +3 -5
  85. package/resources/components/Dashboard/Commerce/CommerceManufacturersTable.stx +2 -2
  86. package/resources/components/Dashboard/Commerce/CommerceOrderDialog.stx +4 -4
  87. package/resources/components/Dashboard/Commerce/CommerceOrdersDashboard.stx +42 -129
  88. package/resources/components/Dashboard/Commerce/CommerceOrdersTable.stx +3 -3
  89. package/resources/components/Dashboard/Commerce/CommerceOverviewDashboard.stx +1 -1
  90. package/resources/components/Dashboard/Commerce/CommerceOverviewOrdersTable.stx +9 -11
  91. package/resources/components/Dashboard/Commerce/CommerceOverviewProductsTable.stx +5 -7
  92. package/resources/components/Dashboard/Commerce/CommerceOverviewStats.stx +14 -16
  93. package/resources/components/Dashboard/Commerce/CommercePaymentsBreakdown.stx +12 -18
  94. package/resources/components/Dashboard/Commerce/CommercePaymentsDashboard.stx +41 -120
  95. package/resources/components/Dashboard/Commerce/CommercePaymentsTable.stx +1 -1
  96. package/resources/components/Dashboard/Commerce/CommercePosCart.stx +13 -15
  97. package/resources/components/Dashboard/Commerce/CommercePosCatalog.stx +17 -19
  98. package/resources/components/Dashboard/Commerce/CommercePosCheckoutDialog.stx +2 -2
  99. package/resources/components/Dashboard/Commerce/CommercePosDashboard.stx +1 -1
  100. package/resources/components/Dashboard/Commerce/CommercePosReceiptDialog.stx +1 -1
  101. package/resources/components/Dashboard/Commerce/CommerceProductDetailDashboard.stx +5 -5
  102. package/resources/components/Dashboard/Commerce/CommerceProductDialog.stx +3 -3
  103. package/resources/components/Dashboard/Commerce/CommerceProductsDashboard.stx +41 -122
  104. package/resources/components/Dashboard/Commerce/CommerceProductsTable.stx +3 -3
  105. package/resources/components/Dashboard/Commerce/CommerceReviewEditDialog.stx +1 -1
  106. package/resources/components/Dashboard/Commerce/CommerceReviewsDashboard.stx +38 -122
  107. package/resources/components/Dashboard/Commerce/CommerceReviewsTable.stx +2 -2
  108. package/resources/components/Dashboard/Commerce/CommerceTaxDialog.stx +3 -3
  109. package/resources/components/Dashboard/Commerce/CommerceTaxesDashboard.stx +5 -4
  110. package/resources/components/Dashboard/Commerce/CommerceTaxesTable.stx +4 -3
  111. package/resources/components/Dashboard/Commerce/CommerceUnitDialog.stx +3 -7
  112. package/resources/components/Dashboard/Commerce/CommerceUnitsDashboard.stx +3 -5
  113. package/resources/components/Dashboard/Commerce/CommerceUnitsTable.stx +2 -2
  114. package/resources/components/Dashboard/Commerce/CommerceVariantDialog.stx +3 -3
  115. package/resources/components/Dashboard/Commerce/CommerceVariantsDashboard.stx +4 -4
  116. package/resources/components/Dashboard/Commerce/CommerceVariantsTable.stx +3 -5
  117. package/resources/components/Dashboard/Commerce/Delivery/CourierDialog.stx +1 -1
  118. package/resources/components/Dashboard/Commerce/Delivery/CouriersDashboard.stx +1 -1
  119. package/resources/components/Dashboard/Commerce/Delivery/CouriersTable.stx +2 -2
  120. package/resources/components/Dashboard/Commerce/Delivery/DeliveryOverviewDashboard.stx +44 -52
  121. package/resources/components/Dashboard/Commerce/Delivery/DeliveryPagination.stx +2 -2
  122. package/resources/components/Dashboard/Commerce/Delivery/DeliveryRouteDialog.stx +1 -1
  123. package/resources/components/Dashboard/Commerce/Delivery/DeliveryRoutesDashboard.stx +1 -1
  124. package/resources/components/Dashboard/Commerce/Delivery/DeliveryRoutesTable.stx +2 -2
  125. package/resources/components/Dashboard/Commerce/Delivery/DigitalDeliveriesDashboard.stx +1 -1
  126. package/resources/components/Dashboard/Commerce/Delivery/DigitalDeliveryTable.stx +2 -2
  127. package/resources/components/Dashboard/Commerce/Delivery/LicenseKeyDialog.stx +3 -3
  128. package/resources/components/Dashboard/Commerce/Delivery/LicenseKeysDashboard.stx +1 -1
  129. package/resources/components/Dashboard/Commerce/Delivery/LicenseKeysTable.stx +2 -2
  130. package/resources/components/Dashboard/Commerce/Delivery/ShippingMethodsDashboard.stx +1 -1
  131. package/resources/components/Dashboard/Commerce/Delivery/ShippingMethodsTable.stx +2 -2
  132. package/resources/components/Dashboard/Commerce/Delivery/ShippingRateDialog.stx +2 -2
  133. package/resources/components/Dashboard/Commerce/Delivery/ShippingRatesDashboard.stx +1 -1
  134. package/resources/components/Dashboard/Commerce/Delivery/ShippingRatesTable.stx +2 -2
  135. package/resources/components/Dashboard/Commerce/Delivery/ShippingZoneDialog.stx +1 -1
  136. package/resources/components/Dashboard/Commerce/Delivery/ShippingZonesDashboard.stx +1 -1
  137. package/resources/components/Dashboard/Commerce/Delivery/ShippingZonesTable.stx +4 -8
  138. package/resources/components/Dashboard/Commerce/PaymentDetailsDialog.stx +1 -3
  139. package/resources/components/Dashboard/Commerce/PrintDeviceBreakdown.stx +9 -15
  140. package/resources/components/Dashboard/Commerce/PrintDeviceDialog.stx +1 -1
  141. package/resources/components/Dashboard/Commerce/PrintDevicesDashboard.stx +3 -3
  142. package/resources/components/Dashboard/Commerce/PrintDevicesTable.stx +3 -3
  143. package/resources/components/Dashboard/Commerce/PrintLogBreakdown.stx +3 -9
  144. package/resources/components/Dashboard/Commerce/PrintLogDetailsDialog.stx +1 -1
  145. package/resources/components/Dashboard/Commerce/PrintLogsDashboard.stx +4 -4
  146. package/resources/components/Dashboard/Commerce/PrintLogsTable.stx +8 -10
  147. package/resources/components/Dashboard/Commerce/ProductWaitlistDashboard.stx +37 -109
  148. package/resources/components/Dashboard/Commerce/ProductWaitlistEntryDialog.stx +3 -3
  149. package/resources/components/Dashboard/Commerce/ProductWaitlistTable.stx +2 -2
  150. package/resources/components/Dashboard/Commerce/RestaurantWaitlistDashboard.stx +38 -112
  151. package/resources/components/Dashboard/Commerce/RestaurantWaitlistEntryDialog.stx +2 -2
  152. package/resources/components/Dashboard/Commerce/RestaurantWaitlistTable.stx +2 -2
  153. package/resources/components/Dashboard/Content/AuthorsDashboard.stx +4 -4
  154. package/resources/components/Dashboard/Content/BlogDashboard.stx +4 -4
  155. package/resources/components/Dashboard/Content/CommentsDashboard.stx +36 -83
  156. package/resources/components/Dashboard/Content/ContentDashboard.stx +12 -14
  157. package/resources/components/Dashboard/Content/ContentTaxonomyDashboard.stx +2 -2
  158. package/resources/components/Dashboard/Content/FileManagerDashboard.stx +8 -12
  159. package/resources/components/Dashboard/Content/FileStoragePanel.stx +6 -10
  160. package/resources/components/Dashboard/Content/FileUploadDialog.stx +1 -3
  161. package/resources/components/Dashboard/Content/PagesDashboard.stx +39 -78
  162. package/resources/components/Dashboard/Content/PostEditorDialog.stx +4 -8
  163. package/resources/components/Dashboard/Content/PostsDashboard.stx +44 -85
  164. package/resources/components/Dashboard/Content/SeoDashboard.stx +5 -4
  165. package/resources/components/Dashboard/Data/DataRecords.stx +140 -12
  166. package/resources/components/Dashboard/Deployments/DeploymentList.stx +4 -4
  167. package/resources/components/Dashboard/Deployments/DeploymentTable.stx +3 -1
  168. package/resources/components/Dashboard/Elements/DropdownNavigation.stx +5 -7
  169. package/resources/components/Dashboard/Email/CapturedMailDashboard.stx +1 -3
  170. package/resources/components/Dashboard/Email/CapturedMailList.stx +18 -20
  171. package/resources/components/Dashboard/Email/EmailActivityDashboard.stx +24 -28
  172. package/resources/components/Dashboard/Email/EmailSettingsList.stx +6 -8
  173. package/resources/components/Dashboard/Email/EmailSettingsNavigation.stx +10 -12
  174. package/resources/components/Dashboard/Email/EmailSidebar.stx +33 -37
  175. package/resources/components/Dashboard/Email/InboxMessageDetail.stx +1 -1
  176. package/resources/components/Dashboard/Email/InboxMessageList.stx +16 -18
  177. package/resources/components/Dashboard/Email/InboxSettingsDashboard.stx +1 -1
  178. package/resources/components/Dashboard/Environment/EnvironmentDashboard.stx +2 -2
  179. package/resources/components/Dashboard/GlobalSearch.stx +19 -21
  180. package/resources/components/Dashboard/Home/DashboardHome.stx +8 -1
  181. package/resources/components/Dashboard/Infrastructure/CloudDashboard.stx +1 -1
  182. package/resources/components/Dashboard/Infrastructure/DnsDashboard.stx +27 -13
  183. package/resources/components/Dashboard/Infrastructure/LogsDashboard.stx +1 -1
  184. package/resources/components/Dashboard/Infrastructure/MailboxesDashboard.stx +46 -8
  185. package/resources/components/Dashboard/Infrastructure/ServerlessDashboard.stx +1 -1
  186. package/resources/components/Dashboard/Infrastructure/ServersDashboard.stx +1 -1
  187. package/resources/components/Dashboard/Jobs/JobDetail.stx +1 -1
  188. package/resources/components/Dashboard/Jobs/JobHistory.stx +44 -57
  189. package/resources/components/Dashboard/Jobs/JobTable.stx +23 -25
  190. package/resources/components/Dashboard/Kanban/KanbanCardDialog.stx +1 -1
  191. package/resources/components/Dashboard/Library/ComponentsDashboard.stx +1 -1
  192. package/resources/components/Dashboard/Management/AssignmentDrawer.stx +5 -7
  193. package/resources/components/Dashboard/Management/PermissionsDashboard.stx +35 -43
  194. package/resources/components/Dashboard/Marketing/AbandonedCartsDashboard.stx +11 -13
  195. package/resources/components/Dashboard/Marketing/CampaignDialog.stx +1 -3
  196. package/resources/components/Dashboard/Marketing/CampaignsDashboard.stx +2 -2
  197. package/resources/components/Dashboard/Marketing/CampaignsTable.stx +2 -2
  198. package/resources/components/Dashboard/Marketing/MarketingListsDashboard.stx +1 -1
  199. package/resources/components/Dashboard/Marketing/MarketingListsTable.stx +2 -2
  200. package/resources/components/Dashboard/Marketing/SocialPostDialog.stx +1 -3
  201. package/resources/components/Dashboard/Marketing/SocialPostsDashboard.stx +2 -2
  202. package/resources/components/Dashboard/Marketing/SocialPostsTable.stx +2 -2
  203. package/resources/components/Dashboard/Models/ModelRecordActions.stx +11 -2
  204. package/resources/components/Dashboard/Models/ModelRecordCreate.stx +193 -0
  205. package/resources/components/Dashboard/Models/ModelRecordDetail.stx +144 -0
  206. package/resources/components/Dashboard/Models/ModelRecordEdit.stx +176 -0
  207. package/resources/components/Dashboard/Models/ModelRecordsDashboard.stx +52 -186
  208. package/resources/components/Dashboard/Models/ModelsOverview.stx +2 -4
  209. package/resources/components/Dashboard/Monitoring/ErrorDashboard.stx +47 -81
  210. package/resources/components/Dashboard/Monitoring/ErrorTable.stx +4 -2
  211. package/resources/components/Dashboard/NotFoundDashboard.stx +4 -4
  212. package/resources/components/Dashboard/Notifications/NotificationDeliveryHistory.stx +43 -77
  213. package/resources/components/Dashboard/Notifications/NotificationDeliveryOverview.stx +15 -17
  214. package/resources/components/Dashboard/Notifications/NotificationDeliveryTable.stx +1 -1
  215. package/resources/components/Dashboard/Operations/AuditDashboard.stx +1 -1
  216. package/resources/components/Dashboard/Operations/ChangeDashboard.stx +1 -1
  217. package/resources/components/Dashboard/Operations/IncidentDashboard.stx +1 -1
  218. package/resources/components/Dashboard/Operations/MigrationDashboard.stx +2 -2
  219. package/resources/components/Dashboard/Operations/RecoveryDashboard.stx +1 -1
  220. package/resources/components/Dashboard/Operations/SchedulerDashboard.stx +1 -1
  221. package/resources/components/Dashboard/Queries/QueryDashboard.stx +60 -86
  222. package/resources/components/Dashboard/Queries/QueryDetail.stx +5 -9
  223. package/resources/components/Dashboard/Realtime/RealtimeDashboard.stx +6 -8
  224. package/resources/components/Dashboard/Remote/RemoteConsole.stx +14 -20
  225. package/resources/components/Dashboard/Settings/AppearanceSettingsDashboard.stx +48 -54
  226. package/resources/components/Dashboard/Settings/MailSettingsDashboard.stx +8 -8
  227. package/resources/components/Dashboard/Settings/SettingsDashboard.stx +43 -47
  228. package/resources/components/Dashboard/Teams/TeamInvitationDashboard.stx +2 -2
  229. package/resources/components/Dashboard/UI/ActivityTable.stx +2 -1
  230. package/resources/components/Dashboard/UI/Button.stx +15 -0
  231. package/resources/components/Dashboard/UI/MetricCards.stx +5 -7
  232. package/resources/components/Dashboard/UI/Pagination.stx +3 -5
  233. package/resources/components/Dashboard/UI/QuickLinks.stx +2 -2
  234. package/resources/components/Dashboard/UI/Select.stx +1 -0
  235. package/resources/components/Dashboard/UI/Table.stx +139 -96
  236. package/resources/components/Dashboard/UI/Tabs.stx +18 -20
  237. package/routes/dashboard-api.ts +2 -0
  238. package/routes/dashboard.ts +246 -253
  239. package/routes/storefront.ts +31 -0
  240. package/stx-components-plugin.ts +12 -1
  241. package/views/dashboard/content/categories/index.stx +1 -1
  242. package/views/dashboard/content/tags/index.stx +1 -1
  243. package/views/dashboard/layouts/default.stx +27 -12
  244. package/views/dashboard/models/[model]/[id]/edit.stx +8 -0
  245. package/views/dashboard/models/[model]/[id].stx +8 -0
  246. package/views/dashboard/models/[model]/create.stx +8 -0
  247. package/resources/components/Dashboard/CreateRecordModal.stx +0 -138
  248. package/resources/components/Dashboard/Models/EditRecordModal.stx +0 -81
@@ -2,6 +2,7 @@
2
2
  import type { RestaurantWaitlistRecord, RestaurantWaitlistSummary, RestaurantWaitlistWritePayload } from '../../../../app/Actions/Dashboard/Commerce/restaurant-waitlist-records'
3
3
  import { restaurantWaitlistTimestamp } from '../../../../app/Actions/Dashboard/Commerce/restaurant-waitlist-records'
4
4
  import { DashboardApiError, dashboardApi } from '../../../../functions/dashboard-api'
5
+ import { useServerList } from '../../../../functions/dashboard-list'
5
6
  import { pushToast } from '../../../../functions/toasts'
6
7
 
7
8
  interface RestaurantWaitlistResponse {
@@ -12,22 +13,9 @@ interface RestaurantWaitlistResponse {
12
13
  summary: RestaurantWaitlistSummary
13
14
  }
14
15
 
15
- const records = state<RestaurantWaitlistRecord[]>([])
16
16
  const summary = state<RestaurantWaitlistSummary>({ total: 0, waiting: 0, seated: 0, cancelled: 0, noShow: 0, averageQuotedWait: 0, seatingRate: 0 })
17
- const search = state('')
18
17
  const status = state('all')
19
18
  const preference = state('all')
20
- // The server searches, filters, sorts and pages (stacksjs/stacks#3218), where
21
- // this page used to do all of that with the newest 500.
22
- const matchingTotal = state(0)
23
- const page = state(1)
24
- const perPage = state(25)
25
- const appliedSearch = state('')
26
- const headerSort = state<{ sort: string, direction: string } | null>(null)
27
- let listRequest = 0
28
- let searchTimer: ReturnType<typeof setTimeout> | null = null
29
- const isLoading = state(true)
30
- const loadError = state('')
31
19
  const entryDialogOpen = state(false)
32
20
  const entryDialogMode = state<'add' | 'edit'>('add')
33
21
  const editingRecord = state<RestaurantWaitlistRecord | null>(null)
@@ -54,9 +42,35 @@ const COLUMN_SORTS: Record<string, string> = {
54
42
  checkIn: 'checkin',
55
43
  }
56
44
 
45
+ // The server searches, filters, sorts and pages (stacksjs/stacks#3218);
46
+ // useServerList keeps the request order, paging, header sort and search
47
+ // debounce this page used to keep itself.
48
+ const {
49
+ records,
50
+ total,
51
+ page,
52
+ perPage,
53
+ search,
54
+ loading: isLoading,
55
+ loadError,
56
+ load,
57
+ changePage,
58
+ changePageSize,
59
+ changeSort,
60
+ } = useServerList<RestaurantWaitlistRecord>({
61
+ fetch: query => dashboardApi<RestaurantWaitlistResponse>(`/api/dashboard/commerce/waitlist-restaurants?${query}`),
62
+ defaultSort: { sort: 'created', direction: 'desc' },
63
+ columnSorts: COLUMN_SORTS,
64
+ filters: () => ({ status: status(), preference: preference() }),
65
+ onLoad: (result) => {
66
+ summary.set((result as RestaurantWaitlistResponse).summary ?? { total: 0, waiting: 0, seated: 0, cancelled: 0, noShow: 0, averageQuotedWait: 0, seatingRate: 0 })
67
+ },
68
+ onError: error => pushToast('error', 'Could not load restaurant waitlist', { detail: error instanceof Error ? error.message : String(error) }),
69
+ })
70
+
57
71
  function matchingLabel(): string {
58
- const count = matchingTotal()
59
- return `${count} matching ${count === 1 ? 'party' : 'parties'}`
72
+ const count = total()
73
+ return `${count.toLocaleString()} matching ${count === 1 ? 'party' : 'parties'}`
60
74
  }
61
75
 
62
76
  function openAddDialog(): void {
@@ -121,96 +135,10 @@ function elapsedMinutes(value: string): number {
121
135
  return Math.max(0, Math.round((Date.now() - checkedIn) / 60000))
122
136
  }
123
137
 
124
- async function loadRecords(): Promise<void> {
125
- const request = ++listRequest
126
- isLoading.set(true)
127
- loadError.set('')
128
- try {
129
- const params = new URLSearchParams()
130
- const order = headerSort() ?? { sort: 'created', direction: 'desc' }
131
- params.set('sort', order.sort)
132
- params.set('direction', order.direction)
133
- if (appliedSearch())
134
- params.set('q', appliedSearch())
135
- if (status() !== 'all')
136
- params.set('status', status())
137
- if (preference() !== 'all')
138
- params.set('preference', preference())
139
- params.set('page', String(page()))
140
- params.set('per_page', String(perPage()))
141
- const result = await dashboardApi<RestaurantWaitlistResponse>(`/api/dashboard/commerce/waitlist-restaurants?${params}`)
142
- // Only the newest request lands.
143
- if (request !== listRequest)
144
- return
145
- records.set(Array.isArray(result.records) ? result.records : [])
146
- matchingTotal.set(Number(result.total) || 0)
147
- page.set(Number(result.page) || 1)
148
- summary.set(result.summary ?? { total: 0, waiting: 0, seated: 0, cancelled: 0, noShow: 0, averageQuotedWait: 0, seatingRate: 0 })
149
- }
150
- catch (error) {
151
- if (request !== listRequest)
152
- return
153
- loadError.set('Restaurant waitlist records could not be loaded.')
154
- pushToast('error', 'Could not load restaurant waitlist', {
155
- detail: error instanceof Error ? error.message : String(error),
156
- })
157
- }
158
- finally {
159
- if (request === listRequest)
160
- isLoading.set(false)
161
- }
162
- }
163
-
164
- function eventValue<T>(value: T | CustomEvent<T>): T {
165
- return value instanceof CustomEvent ? value.detail : value
166
- }
167
-
168
- function changePage(value: number | CustomEvent<number>): void {
169
- page.set(Number(eventValue(value)) || 1)
170
- void loadRecords()
171
- }
172
-
173
- function changePageSize(value: number | CustomEvent<number>): void {
174
- perPage.set(Number(eventValue(value)) || 25)
175
- page.set(1)
176
- void loadRecords()
177
- }
178
-
179
- function changeColumnSort(value: { key: string, direction: string } | CustomEvent<{ key: string, direction: string }>): void {
180
- const column = eventValue(value)
181
- const serverSort = COLUMN_SORTS[column.key]
182
- headerSort.set(serverSort ? { sort: serverSort, direction: column.direction === 'asc' ? 'asc' : 'desc' } : null)
183
- page.set(1)
184
- void loadRecords()
138
+ function loadRecords(): Promise<void> {
139
+ return load()
185
140
  }
186
141
 
187
- // The filters ask the server for page 1 when they change, and the search
188
- // once typing pauses.
189
- let shownFilters = JSON.stringify([status(), preference()])
190
- effect(() => {
191
- const filters = JSON.stringify([status(), preference()])
192
- if (filters === shownFilters)
193
- return
194
- shownFilters = filters
195
- page.set(1)
196
- void loadRecords()
197
- })
198
-
199
- let shownSearch = search().trim()
200
- effect(() => {
201
- const term = search().trim()
202
- if (term === shownSearch)
203
- return
204
- shownSearch = term
205
- if (searchTimer)
206
- clearTimeout(searchTimer)
207
- searchTimer = setTimeout(() => {
208
- appliedSearch.set(term)
209
- page.set(1)
210
- void loadRecords()
211
- }, 250)
212
- })
213
-
214
142
  async function saveRecord(payload: RestaurantWaitlistWritePayload): Promise<void> {
215
143
  const current = editingRecord()
216
144
  const isEditing = entryDialogMode() === 'edit' && current !== null
@@ -306,15 +234,13 @@ onMount(() => {
306
234
  <div :if="loadError()" class="p-4 text-red-700 text-sm dark:text-red-300 bg-red-50 dark:bg-red-950/30 border border-red-200 rounded-lg dark:border-red-900">{{ loadError() }}</div>
307
235
 
308
236
  <section class="grid gap-3 grid-cols-2 lg:grid-cols-5">
309
- <template :for="item in metrics()">
310
- <div class="p-4 bg-white dark:bg-neutral-800 border border-gray-200 rounded-lg dark:border-neutral-700">
311
- <p class="text-gray-500 text-xs uppercase dark:text-neutral-400">{{ item.label }}</p>
312
- <p class="mt-2 font-semibold text-2xl text-gray-900 dark:text-white">{{ item.value }}</p>
313
- </div>
314
- </template>
237
+ <div :for="item in metrics()" class="p-4 bg-white dark:bg-neutral-800 border border-gray-200 rounded-lg dark:border-neutral-700">
238
+ <p class="text-gray-500 text-xs uppercase dark:text-neutral-400">{{ item.label }}</p>
239
+ <p class="mt-2 font-semibold text-2xl text-gray-900 dark:text-white">{{ item.value }}</p>
240
+ </div>
315
241
  </section>
316
242
 
317
- <section class="space-y-3">
243
+ <section class="flex flex-col gap-3">
318
244
  <div class="flex flex-col gap-3 lg:flex-row lg:items-end lg:justify-between">
319
245
  <div>
320
246
  <h2 class="font-semibold text-gray-900 dark:text-white">Waitlist parties</h2>
@@ -344,7 +270,7 @@ onMount(() => {
344
270
 
345
271
  <RestaurantWaitlistTable
346
272
  :records="records()"
347
- :total="matchingTotal()"
273
+ :total="total()"
348
274
  :current-page="page()"
349
275
  :per-page="perPage()"
350
276
  :loading="isLoading()"
@@ -355,7 +281,7 @@ onMount(() => {
355
281
  @delete="openDeleteDialog"
356
282
  @page-change="changePage"
357
283
  @page-size-change="changePageSize"
358
- @sort="changeColumnSort"
284
+ @sort="changeSort"
359
285
  />
360
286
  </section>
361
287
  </div>
@@ -174,7 +174,7 @@ function errorMessages(): string[] {
174
174
  >
175
175
  <form id="restaurant-waitlist-entry-form" @submit.prevent="submitForm()">
176
176
  <ul :if="errorMessages().length > 0" class="p-3 space-y-1 text-red-700 text-sm dark:text-red-300 bg-red-50 dark:bg-red-950/30 border border-red-200 rounded-lg dark:border-red-900">
177
- <template :for="message in errorMessages()" :key="message"><li>{{ message }}</li></template>
177
+ <li :for="message in errorMessages()" :key="message">{{ message }}</li>
178
178
  </ul>
179
179
 
180
180
  <div class="grid gap-4 sm:grid-cols-2 mt-6">
@@ -185,7 +185,7 @@ function errorMessages(): string[] {
185
185
  <div class="sm:col-span-2 -mt-2">
186
186
  <select x-model="customerId" aria-label="Existing customer" class="block px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-700 border border-gray-300 rounded-md dark:border-neutral-600" @change="hydrateCustomer($event)">
187
187
  <option value="">No linked customer</option>
188
- <template :for="option in customers()" :key="option.id"><option :value="option.id" :selected="option.id === String(customerId())">{{ option.label }}{{ option.detail ? ' · ' + option.detail : '' }}</option></template>
188
+ <option :for="option in customers()" :key="option.id" :value="option.id" :selected="option.id === String(customerId())">{{ option.label }}{{ option.detail ? ' · ' + option.detail : '' }}</option>
189
189
  </select>
190
190
  <p :if="moreCustomersLabel()" class="mt-1 text-gray-500 text-xs dark:text-neutral-400" :text="moreCustomersLabel()"></p>
191
191
  </div>
@@ -43,8 +43,8 @@ const COLUMNS = [
43
43
  const ROW_ACTIONS = [
44
44
  { action: 'seat', label: 'Seat party for', icon: 'i-hugeicons-checkmark-circle-02', class: 'text-green-600 dark:text-green-300', when: { key: 'status', equals: 'waiting' } },
45
45
  { action: 'no-show', label: 'Mark no show for', icon: 'i-hugeicons-user-remove-01', class: 'text-red-600 dark:text-red-300', when: { key: 'status', equals: 'waiting' } },
46
- { action: 'edit', label: 'Edit restaurant waitlist entry for', icon: 'i-hugeicons-edit-01' },
47
- { action: 'delete', label: 'Delete restaurant waitlist entry for', icon: 'i-hugeicons-waste', class: 'text-red-600 dark:text-red-300' },
46
+ { action: 'edit', label: 'Edit restaurant waitlist entry for' },
47
+ { action: 'delete', label: 'Delete restaurant waitlist entry for' },
48
48
  ]
49
49
 
50
50
  function formatDateTime(value: string): string {
@@ -54,8 +54,8 @@ const COLUMNS = [
54
54
  ]
55
55
 
56
56
  const ROW_ACTIONS = [
57
- { action: 'edit', label: 'Edit author', icon: 'i-hugeicons-edit-02' },
58
- { action: 'delete', label: 'Delete author', icon: 'i-hugeicons-delete-02', class: 'text-red-500' },
57
+ { action: 'edit', label: 'Edit author' },
58
+ { action: 'delete', label: 'Delete author' },
59
59
  ]
60
60
 
61
61
  /**
@@ -181,9 +181,9 @@ onMount(() => {
181
181
  <div class="space-y-6">
182
182
  <header class="flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between">
183
183
  <div>
184
- <p class="font-semibold text-blue-600 text-xs tracking-wide uppercase dark:text-blue-400">CMS</p>
184
+ <p class="font-semibold text-blue-600 text-xs tracking-wide uppercase dark:text-blue-400">Content</p>
185
185
  <h1 class="mt-1 font-bold text-2xl text-gray-900 dark:text-white">Authors</h1>
186
- <p class="mt-1 text-gray-500 text-sm dark:text-neutral-400">Manage persisted authors and their post assignments.</p>
186
+ <p class="mt-1 text-gray-500 text-sm dark:text-neutral-400">Manage the people who write posts, and which posts each one wrote.</p>
187
187
  </div>
188
188
  <div class="flex gap-2">
189
189
  <Button :loading="loading()" variant="secondary" @click="loadAuthors()"><span :if="!loading()" aria-hidden="true" class="h-4 w-4 i-hugeicons-refresh"></span>Refresh</Button>
@@ -132,15 +132,15 @@ defineClientPayload({ blogUrl })
132
132
  target="_blank"
133
133
  rel="noopener"
134
134
  :title="'View ' + row.title"
135
- class="p-2 text-neutral-600 dark:text-neutral-300 hover:bg-neutral-100 dark:hover:bg-neutral-800 rounded"
135
+ class="p-2 hover:bg-neutral-100 dark:hover:bg-neutral-800 rounded"
136
136
  >
137
- <span class="block h-4 w-4 i-hugeicons-view"></span>
137
+ <span class="block h-4 w-4 text-neutral-500 dark:text-neutral-400 i-hugeicons-view"></span>
138
138
  </a>
139
139
  <Button variant="ghost" size="sm" iconOnly :ariaLabel="'Edit ' + row.title" @click="openEditor(row.post)">
140
- <span class="block h-4 w-4 i-hugeicons-edit-01"></span>
140
+ <span class="block h-4 w-4 text-blue-500 i-hugeicons-pencil-edit-02"></span>
141
141
  </Button>
142
142
  <Button variant="ghost" size="sm" iconOnly :ariaLabel="'Delete ' + row.title" @click="askDelete(row.post)">
143
- <span class="block h-4 w-4 text-red-600 dark:text-red-400 i-hugeicons-waste"></span>
143
+ <span class="block h-4 w-4 text-red-500 i-hugeicons-delete-02"></span>
144
144
  </Button>
145
145
  </div>
146
146
  </template>
@@ -2,6 +2,7 @@
2
2
 
3
3
  <script client>
4
4
  import { dashboardApi } from '../../../../functions/dashboard-api'
5
+ import { useServerList } from '../../../../functions/dashboard-list'
5
6
  import { pushToast } from '../../../../functions/toasts'
6
7
 
7
8
  type CommentStatus = 'pending' | 'approved' | 'spam' | 'trash'
@@ -23,25 +24,14 @@ interface CommentRecord {
23
24
  createdAt: string
24
25
  }
25
26
 
26
- const comments = state<CommentRecord[]>([])
27
- const loading = state(true)
28
- const loadError = state('')
29
- const search = state('')
30
27
  const statusFilter = state('all')
31
28
  const updatingId = state('')
32
29
  const deletingComment = state<CommentRecord | null>(null)
33
30
  const deleting = state(false)
34
31
  const deleteError = state('')
35
32
 
36
- // The list is one page, searched and filtered by the server, newest first
37
- // across both tables (stacksjs/stacks#3193). The cards count every comment.
38
- const listPage = state(1)
39
- const perPage = 25
40
- const appliedSearch = state('')
41
- const total = state(0)
33
+ // The cards count every comment (stacksjs/stacks#3193).
42
34
  const counts = state<Record<string, number>>({ all: 0, pending: 0, approved: 0, spam: 0, trash: 0 })
43
- let listRequestId = 0
44
- let searchTimer: ReturnType<typeof setTimeout> | undefined
45
35
 
46
36
  function normalizeStatus(value: unknown): CommentStatus | null {
47
37
  const status = String(value || '').toLowerCase()
@@ -66,7 +56,7 @@ function normalize(record: any): CommentRecord {
66
56
 
67
57
  /** The page the server chose: its search and status are already applied. */
68
58
  function visibleComments(): CommentRecord[] {
69
- return comments()
59
+ return records()
70
60
  }
71
61
 
72
62
  function statusCount(status: CommentStatus): number {
@@ -102,77 +92,40 @@ interface CommentPageResponse {
102
92
  counts?: Record<string, number>
103
93
  }
104
94
 
105
- function listQuery(): string {
106
- const params = new URLSearchParams({ page: String(listPage()), per_page: String(perPage) })
107
- if (appliedSearch())
108
- params.set('search', appliedSearch())
109
- if (statusFilter() !== 'all')
110
- params.set('status', statusFilter())
111
- return params.toString()
112
- }
113
-
114
- async function loadComments(): Promise<void> {
115
- // Only the newest request may land: typing, paging and filtering can each
116
- // start one while another is still out.
117
- const requestId = ++listRequestId
118
- loading.set(true)
119
- loadError.set('')
120
- try {
121
- const data = await dashboardApi<CommentPageResponse>(`/api/dashboard/comments?${listQuery()}`)
122
- if (requestId !== listRequestId)
123
- return
95
+ // The list is one page, searched and filtered by the server, newest first
96
+ // across both tables (stacksjs/stacks#3193); useServerList keeps the request
97
+ // order, paging and search debounce this page used to keep itself. The
98
+ // search box and the status select stay plain x-model bindings.
99
+ const {
100
+ records,
101
+ total,
102
+ page: listPage,
103
+ perPage,
104
+ search,
105
+ loading,
106
+ loadError,
107
+ load,
108
+ changePage,
109
+ } = useServerList<CommentRecord>({
110
+ fetch: async (query) => {
111
+ const data = await dashboardApi<CommentPageResponse>(`/api/dashboard/comments?${query}`)
124
112
  if (!Array.isArray(data.comments))
125
113
  throw new TypeError('Comments were not returned in the expected shape.')
126
- comments.set(data.comments.map(normalize))
127
- total.set(Number(data.total || 0))
128
- // The server moves back to the last page when moderation or a narrower
129
- // search leaves this one past the end.
130
- listPage.set(Number(data.page || 1))
114
+ return { ...data, records: data.comments.map(normalize) }
115
+ },
116
+ defaultSort: { sort: 'created_at', direction: 'desc' },
117
+ filters: () => ({ status: statusFilter() }),
118
+ searchParam: 'search',
119
+ onLoad: (result) => {
120
+ const data = result as CommentPageResponse
131
121
  counts.set(data.counts && typeof data.counts === 'object' ? data.counts : {})
132
- }
133
- catch (error) {
134
- if (requestId !== listRequestId)
135
- return
136
- loadError.set(error instanceof Error ? error.message : String(error))
137
- pushToast('error', 'Could not load comments', { detail: loadError() })
138
- }
139
- finally {
140
- if (requestId === listRequestId)
141
- loading.set(false)
142
- }
143
- }
144
-
145
- function changePage(next: number): void {
146
- listPage.set(next)
147
- void loadComments()
148
- }
149
-
150
- // The search box and the status select stay plain x-model bindings; a change
151
- // to either asks the server for page 1, the search once typing pauses.
152
- let shownSearch = search()
153
- effect(() => {
154
- const term = search().trim()
155
- if (term === shownSearch)
156
- return
157
- shownSearch = term
158
- if (searchTimer)
159
- clearTimeout(searchTimer)
160
- searchTimer = setTimeout(() => {
161
- appliedSearch.set(term)
162
- listPage.set(1)
163
- void loadComments()
164
- }, 250)
122
+ },
123
+ onError: error => pushToast('error', 'Could not load comments', { detail: error instanceof Error ? error.message : String(error) }),
165
124
  })
166
125
 
167
- let shownStatus = statusFilter()
168
- effect(() => {
169
- const status = statusFilter()
170
- if (status === shownStatus)
171
- return
172
- shownStatus = status
173
- listPage.set(1)
174
- void loadComments()
175
- })
126
+ function loadComments(): Promise<void> {
127
+ return load()
128
+ }
176
129
 
177
130
  async function setStatus(comment: CommentRecord, status: CommentStatus): Promise<void> {
178
131
  updatingId.set(comment.key)
@@ -240,7 +193,7 @@ onMount(() => {
240
193
 
241
194
  <div class="space-y-6">
242
195
  <header class="flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between">
243
- <div><p class="font-semibold text-blue-600 text-xs tracking-wide uppercase dark:text-blue-400">CMS</p><h1 class="mt-1 font-bold text-2xl text-gray-900 dark:text-white">Comments</h1><p class="mt-1 text-gray-500 text-sm dark:text-neutral-400">Moderate persisted reader comments without altering their content.</p></div>
196
+ <div><p class="font-semibold text-blue-600 text-xs tracking-wide uppercase dark:text-blue-400">Content</p><h1 class="mt-1 font-bold text-2xl text-gray-900 dark:text-white">Comments</h1><p class="mt-1 text-gray-500 text-sm dark:text-neutral-400">Approve, hide or remove reader comments. A comment is never edited.</p></div>
244
197
  <Button :loading="loading()" variant="secondary" @click="loadComments()"><span :if="!loading()" aria-hidden="true" class="h-4 w-4 i-hugeicons-refresh"></span>Refresh</Button>
245
198
  </header>
246
199
 
@@ -258,10 +211,10 @@ onMount(() => {
258
211
  <div class="divide-gray-200 divide-y dark:divide-neutral-700">
259
212
  <div :if="loading()" class="px-4 py-14 text-center text-gray-500 text-sm dark:text-neutral-400"><span class="inline-block mr-2 h-4 w-4 animate-spin i-hugeicons-loading-03"></span>Loading comments</div>
260
213
  <div :else-if="visibleComments().length === 0" class="px-4 py-14 text-center"><span class="inline-block h-6 w-6 text-gray-400 i-hugeicons-comment-01"></span><p class="mt-2 font-medium text-gray-900 text-sm dark:text-white">No comments found</p><p class="mt-1 text-gray-500 text-sm dark:text-neutral-400">Adjust the search or status filter.</p></div>
261
- <template :else><template :for="comment in visibleComments()"><article class="p-4"><div class="flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between"><div class="min-w-0"><div class="flex flex-wrap gap-2 items-center"><p class="font-semibold text-gray-900 text-sm dark:text-white">{{ comment.authorName || 'Anonymous' }}</p><span :class="statusClass(comment.status)">{{ comment.status }}</span><span class="text-gray-500 text-xs dark:text-gray-400">{{ formatDate(comment.createdAt) }}</span></div><p class="mt-1 text-gray-500 text-xs dark:text-neutral-400">{{ comment.authorEmail }}<span :if="comment.postTitle"> on {{ comment.postTitle }}</span></p><p class="mt-3 max-w-4xl text-gray-700 text-sm whitespace-pre-wrap dark:text-neutral-200">{{ comment.content }}</p></div><div class="flex flex-shrink-0 flex-wrap gap-2"><Button :if="comment.status !== 'approved'" variant="success" size="sm" :disabled="Boolean(updatingId())" @click="setStatus(comment, 'approved')">Approve</Button><Button :if="comment.status !== 'pending'" variant="secondary" size="sm" :disabled="Boolean(updatingId())" @click="setStatus(comment, 'pending')">Restore</Button><Button :if="comment.status !== 'spam'" variant="warning" size="sm" :disabled="Boolean(updatingId())" @click="setStatus(comment, 'spam')">Spam</Button><Button :if="comment.status !== 'trash' && comment.source === 'comments'" variant="outline" size="sm" :disabled="Boolean(updatingId())" @click="setStatus(comment, 'trash')">Trash</Button><Button variant="ghost" size="sm" iconOnly :ariaLabel="'Permanently delete comment by ' + comment.authorName" :disabled="Boolean(updatingId())" @click="openDelete(comment)"><span class="block h-4 w-4 text-red-500 i-hugeicons-delete-02"></span></Button></div></div></article></template></template>
214
+ <template :else><article :for="comment in visibleComments()" class="p-4"><div class="flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between"><div class="min-w-0"><div class="flex flex-wrap gap-2 items-center"><p class="font-semibold text-gray-900 text-sm dark:text-white">{{ comment.authorName || 'Anonymous' }}</p><span :class="statusClass(comment.status)">{{ comment.status }}</span><span class="text-gray-500 text-xs dark:text-gray-400">{{ formatDate(comment.createdAt) }}</span></div><p class="mt-1 text-gray-500 text-xs dark:text-neutral-400">{{ comment.authorEmail }}<span :if="comment.postTitle"> on {{ comment.postTitle }}</span></p><p class="mt-3 max-w-4xl text-gray-700 text-sm whitespace-pre-wrap dark:text-neutral-200">{{ comment.content }}</p></div><div class="flex flex-shrink-0 flex-wrap gap-2"><Button :if="comment.status !== 'approved'" variant="success" size="sm" :disabled="Boolean(updatingId())" @click="setStatus(comment, 'approved')">Approve</Button><Button :if="comment.status !== 'pending'" variant="secondary" size="sm" :disabled="Boolean(updatingId())" @click="setStatus(comment, 'pending')">Restore</Button><Button :if="comment.status !== 'spam'" variant="warning" size="sm" :disabled="Boolean(updatingId())" @click="setStatus(comment, 'spam')">Spam</Button><Button :if="comment.status !== 'trash' && comment.source === 'comments'" variant="outline" size="sm" :disabled="Boolean(updatingId())" @click="setStatus(comment, 'trash')">Trash</Button><Button variant="ghost" size="sm" iconOnly :ariaLabel="'Permanently delete comment by ' + comment.authorName" :disabled="Boolean(updatingId())" @click="openDelete(comment)"><span class="block h-4 w-4 text-red-500 i-hugeicons-delete-02"></span></Button></div></div></article></template>
262
215
  </div>
263
- <div :if="total() > perPage" class="px-4 py-3 border-gray-200 border-t dark:border-neutral-700">
264
- <Pagination :currentPage="listPage()" :totalItems="total()" :itemsPerPage="perPage" showTotalItems @page="changePage" />
216
+ <div :if="total() > perPage()" class="px-4 py-3 border-gray-200 border-t dark:border-neutral-700">
217
+ <Pagination :currentPage="listPage()" :totalItems="total()" :itemsPerPage="perPage()" showTotalItems @page="changePage" />
265
218
  </div>
266
219
  </section>
267
220
  </div>
@@ -242,7 +242,7 @@ onDestroy(() => {
242
242
  <div>
243
243
  <p class="font-semibold text-blue-600 text-xs tracking-wide uppercase dark:text-blue-400">Content</p>
244
244
  <h1 class="mt-1 font-bold text-2xl text-gray-900 dark:text-white">Content Dashboard</h1>
245
- <p class="mt-1 text-gray-500 text-sm dark:text-neutral-400">Persisted CMS activity for the selected period.</p>
245
+ <p class="mt-1 text-gray-500 text-sm dark:text-neutral-400">What was written, published and read in the selected period.</p>
246
246
  </div>
247
247
  <div class="flex gap-2">
248
248
  <label>
@@ -319,7 +319,7 @@ onDestroy(() => {
319
319
  <div class="flex items-center justify-between p-4 border-b border-gray-200 dark:border-neutral-700">
320
320
  <div>
321
321
  <h2 class="font-semibold text-gray-900 text-sm dark:text-white">Top posts</h2>
322
- <p class="mt-1 text-gray-500 text-xs dark:text-neutral-400">Ranked by persisted view count.</p>
322
+ <p class="mt-1 text-gray-500 text-xs dark:text-neutral-400">Ranked by views.</p>
323
323
  </div>
324
324
  <a href="/content/posts" class="font-semibold text-blue-600 text-sm dark:text-blue-400">Manage posts</a>
325
325
  </div>
@@ -343,18 +343,16 @@ onDestroy(() => {
343
343
  <tr><td colspan="6" class="px-4 py-10 text-center text-gray-500 text-sm dark:text-neutral-400">No posts in this period.</td></tr>
344
344
  </template>
345
345
  <template :else>
346
- <template :for="post in overview().topPosts">
347
- <tr>
348
- <td class="px-4 py-3 font-medium text-gray-900 text-sm dark:text-white">{{ post.title }}</td>
349
- <td class="px-4 py-3 text-gray-500 text-sm dark:text-neutral-400">{{ post.category }}</td>
350
- <td class="px-4 py-3 text-gray-500 text-right text-sm dark:text-neutral-400">{{ formatNumber(post.views) }}</td>
351
- <td class="px-4 py-3 text-gray-500 text-right text-sm dark:text-neutral-400">{{ formatNumber(post.comments) }}</td>
352
- <td class="px-4 py-3 text-gray-500 text-sm dark:text-neutral-400">{{ formatDate(post.publishedAt) }}</td>
353
- <td class="px-4 py-3">
354
- <span :class="postStatusClass(post.status)" class="inline-flex px-2 py-1 font-semibold text-xs rounded-full">{{ post.status }}</span>
355
- </td>
356
- </tr>
357
- </template>
346
+ <tr :for="post in overview().topPosts">
347
+ <td class="px-4 py-3 font-medium text-gray-900 text-sm dark:text-white">{{ post.title }}</td>
348
+ <td class="px-4 py-3 text-gray-500 text-sm dark:text-neutral-400">{{ post.category }}</td>
349
+ <td class="px-4 py-3 text-gray-500 text-right text-sm dark:text-neutral-400">{{ formatNumber(post.views) }}</td>
350
+ <td class="px-4 py-3 text-gray-500 text-right text-sm dark:text-neutral-400">{{ formatNumber(post.comments) }}</td>
351
+ <td class="px-4 py-3 text-gray-500 text-sm dark:text-neutral-400">{{ formatDate(post.publishedAt) }}</td>
352
+ <td class="px-4 py-3">
353
+ <span :class="postStatusClass(post.status)" class="inline-flex px-2 py-1 font-semibold text-xs rounded-full">{{ post.status }}</span>
354
+ </td>
355
+ </tr>
358
356
  </template>
359
357
  </tbody>
360
358
  </table>
@@ -67,7 +67,7 @@ function columns() {
67
67
  }
68
68
 
69
69
  const ROW_ACTIONS = [
70
- { action: 'delete', label: 'Delete', icon: 'i-hugeicons-delete-02', class: 'text-red-500' },
70
+ { action: 'delete', label: 'Delete' },
71
71
  ]
72
72
 
73
73
  /** `UI/Table` owns the search; the fourth cell is derived onto the row. */
@@ -194,7 +194,7 @@ onMount(() => {
194
194
  <div class="space-y-6 max-w-full min-w-0">
195
195
  <header class="flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between">
196
196
  <div>
197
- <p class="font-semibold text-blue-600 text-xs tracking-wide uppercase dark:text-blue-400">CMS</p>
197
+ <p class="font-semibold text-blue-600 text-xs tracking-wide uppercase dark:text-blue-400">Content</p>
198
198
  <h1 class="mt-1 font-bold text-2xl text-gray-900 dark:text-white">{{ title() }}</h1>
199
199
  <p class="mt-1 text-gray-500 text-sm dark:text-neutral-400">{{ description() }}</p>
200
200
  </div>
@@ -467,10 +467,10 @@ onMount(() => { void loadFiles() })
467
467
  </div>
468
468
  </div>
469
469
  <nav aria-label="Folder path" class="flex overflow-x-auto items-center mt-4 text-sm">
470
- <template :for="(crumb, index) in breadcrumbs">
470
+ <div :for="(crumb, index) in breadcrumbs" class="contents">
471
471
  <span :if="index > 0" aria-hidden="true" class="mx-1 text-stone-300 dark:text-neutral-600">/</span>
472
472
  <button type="button" :aria-current="crumb.path === currentFolderPath() ? 'page' : undefined" class="font-medium text-stone-500 whitespace-nowrap dark:text-neutral-400 hover:text-blue-600 dark:hover:text-blue-400" @click="currentFolderPath.set(crumb.path)">{{ crumb.label }}</button>
473
- </template>
473
+ </div>
474
474
  </nav>
475
475
  </header>
476
476
 
@@ -479,15 +479,13 @@ onMount(() => { void loadFiles() })
479
479
  <div :if="warnings().length" role="status" class="mb-4 p-3 text-amber-800 text-sm dark:text-amber-200 bg-amber-50 dark:bg-amber-950/30 border border-amber-200 rounded-lg dark:border-amber-900">
480
480
  <p class="font-semibold">Some storage metadata is unavailable</p>
481
481
  <ul class="mt-1 list-disc list-inside">
482
- <template :for="warning in warnings()">
483
- <li>{{ warning }}</li>
484
- </template>
482
+ <li :for="warning in warnings()">{{ warning }}</li>
485
483
  </ul>
486
484
  </div>
487
485
  <div :if="truncated()" role="status" class="flex gap-4 items-center justify-between mb-4 p-3 text-amber-800 text-sm dark:text-amber-200 bg-amber-50 dark:bg-amber-950/30 border border-amber-200 rounded-lg dark:border-amber-900"><span>This disk contains more than {{ scanLimit }} visible entries. The current view shows the first {{ scanLimit }}.</span><Button :if="scanLimit() < 5000" variant="secondary" size="sm" :loading="loading()" @click="loadMore()">Load 1,000 more</Button><span :else class="flex-shrink-0 font-semibold">5,000 entry limit</span></div>
488
486
 
489
487
  <div :if="loading() && !root().items?.length" class="grid gap-4 grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 xl:grid-cols-6" aria-label="Loading files">
490
- <template :for="index in [1, 2, 3, 4, 5, 6]"><div class="h-44 bg-stone-100 dark:bg-neutral-800 rounded-lg animate-pulse"></div></template>
488
+ <div :for="index in [1, 2, 3, 4, 5, 6]" class="h-44 bg-stone-100 dark:bg-neutral-800 rounded-lg animate-pulse"></div>
491
489
  </div>
492
490
 
493
491
  <div :else-if="!loadError() && filteredItems().length === 0" class="flex flex-col items-center justify-center min-h-[55dvh] text-center">
@@ -495,12 +493,10 @@ onMount(() => { void loadFiles() })
495
493
  </div>
496
494
 
497
495
  <div :else-if="viewMode() === 'grid'" class="grid gap-4 grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-6">
498
- <template :for="item in filteredItems">
499
- <article role="button" tabindex="0" :aria-label="(item.type === 'folder' ? 'Open folder ' : 'View file ') + item.name" :class="gridCardClass(item)" @click="onItemClick(item)" @keydown="onItemKeydown(item, $event)">
500
- <MediaCard :item="item" />
501
- <div class="absolute right-2 top-2 opacity-0 focus-within:opacity-100 group-hover:opacity-100 transition-opacity"><Button variant="secondary" size="sm" iconOnly :ariaLabel="'Delete ' + item.name" @click="openDelete(item, $event)"><span class="block h-4 w-4 text-red-500 i-hugeicons-delete-02"></span></Button></div>
502
- </article>
503
- </template>
496
+ <article :for="item in filteredItems" role="button" tabindex="0" :aria-label="(item.type === 'folder' ? 'Open folder ' : 'View file ') + item.name" :class="gridCardClass(item)" @click="onItemClick(item)" @keydown="onItemKeydown(item, $event)">
497
+ <MediaCard :item="item" />
498
+ <div class="absolute right-2 top-2 opacity-0 focus-within:opacity-100 group-hover:opacity-100 transition-opacity"><Button variant="secondary" size="sm" iconOnly :ariaLabel="'Delete ' + item.name" @click="openDelete(item, $event)"><span class="block h-4 w-4 text-red-500 i-hugeicons-delete-02"></span></Button></div>
499
+ </article>
504
500
  </div>
505
501
 
506
502
  {{--
@@ -52,7 +52,7 @@ function navRowClass(active: boolean): string {
52
52
  <label class="block">
53
53
  <span class="font-semibold text-[11px] text-stone-500 tracking-wider uppercase dark:text-neutral-500">Storage disk</span>
54
54
  <select x-model="disk" :disabled="busy()" class="mt-2 px-2.5 py-2 w-full text-sm text-stone-800 dark:text-white bg-white/80 dark:bg-neutral-800 border border-stone-200 rounded-lg dark:border-neutral-700 disabled:opacity-60" @change="emit('disk', $event.target.value)">
55
- <template :for="option in disks"><option :value="option.name">{{ option.name }}{{ option.public ? ' (public)' : '' }}</option></template>
55
+ <option :for="option in disks" :value="option.name">{{ option.name }}{{ option.public ? ' (public)' : '' }}</option>
56
56
  </select>
57
57
  </label>
58
58
  </div>
@@ -71,12 +71,10 @@ function navRowClass(active: boolean): string {
71
71
  <div class="p-4 border-b border-black/[0.06] dark:border-white/[0.08]">
72
72
  <p class="font-semibold text-[11px] text-stone-500 tracking-wider uppercase dark:text-neutral-500">Content by type</p>
73
73
  <div class="mt-3 space-y-3">
74
- <template :for="row in typeRows">
75
- <div>
76
- <div class="flex items-center justify-between text-[11px]"><span class="text-stone-600 dark:text-neutral-300">{{ row.label }}</span><span class="font-mono text-stone-500 dark:text-neutral-500">{{ row.size }}</span></div>
77
- <div class="overflow-hidden mt-1 h-1.5 bg-black/[0.06] dark:bg-white/[0.08] rounded-full"><div :class="'h-full rounded-full ' + row.color" :style="row.barStyle"></div></div>
78
- </div>
79
- </template>
74
+ <div :for="row in typeRows">
75
+ <div class="flex items-center justify-between text-[11px]"><span class="text-stone-600 dark:text-neutral-300">{{ row.label }}</span><span class="font-mono text-stone-500 dark:text-neutral-500">{{ row.size }}</span></div>
76
+ <div class="overflow-hidden mt-1 h-1.5 bg-black/[0.06] dark:bg-white/[0.08] rounded-full"><div :class="'h-full rounded-full ' + row.color" :style="row.barStyle"></div></div>
77
+ </div>
80
78
  </div>
81
79
  </div>
82
80
 
@@ -88,9 +86,7 @@ function navRowClass(active: boolean): string {
88
86
 
89
87
  <nav aria-label="Storage folders" class="overflow-y-auto flex-1 p-2">
90
88
  <button type="button" :class="navRowClass(currentPath() === '')" @click="emit('navigate', '')"><span class="h-[18px] w-[18px] text-blue-500 i-hugeicons-home-02"></span>Home</button>
91
- <template :for="folder in folders">
92
- <button type="button" :class="navRowClass(currentPath() === folder.path)" @click="emit('navigate', folder.path)"><span class="h-[18px] w-[18px] text-amber-500 i-hugeicons-folder-02"></span><span class="truncate">{{ folder.name }}</span><span class="ml-auto tabular-nums text-[11px] text-stone-500 dark:text-neutral-500">{{ folder.count }}</span></button>
93
- </template>
89
+ <button :for="folder in folders" type="button" :class="navRowClass(currentPath() === folder.path)" @click="emit('navigate', folder.path)"><span class="h-[18px] w-[18px] text-amber-500 i-hugeicons-folder-02"></span><span class="truncate">{{ folder.name }}</span><span class="ml-auto tabular-nums text-[11px] text-stone-500 dark:text-neutral-500">{{ folder.count }}</span></button>
94
90
  </nav>
95
91
 
96
92
  <div class="p-3 border-black/[0.06] border-t dark:border-white/[0.08]">