@stacksjs/defaults 0.70.54
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/LICENSE.md +21 -0
- package/README.md +2 -0
- package/package.json +20 -0
- package/resources/assets/fonts/013717e9.woff +0 -0
- package/resources/assets/fonts/03355817.woff2 +0 -0
- package/resources/assets/fonts/0380de7e.woff2 +0 -0
- package/resources/assets/fonts/0ba5d32a.woff +0 -0
- package/resources/assets/fonts/0bd57ddf.woff2 +0 -0
- package/resources/assets/fonts/19de0a60.woff2 +0 -0
- package/resources/assets/fonts/20b87e84.woff +0 -0
- package/resources/assets/fonts/4bbc67e1.woff +0 -0
- package/resources/assets/fonts/576fb0d7.woff +0 -0
- package/resources/assets/fonts/5ea10ee5.woff2 +0 -0
- package/resources/assets/fonts/6413fc0a.woff +0 -0
- package/resources/assets/fonts/72c114cf.woff +0 -0
- package/resources/assets/fonts/73c57e73.woff2 +0 -0
- package/resources/assets/fonts/813dca6c.woff +0 -0
- package/resources/assets/fonts/8a9b0995.woff2 +0 -0
- package/resources/assets/fonts/90b4832f.woff +0 -0
- package/resources/assets/fonts/9394ab85.woff2 +0 -0
- package/resources/assets/fonts/9b3c7d7f.woff2 +0 -0
- package/resources/assets/fonts/Monaco.ttf +0 -0
- package/resources/assets/fonts/b1b36d74.woff +0 -0
- package/resources/assets/fonts/b5d74798.woff2 +0 -0
- package/resources/assets/fonts/b9f81a4d.woff +0 -0
- package/resources/assets/fonts/c9784008.woff2 +0 -0
- package/resources/assets/fonts/cf692227.woff +0 -0
- package/resources/assets/fonts/d1c6ab51.woff2 +0 -0
- package/resources/assets/fonts/e2eb62fc.woff +0 -0
- package/resources/assets/fonts/fe21f8d8.woff2 +0 -0
- package/resources/assets/fonts/nps/CampmateScript-Regular.woff2 +0 -0
- package/resources/assets/fonts/nps/NPS_2026-variable.woff2 +0 -0
- package/resources/assets/fonts/nps/RedwoodSerif-Regular.woff2 +0 -0
- package/resources/assets/fonts/nps/SequoiaSans-Regular.woff2 +0 -0
- package/resources/assets/fonts/nps/Switchback-Regular.woff2 +0 -0
- package/resources/assets/images/app-icon.png +0 -0
- package/resources/assets/images/bg-img.png +0 -0
- package/resources/assets/images/park-ridge.svg +15 -0
- package/resources/assets/images/topography.svg +1 -0
- package/resources/assets/scripts/main.ts +2153 -0
- package/resources/assets/styles/README.md +19 -0
- package/resources/assets/styles/docs/main.css +1 -0
- package/resources/assets/styles/docs/overrides.css +1 -0
- package/resources/assets/styles/docs/vars.css +8 -0
- package/resources/assets/styles/main.css +1419 -0
- package/resources/components/Button.stx +70 -0
- package/resources/components/Buttons/BaseButton.stx +39 -0
- package/resources/components/Buttons/Counter.stx +28 -0
- package/resources/components/Buttons/ToggleDark.stx +11 -0
- package/resources/components/Container.stx +10 -0
- package/resources/components/Dashboard/.gitkeep +0 -0
- package/resources/components/Dashboard/Auth/ForgotPassword.stx +127 -0
- package/resources/components/Dashboard/Auth/Login.stx +212 -0
- package/resources/components/Dashboard/Auth/Register.stx +306 -0
- package/resources/components/Dashboard/Avatar.stx +123 -0
- package/resources/components/Dashboard/Billing/ActivePlan.stx +57 -0
- package/resources/components/Dashboard/Billing/CardBrands.stx +32 -0
- package/resources/components/Dashboard/Billing/CardForm.stx +34 -0
- package/resources/components/Dashboard/Billing/OneTimePayment.stx +28 -0
- package/resources/components/Dashboard/Billing/PaymentForm.stx +33 -0
- package/resources/components/Dashboard/Billing/PaymentMethod.stx +66 -0
- package/resources/components/Dashboard/Billing/PaymentMethodList.stx +52 -0
- package/resources/components/Dashboard/Billing/Plans.stx +136 -0
- package/resources/components/Dashboard/Buttons/AppButton.stx +48 -0
- package/resources/components/Dashboard/Buttons/IconButton.stx +20 -0
- package/resources/components/Dashboard/Card.stx +78 -0
- package/resources/components/Dashboard/Chart.stx +75 -0
- package/resources/components/Dashboard/CodeEditor.stx +41 -0
- package/resources/components/Dashboard/Commerce/BulkActionBar.stx +70 -0
- package/resources/components/Dashboard/Commerce/CategoriesTable.stx +133 -0
- package/resources/components/Dashboard/Commerce/CouponsTable.stx +161 -0
- package/resources/components/Dashboard/Commerce/CustomersTable.stx +142 -0
- package/resources/components/Dashboard/Commerce/Delivery/DeliveryRoutesTable.stx +80 -0
- package/resources/components/Dashboard/Commerce/Delivery/DigitalDeliveryTable.stx +85 -0
- package/resources/components/Dashboard/Commerce/Delivery/DriversTable.stx +99 -0
- package/resources/components/Dashboard/Commerce/Delivery/LicenseKeysTable.stx +92 -0
- package/resources/components/Dashboard/Commerce/Delivery/LicenseTemplatesTable.stx +88 -0
- package/resources/components/Dashboard/Commerce/Delivery/Pagination.stx +122 -0
- package/resources/components/Dashboard/Commerce/Delivery/SearchFilter.stx +23 -0
- package/resources/components/Dashboard/Commerce/Delivery/ShippingMethodsTable.stx +80 -0
- package/resources/components/Dashboard/Commerce/Delivery/ShippingRatesTable.stx +59 -0
- package/resources/components/Dashboard/Commerce/Delivery/ShippingZonesTable.stx +71 -0
- package/resources/components/Dashboard/Commerce/Delivery/TabNavigation.stx +36 -0
- package/resources/components/Dashboard/Commerce/Forms/CouponsForm.stx +191 -0
- package/resources/components/Dashboard/Commerce/OrdersTable.stx +131 -0
- package/resources/components/Dashboard/Commerce/ProductsTable.stx +170 -0
- package/resources/components/Dashboard/CreateRecordModal.stx +363 -0
- package/resources/components/Dashboard/DashboardLayout.stx +155 -0
- package/resources/components/Dashboard/Deployments/ActivityFeed.stx +54 -0
- package/resources/components/Dashboard/Deployments/DeployScript.stx +23 -0
- package/resources/components/Dashboard/Deployments/DeploymentHistory.stx +97 -0
- package/resources/components/Dashboard/Deployments/DeploymentList.stx +94 -0
- package/resources/components/Dashboard/Deployments/LiveTerminalOutput.stx +18 -0
- package/resources/components/Dashboard/Elements/Dropdown.stx +57 -0
- package/resources/components/Dashboard/Email/EmailActivityChart.stx +111 -0
- package/resources/components/Dashboard/Email/EmailCompose.stx +72 -0
- package/resources/components/Dashboard/Email/EmailDetail.stx +105 -0
- package/resources/components/Dashboard/Email/EmailList.stx +117 -0
- package/resources/components/Dashboard/Email/EmailSearch.stx +40 -0
- package/resources/components/Dashboard/Email/EmailSidebar.stx +133 -0
- package/resources/components/Dashboard/GlobalSearch.stx +124 -0
- package/resources/components/Dashboard/MobileSidebar.stx +47 -0
- package/resources/components/Dashboard/Modals/BaseModal.stx +50 -0
- package/resources/components/Dashboard/Modals/Popups/Alert.stx +112 -0
- package/resources/components/Dashboard/Modals/Popups/Toast.stx +70 -0
- package/resources/components/Dashboard/Modals/ToastWrapper.stx +35 -0
- package/resources/components/Dashboard/Monitoring/ErrorDetailModal.stx +228 -0
- package/resources/components/Dashboard/Monitoring/ErrorsTable.stx +184 -0
- package/resources/components/Dashboard/Navbar.stx +194 -0
- package/resources/components/Dashboard/NavbarModern.stx +188 -0
- package/resources/components/Dashboard/NotificationErrorModal.stx +105 -0
- package/resources/components/Dashboard/NotificationStatusBadge.stx +20 -0
- package/resources/components/Dashboard/Pagination.stx +90 -0
- package/resources/components/Dashboard/Queue/QueueTable.stx +127 -0
- package/resources/components/Dashboard/Settings/Forms/AIForm.stx +126 -0
- package/resources/components/Dashboard/Settings/Forms/AnalyticsForm.stx +52 -0
- package/resources/components/Dashboard/Settings/Forms/AppForm.stx +157 -0
- package/resources/components/Dashboard/Settings/Forms/CLIForm.stx +66 -0
- package/resources/components/Dashboard/Settings/Forms/CacheForm.stx +253 -0
- package/resources/components/Dashboard/Settings/Forms/CloudForm.stx +441 -0
- package/resources/components/Dashboard/Settings/Forms/DNSForm.stx +307 -0
- package/resources/components/Dashboard/Settings/Forms/DatabaseForm.stx +168 -0
- package/resources/components/Dashboard/Settings/Forms/EmailForm.stx +100 -0
- package/resources/components/Dashboard/Settings/Forms/FileSystemForm.stx +259 -0
- package/resources/components/Dashboard/Settings/Forms/HashingForm.stx +119 -0
- package/resources/components/Dashboard/Settings/Forms/LibraryForm.stx +389 -0
- package/resources/components/Dashboard/Settings/Forms/QueueForm.stx +219 -0
- package/resources/components/Dashboard/Settings/Forms/SearchEngineForm.stx +48 -0
- package/resources/components/Dashboard/Settings/Forms/SecurityForm.stx +143 -0
- package/resources/components/Dashboard/Settings/Forms/ServicesForm.stx +194 -0
- package/resources/components/Dashboard/Settings/Forms/StorageForm.stx +191 -0
- package/resources/components/Dashboard/Settings/Forms/TeamsForm.stx +33 -0
- package/resources/components/Dashboard/Settings/SettingsFormManager.stx +181 -0
- package/resources/components/Dashboard/SettingsHeader.stx +88 -0
- package/resources/components/Dashboard/SettingsSidebar.stx +234 -0
- package/resources/components/Dashboard/Sidebar.stx +23 -0
- package/resources/components/Dashboard/SidebarModern.stx +249 -0
- package/resources/components/Dashboard/Skeleton/LoadingCard.stx +15 -0
- package/resources/components/Dashboard/Skeleton/LoadingDetails.stx +26 -0
- package/resources/components/Dashboard/Table.stx +82 -0
- package/resources/components/Dashboard/TerminalContainer.stx +97 -0
- package/resources/components/Dashboard/Tooltip.stx +166 -0
- package/resources/components/Dashboard/Transaction/index.stx +88 -0
- package/resources/components/Dashboard/UI/ActivityTable.stx +54 -0
- package/resources/components/Dashboard/UI/Avatar.stx +102 -0
- package/resources/components/Dashboard/UI/Badge.stx +66 -0
- package/resources/components/Dashboard/UI/Button.stx +73 -0
- package/resources/components/Dashboard/UI/Card.stx +51 -0
- package/resources/components/Dashboard/UI/ChartCard.stx +36 -0
- package/resources/components/Dashboard/UI/Checkbox.stx +74 -0
- package/resources/components/Dashboard/UI/ConfirmDialog.stx +74 -0
- package/resources/components/Dashboard/UI/DataTable.stx +45 -0
- package/resources/components/Dashboard/UI/Dropdown.stx +72 -0
- package/resources/components/Dashboard/UI/DropdownItem.stx +80 -0
- package/resources/components/Dashboard/UI/EmptyState.stx +50 -0
- package/resources/components/Dashboard/UI/FilterBar.stx +48 -0
- package/resources/components/Dashboard/UI/Input.stx +77 -0
- package/resources/components/Dashboard/UI/Modal.stx +75 -0
- package/resources/components/Dashboard/UI/PageHeader.stx +69 -0
- package/resources/components/Dashboard/UI/PageLayout.stx +84 -0
- package/resources/components/Dashboard/UI/Pagination.stx +126 -0
- package/resources/components/Dashboard/UI/QuickLinks.stx +31 -0
- package/resources/components/Dashboard/UI/RouterLink.stx +31 -0
- package/resources/components/Dashboard/UI/Select.stx +84 -0
- package/resources/components/Dashboard/UI/ServiceHealth.stx +38 -0
- package/resources/components/Dashboard/UI/StatsCard.stx +79 -0
- package/resources/components/Dashboard/UI/Table.stx +143 -0
- package/resources/components/Dashboard/UI/Tabs.stx +45 -0
- package/resources/components/Dashboard/UI/Textarea.stx +93 -0
- package/resources/components/Dashboard/UI/Toggle.stx +84 -0
- package/resources/components/Dashboard/UI/WindowControls.stx +135 -0
- package/resources/components/Dashboard/Widget.stx +89 -0
- package/resources/components/Dashboard/WindowControls.stx +119 -0
- package/resources/components/Dashboard/index.ts +106 -0
- package/resources/components/Docs/Demo/ComboboxCode.md +114 -0
- package/resources/components/Docs/Demo/ComboboxDemo.stx +91 -0
- package/resources/components/Docs/Demo/DialogCode.md +42 -0
- package/resources/components/Docs/Demo/DialogDemo.stx +76 -0
- package/resources/components/Docs/Demo/DocsPlayground.stx +39 -0
- package/resources/components/Docs/Demo/DropdownCode.md +109 -0
- package/resources/components/Docs/Demo/DropdownDemo.stx +82 -0
- package/resources/components/Docs/Demo/Hero.stx +100 -0
- package/resources/components/Docs/Demo/ListboxCode.md +87 -0
- package/resources/components/Docs/Demo/ListboxDemo.stx +59 -0
- package/resources/components/Docs/Demo/NotificationCode.md +173 -0
- package/resources/components/Docs/Demo/NotificationDemo.stx +99 -0
- package/resources/components/Docs/Demo/PopoverCode.md +161 -0
- package/resources/components/Docs/Demo/PopoverDemo.stx +96 -0
- package/resources/components/Docs/Demo/RadioGroupCode.md +98 -0
- package/resources/components/Docs/Demo/RadioGroupDemo.stx +53 -0
- package/resources/components/Docs/Demo/StepperCode.md +216 -0
- package/resources/components/Docs/Demo/StepperDemo.stx +137 -0
- package/resources/components/Docs/Demo/SwitchCode.md +24 -0
- package/resources/components/Docs/Demo/SwitchDemo.stx +28 -0
- package/resources/components/Docs/Home.stx +7 -0
- package/resources/components/Docs/HomeContributors.stx +23 -0
- package/resources/components/Docs/HomeSponsors.stx +17 -0
- package/resources/components/Docs/HomeTeam.stx +18 -0
- package/resources/components/Docs/TeamMember.stx +79 -0
- package/resources/components/Email/EmailButton.stx +32 -0
- package/resources/components/Email/EmailDivider.stx +20 -0
- package/resources/components/Email/EmailImage.stx +24 -0
- package/resources/components/Email/EmailLayout.stx +55 -0
- package/resources/components/Email/EmailLink.stx +22 -0
- package/resources/components/Email/EmailSection.stx +20 -0
- package/resources/components/Email/EmailText.stx +30 -0
- package/resources/components/Forum/ForumBreadcrumb.stx +38 -0
- package/resources/components/Forum/ForumCategory.stx +16 -0
- package/resources/components/Forum/ForumCategoryItem.stx +46 -0
- package/resources/components/Forum/ForumLayout.stx +36 -0
- package/resources/components/Forum/ForumPagination.stx +39 -0
- package/resources/components/Forum/ForumPost.stx +71 -0
- package/resources/components/Forum/ForumReplyForm.stx +76 -0
- package/resources/components/Forum/ForumSidebar.stx +86 -0
- package/resources/components/Forum/ForumTopicItem.stx +77 -0
- package/resources/components/Forum/ForumTopicList.stx +23 -0
- package/resources/components/HelloWorld.stx +253 -0
- package/resources/components/Logo.stx +10 -0
- package/resources/components/Marketing/CallToAction.stx +30 -0
- package/resources/components/Marketing/ComingSoon.stx +155 -0
- package/resources/components/Marketing/Faqs.stx +99 -0
- package/resources/components/Marketing/Feature.stx +32 -0
- package/resources/components/Marketing/Fields.stx +28 -0
- package/resources/components/Marketing/Footer.stx +33 -0
- package/resources/components/Marketing/Header.stx +51 -0
- package/resources/components/Marketing/Hero.stx +46 -0
- package/resources/components/Marketing/Layout.stx +26 -0
- package/resources/components/Marketing/NavLink.stx +13 -0
- package/resources/components/Marketing/Plan.stx +43 -0
- package/resources/components/Marketing/Pricing.stx +120 -0
- package/resources/components/Marketing/PrimaryFeatures.stx +80 -0
- package/resources/components/Marketing/PrimaryFeatures2.stx +98 -0
- package/resources/components/Marketing/SecondaryFeatures.stx +80 -0
- package/resources/components/Marketing/Testimonials.stx +120 -0
- package/resources/components/Pagination.stx +149 -0
- package/resources/components/Playground.stx +9 -0
- package/resources/components/README.md +87 -0
- package/resources/components/Storefront/AnnouncementBar.stx +17 -0
- package/resources/components/Storefront/CartDrawer.stx +227 -0
- package/resources/components/Storefront/CheckoutSteps.stx +50 -0
- package/resources/components/Storefront/Footer.stx +81 -0
- package/resources/components/Storefront/Header.stx +66 -0
- package/resources/components/Storefront/OrderSummary.stx +79 -0
- package/resources/components/Storefront/ProductCard.stx +63 -0
- package/resources/components/Storefront/ProductGallery.stx +88 -0
- package/resources/components/Storefront/QuantitySelector.stx +97 -0
- package/resources/components/index.ts +13 -0
- package/resources/emails/email-verification.stx +46 -0
- package/resources/emails/layouts/base.html +113 -0
- package/resources/emails/password-changed.stx +55 -0
- package/resources/emails/password-reset.stx +43 -0
- package/resources/emails/subscription-confirmation.stx +99 -0
- package/resources/emails/welcome.stx +48 -0
- package/resources/functions/README.md +28 -0
- package/resources/functions/counter.ts +13 -0
- package/resources/functions/dark.ts +4 -0
- package/resources/functions/dashboard/analytics.ts +238 -0
- package/resources/functions/dashboard/config-io.ts +316 -0
- package/resources/functions/dashboard/data.ts +375 -0
- package/resources/functions/dashboard/library.ts +250 -0
- package/resources/functions/dashboard/sidebar.ts +537 -0
- package/resources/functions/dashboard/system.ts +150 -0
- package/resources/layouts/403.stx +188 -0
- package/resources/layouts/404.stx +34 -0
- package/resources/layouts/README.md +14 -0
- package/resources/layouts/dashboard/default.stx +20 -0
- package/resources/layouts/dashboard/guest.stx +10 -0
- package/resources/layouts/default.stx +3 -0
- package/resources/layouts/maintenance.stx +11 -0
- package/resources/layouts/storefront.stx +73 -0
- package/resources/layouts/system-tray/default.stx +3 -0
- package/resources/modules/.gitkeep +0 -0
- package/resources/plugins/.gitkeep +0 -0
- package/resources/plugins/preloader.ts +308 -0
- package/resources/types/README.md +3 -0
- package/resources/views/cart.stx +149 -0
- package/resources/views/checkout/contact.stx +101 -0
- package/resources/views/checkout/payment.stx +114 -0
- package/resources/views/checkout/shipping.stx +120 -0
- package/resources/views/coming-soon.stx +9 -0
- package/resources/views/dashboard/custom-page.stx +45 -0
- package/resources/views/dashboard/index.stx +24 -0
- package/resources/views/emails/welcome.stx +0 -0
- package/resources/views/errors/tester.stx +26 -0
- package/resources/views/index.stx +2865 -0
- package/resources/views/orders/[id].stx +130 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* System-level dashboard helpers — service health probes, env / config
|
|
3
|
+
* snapshots. Read-only; safe to call on every page render.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { existsSync, readFileSync } from 'node:fs'
|
|
7
|
+
import { resolve } from 'node:path'
|
|
8
|
+
import process from 'node:process'
|
|
9
|
+
|
|
10
|
+
import { loadModel, safeAll } from './data'
|
|
11
|
+
|
|
12
|
+
export interface ServiceStatus {
|
|
13
|
+
name: string
|
|
14
|
+
status: 'healthy' | 'degraded' | 'offline' | 'unknown'
|
|
15
|
+
detail: string
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
let projectRootCache: string | null = null
|
|
19
|
+
function projectRoot(): string {
|
|
20
|
+
if (projectRootCache) return projectRootCache
|
|
21
|
+
let dir = process.cwd()
|
|
22
|
+
for (let i = 0; i < 8; i++) {
|
|
23
|
+
if (existsSync(resolve(dir, 'storage/framework/defaults'))) {
|
|
24
|
+
projectRootCache = dir
|
|
25
|
+
return dir
|
|
26
|
+
}
|
|
27
|
+
const parent = resolve(dir, '..')
|
|
28
|
+
if (parent === dir) break
|
|
29
|
+
dir = parent
|
|
30
|
+
}
|
|
31
|
+
projectRootCache = process.cwd()
|
|
32
|
+
return projectRootCache
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Probe each core service's status. The "probe" for the database is
|
|
37
|
+
* just a User.count() — if it resolves we know the connection works and
|
|
38
|
+
* the schema migrated. The other services don't have a cheap dev-time
|
|
39
|
+
* probe yet, so they report "unknown" with a hint about how to test.
|
|
40
|
+
*/
|
|
41
|
+
export async function getServiceHealth(): Promise<ServiceStatus[]> {
|
|
42
|
+
const out: ServiceStatus[] = []
|
|
43
|
+
|
|
44
|
+
// Database
|
|
45
|
+
try {
|
|
46
|
+
const User = await loadModel('User')
|
|
47
|
+
if (User?._isStub) {
|
|
48
|
+
out.push({ name: 'Database', status: 'unknown', detail: 'Model not loaded' })
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
const count = typeof User.count === 'function' ? await User.count() : (await safeAll(User)).length
|
|
52
|
+
out.push({
|
|
53
|
+
name: 'Database',
|
|
54
|
+
status: count > 0 ? 'healthy' : 'degraded',
|
|
55
|
+
detail: count > 0 ? `${count} users` : 'Schema reachable, no rows — run buddy seed',
|
|
56
|
+
})
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
catch (e: any) {
|
|
60
|
+
out.push({ name: 'Database', status: 'offline', detail: e?.message || 'Connection failed' })
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Cache — read driver from env, no live ping yet
|
|
64
|
+
const cacheDriver = process.env.CACHE_DRIVER || 'memory'
|
|
65
|
+
out.push({ name: 'Cache', status: 'healthy', detail: `${cacheDriver} driver` })
|
|
66
|
+
|
|
67
|
+
// Queue
|
|
68
|
+
const queueDriver = process.env.QUEUE_CONNECTION || 'sync'
|
|
69
|
+
try {
|
|
70
|
+
const Job = await loadModel('Job')
|
|
71
|
+
const FailedJob = await loadModel('FailedJob')
|
|
72
|
+
const pending = await safeAll(Job)
|
|
73
|
+
const failed = await safeAll(FailedJob)
|
|
74
|
+
out.push({
|
|
75
|
+
name: 'Queue',
|
|
76
|
+
status: failed.length > 0 ? 'degraded' : 'healthy',
|
|
77
|
+
detail: `${queueDriver} · ${pending.length} pending, ${failed.length} failed`,
|
|
78
|
+
})
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
out.push({ name: 'Queue', status: 'unknown', detail: `${queueDriver} driver` })
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Storage
|
|
85
|
+
const storageDriver = process.env.FILESYSTEM_DISK || 'local'
|
|
86
|
+
const publicDir = resolve(projectRoot(), 'storage/app/public')
|
|
87
|
+
out.push({
|
|
88
|
+
name: 'Storage',
|
|
89
|
+
status: existsSync(publicDir) ? 'healthy' : 'degraded',
|
|
90
|
+
detail: `${storageDriver} disk`,
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
return out
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface EnvSummary {
|
|
97
|
+
appEnv: string
|
|
98
|
+
appUrl: string
|
|
99
|
+
nodeVersion: string
|
|
100
|
+
bunVersion: string
|
|
101
|
+
dbDriver: string
|
|
102
|
+
dbPath: string
|
|
103
|
+
cacheDriver: string
|
|
104
|
+
queueDriver: string
|
|
105
|
+
mailDriver: string
|
|
106
|
+
storageDriver: string
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Snapshot env-driven configuration for the Environment / Settings pages.
|
|
111
|
+
* Strips secrets — only driver names and non-sensitive paths are exposed.
|
|
112
|
+
*/
|
|
113
|
+
export function getEnvSummary(): EnvSummary {
|
|
114
|
+
return {
|
|
115
|
+
appEnv: process.env.NODE_ENV || process.env.APP_ENV || 'development',
|
|
116
|
+
appUrl: process.env.APP_URL || 'http://localhost:3000',
|
|
117
|
+
nodeVersion: process.version,
|
|
118
|
+
bunVersion: typeof Bun !== 'undefined' ? Bun.version : 'n/a',
|
|
119
|
+
dbDriver: process.env.DB_CONNECTION || 'sqlite',
|
|
120
|
+
dbPath: process.env.DB_DATABASE_PATH || 'database/stacks.sqlite',
|
|
121
|
+
cacheDriver: process.env.CACHE_DRIVER || 'memory',
|
|
122
|
+
queueDriver: process.env.QUEUE_CONNECTION || 'sync',
|
|
123
|
+
mailDriver: process.env.MAIL_MAILER || 'log',
|
|
124
|
+
storageDriver: process.env.FILESYSTEM_DISK || 'local',
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Read the project's root package.json. Used by the Library / Home
|
|
130
|
+
* pages to display project metadata.
|
|
131
|
+
*/
|
|
132
|
+
export function readPackageJson(): { name: string, version: string, dependencies: Record<string, string>, devDependencies: Record<string, string> } {
|
|
133
|
+
const root = projectRoot()
|
|
134
|
+
const file = resolve(root, 'package.json')
|
|
135
|
+
if (!existsSync(file)) {
|
|
136
|
+
return { name: 'unknown', version: '0.0.0', dependencies: {}, devDependencies: {} }
|
|
137
|
+
}
|
|
138
|
+
try {
|
|
139
|
+
const json = JSON.parse(readFileSync(file, 'utf8'))
|
|
140
|
+
return {
|
|
141
|
+
name: json.name || 'unknown',
|
|
142
|
+
version: json.version || '0.0.0',
|
|
143
|
+
dependencies: json.dependencies || {},
|
|
144
|
+
devDependencies: json.devDependencies || {},
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
catch {
|
|
148
|
+
return { name: 'unknown', version: '0.0.0', dependencies: {}, devDependencies: {} }
|
|
149
|
+
}
|
|
150
|
+
}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
<script server>
|
|
2
|
+
const appName = props.appName || 'Your App'
|
|
3
|
+
const supportEmail = props.supportEmail || 'support@example.com'
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
<div class="flex flex-col lg:flex-row min-h-screen bg-gradient-to-br from-slate-50 to-slate-100">
|
|
7
|
+
<!-- Left side content -->
|
|
8
|
+
<div class="flex items-center justify-center p-8 w-full lg:w-1/2">
|
|
9
|
+
<div class="max-w-xl w-full">
|
|
10
|
+
<div class="flex items-center justify-between mb-16">
|
|
11
|
+
<div class="flex items-center space-x-2">
|
|
12
|
+
<h1 class="font-bold text-slate-900 text-xl">{{ appName }}</h1>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<div class="">
|
|
17
|
+
<h2 class="mb-4 font-bold text-6xl text-slate-900">
|
|
18
|
+
Access Denied
|
|
19
|
+
</h2>
|
|
20
|
+
<p class="mb-8 font-bold text-8xl bounce" style="animation-duration: 1s; animation-iteration-count: 2;">
|
|
21
|
+
403
|
|
22
|
+
</p>
|
|
23
|
+
<p class="mb-8 text-slate-600 text-xl">
|
|
24
|
+
Sorry, you don't have permission to access this page.
|
|
25
|
+
</p>
|
|
26
|
+
|
|
27
|
+
<div class="flex gap-4 sm:flex-row">
|
|
28
|
+
<a
|
|
29
|
+
href="/"
|
|
30
|
+
class="flex items-center justify-center px-6 py-3 w-full sm:w-auto text-white bg-slate-500 hover:bg-slate-600 rounded-lg duration-200 transition-colors"
|
|
31
|
+
>
|
|
32
|
+
<i class="mr-2 h-5 w-5 i-hugeicons-home-03"></i>
|
|
33
|
+
Back to Home
|
|
34
|
+
</a>
|
|
35
|
+
|
|
36
|
+
<a
|
|
37
|
+
href="javascript:history.back()"
|
|
38
|
+
class="flex items-center justify-center px-6 py-3 w-full sm:w-auto text-slate-700 hover:bg-slate-50 border border-slate-300 rounded-lg duration-200 transition-colors"
|
|
39
|
+
>
|
|
40
|
+
<i class="mr-2 h-5 w-5 i-hugeicons-arrow-left-02"></i>
|
|
41
|
+
Go Back
|
|
42
|
+
</a>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<div class="mt-16 pt-8 border-slate-200 border-t">
|
|
47
|
+
<p class="text-slate-600">
|
|
48
|
+
Need help? Contact us at
|
|
49
|
+
<a href="mailto:{{ supportEmail }}" class="text-slate-500 hover:text-slate-600">
|
|
50
|
+
{{ supportEmail }}
|
|
51
|
+
</a>
|
|
52
|
+
</p>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
<!-- Right side SVG -->
|
|
58
|
+
<div class="flex overflow-hidden relative items-center justify-center h-[100vh] w-full lg:w-1/2">
|
|
59
|
+
<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
60
|
+
<defs>
|
|
61
|
+
<linearGradient id="a" x1="50%" x2="50%" y1="100%" y2="0%">
|
|
62
|
+
<stop offset="0" stop-color="#76c3c3"/>
|
|
63
|
+
<stop offset="1" stop-color="#183468"/>
|
|
64
|
+
</linearGradient>
|
|
65
|
+
<linearGradient id="b" x1="100%" x2="0%" y1="50%" y2="50%">
|
|
66
|
+
<stop offset="0" stop-color="#486587"/>
|
|
67
|
+
<stop offset=".3323" stop-color="#183352"/>
|
|
68
|
+
<stop offset=".6667" stop-color="#264a6e"/>
|
|
69
|
+
<stop offset="1" stop-color="#183352"/>
|
|
70
|
+
</linearGradient>
|
|
71
|
+
<linearGradient id="c" x1="49.87%" x2="48.5%" y1="3.62%" y2="100%">
|
|
72
|
+
<stop offset="0" stop-color="#e0f2fa"/>
|
|
73
|
+
<stop offset=".0898" stop-color="#89bed6"/>
|
|
74
|
+
<stop offset=".3298" stop-color="#1e3c6e"/>
|
|
75
|
+
<stop offset="1" stop-color="#1b376b"/>
|
|
76
|
+
</linearGradient>
|
|
77
|
+
<linearGradient id="d">
|
|
78
|
+
<stop offset="0" stop-color="#b0ddf1"/>
|
|
79
|
+
<stop offset="1" stop-color="#325c82"/>
|
|
80
|
+
</linearGradient>
|
|
81
|
+
<linearGradient id="e" x1="49.87%" x2="49.87%" xlink:href="#d" y1="3.62%" y2="77.75%"/>
|
|
82
|
+
<linearGradient id="f">
|
|
83
|
+
<stop offset="0" stop-color="#1d3a6d"/>
|
|
84
|
+
<stop offset="1" stop-color="#467994"/>
|
|
85
|
+
</linearGradient>
|
|
86
|
+
<linearGradient id="g" x1="91.59%" x2="66.97%" xlink:href="#f" y1="5.89%" y2="100%"/>
|
|
87
|
+
<linearGradient id="h" x1="97.27%" x2="52.53%" xlink:href="#f" y1="6.88%" y2="100%"/>
|
|
88
|
+
<linearGradient id="i" x1="82.73%" x2="41.46%" xlink:href="#f" y1="41.06%" y2="167.23%"/>
|
|
89
|
+
<linearGradient id="j" x1="49.87%" x2="49.87%" xlink:href="#d" y1="3.62%" y2="100.77%"/>
|
|
90
|
+
<linearGradient id="k" x1="100%" x2="72.45%" xlink:href="#f" y1="0%" y2="85.2%"/>
|
|
91
|
+
<linearGradient id="l" x1="100%" x2="62.1%" y1="0%" y2="68.86%">
|
|
92
|
+
<stop offset="0" stop-color="#163055"/>
|
|
93
|
+
<stop offset="1" stop-color="#2f587f"/>
|
|
94
|
+
</linearGradient>
|
|
95
|
+
<circle id="m" cx="180" cy="102" r="40"/>
|
|
96
|
+
<filter id="n" height="340%" width="340%" x="-120%" y="-120%">
|
|
97
|
+
<feOffset in="SourceAlpha" result="shadowOffsetOuter1"/>
|
|
98
|
+
<feGaussianBlur in="shadowOffsetOuter1" result="shadowBlurOuter1" stdDeviation="32"/>
|
|
99
|
+
<feColorMatrix in="shadowBlurOuter1" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.696473053 0"/>
|
|
100
|
+
</filter>
|
|
101
|
+
<linearGradient id="o" x1="0%" y1="50%" y2="50%">
|
|
102
|
+
<stop offset="0" stop-color="#fff" stop-opacity="0"/>
|
|
103
|
+
<stop offset="1" stop-color="#fff"/>
|
|
104
|
+
</linearGradient>
|
|
105
|
+
</defs>
|
|
106
|
+
<g fill="none" fill-rule="evenodd">
|
|
107
|
+
<path d="m0 0h1024v1024h-1024z" fill="url(#a)"/>
|
|
108
|
+
<g transform="translate(761 481)">
|
|
109
|
+
<path d="m96 27 4-1v11h-4z" fill="#8dbcd2"/>
|
|
110
|
+
<path d="m76 23 4-1v15h-4z" fill="#8dbcd2"/>
|
|
111
|
+
<g fill="#183352">
|
|
112
|
+
<path d="m40 22 4 1v14h-4z"/>
|
|
113
|
+
<path d="m20 26 4 1v14h-4z"/>
|
|
114
|
+
<path d="m59 0h2v20h-2z" opacity=".5"/>
|
|
115
|
+
</g>
|
|
116
|
+
<path d="m61 0c3 0 3 2 6 2s3-2 6-2 3 2 6 2v8c-3 0-3-2-6-2s-3 2-6 2-3-2-6-2z" fill="url(#b)"/>
|
|
117
|
+
<path d="m50 20 10-2v110h-60l10-100 10-2v10.92l10-.98v-11.94l10-2v12.96l10-.98z" fill="#8dbcd2"/>
|
|
118
|
+
<path d="m100 26 10 2 10 100h-60v-110l10 2v13.98l10 .98v-12.96l10 2v11.94l10 .98z" fill="#183352"/>
|
|
119
|
+
</g>
|
|
120
|
+
<g transform="translate(0 565)">
|
|
121
|
+
<path d="m1024 385h-1024v-278.14c118.4 21.09 185.14 57.03 327.4 48.14 198.54-12.4 250-125 500-125 90.18 0 147.92 16.3 196.6 37.12z" fill="url(#c)"/>
|
|
122
|
+
<path d="m1024 355h-1024v-275.44c76.46-35.75 137.14-79.56 285-79.56 250 0 301.46 112.6 500 125 103.24 6.45 166.7-10.7 239-28.66z" fill="url(#e)"/>
|
|
123
|
+
<path d="m344.12 130.57c23.1 13.47-25.27 81.95-145.12 205.43h649c-344.06-141.7-512.02-210.17-503.88-205.43z" fill="url(#e)"/>
|
|
124
|
+
<path d="m0 336v-256.44c76.46-35.75 137.14-79.56 285-79.56 71.14 0 86.22 26.04 32.5 82-48 50 147.33 58.02 36 136.5-40.67 28.67 21.17 67.83 185.5 117.5z" fill="url(#g)"/>
|
|
125
|
+
<path d="m317.5 82c-48 50 147.33 58.02 36 136.5-40.67 28.67 21.17 67.83 185.5 117.5h-484z" fill="url(#h)"/>
|
|
126
|
+
<path d="m353.5 218.5c-40.67 28.67 21.17 67.83 185.5 117.5h-364z" fill="url(#i)"/>
|
|
127
|
+
<path d="m0 459v-194.46c100.25 21.2 167.18 50.29 296.67 42.19 198.57-12.43 250.04-125.15 500.07-125.15 109.75 0 171.47 24.16 227.26 51.25v226.17z" fill="url(#j)"/>
|
|
128
|
+
<path d="m1024 459h-177.84c51.95-58.9 48.86-97.16-9.28-114.78-186.64-56.58-101.76-162.64-39.97-162.64 109.64 0 171.34 24.12 227.09 51.19z" fill="url(#k)"/>
|
|
129
|
+
<path d="m1024 459h-177.81c52.01-59.01 48.94-97.34-9.22-115l187.03 53.48z" fill="url(#l)"/>
|
|
130
|
+
</g>
|
|
131
|
+
<g id="moonGroup">
|
|
132
|
+
<g transform="translate(94 23)">
|
|
133
|
+
<use fill="#000" filter="url(#n)" xlink:href="#m"/>
|
|
134
|
+
<use fill="#d2f1fe" xlink:href="#m"/>
|
|
135
|
+
</g>
|
|
136
|
+
</g>
|
|
137
|
+
<g transform="translate(94 23)">
|
|
138
|
+
<use fill="#000" filter="url(#n)" xlink:href="#m"/>
|
|
139
|
+
<g fill="#fff">
|
|
140
|
+
<circle cx="123" cy="255" fill-opacity=".4" r="3"/>
|
|
141
|
+
<circle cx="2" cy="234" r="2"/>
|
|
142
|
+
<circle cx="33" cy="65" r="3"/>
|
|
143
|
+
<circle cx="122" cy="2" r="2"/>
|
|
144
|
+
<circle cx="72" cy="144" r="2"/>
|
|
145
|
+
<circle cx="282" cy="224" r="2"/>
|
|
146
|
+
<circle cx="373" cy="65" opacity=".4" r="3"/>
|
|
147
|
+
<circle cx="433" cy="255" r="3"/>
|
|
148
|
+
</g>
|
|
149
|
+
<path d="m373.25 325.25a5 5 0 0 0 0-10h-75v10z" fill="url(#o)" opacity=".4" transform="matrix(.70710678 .70710678 -.70710678 .70710678 325.523078 -145.38023)"/>
|
|
150
|
+
<g fill="#fff">
|
|
151
|
+
<circle cx="363" cy="345" r="3"/>
|
|
152
|
+
<circle cx="513" cy="115" r="3"/>
|
|
153
|
+
<circle cx="723" cy="5" opacity=".4" r="3"/>
|
|
154
|
+
<circle cx="422" cy="134" r="2"/>
|
|
155
|
+
<circle cx="752" cy="204" r="2"/>
|
|
156
|
+
<circle cx="672" cy="114" r="2"/>
|
|
157
|
+
<circle cx="853" cy="255" opacity=".4" r="3"/>
|
|
158
|
+
<circle cx="623" cy="225" r="3"/>
|
|
159
|
+
<circle cx="823" cy="55" r="3"/>
|
|
160
|
+
<circle cx="902" cy="144" r="2"/>
|
|
161
|
+
<circle cx="552" cy="14" r="2"/>
|
|
162
|
+
</g>
|
|
163
|
+
</g>
|
|
164
|
+
<path d="m796 535a4 4 0 0 1 4 4v20h-8v-20a4 4 0 0 1 4-4z" fill="#486587"/>
|
|
165
|
+
<path d="m798 535.54a4 4 0 0 0 -2 3.46v20h-4v-20a4 4 0 0 1 6-3.46zm48-.54a4 4 0 0 1 4 4v20h-8v-20a4 4 0 0 1 4-4z" fill="#071423"/>
|
|
166
|
+
<path d="m846 559v-20a4 4 0 0 0 -2-3.46 4 4 0 0 1 6 3.46v20z" fill="#8dbcd2"/>
|
|
167
|
+
<path d="m554.67 131.48a9.46 9.46 0 0 1 13.33 0 9.46 9.46 0 0 0 13.33 0l13.33-13.24a28.39 28.39 0 0 1 40 0l10 9.93a14.2 14.2 0 0 0 20 0 14.2 14.2 0 0 1 20 0l.6.6a31.8 31.8 0 0 1 9.4 22.56h-146.66v-3.84c0-6.01 2.4-11.78 6.67-16.01zm196.33-123.23c11.07-11 28.93-11 40 0l10 9.94a14.19 14.19 0 0 0 20 0 14.19 14.19 0 0 1 20 0 16.36 16.36 0 0 0 21.3 1.5l8.7-6.47a33.47 33.47 0 0 1 40 0l4.06 3.03a39.6 39.6 0 0 1 15.94 31.75h-200c0-12.72 8.93-28.75 20-39.75zm-736.9 66.89.9-.9a21.29 21.29 0 0 1 30 0 21.29 21.29 0 0 0 30 0l10-9.93a35.48 35.48 0 0 1 50 0l15 14.9a14.2 14.2 0 0 0 20 0 14.2 14.2 0 0 1 20 0c6.4 6.35 10 15 10 24.02v5.77h-200c0-12.71 5.07-24.9 14.1-33.86z" fill="#fff" opacity=".07" transform="translate(54 301)"/>
|
|
168
|
+
</g>
|
|
169
|
+
</svg>
|
|
170
|
+
</div>
|
|
171
|
+
</div>
|
|
172
|
+
|
|
173
|
+
<style>
|
|
174
|
+
@keyframes floatMoon {
|
|
175
|
+
0% { transform: translateX(0); }
|
|
176
|
+
50% { transform: translateX(20px); }
|
|
177
|
+
100% { transform: translateX(0); }
|
|
178
|
+
}
|
|
179
|
+
#moonGroup {
|
|
180
|
+
animation: floatMoon 4s ease-in-out infinite;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
@keyframes waveTop {
|
|
184
|
+
0% { transform: translateY(0); }
|
|
185
|
+
50% { transform: translateY(-2px); }
|
|
186
|
+
100% { transform: translateY(0); }
|
|
187
|
+
}
|
|
188
|
+
</style>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script server>
|
|
2
|
+
const backgroundImage = props.backgroundImage || '/images/background-auth.jpg'
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<div class="flex relative justify-center shrink-0 md:px-12 lg:px-0 min-h-full">
|
|
6
|
+
<div class="flex relative z-10 flex-1 flex-col sm:justify-center md:flex-none px-4 py-10 md:px-28 bg-white shadow-2xl">
|
|
7
|
+
<main class="mx-auto sm:px-4 md:px-0 max-w-md w-full md:max-w-sm md:w-96">
|
|
8
|
+
<div class="flex">
|
|
9
|
+
<a href="/" aria-label="Home">
|
|
10
|
+
<Logo class="h-10 w-auto" />
|
|
11
|
+
</a>
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
<p class="mt-20 font-medium text-gray-700 text-sm">
|
|
15
|
+
404
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
<h1 class="mt-3 font-semibold text-gray-900 text-lg">
|
|
19
|
+
Page not found
|
|
20
|
+
</h1>
|
|
21
|
+
|
|
22
|
+
<p class="mt-3 text-gray-700 text-sm">
|
|
23
|
+
Sorry, we couldn't find the page you're looking for.
|
|
24
|
+
</p>
|
|
25
|
+
|
|
26
|
+
<a href="/" class="inline-block mt-10 px-4 py-2 text-white bg-blue-600 hover:bg-blue-700 rounded">
|
|
27
|
+
Go back home
|
|
28
|
+
</a>
|
|
29
|
+
</main>
|
|
30
|
+
</div>
|
|
31
|
+
<div class="hidden sm:contents lg:block lg:relative lg:flex-1">
|
|
32
|
+
<img class="absolute inset-0 object-cover h-full w-full" src="{{ backgroundImage }}" alt="">
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
## Layouts
|
|
2
|
+
|
|
3
|
+
Vue components in this dir are used as layouts.
|
|
4
|
+
|
|
5
|
+
By default, `default.stx` will be used unless an alternative is specified in the route meta.
|
|
6
|
+
|
|
7
|
+
With [`unplugin-vue-router`](https://github.com/posva/unplugin-vue-router) and [`vite-plugin-layouts`](https://github.com/stacksjs/vite-plugin-layouts), you can specify the layout in the page's SFCs like this:
|
|
8
|
+
|
|
9
|
+
```html
|
|
10
|
+
<route lang="yaml">
|
|
11
|
+
meta:
|
|
12
|
+
layout: home
|
|
13
|
+
</route>
|
|
14
|
+
```
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<div>
|
|
2
|
+
<!-- Off-canvas menu for mobile, show/hide based on off-canvas menu state. -->
|
|
3
|
+
<MobileSidebar />
|
|
4
|
+
<Sidebar />
|
|
5
|
+
|
|
6
|
+
<div class="lg:pl-64">
|
|
7
|
+
<Navbar />
|
|
8
|
+
|
|
9
|
+
<main class="bg-neutral-50 dark:bg-neutral-900">
|
|
10
|
+
<slot />
|
|
11
|
+
</main>
|
|
12
|
+
|
|
13
|
+
<Toast />
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
<style>
|
|
17
|
+
body {
|
|
18
|
+
@apply dark:bg-neutral-900 bg-neutral-50;
|
|
19
|
+
}
|
|
20
|
+
</style>
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<script server>
|
|
2
|
+
/**
|
|
3
|
+
* Default storefront layout.
|
|
4
|
+
*
|
|
5
|
+
* Pages extend "layouts/storefront" and the framework wires in
|
|
6
|
+
* the announcement bar, sticky header (with live cart-count badge),
|
|
7
|
+
* footer, and slide-in cart drawer. To customize the brand, copy this
|
|
8
|
+
* file to `resources/views/layouts/storefront.stx` in your project and
|
|
9
|
+
* pass the props you want — the STX layout resolver walks up from the
|
|
10
|
+
* calling file looking for a `layouts/` directory, so the project
|
|
11
|
+
* copy wins for any view also under `resources/views/`.
|
|
12
|
+
*
|
|
13
|
+
* Note: framework-default pages (cart.stx, checkout/*.stx, orders/
|
|
14
|
+
* [id].stx) live under storage/framework/defaults/resources/views/, so
|
|
15
|
+
* they resolve THIS layout by the upward walk — not the project's.
|
|
16
|
+
* Stick to real STX directives only (if / yield / section / stack);
|
|
17
|
+
* unrecognized at-directives are scanned even inside script-server
|
|
18
|
+
* comments and can leave structural mismatches downstream that hang
|
|
19
|
+
* the request handler.
|
|
20
|
+
*
|
|
21
|
+
* The cart count is read from the storefront's session cookie so the
|
|
22
|
+
* badge is correct on first paint, before any client-side JS runs.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
const Database = require('bun:sqlite').Database
|
|
26
|
+
const path = require('path')
|
|
27
|
+
|
|
28
|
+
const dbPath = path.resolve(process.cwd(), process.env.DB_DATABASE_PATH || 'database/stacks.sqlite')
|
|
29
|
+
|
|
30
|
+
let cartCount = 0
|
|
31
|
+
try {
|
|
32
|
+
const sessionToken = (typeof requestContext !== 'undefined') ? requestContext.cookie('stacks_cart') : null
|
|
33
|
+
if (sessionToken) {
|
|
34
|
+
const db = new Database(dbPath, { readonly: true })
|
|
35
|
+
const cart = db.query(`SELECT total_items FROM carts WHERE session_token = ?1 AND status = 'active' LIMIT 1`).get(sessionToken)
|
|
36
|
+
if (cart && cart.total_items)
|
|
37
|
+
cartCount = Number(cart.total_items) || 0
|
|
38
|
+
db.close()
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
catch { /* schema not migrated yet, or db missing — render an empty header */ }
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<!DOCTYPE html>
|
|
45
|
+
<html lang="en" class="text-stone-900 bg-stone-50">
|
|
46
|
+
<head>
|
|
47
|
+
<meta charset="UTF-8">
|
|
48
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
49
|
+
<title>@yield('title', 'Stacks Store')</title>
|
|
50
|
+
<meta name="description" content="@yield('description', 'A storefront powered by Stacks.')">
|
|
51
|
+
{{-- Constrain the SPA router to swap only <main>; @stacksjs/stx auto-
|
|
52
|
+
injects __stxRouterConfig with container:'body', which would erase
|
|
53
|
+
the header/footer on every navigation. STX_ROUTER_OPTIONS is checked
|
|
54
|
+
last by the router's Object.assign, so this wins. --}}
|
|
55
|
+
<script>window.STX_ROUTER_OPTIONS = { container: 'main' };</script>
|
|
56
|
+
</head>
|
|
57
|
+
<body class="antialiased font-serif text-stone-900 bg-stone-50">
|
|
58
|
+
|
|
59
|
+
<AnnouncementBar />
|
|
60
|
+
|
|
61
|
+
<Header :cartCount="cartCount" />
|
|
62
|
+
|
|
63
|
+
<main>
|
|
64
|
+
@yield('content')
|
|
65
|
+
</main>
|
|
66
|
+
|
|
67
|
+
<Footer />
|
|
68
|
+
|
|
69
|
+
<CartDrawer />
|
|
70
|
+
|
|
71
|
+
@stack('scripts')
|
|
72
|
+
</body>
|
|
73
|
+
</html>
|
|
File without changes
|
|
File without changes
|