@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
|
@@ -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 =
|
|
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
|
-
|
|
125
|
-
|
|
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
|
-
<
|
|
310
|
-
<
|
|
311
|
-
|
|
312
|
-
|
|
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="
|
|
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="
|
|
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="
|
|
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
|
-
<
|
|
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
|
-
<
|
|
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'
|
|
47
|
-
{ action: 'delete', label: 'Delete restaurant waitlist entry for'
|
|
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'
|
|
58
|
-
{ action: 'delete', label: 'Delete author'
|
|
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">
|
|
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
|
|
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
|
|
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-
|
|
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-
|
|
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
|
|
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
|
|
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
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
const data = await dashboardApi<CommentPageResponse>(`/api/dashboard/comments?${
|
|
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
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
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
|
-
|
|
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
|
-
|
|
168
|
-
|
|
169
|
-
|
|
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">
|
|
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><
|
|
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">
|
|
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
|
|
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
|
-
<
|
|
347
|
-
<
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
<
|
|
354
|
-
|
|
355
|
-
|
|
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'
|
|
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">
|
|
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
|
-
<
|
|
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
|
-
</
|
|
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
|
-
<
|
|
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
|
-
<
|
|
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
|
-
<
|
|
499
|
-
<
|
|
500
|
-
|
|
501
|
-
|
|
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
|
-
<
|
|
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
|
-
<
|
|
75
|
-
<div>
|
|
76
|
-
|
|
77
|
-
|
|
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
|
-
<
|
|
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]">
|