@stacksjs/defaults 0.75.529 → 0.75.535
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.
- package/ai/skills/stacks-actions/SKILL.md +1 -1
- package/ai/skills/stacks-build/SKILL.md +1 -1
- package/ai/skills/stacks-dashboard/SKILL.md +2 -2
- package/ai/skills/stacks-database/SKILL.md +1 -1
- package/ai/skills/stacks-migrations/SKILL.md +2 -2
- package/ai/skills/stacks-native/CATALOG.md +4 -4
- package/app/Actions/Dashboard/Commerce/CommerceCouponsAction.ts +27 -15
- package/app/Actions/Dashboard/Commerce/CommerceCouponsExportAction.ts +45 -0
- package/app/Actions/Dashboard/Commerce/CommerceCustomersAction.ts +22 -12
- package/app/Actions/Dashboard/Commerce/CommerceCustomersExportAction.ts +44 -0
- package/app/Actions/Dashboard/Commerce/CommercePosCheckoutAction.ts +9 -29
- package/app/Actions/Dashboard/Commerce/CommercePrintDevicesAction.ts +7 -9
- package/app/Actions/Dashboard/Commerce/CommerceProductDetailAction.ts +9 -8
- package/app/Actions/Dashboard/Commerce/CommerceTaxesAction.ts +7 -9
- package/app/Actions/Dashboard/Commerce/ManufacturerIndexAction.ts +8 -20
- package/app/Actions/Dashboard/Commerce/commerce-coupon-list.test.ts +203 -0
- package/app/Actions/Dashboard/Commerce/commerce-coupon-list.ts +248 -0
- package/app/Actions/Dashboard/Commerce/commerce-customer-list.test.ts +183 -0
- package/app/Actions/Dashboard/Commerce/commerce-customer-list.ts +186 -0
- package/app/Actions/Dashboard/Commerce/commerce-customer-records.test.ts +1 -34
- package/app/Actions/Dashboard/Commerce/commerce-customer-records.ts +0 -11
- package/app/Actions/Dashboard/Commerce/commerce-manufacturer-list.test.ts +118 -0
- package/app/Actions/Dashboard/Commerce/commerce-manufacturer-list.ts +41 -0
- package/app/Actions/Dashboard/Commerce/commerce-pos-catalog.test.ts +17 -5
- package/app/Actions/Dashboard/Commerce/commerce-pos-catalog.ts +17 -3
- package/app/Actions/Dashboard/Commerce/commerce-print-device-list.test.ts +99 -0
- package/app/Actions/Dashboard/Commerce/commerce-print-device-list.ts +18 -0
- package/app/Actions/Dashboard/Commerce/commerce-product-list.ts +5 -5
- package/app/Actions/Dashboard/Commerce/commerce-product-options.test.ts +81 -0
- package/app/Actions/Dashboard/Commerce/commerce-tax-rate-list.test.ts +99 -0
- package/app/Actions/Dashboard/Commerce/commerce-tax-rate-list.ts +18 -0
- package/app/Actions/Dashboard/Commerce/coupon-records.test.ts +1 -16
- package/app/Actions/Dashboard/Commerce/coupon-records.ts +6 -10
- package/app/Actions/Dashboard/Commerce/manufacturer-records.test.ts +5 -17
- package/app/Actions/Dashboard/Commerce/manufacturer-records.ts +0 -29
- package/app/Actions/Dashboard/Email/captured-mail.test.ts +16 -0
- package/app/Actions/Dashboard/Email/captured-mail.ts +9 -1
- package/app/Actions/Dashboard/Models/model-write.ts +36 -3
- package/app/Actions/Dashboard/Notifications/NotificationDeliveryHistoryAction.ts +13 -58
- package/app/Actions/Dashboard/Notifications/notification-delivery-history.ts +74 -0
- package/app/Actions/SitemapAction.ts +3 -1
- package/app/Models/Notification.ts +3 -1
- package/app/Models/NotificationDelivery.ts +4 -0
- package/app/Models/User.ts +10 -1
- package/bootstrap.ts +10 -2
- package/functions/commerce/tax-types.ts +21 -0
- package/functions/dashboard-list.test.ts +16 -0
- package/functions/dashboard-list.ts +14 -6
- package/functions/dashboard-model-record.test.ts +139 -0
- package/functions/dashboard-model-record.ts +353 -0
- package/functions/monitoring/errors.ts +22 -103
- package/functions/notifications/deliveries.ts +7 -38
- package/functions/queries.ts +7 -10
- package/ide/vscode/package.json +1 -1
- package/package.json +5 -5
- package/resources/components/Dashboard/Analytics/AnalyticsHub.stx +2 -2
- package/resources/components/Dashboard/Analytics/CampaignAnalytics.stx +22 -28
- package/resources/components/Dashboard/Analytics/EventAnalytics.stx +26 -34
- package/resources/components/Dashboard/Analytics/SalesAnalytics.stx +29 -37
- package/resources/components/Dashboard/Analytics/WebAnalyticsBreakdown.stx +12 -16
- package/resources/components/Dashboard/Analytics/WebAnalyticsDashboard.stx +43 -53
- package/resources/components/Dashboard/App/RequestsOverview.stx +2 -1
- package/resources/components/Dashboard/App/SourceInventory.stx +2 -1
- package/resources/components/Dashboard/Auth/AccessTokens.stx +3 -5
- package/resources/components/Dashboard/Billing/BillingPaymentMethodsPanel.stx +9 -11
- package/resources/components/Dashboard/Billing/BillingSettings.stx +1 -1
- package/resources/components/Dashboard/Buddy/BuddyAssistant.stx +4 -6
- package/resources/components/Dashboard/Commerce/CommerceCategoriesDashboard.stx +2 -2
- package/resources/components/Dashboard/Commerce/CommerceCategoriesTable.stx +3 -3
- package/resources/components/Dashboard/Commerce/CommerceCategoryDialog.stx +2 -2
- package/resources/components/Dashboard/Commerce/CommerceCategoryHierarchy.stx +3 -5
- package/resources/components/Dashboard/Commerce/CommerceCouponBreakdown.stx +17 -13
- package/resources/components/Dashboard/Commerce/CommerceCouponDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceCouponsDashboard.stx +57 -85
- package/resources/components/Dashboard/Commerce/CommerceCouponsTable.stx +32 -9
- package/resources/components/Dashboard/Commerce/CommerceCustomerDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceCustomersDashboard.stx +49 -83
- package/resources/components/Dashboard/Commerce/CommerceCustomersTable.stx +32 -9
- package/resources/components/Dashboard/Commerce/CommerceGiftCardBreakdown.stx +9 -15
- package/resources/components/Dashboard/Commerce/CommerceGiftCardDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceGiftCardsDashboard.stx +35 -119
- package/resources/components/Dashboard/Commerce/CommerceGiftCardsTable.stx +3 -3
- package/resources/components/Dashboard/Commerce/CommerceManufacturerDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceManufacturersDashboard.stx +3 -5
- package/resources/components/Dashboard/Commerce/CommerceManufacturersTable.stx +2 -2
- package/resources/components/Dashboard/Commerce/CommerceOrderDialog.stx +4 -4
- package/resources/components/Dashboard/Commerce/CommerceOrdersDashboard.stx +42 -129
- package/resources/components/Dashboard/Commerce/CommerceOrdersTable.stx +3 -3
- package/resources/components/Dashboard/Commerce/CommerceOverviewDashboard.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceOverviewOrdersTable.stx +9 -11
- package/resources/components/Dashboard/Commerce/CommerceOverviewProductsTable.stx +5 -7
- package/resources/components/Dashboard/Commerce/CommerceOverviewStats.stx +14 -16
- package/resources/components/Dashboard/Commerce/CommercePaymentsBreakdown.stx +12 -18
- package/resources/components/Dashboard/Commerce/CommercePaymentsDashboard.stx +41 -120
- package/resources/components/Dashboard/Commerce/CommercePaymentsTable.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommercePosCart.stx +13 -15
- package/resources/components/Dashboard/Commerce/CommercePosCatalog.stx +17 -19
- package/resources/components/Dashboard/Commerce/CommercePosCheckoutDialog.stx +2 -2
- package/resources/components/Dashboard/Commerce/CommercePosDashboard.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommercePosReceiptDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceProductDetailDashboard.stx +5 -5
- package/resources/components/Dashboard/Commerce/CommerceProductDialog.stx +3 -3
- package/resources/components/Dashboard/Commerce/CommerceProductsDashboard.stx +41 -122
- package/resources/components/Dashboard/Commerce/CommerceProductsTable.stx +3 -3
- package/resources/components/Dashboard/Commerce/CommerceReviewEditDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceReviewsDashboard.stx +38 -122
- package/resources/components/Dashboard/Commerce/CommerceReviewsTable.stx +2 -2
- package/resources/components/Dashboard/Commerce/CommerceTaxDialog.stx +3 -3
- package/resources/components/Dashboard/Commerce/CommerceTaxesDashboard.stx +5 -4
- package/resources/components/Dashboard/Commerce/CommerceTaxesTable.stx +4 -3
- package/resources/components/Dashboard/Commerce/CommerceUnitDialog.stx +3 -7
- package/resources/components/Dashboard/Commerce/CommerceUnitsDashboard.stx +3 -5
- package/resources/components/Dashboard/Commerce/CommerceUnitsTable.stx +2 -2
- package/resources/components/Dashboard/Commerce/CommerceVariantDialog.stx +3 -3
- package/resources/components/Dashboard/Commerce/CommerceVariantsDashboard.stx +4 -4
- package/resources/components/Dashboard/Commerce/CommerceVariantsTable.stx +3 -5
- package/resources/components/Dashboard/Commerce/Delivery/CourierDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/CouriersDashboard.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/CouriersTable.stx +2 -2
- package/resources/components/Dashboard/Commerce/Delivery/DeliveryOverviewDashboard.stx +44 -52
- package/resources/components/Dashboard/Commerce/Delivery/DeliveryPagination.stx +2 -2
- package/resources/components/Dashboard/Commerce/Delivery/DeliveryRouteDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/DeliveryRoutesDashboard.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/DeliveryRoutesTable.stx +2 -2
- package/resources/components/Dashboard/Commerce/Delivery/DigitalDeliveriesDashboard.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/DigitalDeliveryTable.stx +2 -2
- package/resources/components/Dashboard/Commerce/Delivery/LicenseKeyDialog.stx +3 -3
- package/resources/components/Dashboard/Commerce/Delivery/LicenseKeysDashboard.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/LicenseKeysTable.stx +2 -2
- package/resources/components/Dashboard/Commerce/Delivery/ShippingMethodsDashboard.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/ShippingMethodsTable.stx +2 -2
- package/resources/components/Dashboard/Commerce/Delivery/ShippingRateDialog.stx +2 -2
- package/resources/components/Dashboard/Commerce/Delivery/ShippingRatesDashboard.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/ShippingRatesTable.stx +2 -2
- package/resources/components/Dashboard/Commerce/Delivery/ShippingZoneDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/ShippingZonesDashboard.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/ShippingZonesTable.stx +4 -8
- package/resources/components/Dashboard/Commerce/PaymentDetailsDialog.stx +1 -3
- package/resources/components/Dashboard/Commerce/PrintDeviceBreakdown.stx +9 -15
- package/resources/components/Dashboard/Commerce/PrintDeviceDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/PrintDevicesDashboard.stx +3 -3
- package/resources/components/Dashboard/Commerce/PrintDevicesTable.stx +3 -3
- package/resources/components/Dashboard/Commerce/PrintLogBreakdown.stx +3 -9
- package/resources/components/Dashboard/Commerce/PrintLogDetailsDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/PrintLogsDashboard.stx +4 -4
- package/resources/components/Dashboard/Commerce/PrintLogsTable.stx +8 -10
- package/resources/components/Dashboard/Commerce/ProductWaitlistDashboard.stx +37 -109
- package/resources/components/Dashboard/Commerce/ProductWaitlistEntryDialog.stx +3 -3
- package/resources/components/Dashboard/Commerce/ProductWaitlistTable.stx +2 -2
- package/resources/components/Dashboard/Commerce/RestaurantWaitlistDashboard.stx +38 -112
- package/resources/components/Dashboard/Commerce/RestaurantWaitlistEntryDialog.stx +2 -2
- package/resources/components/Dashboard/Commerce/RestaurantWaitlistTable.stx +2 -2
- package/resources/components/Dashboard/Content/AuthorsDashboard.stx +4 -4
- package/resources/components/Dashboard/Content/BlogDashboard.stx +4 -4
- package/resources/components/Dashboard/Content/CommentsDashboard.stx +36 -83
- package/resources/components/Dashboard/Content/ContentDashboard.stx +12 -14
- package/resources/components/Dashboard/Content/ContentTaxonomyDashboard.stx +2 -2
- package/resources/components/Dashboard/Content/FileManagerDashboard.stx +8 -12
- package/resources/components/Dashboard/Content/FileStoragePanel.stx +6 -10
- package/resources/components/Dashboard/Content/FileUploadDialog.stx +1 -3
- package/resources/components/Dashboard/Content/PagesDashboard.stx +39 -78
- package/resources/components/Dashboard/Content/PostEditorDialog.stx +4 -8
- package/resources/components/Dashboard/Content/PostsDashboard.stx +44 -85
- package/resources/components/Dashboard/Content/SeoDashboard.stx +5 -4
- package/resources/components/Dashboard/Data/DataRecords.stx +140 -12
- package/resources/components/Dashboard/Deployments/DeploymentList.stx +4 -4
- package/resources/components/Dashboard/Deployments/DeploymentTable.stx +3 -1
- package/resources/components/Dashboard/Elements/DropdownNavigation.stx +5 -7
- package/resources/components/Dashboard/Email/CapturedMailDashboard.stx +1 -3
- package/resources/components/Dashboard/Email/CapturedMailList.stx +18 -20
- package/resources/components/Dashboard/Email/EmailActivityDashboard.stx +24 -28
- package/resources/components/Dashboard/Email/EmailSettingsList.stx +6 -8
- package/resources/components/Dashboard/Email/EmailSettingsNavigation.stx +10 -12
- package/resources/components/Dashboard/Email/EmailSidebar.stx +33 -37
- package/resources/components/Dashboard/Email/InboxMessageDetail.stx +1 -1
- package/resources/components/Dashboard/Email/InboxMessageList.stx +16 -18
- package/resources/components/Dashboard/Email/InboxSettingsDashboard.stx +1 -1
- package/resources/components/Dashboard/Environment/EnvironmentDashboard.stx +2 -2
- package/resources/components/Dashboard/GlobalSearch.stx +19 -21
- package/resources/components/Dashboard/Home/DashboardHome.stx +8 -1
- package/resources/components/Dashboard/Infrastructure/CloudDashboard.stx +1 -1
- package/resources/components/Dashboard/Infrastructure/DnsDashboard.stx +27 -13
- package/resources/components/Dashboard/Infrastructure/LogsDashboard.stx +1 -1
- package/resources/components/Dashboard/Infrastructure/MailboxesDashboard.stx +46 -8
- package/resources/components/Dashboard/Infrastructure/ServerlessDashboard.stx +1 -1
- package/resources/components/Dashboard/Infrastructure/ServersDashboard.stx +1 -1
- package/resources/components/Dashboard/Jobs/JobDetail.stx +1 -1
- package/resources/components/Dashboard/Jobs/JobHistory.stx +44 -57
- package/resources/components/Dashboard/Jobs/JobTable.stx +23 -25
- package/resources/components/Dashboard/Kanban/KanbanCardDialog.stx +1 -1
- package/resources/components/Dashboard/Library/ComponentsDashboard.stx +1 -1
- package/resources/components/Dashboard/Management/AssignmentDrawer.stx +5 -7
- package/resources/components/Dashboard/Management/PermissionsDashboard.stx +35 -43
- package/resources/components/Dashboard/Marketing/AbandonedCartsDashboard.stx +11 -13
- package/resources/components/Dashboard/Marketing/CampaignDialog.stx +1 -3
- package/resources/components/Dashboard/Marketing/CampaignsDashboard.stx +2 -2
- package/resources/components/Dashboard/Marketing/CampaignsTable.stx +2 -2
- package/resources/components/Dashboard/Marketing/MarketingListsDashboard.stx +1 -1
- package/resources/components/Dashboard/Marketing/MarketingListsTable.stx +2 -2
- package/resources/components/Dashboard/Marketing/SocialPostDialog.stx +1 -3
- package/resources/components/Dashboard/Marketing/SocialPostsDashboard.stx +2 -2
- package/resources/components/Dashboard/Marketing/SocialPostsTable.stx +2 -2
- package/resources/components/Dashboard/Models/ModelRecordActions.stx +11 -2
- package/resources/components/Dashboard/Models/ModelRecordCreate.stx +193 -0
- package/resources/components/Dashboard/Models/ModelRecordDetail.stx +144 -0
- package/resources/components/Dashboard/Models/ModelRecordEdit.stx +176 -0
- package/resources/components/Dashboard/Models/ModelRecordsDashboard.stx +52 -186
- package/resources/components/Dashboard/Models/ModelsOverview.stx +2 -4
- package/resources/components/Dashboard/Monitoring/ErrorDashboard.stx +47 -81
- package/resources/components/Dashboard/Monitoring/ErrorTable.stx +4 -2
- package/resources/components/Dashboard/NotFoundDashboard.stx +4 -4
- package/resources/components/Dashboard/Notifications/NotificationDeliveryHistory.stx +43 -77
- package/resources/components/Dashboard/Notifications/NotificationDeliveryOverview.stx +15 -17
- package/resources/components/Dashboard/Notifications/NotificationDeliveryTable.stx +1 -1
- package/resources/components/Dashboard/Operations/AuditDashboard.stx +1 -1
- package/resources/components/Dashboard/Operations/ChangeDashboard.stx +1 -1
- package/resources/components/Dashboard/Operations/IncidentDashboard.stx +1 -1
- package/resources/components/Dashboard/Operations/MigrationDashboard.stx +2 -2
- package/resources/components/Dashboard/Operations/RecoveryDashboard.stx +1 -1
- package/resources/components/Dashboard/Operations/SchedulerDashboard.stx +1 -1
- package/resources/components/Dashboard/Queries/QueryDashboard.stx +60 -86
- package/resources/components/Dashboard/Queries/QueryDetail.stx +5 -9
- package/resources/components/Dashboard/Realtime/RealtimeDashboard.stx +6 -8
- package/resources/components/Dashboard/Remote/RemoteConsole.stx +14 -20
- package/resources/components/Dashboard/Settings/AppearanceSettingsDashboard.stx +48 -54
- package/resources/components/Dashboard/Settings/MailSettingsDashboard.stx +8 -8
- package/resources/components/Dashboard/Settings/SettingsDashboard.stx +43 -47
- package/resources/components/Dashboard/Teams/TeamInvitationDashboard.stx +2 -2
- package/resources/components/Dashboard/UI/ActivityTable.stx +2 -1
- package/resources/components/Dashboard/UI/Button.stx +15 -0
- package/resources/components/Dashboard/UI/MetricCards.stx +5 -7
- package/resources/components/Dashboard/UI/Pagination.stx +3 -5
- package/resources/components/Dashboard/UI/QuickLinks.stx +2 -2
- package/resources/components/Dashboard/UI/Select.stx +1 -0
- package/resources/components/Dashboard/UI/Table.stx +139 -96
- package/resources/components/Dashboard/UI/Tabs.stx +18 -20
- package/routes/dashboard-api.ts +2 -0
- package/routes/dashboard.ts +246 -253
- package/routes/storefront.ts +31 -0
- package/stx-components-plugin.ts +12 -1
- package/views/dashboard/content/categories/index.stx +1 -1
- package/views/dashboard/content/tags/index.stx +1 -1
- package/views/dashboard/layouts/default.stx +27 -12
- package/views/dashboard/models/[model]/[id]/edit.stx +8 -0
- package/views/dashboard/models/[model]/[id].stx +8 -0
- package/views/dashboard/models/[model]/create.stx +8 -0
- package/resources/components/Dashboard/CreateRecordModal.stx +0 -138
- package/resources/components/Dashboard/Models/EditRecordModal.stx +0 -81
|
@@ -72,9 +72,7 @@ function submit(): void {
|
|
|
72
72
|
<input ref="dashboardFileUploadInput" name="files" type="file" class="sr-only" multiple @change="handleFileSelection($event)" />
|
|
73
73
|
</label>
|
|
74
74
|
<ul :if="files().length" class="overflow-y-auto mt-4 space-y-1 max-h-32 text-sm">
|
|
75
|
-
<
|
|
76
|
-
<li class="flex gap-4 items-center justify-between px-3 py-2 bg-stone-50 dark:bg-neutral-900 rounded-lg"><span class="text-stone-700 truncate dark:text-neutral-200">{{ file.name }}</span><span class="flex-shrink-0 font-mono text-stone-500 text-xs dark:text-neutral-500">{{ formatFileSize(file.size) }}</span></li>
|
|
77
|
-
</template>
|
|
75
|
+
<li :for="file in files" class="flex gap-4 items-center justify-between px-3 py-2 bg-stone-50 dark:bg-neutral-900 rounded-lg"><span class="text-stone-700 truncate dark:text-neutral-200">{{ file.name }}</span><span class="flex-shrink-0 font-mono text-stone-500 text-xs dark:text-neutral-500">{{ formatFileSize(file.size) }}</span></li>
|
|
78
76
|
</ul>
|
|
79
77
|
</form>
|
|
80
78
|
|
|
@@ -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
|
interface PageRecord {
|
|
@@ -19,9 +20,6 @@ interface PageDraft {
|
|
|
19
20
|
published: boolean
|
|
20
21
|
}
|
|
21
22
|
|
|
22
|
-
const pages = state<PageRecord[]>([])
|
|
23
|
-
const loading = state(true)
|
|
24
|
-
const loadError = state('')
|
|
25
23
|
const formOpen = state(false)
|
|
26
24
|
const editingPage = state<PageRecord | null>(null)
|
|
27
25
|
const saving = state(false)
|
|
@@ -30,20 +28,11 @@ const deletingPage = state<PageRecord | null>(null)
|
|
|
30
28
|
const deleting = state(false)
|
|
31
29
|
const deleteError = state('')
|
|
32
30
|
|
|
33
|
-
// The
|
|
34
|
-
// it was last asked for (stacksjs/stacks#3192). The cards count every page.
|
|
35
|
-
const listPage = state(1)
|
|
36
|
-
const perPage = state(25)
|
|
37
|
-
const search = state('')
|
|
38
|
-
const sort = state('')
|
|
39
|
-
const sortDirection = state('asc')
|
|
40
|
-
const total = state(0)
|
|
31
|
+
// The cards count every page (stacksjs/stacks#3192).
|
|
41
32
|
const allCount = state(0)
|
|
42
33
|
const viewCount = state(0)
|
|
43
34
|
const conversionCount = state(0)
|
|
44
35
|
const newestTitle = state('')
|
|
45
|
-
let listRequestId = 0
|
|
46
|
-
let searchTimer: ReturnType<typeof setTimeout> | undefined
|
|
47
36
|
|
|
48
37
|
/** The server's name for each sortable column. */
|
|
49
38
|
const SORT_KEYS: Record<string, string> = { title: 'title', publishState: 'published' }
|
|
@@ -78,13 +67,13 @@ const COLUMNS = [
|
|
|
78
67
|
]
|
|
79
68
|
|
|
80
69
|
const ROW_ACTIONS = [
|
|
81
|
-
{ action: 'edit', label: 'Edit page'
|
|
82
|
-
{ action: 'delete', label: 'Delete page'
|
|
70
|
+
{ action: 'edit', label: 'Edit page' },
|
|
71
|
+
{ action: 'delete', label: 'Delete page' },
|
|
83
72
|
]
|
|
84
73
|
|
|
85
74
|
/** The rows are the page the server chose; the cells each read a field, so derive them. */
|
|
86
75
|
function visiblePages(): PageRecord[] {
|
|
87
|
-
return
|
|
76
|
+
return records().map(page => ({
|
|
88
77
|
...page,
|
|
89
78
|
viewsLabel: `${formatNumber(page.views)} views`,
|
|
90
79
|
conversionsLabel: `${formatNumber(page.conversions)} conversions`,
|
|
@@ -123,77 +112,49 @@ interface PageListResponse {
|
|
|
123
112
|
newestTitle?: string
|
|
124
113
|
}
|
|
125
114
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
const data = await dashboardApi<PageListResponse>(`/api/dashboard/pages?${
|
|
145
|
-
if (requestId !== listRequestId)
|
|
146
|
-
return
|
|
115
|
+
// The server pages, searches and sorts (stacksjs/stacks#3192); useServerList
|
|
116
|
+
// keeps the request order, paging, header sort and search debounce this page
|
|
117
|
+
// used to keep itself. Unsorted is newest first, which the server reads as
|
|
118
|
+
// created_at descending.
|
|
119
|
+
const {
|
|
120
|
+
records,
|
|
121
|
+
total,
|
|
122
|
+
page: listPage,
|
|
123
|
+
perPage,
|
|
124
|
+
search,
|
|
125
|
+
loading,
|
|
126
|
+
loadError,
|
|
127
|
+
load,
|
|
128
|
+
changePage,
|
|
129
|
+
changePageSize,
|
|
130
|
+
changeSort,
|
|
131
|
+
} = useServerList<PageRecord>({
|
|
132
|
+
fetch: async (query) => {
|
|
133
|
+
const data = await dashboardApi<PageListResponse>(`/api/dashboard/pages?${query}`)
|
|
147
134
|
if (!Array.isArray(data.pages))
|
|
148
135
|
throw new TypeError('Pages were not returned in the expected shape.')
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
136
|
+
return { ...data, records: data.pages.map(normalize) }
|
|
137
|
+
},
|
|
138
|
+
defaultSort: { sort: 'created_at', direction: 'desc' },
|
|
139
|
+
columnSorts: SORT_KEYS,
|
|
140
|
+
searchParam: 'search',
|
|
141
|
+
onLoad: (result) => {
|
|
142
|
+
const data = result as PageListResponse
|
|
154
143
|
allCount.set(Number(data.allCount || 0))
|
|
155
144
|
viewCount.set(Number(data.totalViews || 0))
|
|
156
145
|
conversionCount.set(Number(data.totalConversions || 0))
|
|
157
146
|
newestTitle.set(String(data.newestTitle || ''))
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
return
|
|
162
|
-
loadError.set(error instanceof Error ? error.message : String(error))
|
|
163
|
-
pushToast('error', 'Could not load pages', { detail: loadError() })
|
|
164
|
-
}
|
|
165
|
-
finally {
|
|
166
|
-
if (requestId === listRequestId)
|
|
167
|
-
loading.set(false)
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
function changePage(next: number): void {
|
|
172
|
-
listPage.set(next)
|
|
173
|
-
void loadPages()
|
|
174
|
-
}
|
|
147
|
+
},
|
|
148
|
+
onError: error => pushToast('error', 'Could not load pages', { detail: error instanceof Error ? error.message : String(error) }),
|
|
149
|
+
})
|
|
175
150
|
|
|
176
|
-
function
|
|
177
|
-
|
|
178
|
-
listPage.set(1)
|
|
179
|
-
void loadPages()
|
|
151
|
+
function loadPages(): Promise<void> {
|
|
152
|
+
return load()
|
|
180
153
|
}
|
|
181
154
|
|
|
155
|
+
/** The table's own search box; useServerList waits for typing to pause. */
|
|
182
156
|
function changeSearch(term: string): void {
|
|
183
|
-
|
|
184
|
-
clearTimeout(searchTimer)
|
|
185
|
-
searchTimer = setTimeout(() => {
|
|
186
|
-
search.set(String(term || '').trim())
|
|
187
|
-
listPage.set(1)
|
|
188
|
-
void loadPages()
|
|
189
|
-
}, 250)
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
function changeSort(next: { key: string, direction: string }): void {
|
|
193
|
-
sort.set(SORT_KEYS[next.key] || '')
|
|
194
|
-
sortDirection.set(next.direction === 'desc' ? 'desc' : 'asc')
|
|
195
|
-
listPage.set(1)
|
|
196
|
-
void loadPages()
|
|
157
|
+
search.set(String(term || ''))
|
|
197
158
|
}
|
|
198
159
|
|
|
199
160
|
function openCreate(): void {
|
|
@@ -276,7 +237,7 @@ onMount(() => {
|
|
|
276
237
|
|
|
277
238
|
<div class="space-y-6">
|
|
278
239
|
<header class="flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between">
|
|
279
|
-
<div><p class="font-semibold text-blue-600 text-xs tracking-wide uppercase dark:text-blue-400">
|
|
240
|
+
<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">Pages</h1><p class="mt-1 text-gray-500 text-sm dark:text-neutral-400">Create your site's pages, choose their templates, and decide when they go live.</p></div>
|
|
280
241
|
<div class="flex gap-2"><Button :loading="loading()" variant="secondary" @click="loadPages()"><span :if="!loading()" aria-hidden="true" class="h-4 w-4 i-hugeicons-refresh"></span>Refresh</Button><Button @click="openCreate()"><span aria-hidden="true" class="h-4 w-4 i-hugeicons-add-01"></span>New page</Button></div>
|
|
281
242
|
</header>
|
|
282
243
|
|
|
@@ -111,7 +111,7 @@ function submit(): void {
|
|
|
111
111
|
<Modal
|
|
112
112
|
:isOpen="open()"
|
|
113
113
|
:title="editing() ? 'Edit post' : 'New post'"
|
|
114
|
-
description="
|
|
114
|
+
description="The text, author, categories and tags are saved together."
|
|
115
115
|
size="xl"
|
|
116
116
|
:closable="!busy()"
|
|
117
117
|
@close="close"
|
|
@@ -134,7 +134,7 @@ function submit(): void {
|
|
|
134
134
|
<span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Author</span>
|
|
135
135
|
<select x-model="authorId" name="author_id" class="mt-1 px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-900 border border-gray-300 rounded-md dark:border-neutral-700">
|
|
136
136
|
<option value="">No author</option>
|
|
137
|
-
<
|
|
137
|
+
<option :for="author in authors()" :value="author.id">{{ author.name }} ({{ author.email }})</option>
|
|
138
138
|
</select>
|
|
139
139
|
</label>
|
|
140
140
|
<label class="flex gap-3 items-center self-end px-3 py-2 min-h-10 bg-gray-50 dark:bg-neutral-900/60 border border-gray-200 rounded-md dark:border-neutral-700">
|
|
@@ -167,18 +167,14 @@ function submit(): void {
|
|
|
167
167
|
<legend class="px-1 font-semibold text-gray-700 text-sm dark:text-neutral-200">Categories, {{ categoryIds().length }} selected</legend>
|
|
168
168
|
<div :if="categories().length === 0" class="text-gray-500 text-sm dark:text-neutral-400">No categories available.</div>
|
|
169
169
|
<div :else class="grid gap-2">
|
|
170
|
-
<
|
|
171
|
-
<label class="flex gap-2 items-center"><input x-model="categoryIds" name="category_ids" type="checkbox" :value="categoryOption.id" class="h-4 w-4 text-blue-600 border-gray-300 rounded" /><span class="text-gray-700 text-sm dark:text-neutral-200">{{ categoryOption.name }}</span></label>
|
|
172
|
-
</template>
|
|
170
|
+
<label :for="categoryOption in categories()" class="flex gap-2 items-center"><input x-model="categoryIds" name="category_ids" type="checkbox" :value="categoryOption.id" class="h-4 w-4 text-blue-600 border-gray-300 rounded" /><span class="text-gray-700 text-sm dark:text-neutral-200">{{ categoryOption.name }}</span></label>
|
|
173
171
|
</div>
|
|
174
172
|
</fieldset>
|
|
175
173
|
<fieldset class="p-4 border border-gray-200 rounded-lg dark:border-neutral-700">
|
|
176
174
|
<legend class="px-1 font-semibold text-gray-700 text-sm dark:text-neutral-200">Tags, {{ tagIds().length }} selected</legend>
|
|
177
175
|
<div :if="tags().length === 0" class="text-gray-500 text-sm dark:text-neutral-400">No tags available.</div>
|
|
178
176
|
<div :else class="grid gap-2 sm:grid-cols-2">
|
|
179
|
-
<
|
|
180
|
-
<label class="flex gap-2 items-center"><input x-model="tagIds" name="tag_ids" type="checkbox" :value="tag.id" class="h-4 w-4 text-blue-600 border-gray-300 rounded" /><span class="text-gray-700 text-sm dark:text-neutral-200">{{ tag.name }}</span></label>
|
|
181
|
-
</template>
|
|
177
|
+
<label :for="tag in tags()" class="flex gap-2 items-center"><input x-model="tagIds" name="tag_ids" type="checkbox" :value="tag.id" class="h-4 w-4 text-blue-600 border-gray-300 rounded" /><span class="text-gray-700 text-sm dark:text-neutral-200">{{ tag.name }}</span></label>
|
|
182
178
|
</div>
|
|
183
179
|
</fieldset>
|
|
184
180
|
</div>
|
|
@@ -8,6 +8,7 @@ export const blogUrl = publicApplicationUrl('/blog')
|
|
|
8
8
|
|
|
9
9
|
<script client>
|
|
10
10
|
import { dashboardApi } from '../../../../functions/dashboard-api'
|
|
11
|
+
import { useServerList } from '../../../../functions/dashboard-list'
|
|
11
12
|
import { pushToast } from '../../../../functions/toasts'
|
|
12
13
|
|
|
13
14
|
type PostStatus = 'draft' | 'published' | 'archived'
|
|
@@ -39,29 +40,17 @@ interface PostDraft {
|
|
|
39
40
|
tagIds: string[]
|
|
40
41
|
}
|
|
41
42
|
|
|
42
|
-
const posts = state<PostRecord[]>([])
|
|
43
43
|
const categories = state<OptionRecord[]>([])
|
|
44
44
|
const tags = state<OptionRecord[]>([])
|
|
45
45
|
const authors = state<AuthorRecord[]>([])
|
|
46
|
-
const loading = state(true)
|
|
47
|
-
const loadError = state('')
|
|
48
46
|
const statusFilter = state('all')
|
|
49
47
|
|
|
50
|
-
// The
|
|
51
|
-
// it was last asked for (stacksjs/stacks#3191). The cards count every post.
|
|
52
|
-
const page = state(1)
|
|
53
|
-
const perPage = state(25)
|
|
54
|
-
const search = state('')
|
|
55
|
-
const sort = state('')
|
|
56
|
-
const sortDirection = state('asc')
|
|
57
|
-
const total = state(0)
|
|
48
|
+
// The cards count every post (stacksjs/stacks#3191).
|
|
58
49
|
const allCount = state(0)
|
|
59
50
|
const publishedCount = state(0)
|
|
60
51
|
const draftCount = state(0)
|
|
61
52
|
const archivedCount = state(0)
|
|
62
53
|
const totalViewCount = state(0)
|
|
63
|
-
let listRequestId = 0
|
|
64
|
-
let searchTimer: ReturnType<typeof setTimeout> | undefined
|
|
65
54
|
|
|
66
55
|
const loadedContent = state('')
|
|
67
56
|
const contentLoading = state(false)
|
|
@@ -132,8 +121,8 @@ const COLUMNS = [
|
|
|
132
121
|
]
|
|
133
122
|
|
|
134
123
|
const ROW_ACTIONS = [
|
|
135
|
-
{ action: 'edit', label: 'Edit post'
|
|
136
|
-
{ action: 'delete', label: 'Delete post'
|
|
124
|
+
{ action: 'edit', label: 'Edit post' },
|
|
125
|
+
{ action: 'delete', label: 'Delete post' },
|
|
137
126
|
]
|
|
138
127
|
|
|
139
128
|
/**
|
|
@@ -142,7 +131,7 @@ const ROW_ACTIONS = [
|
|
|
142
131
|
* back into the component.
|
|
143
132
|
*/
|
|
144
133
|
function visiblePosts(): PostRecord[] {
|
|
145
|
-
return
|
|
134
|
+
return records()
|
|
146
135
|
.map(post => ({
|
|
147
136
|
...post,
|
|
148
137
|
summaryLabel: post.excerpt || post.preview,
|
|
@@ -198,89 +187,59 @@ interface PostPageResponse {
|
|
|
198
187
|
totalViews?: number
|
|
199
188
|
}
|
|
200
189
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
try {
|
|
221
|
-
const data = await dashboardApi<PostPageResponse>(`/api/dashboard/posts?${listQuery()}`)
|
|
222
|
-
if (requestId !== listRequestId)
|
|
223
|
-
return
|
|
190
|
+
// The server pages, searches, filters and sorts (stacksjs/stacks#3191);
|
|
191
|
+
// useServerList keeps the request order, paging, header sort and search
|
|
192
|
+
// debounce this page used to keep itself. Unsorted is newest first, which the
|
|
193
|
+
// server reads as created_at descending.
|
|
194
|
+
const {
|
|
195
|
+
records,
|
|
196
|
+
total,
|
|
197
|
+
page,
|
|
198
|
+
perPage,
|
|
199
|
+
search,
|
|
200
|
+
loading,
|
|
201
|
+
loadError,
|
|
202
|
+
load,
|
|
203
|
+
changePage,
|
|
204
|
+
changePageSize,
|
|
205
|
+
changeSort,
|
|
206
|
+
} = useServerList<PostRecord>({
|
|
207
|
+
fetch: async (query) => {
|
|
208
|
+
const data = await dashboardApi<PostPageResponse>(`/api/dashboard/posts?${query}`)
|
|
224
209
|
if (!Array.isArray(data.posts) || !Array.isArray(data.categories) || !Array.isArray(data.tags) || !Array.isArray(data.authors))
|
|
225
210
|
throw new TypeError('Posts were not returned in the expected shape.')
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
211
|
+
return { ...data, records: data.posts.map(normalizePost) }
|
|
212
|
+
},
|
|
213
|
+
defaultSort: { sort: 'created_at', direction: 'desc' },
|
|
214
|
+
// The table's sortable columns are named as the server sorts them.
|
|
215
|
+
columnSorts: { title: 'title', status: 'status', views: 'views' },
|
|
216
|
+
filters: () => ({ status: statusFilter() }),
|
|
217
|
+
searchParam: 'search',
|
|
218
|
+
onLoad: (result) => {
|
|
219
|
+
const data = result as PostPageResponse
|
|
220
|
+
categories.set((data.categories ?? []).map(normalizeOption))
|
|
221
|
+
tags.set((data.tags ?? []).map(normalizeOption))
|
|
222
|
+
authors.set((data.authors ?? []).map(normalizeAuthor))
|
|
234
223
|
allCount.set(Number(data.allCount || 0))
|
|
235
224
|
publishedCount.set(Number(data.publishedCount || 0))
|
|
236
225
|
draftCount.set(Number(data.draftCount || 0))
|
|
237
226
|
archivedCount.set(Number(data.archivedCount || 0))
|
|
238
227
|
totalViewCount.set(Number(data.totalViews || 0))
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
return
|
|
243
|
-
loadError.set(error instanceof Error ? error.message : String(error))
|
|
244
|
-
pushToast('error', 'Could not load posts', { detail: loadError() })
|
|
245
|
-
}
|
|
246
|
-
finally {
|
|
247
|
-
if (requestId === listRequestId)
|
|
248
|
-
loading.set(false)
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
function changePage(next: number): void {
|
|
253
|
-
page.set(next)
|
|
254
|
-
void loadPosts()
|
|
255
|
-
}
|
|
228
|
+
},
|
|
229
|
+
onError: error => pushToast('error', 'Could not load posts', { detail: error instanceof Error ? error.message : String(error) }),
|
|
230
|
+
})
|
|
256
231
|
|
|
257
|
-
function
|
|
258
|
-
|
|
259
|
-
page.set(1)
|
|
260
|
-
void loadPosts()
|
|
232
|
+
function loadPosts(): Promise<void> {
|
|
233
|
+
return load()
|
|
261
234
|
}
|
|
262
235
|
|
|
236
|
+
/** The table's own search box; useServerList waits for typing to pause. */
|
|
263
237
|
function changeSearch(term: string): void {
|
|
264
|
-
|
|
265
|
-
clearTimeout(searchTimer)
|
|
266
|
-
searchTimer = setTimeout(() => {
|
|
267
|
-
search.set(String(term || '').trim())
|
|
268
|
-
page.set(1)
|
|
269
|
-
void loadPosts()
|
|
270
|
-
}, 250)
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
function changeSort(next: { key: string, direction: string }): void {
|
|
274
|
-
sort.set(next.key || '')
|
|
275
|
-
sortDirection.set(next.direction === 'desc' ? 'desc' : 'asc')
|
|
276
|
-
page.set(1)
|
|
277
|
-
void loadPosts()
|
|
238
|
+
search.set(String(term || ''))
|
|
278
239
|
}
|
|
279
240
|
|
|
280
241
|
function changeStatus(event: Event): void {
|
|
281
242
|
statusFilter.set((event.target as HTMLSelectElement).value)
|
|
282
|
-
page.set(1)
|
|
283
|
-
void loadPosts()
|
|
284
243
|
}
|
|
285
244
|
|
|
286
245
|
async function loadEditorContent(post: PostRecord): Promise<void> {
|
|
@@ -391,7 +350,7 @@ onMount(() => { void loadPosts() })
|
|
|
391
350
|
|
|
392
351
|
<div class="space-y-6">
|
|
393
352
|
<header class="flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between">
|
|
394
|
-
<div><p class="font-semibold text-blue-600 text-xs tracking-wide uppercase dark:text-blue-400">
|
|
353
|
+
<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">Posts</h1><p class="mt-1 text-gray-500 text-sm dark:text-neutral-400">Write and publish articles, and manage their authors, categories and tags.</p></div>
|
|
395
354
|
<div class="flex flex-wrap gap-2"><Button href="{{ blogUrl }}" target="_blank" rel="noreferrer" variant="secondary"><span aria-hidden="true" class="h-4 w-4 i-hugeicons-view"></span>View blog</Button><Button :loading="loading()" variant="secondary" @click="loadPosts()"><span :if="!loading()" aria-hidden="true" class="h-4 w-4 i-hugeicons-refresh"></span>Refresh</Button><Button @click="openCreate()"><span aria-hidden="true" class="h-4 w-4 i-hugeicons-add-01"></span>New post</Button></div>
|
|
396
355
|
</header>
|
|
397
356
|
|
|
@@ -124,7 +124,7 @@ const filteredEntries = derived(() => {
|
|
|
124
124
|
* on a derived band and `badgeLabelKey` puts the number itself in the pill.
|
|
125
125
|
*/
|
|
126
126
|
const SEO_ROW_ACTIONS = [
|
|
127
|
-
{ action: 'edit', label: 'Edit SEO for'
|
|
127
|
+
{ action: 'edit', label: 'Edit SEO for' },
|
|
128
128
|
]
|
|
129
129
|
|
|
130
130
|
const SEO_COLUMNS = [
|
|
@@ -227,10 +227,10 @@ void loadEntries()
|
|
|
227
227
|
</script>
|
|
228
228
|
|
|
229
229
|
<template>
|
|
230
|
-
<div class="mx-auto pb-12 pt-6 px-6
|
|
230
|
+
<div class="flex flex-col gap-6 mx-auto pb-12 pt-6 px-6 max-w-7xl">
|
|
231
231
|
<PageHeader
|
|
232
232
|
title="SEO"
|
|
233
|
-
description="
|
|
233
|
+
description="How every post appears in search results: its title, description and focus keyword"
|
|
234
234
|
/>
|
|
235
235
|
|
|
236
236
|
<div class="px-4 py-3 text-blue-800 text-sm dark:text-blue-200 bg-blue-50 dark:bg-blue-500/10 border border-blue-200 rounded-lg dark:border-blue-500/20">
|
|
@@ -299,6 +299,7 @@ void loadEntries()
|
|
|
299
299
|
adding one to a working table, watching `/dependencies` stop
|
|
300
300
|
responding, and removing it again. See stacksjs/stx#2101. --}}
|
|
301
301
|
<Table
|
|
302
|
+
:framed="false"
|
|
302
303
|
:columns="SEO_COLUMNS"
|
|
303
304
|
:data="seoRows()"
|
|
304
305
|
:loading="loading()"
|
|
@@ -306,7 +307,7 @@ void loadEntries()
|
|
|
306
307
|
paginated
|
|
307
308
|
:page-size="25"
|
|
308
309
|
empty-title="No matching posts"
|
|
309
|
-
empty-description="Adjust the search or score filter, or create a
|
|
310
|
+
empty-description="Adjust the search or score filter, or create a post first."
|
|
310
311
|
:row-actions="SEO_ROW_ACTIONS"
|
|
311
312
|
action-label-key="title"
|
|
312
313
|
@row-action="openEdit($event.row)"
|