create-pet-adopt 0.0.0 → 0.3.0
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 +21 -0
- package/README.md +120 -0
- package/index.js +920 -0
- package/package.json +43 -1
- package/template/.env.example +136 -0
- package/template/.pet-adopt/template.json +581 -0
- package/template/LICENSE +21 -0
- package/template/README.md +109 -0
- package/template/_gitignore +28 -0
- package/template/_pnpm-lock.yaml +9251 -0
- package/template/assets/sample-pet.png +0 -0
- package/template/components.json +25 -0
- package/template/docker-compose.yml +110 -0
- package/template/drizzle/pg/0000_initial.sql +176 -0
- package/template/drizzle/pg/0001_greedy_the_renegades.sql +1 -0
- package/template/drizzle/pg/0002_fuzzy_the_renegades.sql +1 -0
- package/template/drizzle/pg/0003_thin_multiple_man.sql +1 -0
- package/template/drizzle/pg/0004_boring_norman_osborn.sql +15 -0
- package/template/drizzle/pg/0005_bitter_proemial_gods.sql +3 -0
- package/template/drizzle/pg/0006_friendly_black_knight.sql +2 -0
- package/template/drizzle/pg/0007_wise_ozymandias.sql +11 -0
- package/template/drizzle/pg/0008_messy_human_fly.sql +2 -0
- package/template/drizzle/pg/0009_amused_lady_bullseye.sql +1 -0
- package/template/drizzle/pg/0010_cute_mauler.sql +7 -0
- package/template/drizzle/pg/0011_clear_purple_man.sql +3 -0
- package/template/drizzle/pg/0012_tiresome_gunslinger.sql +2 -0
- package/template/drizzle/pg/0013_awesome_wong.sql +18 -0
- package/template/drizzle/pg/0014_fantastic_sumo.sql +12 -0
- package/template/drizzle/pg/0015_pink_carnage.sql +12 -0
- package/template/drizzle/pg/0016_sloppy_king_bedlam.sql +2 -0
- package/template/drizzle/pg/0017_steep_warhawk.sql +15 -0
- package/template/drizzle/pg/0018_mixed_otto_octavius.sql +4 -0
- package/template/drizzle/pg/0019_talented_rocket_raccoon.sql +1 -0
- package/template/drizzle/pg/0020_worthless_zodiak.sql +19 -0
- package/template/drizzle/pg/0021_adorable_squadron_supreme.sql +1 -0
- package/template/drizzle/pg/0022_soft_pixie.sql +5 -0
- package/template/drizzle/pg/0023_fluffy_quasar.sql +1 -0
- package/template/drizzle/pg/0024_uneven_ken_ellis.sql +2 -0
- package/template/drizzle/pg/0025_rich_white_queen.sql +3 -0
- package/template/drizzle/pg/0026_spooky_komodo.sql +16 -0
- package/template/drizzle/pg/0027_big_thunderbolts.sql +2 -0
- package/template/drizzle/pg/meta/0000_snapshot.json +1265 -0
- package/template/drizzle/pg/meta/0001_snapshot.json +1272 -0
- package/template/drizzle/pg/meta/0002_snapshot.json +1278 -0
- package/template/drizzle/pg/meta/0003_snapshot.json +1284 -0
- package/template/drizzle/pg/meta/0004_snapshot.json +1401 -0
- package/template/drizzle/pg/meta/0005_snapshot.json +1401 -0
- package/template/drizzle/pg/meta/0006_snapshot.json +1414 -0
- package/template/drizzle/pg/meta/0007_snapshot.json +1485 -0
- package/template/drizzle/pg/meta/0008_snapshot.json +1504 -0
- package/template/drizzle/pg/meta/0009_snapshot.json +1510 -0
- package/template/drizzle/pg/meta/0010_snapshot.json +1556 -0
- package/template/drizzle/pg/meta/0011_snapshot.json +1574 -0
- package/template/drizzle/pg/meta/0012_snapshot.json +1586 -0
- package/template/drizzle/pg/meta/0013_snapshot.json +1730 -0
- package/template/drizzle/pg/meta/0014_snapshot.json +1805 -0
- package/template/drizzle/pg/meta/0015_snapshot.json +1883 -0
- package/template/drizzle/pg/meta/0016_snapshot.json +1897 -0
- package/template/drizzle/pg/meta/0017_snapshot.json +2013 -0
- package/template/drizzle/pg/meta/0018_snapshot.json +1988 -0
- package/template/drizzle/pg/meta/0019_snapshot.json +1994 -0
- package/template/drizzle/pg/meta/0020_snapshot.json +2108 -0
- package/template/drizzle/pg/meta/0021_snapshot.json +2114 -0
- package/template/drizzle/pg/meta/0022_snapshot.json +2126 -0
- package/template/drizzle/pg/meta/0023_snapshot.json +2132 -0
- package/template/drizzle/pg/meta/0024_snapshot.json +2151 -0
- package/template/drizzle/pg/meta/0025_snapshot.json +2169 -0
- package/template/drizzle/pg/meta/0026_snapshot.json +2294 -0
- package/template/drizzle/pg/meta/0027_snapshot.json +2330 -0
- package/template/drizzle/pg/meta/_journal.json +202 -0
- package/template/drizzle/sqlite/0000_initial.sql +176 -0
- package/template/drizzle/sqlite/0001_easy_sebastian_shaw.sql +1 -0
- package/template/drizzle/sqlite/0002_past_king_cobra.sql +1 -0
- package/template/drizzle/sqlite/0003_organic_masked_marvel.sql +1 -0
- package/template/drizzle/sqlite/0004_panoramic_inhumans.sql +15 -0
- package/template/drizzle/sqlite/0005_small_sunset_bain.sql +19 -0
- package/template/drizzle/sqlite/0006_narrow_medusa.sql +2 -0
- package/template/drizzle/sqlite/0007_gray_grandmaster.sql +10 -0
- package/template/drizzle/sqlite/0008_chief_toxin.sql +1 -0
- package/template/drizzle/sqlite/0009_vengeful_tag.sql +1 -0
- package/template/drizzle/sqlite/0010_kind_klaw.sql +7 -0
- package/template/drizzle/sqlite/0011_overrated_meltdown.sql +3 -0
- package/template/drizzle/sqlite/0012_robust_next_avengers.sql +2 -0
- package/template/drizzle/sqlite/0013_melodic_kitty_pryde.sql +18 -0
- package/template/drizzle/sqlite/0014_stormy_cyclops.sql +12 -0
- package/template/drizzle/sqlite/0015_parallel_mongu.sql +11 -0
- package/template/drizzle/sqlite/0016_grey_quicksilver.sql +2 -0
- package/template/drizzle/sqlite/0017_daily_psylocke.sql +15 -0
- package/template/drizzle/sqlite/0018_whole_redwing.sql +4 -0
- package/template/drizzle/sqlite/0019_spotty_mandroid.sql +1 -0
- package/template/drizzle/sqlite/0020_wild_wendell_rand.sql +19 -0
- package/template/drizzle/sqlite/0021_calm_lockheed.sql +1 -0
- package/template/drizzle/sqlite/0022_lonely_emma_frost.sql +5 -0
- package/template/drizzle/sqlite/0023_elite_tony_stark.sql +1 -0
- package/template/drizzle/sqlite/0024_little_lily_hollister.sql +1 -0
- package/template/drizzle/sqlite/0025_tough_shotgun.sql +3 -0
- package/template/drizzle/sqlite/0026_faithful_mephistopheles.sql +16 -0
- package/template/drizzle/sqlite/0027_rapid_arclight.sql +2 -0
- package/template/drizzle/sqlite/meta/0000_snapshot.json +1237 -0
- package/template/drizzle/sqlite/meta/0001_snapshot.json +1245 -0
- package/template/drizzle/sqlite/meta/0002_snapshot.json +1252 -0
- package/template/drizzle/sqlite/meta/0003_snapshot.json +1259 -0
- package/template/drizzle/sqlite/meta/0004_snapshot.json +1369 -0
- package/template/drizzle/sqlite/meta/0005_snapshot.json +1369 -0
- package/template/drizzle/sqlite/meta/0006_snapshot.json +1384 -0
- package/template/drizzle/sqlite/meta/0007_snapshot.json +1459 -0
- package/template/drizzle/sqlite/meta/0008_snapshot.json +1479 -0
- package/template/drizzle/sqlite/meta/0009_snapshot.json +1486 -0
- package/template/drizzle/sqlite/meta/0010_snapshot.json +1533 -0
- package/template/drizzle/sqlite/meta/0011_snapshot.json +1554 -0
- package/template/drizzle/sqlite/meta/0012_snapshot.json +1568 -0
- package/template/drizzle/sqlite/meta/0013_snapshot.json +1687 -0
- package/template/drizzle/sqlite/meta/0014_snapshot.json +1769 -0
- package/template/drizzle/sqlite/meta/0015_snapshot.json +1852 -0
- package/template/drizzle/sqlite/meta/0016_snapshot.json +1867 -0
- package/template/drizzle/sqlite/meta/0017_snapshot.json +1973 -0
- package/template/drizzle/sqlite/meta/0018_snapshot.json +1944 -0
- package/template/drizzle/sqlite/meta/0019_snapshot.json +1951 -0
- package/template/drizzle/sqlite/meta/0020_snapshot.json +2077 -0
- package/template/drizzle/sqlite/meta/0021_snapshot.json +2084 -0
- package/template/drizzle/sqlite/meta/0022_snapshot.json +2098 -0
- package/template/drizzle/sqlite/meta/0023_snapshot.json +2105 -0
- package/template/drizzle/sqlite/meta/0024_snapshot.json +2125 -0
- package/template/drizzle/sqlite/meta/0025_snapshot.json +2146 -0
- package/template/drizzle/sqlite/meta/0026_snapshot.json +2265 -0
- package/template/drizzle/sqlite/meta/0027_snapshot.json +2280 -0
- package/template/drizzle/sqlite/meta/_journal.json +202 -0
- package/template/drizzle.pg.config.ts +8 -0
- package/template/drizzle.sqlite.config.ts +8 -0
- package/template/eslint.config.mjs +22 -0
- package/template/next.config.ts +153 -0
- package/template/package.json +102 -0
- package/template/pet-adopt.blocks.ts +9 -0
- package/template/pet-adopt.config.ts +17 -0
- package/template/pnpm-workspace.yaml +19 -0
- package/template/postcss.config.mjs +5 -0
- package/template/scripts/check-routes.ts +405 -0
- package/template/scripts/check-schemas.ts +58 -0
- package/template/scripts/migrate-all.ts +25 -0
- package/template/scripts/migrate-on-build.ts +71 -0
- package/template/scripts/migrate.ts +20 -0
- package/template/scripts/plugin-generate.ts +92 -0
- package/template/scripts/reset-password.ts +45 -0
- package/template/scripts/reset-two-factor.ts +53 -0
- package/template/scripts/seed.ts +79 -0
- package/template/scripts/setup-env.ts +91 -0
- package/template/scripts/storage-check.ts +53 -0
- package/template/src/app/(admin)/admin/account/AccountForms.tsx +194 -0
- package/template/src/app/(admin)/admin/account/page.tsx +59 -0
- package/template/src/app/(admin)/admin/activity/page.tsx +76 -0
- package/template/src/app/(admin)/admin/authentication/archived/page.tsx +24 -0
- package/template/src/app/(admin)/admin/authentication/layout.tsx +20 -0
- package/template/src/app/(admin)/admin/authentication/page.tsx +36 -0
- package/template/src/app/(admin)/admin/authentication/providers/page.tsx +33 -0
- package/template/src/app/(admin)/admin/email/layout.tsx +21 -0
- package/template/src/app/(admin)/admin/email/page.tsx +43 -0
- package/template/src/app/(admin)/admin/email/templates/page.tsx +38 -0
- package/template/src/app/(admin)/admin/error.tsx +36 -0
- package/template/src/app/(admin)/admin/layout.tsx +26 -0
- package/template/src/app/(admin)/admin/loading.tsx +9 -0
- package/template/src/app/(admin)/admin/media/[id]/page.tsx +97 -0
- package/template/src/app/(admin)/admin/media/page.tsx +34 -0
- package/template/src/app/(admin)/admin/media/search-params.ts +16 -0
- package/template/src/app/(admin)/admin/page.tsx +79 -0
- package/template/src/app/(admin)/admin/pages/PageForm.tsx +604 -0
- package/template/src/app/(admin)/admin/pages/[id]/page.tsx +51 -0
- package/template/src/app/(admin)/admin/pages/new/page.tsx +19 -0
- package/template/src/app/(admin)/admin/pages/page.tsx +49 -0
- package/template/src/app/(admin)/admin/pets/PetForm.tsx +437 -0
- package/template/src/app/(admin)/admin/pets/[id]/page.tsx +41 -0
- package/template/src/app/(admin)/admin/pets/new/page.tsx +26 -0
- package/template/src/app/(admin)/admin/pets/page.tsx +70 -0
- package/template/src/app/(admin)/admin/pets/search-params.ts +16 -0
- package/template/src/app/(admin)/admin/plugins/[plugin]/[[...path]]/page.tsx +73 -0
- package/template/src/app/(admin)/admin/plugins/page.tsx +66 -0
- package/template/src/app/(admin)/admin/settings/SettingsForm.tsx +644 -0
- package/template/src/app/(admin)/admin/settings/email/page.tsx +9 -0
- package/template/src/app/(admin)/admin/settings/page.tsx +40 -0
- package/template/src/app/(admin)/admin/settings/templates/page.tsx +9 -0
- package/template/src/app/(admin)/admin/theme/[id]/page.tsx +28 -0
- package/template/src/app/(admin)/admin/theme/page.tsx +30 -0
- package/template/src/app/(admin)/admin/users/page.tsx +33 -0
- package/template/src/app/(admin)/layout.tsx +75 -0
- package/template/src/app/(admin)/providers.tsx +42 -0
- package/template/src/app/(auth)/admin/confirm-email/page.tsx +40 -0
- package/template/src/app/(auth)/admin/invite/page.tsx +38 -0
- package/template/src/app/(auth)/admin/login/DemoSignIn.tsx +69 -0
- package/template/src/app/(auth)/admin/login/page.tsx +83 -0
- package/template/src/app/(auth)/admin/reset-password/page.tsx +73 -0
- package/template/src/app/(auth)/error.tsx +9 -0
- package/template/src/app/(auth)/layout.tsx +71 -0
- package/template/src/app/(editor)/EditorToast.tsx +43 -0
- package/template/src/app/(editor)/edit/[id]/PageEditor.tsx +586 -0
- package/template/src/app/(editor)/edit/[id]/actions.ts +139 -0
- package/template/src/app/(editor)/edit/[id]/page.tsx +76 -0
- package/template/src/app/(editor)/edit/[id]/preview/page.tsx +81 -0
- package/template/src/app/(editor)/edit/email/[id]/EmailEditor.tsx +236 -0
- package/template/src/app/(editor)/edit/email/[id]/page.tsx +64 -0
- package/template/src/app/(editor)/edit/theme-preview/page.tsx +94 -0
- package/template/src/app/(editor)/editor.css +223 -0
- package/template/src/app/(editor)/error.tsx +32 -0
- package/template/src/app/(editor)/layout.tsx +67 -0
- package/template/src/app/(frontend)/[slug]/page.tsx +53 -0
- package/template/src/app/(frontend)/fonts.ts +8 -0
- package/template/src/app/(frontend)/layout.tsx +107 -0
- package/template/src/app/(frontend)/not-found.tsx +16 -0
- package/template/src/app/(frontend)/page.tsx +42 -0
- package/template/src/app/(frontend)/pets/[slug]/page.tsx +92 -0
- package/template/src/app/(frontend)/pets/page.tsx +42 -0
- package/template/src/app/(frontend)/styles.css +537 -0
- package/template/src/app/(setup)/error.tsx +9 -0
- package/template/src/app/(setup)/layout.tsx +41 -0
- package/template/src/app/(setup)/setup/page.tsx +105 -0
- package/template/src/app/(setup)/setup/storage-check.ts +43 -0
- package/template/src/app/api/auth/[...all]/route.ts +144 -0
- package/template/src/app/health/route.ts +9 -0
- package/template/src/app/media/[...path]/route.ts +45 -0
- package/template/src/app/media/email/[name]/route.ts +60 -0
- package/template/src/app/robots.ts +19 -0
- package/template/src/app/sitemap.ts +24 -0
- package/template/src/components/admin/AdminNav.tsx +153 -0
- package/template/src/components/admin/AdminShell.tsx +107 -0
- package/template/src/components/admin/DemoNotice.tsx +31 -0
- package/template/src/components/admin/EmailConfirmBanner.tsx +44 -0
- package/template/src/components/admin/EmptyState.tsx +10 -0
- package/template/src/components/admin/ErrorSummary.tsx +72 -0
- package/template/src/components/admin/MediaDetails.tsx +218 -0
- package/template/src/components/admin/MediaGrid.tsx +307 -0
- package/template/src/components/admin/MediaLibrary.tsx +103 -0
- package/template/src/components/admin/MediaPager.tsx +66 -0
- package/template/src/components/admin/PageHeader.tsx +22 -0
- package/template/src/components/admin/PhoneInput.tsx +128 -0
- package/template/src/components/admin/PluginWidgetBoundary.tsx +38 -0
- package/template/src/components/admin/PluginWidgets.tsx +51 -0
- package/template/src/components/admin/RemountOnNavigate.tsx +37 -0
- package/template/src/components/admin/StatusBadge.tsx +16 -0
- package/template/src/components/admin/UploadPhotosDialog.tsx +387 -0
- package/template/src/components/admin/UserAvatar.tsx +18 -0
- package/template/src/components/admin/UserMenu.tsx +118 -0
- package/template/src/components/admin/ViewSiteLink.tsx +24 -0
- package/template/src/components/admin/account/ConnectedProviders.tsx +91 -0
- package/template/src/components/admin/account/DeleteAccountCard.tsx +136 -0
- package/template/src/components/admin/account/EmailCard.tsx +137 -0
- package/template/src/components/admin/account/ProfilePicture.tsx +159 -0
- package/template/src/components/admin/activity/ActivityFilters.tsx +146 -0
- package/template/src/components/admin/activity/ActivityLog.tsx +159 -0
- package/template/src/components/admin/activity/RecentActivity.tsx +52 -0
- package/template/src/components/admin/demo-mode.tsx +17 -0
- package/template/src/components/admin/nav-items.ts +47 -0
- package/template/src/components/admin/pages/PageDetails.tsx +198 -0
- package/template/src/components/admin/pages/PageVersions.tsx +296 -0
- package/template/src/components/admin/pages/PagesTable.tsx +467 -0
- package/template/src/components/admin/pets/FilterBar.tsx +154 -0
- package/template/src/components/admin/pets/PetCard.tsx +170 -0
- package/template/src/components/admin/pets/PetList.tsx +112 -0
- package/template/src/components/admin/pets/PetListSkeleton.tsx +84 -0
- package/template/src/components/admin/pets/PetPagination.tsx +91 -0
- package/template/src/components/admin/pets/form/AgeFields.tsx +132 -0
- package/template/src/components/admin/pets/form/LocationFields.tsx +231 -0
- package/template/src/components/admin/pets/form/MediaPickerDialog.tsx +359 -0
- package/template/src/components/admin/pets/form/PhotosField.tsx +176 -0
- package/template/src/components/admin/pets/form/RichTextField.tsx +438 -0
- package/template/src/components/admin/pets/form/SeoImageField.tsx +87 -0
- package/template/src/components/admin/pets/form/SeoPreview.tsx +142 -0
- package/template/src/components/admin/pets/form/fields.tsx +434 -0
- package/template/src/components/admin/pets/form/rich-text-extensions.ts +45 -0
- package/template/src/components/admin/pets/timeline/PetTimeline.tsx +297 -0
- package/template/src/components/admin/pets/timeline/TimelineEntryForm.tsx +289 -0
- package/template/src/components/admin/pets/timeline/TimelinePhotosField.tsx +173 -0
- package/template/src/components/admin/plugins/PluginNotReady.tsx +28 -0
- package/template/src/components/admin/plugins/PluginOverview.tsx +121 -0
- package/template/src/components/admin/plugins/SendTestEmail.tsx +70 -0
- package/template/src/components/admin/settings/AuthProviders.tsx +373 -0
- package/template/src/components/admin/settings/AuthenticationNav.tsx +42 -0
- package/template/src/components/admin/settings/EmailNav.tsx +40 -0
- package/template/src/components/admin/settings/EmailSettingsForm.tsx +325 -0
- package/template/src/components/admin/settings/EmailTemplates.tsx +551 -0
- package/template/src/components/admin/settings/RegionFields.tsx +203 -0
- package/template/src/components/admin/site-time.tsx +26 -0
- package/template/src/components/admin/theme/ThemeEditor.tsx +467 -0
- package/template/src/components/admin/theme/ThemeLibrary.tsx +339 -0
- package/template/src/components/admin/theme/ThemeSwatches.tsx +30 -0
- package/template/src/components/admin/theme/theme-utils.ts +32 -0
- package/template/src/components/admin/two-factor/BackupCodeList.tsx +54 -0
- package/template/src/components/admin/two-factor/TwoFactorCard.tsx +237 -0
- package/template/src/components/admin/two-factor/TwoFactorRequired.tsx +52 -0
- package/template/src/components/admin/two-factor/TwoFactorSetup.tsx +180 -0
- package/template/src/components/admin/use-unsaved-changes.tsx +101 -0
- package/template/src/components/admin/users/ArchivedAccounts.tsx +159 -0
- package/template/src/components/admin/users/InviteDialogs.tsx +131 -0
- package/template/src/components/admin/users/TwoFactorRoles.tsx +80 -0
- package/template/src/components/admin/users/UserDialogs.tsx +681 -0
- package/template/src/components/admin/users/UsersTable.tsx +374 -0
- package/template/src/components/admin/view-only.tsx +43 -0
- package/template/src/components/auth/AcceptInviteForm.tsx +123 -0
- package/template/src/components/auth/AuthNav.tsx +80 -0
- package/template/src/components/auth/ConfirmEmailForm.tsx +73 -0
- package/template/src/components/auth/LoginForm.tsx +250 -0
- package/template/src/components/auth/PageError.tsx +37 -0
- package/template/src/components/auth/ProviderSignIn.tsx +53 -0
- package/template/src/components/auth/ResetPasswordForm.tsx +267 -0
- package/template/src/components/demo/DemoBanner.tsx +38 -0
- package/template/src/components/demo/SiteDemoBanner.tsx +22 -0
- package/template/src/components/demo/wording.ts +21 -0
- package/template/src/components/setup/SetupAccountForm.tsx +93 -0
- package/template/src/components/setup/SetupDone.tsx +95 -0
- package/template/src/components/setup/SetupNav.tsx +49 -0
- package/template/src/components/setup/SetupSampleContent.tsx +67 -0
- package/template/src/components/setup/SetupSiteForm.tsx +104 -0
- package/template/src/components/setup/SetupThemePicker.tsx +73 -0
- package/template/src/components/setup/SkipSetup.tsx +35 -0
- package/template/src/components/site/BuilderContent.tsx +46 -0
- package/template/src/components/site/CopyButton.tsx +28 -0
- package/template/src/components/site/ImageCarousel.tsx +52 -0
- package/template/src/components/site/PetCard.tsx +32 -0
- package/template/src/components/site/PetCatalog.tsx +106 -0
- package/template/src/components/site/PetGallery.tsx +75 -0
- package/template/src/components/site/PetTimeline.tsx +82 -0
- package/template/src/components/site/RemountOnNavigate.tsx +13 -0
- package/template/src/components/site/RichText.tsx +56 -0
- package/template/src/components/site/SmartLink.tsx +37 -0
- package/template/src/components/site/SocialIcons.tsx +26 -0
- package/template/src/components/site/ThemePreviewBridge.tsx +29 -0
- package/template/src/components/site/ThemeStyle.tsx +22 -0
- package/template/src/components/site/ThemeToggle.tsx +36 -0
- package/template/src/components/site/WhatsAppButton.tsx +27 -0
- package/template/src/components/site/timeline-format.ts +20 -0
- package/template/src/db/client.ts +702 -0
- package/template/src/db/compare-tables.ts +41 -0
- package/template/src/db/migrate.ts +28 -0
- package/template/src/db/plugin-migrations.ts +167 -0
- package/template/src/db/schema/pg.ts +484 -0
- package/template/src/db/schema/sqlite.ts +492 -0
- package/template/src/instrumentation.ts +110 -0
- package/template/src/lib/activity.ts +29 -0
- package/template/src/lib/admin/call-action.ts +19 -0
- package/template/src/lib/admin/initials.ts +9 -0
- package/template/src/lib/admin/media-cache.ts +16 -0
- package/template/src/lib/admin/media-page.ts +3 -0
- package/template/src/lib/admin/pet-form.ts +242 -0
- package/template/src/lib/admin/pets-cache.ts +22 -0
- package/template/src/lib/admin/unwrap-client.ts +11 -0
- package/template/src/lib/admin/unwrap.ts +38 -0
- package/template/src/lib/admin/use-media-list.ts +41 -0
- package/template/src/lib/admin/use-pet-list.ts +58 -0
- package/template/src/lib/age.ts +117 -0
- package/template/src/lib/auth-provider-errors.ts +38 -0
- package/template/src/lib/cache.ts +69 -0
- package/template/src/lib/color-mode.ts +48 -0
- package/template/src/lib/demo.ts +78 -0
- package/template/src/lib/email-address.ts +9 -0
- package/template/src/lib/email-template.ts +691 -0
- package/template/src/lib/links.ts +78 -0
- package/template/src/lib/mail-error.ts +38 -0
- package/template/src/lib/media-name.ts +31 -0
- package/template/src/lib/options.ts +134 -0
- package/template/src/lib/pagination.ts +28 -0
- package/template/src/lib/pet-placeholders.ts +34 -0
- package/template/src/lib/pet-seo.ts +40 -0
- package/template/src/lib/pet-timeline.ts +62 -0
- package/template/src/lib/phone.ts +129 -0
- package/template/src/lib/places.ts +84 -0
- package/template/src/lib/queries.ts +549 -0
- package/template/src/lib/revalidate.ts +32 -0
- package/template/src/lib/rich-text.ts +215 -0
- package/template/src/lib/seo.ts +121 -0
- package/template/src/lib/slugify.ts +11 -0
- package/template/src/lib/theme.ts +546 -0
- package/template/src/lib/utils.ts +2 -0
- package/template/src/lib/whatsapp.ts +29 -0
- package/template/src/lib/zod-schema/auth.ts +56 -0
- package/template/src/lib/zod-schema/page.ts +57 -0
- package/template/src/lib/zod-schema/pet-timeline.ts +118 -0
- package/template/src/lib/zod-schema/pet.ts +172 -0
- package/template/src/lib/zod-schema/settings.ts +162 -0
- package/template/src/plugins/host.ts +117 -0
- package/template/src/plugins/icon.ts +89 -0
- package/template/src/plugins/registry.ts +369 -0
- package/template/src/plugins/storage-rules.ts +87 -0
- package/template/src/plugins/storage.ts +184 -0
- package/template/src/puck/actions.ts +46 -0
- package/template/src/puck/config.tsx +1693 -0
- package/template/src/puck/data.ts +196 -0
- package/template/src/puck/demo-mode.tsx +20 -0
- package/template/src/puck/email-config.tsx +267 -0
- package/template/src/puck/icons.tsx +76 -0
- package/template/src/puck/media-picker.tsx +273 -0
- package/template/src/puck/padding.tsx +71 -0
- package/template/src/puck/pet-page-config.tsx +511 -0
- package/template/src/puck/pet-picker.tsx +40 -0
- package/template/src/puck/plugin-block-data.ts +91 -0
- package/template/src/puck/plugin-blocks.tsx +235 -0
- package/template/src/puck/plugin-choice-field.tsx +87 -0
- package/template/src/puck/sanitize.ts +107 -0
- package/template/src/puck/server.ts +36 -0
- package/template/src/puck/types.ts +41 -0
- package/template/src/server/actions/activity.ts +48 -0
- package/template/src/server/actions/auth-providers.ts +171 -0
- package/template/src/server/actions/auth.ts +217 -0
- package/template/src/server/actions/demo.ts +30 -0
- package/template/src/server/actions/email-change.ts +80 -0
- package/template/src/server/actions/email-templates.ts +144 -0
- package/template/src/server/actions/email.ts +70 -0
- package/template/src/server/actions/media.ts +127 -0
- package/template/src/server/actions/pages.ts +159 -0
- package/template/src/server/actions/password-reset.ts +80 -0
- package/template/src/server/actions/pet-timeline.ts +75 -0
- package/template/src/server/actions/pets.ts +74 -0
- package/template/src/server/actions/places.ts +36 -0
- package/template/src/server/actions/settings.ts +29 -0
- package/template/src/server/actions/setup.ts +72 -0
- package/template/src/server/actions/themes.ts +80 -0
- package/template/src/server/actions/two-factor.ts +306 -0
- package/template/src/server/actions/users.ts +200 -0
- package/template/src/server/activity.ts +409 -0
- package/template/src/server/auth-errors.ts +17 -0
- package/template/src/server/auth-providers.ts +359 -0
- package/template/src/server/auth.ts +266 -0
- package/template/src/server/avatars.ts +263 -0
- package/template/src/server/demo-site.ts +169 -0
- package/template/src/server/email-change.ts +278 -0
- package/template/src/server/email-templates.ts +350 -0
- package/template/src/server/email.ts +442 -0
- package/template/src/server/invites.ts +143 -0
- package/template/src/server/media-url.ts +20 -0
- package/template/src/server/media.ts +236 -0
- package/template/src/server/pages.ts +812 -0
- package/template/src/server/password-reset.ts +158 -0
- package/template/src/server/pending-links.ts +46 -0
- package/template/src/server/pet-timeline.ts +181 -0
- package/template/src/server/pets.ts +555 -0
- package/template/src/server/places.ts +113 -0
- package/template/src/server/privacy.ts +21 -0
- package/template/src/server/provider-endpoints.ts +94 -0
- package/template/src/server/provider-guard.ts +157 -0
- package/template/src/server/result.ts +280 -0
- package/template/src/server/sample-content.ts +368 -0
- package/template/src/server/search-text.ts +43 -0
- package/template/src/server/secret-box.ts +38 -0
- package/template/src/server/session.ts +154 -0
- package/template/src/server/settings.ts +361 -0
- package/template/src/server/setup.ts +110 -0
- package/template/src/server/sitemap.ts +88 -0
- package/template/src/server/storage.ts +267 -0
- package/template/src/server/strip-metadata.ts +357 -0
- package/template/src/server/themes.ts +195 -0
- package/template/src/server/throttle.ts +258 -0
- package/template/src/server/two-factor-codes.ts +32 -0
- package/template/src/server/two-factor.ts +158 -0
- package/template/src/server/types.ts +198 -0
- package/template/src/server/uploads.ts +137 -0
- package/template/src/server/users.ts +500 -0
- package/template/tsconfig.json +44 -0
- package/template/ui/components.json +25 -0
- package/template/ui/package.json +12 -0
- package/template/ui/src/components/alert-dialog.tsx +187 -0
- package/template/ui/src/components/avatar.tsx +108 -0
- package/template/ui/src/components/badge.tsx +51 -0
- package/template/ui/src/components/button.tsx +57 -0
- package/template/ui/src/components/card.tsx +102 -0
- package/template/ui/src/components/carousel.tsx +245 -0
- package/template/ui/src/components/checkbox.tsx +27 -0
- package/template/ui/src/components/combobox.tsx +297 -0
- package/template/ui/src/components/dialog.tsx +159 -0
- package/template/ui/src/components/dropdown-menu.tsx +265 -0
- package/template/ui/src/components/field.tsx +238 -0
- package/template/ui/src/components/input-group.tsx +158 -0
- package/template/ui/src/components/input.tsx +19 -0
- package/template/ui/src/components/label.tsx +19 -0
- package/template/ui/src/components/pagination.tsx +127 -0
- package/template/ui/src/components/popover.tsx +89 -0
- package/template/ui/src/components/radio-group.tsx +37 -0
- package/template/ui/src/components/select.tsx +200 -0
- package/template/ui/src/components/separator.tsx +24 -0
- package/template/ui/src/components/sheet.tsx +138 -0
- package/template/ui/src/components/sidebar.tsx +723 -0
- package/template/ui/src/components/skeleton.tsx +13 -0
- package/template/ui/src/components/switch.tsx +31 -0
- package/template/ui/src/components/table.tsx +115 -0
- package/template/ui/src/components/tabs.tsx +81 -0
- package/template/ui/src/components/textarea.tsx +17 -0
- package/template/ui/src/components/toggle.tsx +44 -0
- package/template/ui/src/components/tooltip.tsx +65 -0
- package/template/ui/src/hooks/use-mobile.ts +21 -0
- package/template/ui/src/lib/utils.ts +2 -0
- package/template/ui/src/styles/globals.css +145 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { can } from '@pet-adopt/plugin-sdk'
|
|
2
|
+
import type { Data } from '@puckeditor/core'
|
|
3
|
+
import type { Metadata } from 'next'
|
|
4
|
+
import { redirect } from 'next/navigation'
|
|
5
|
+
import React from 'react'
|
|
6
|
+
|
|
7
|
+
import { BuilderContent } from '@/components/site/BuilderContent'
|
|
8
|
+
import { ThemePreviewBridge } from '@/components/site/ThemePreviewBridge'
|
|
9
|
+
import { getSessionUser } from '@/server/session'
|
|
10
|
+
|
|
11
|
+
// Per request, and may wait for its data: see `instant` in the root layout.
|
|
12
|
+
export const instant = false
|
|
13
|
+
|
|
14
|
+
// The theme editor's live preview (signed in only): a sample page built from real blocks, so a
|
|
15
|
+
// theme is judged on what visitors will see. The editor layout loads the site's CSS and fonts; the
|
|
16
|
+
// bridge applies the theme being edited, sent by the editor page, on top of the active one.
|
|
17
|
+
export const metadata: Metadata = { title: 'Theme preview', robots: { index: false, follow: false } }
|
|
18
|
+
|
|
19
|
+
const SAMPLE: Data = {
|
|
20
|
+
root: { props: {} },
|
|
21
|
+
zones: {},
|
|
22
|
+
content: [
|
|
23
|
+
{
|
|
24
|
+
type: 'Hero',
|
|
25
|
+
props: {
|
|
26
|
+
id: 'hero',
|
|
27
|
+
heading: 'Find your new best friend',
|
|
28
|
+
subheading: 'This is how headings, text and buttons look with this theme.',
|
|
29
|
+
image: null,
|
|
30
|
+
ctaLabel: 'Meet the pets',
|
|
31
|
+
ctaHref: '#',
|
|
32
|
+
showWhatsApp: true,
|
|
33
|
+
align: 'center',
|
|
34
|
+
height: 'md',
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
type: 'Features',
|
|
39
|
+
props: {
|
|
40
|
+
id: 'features',
|
|
41
|
+
heading: 'Every pet comes',
|
|
42
|
+
intro: '',
|
|
43
|
+
columns: 3,
|
|
44
|
+
items: [
|
|
45
|
+
{ icon: 'shield', title: 'Vaccinated', text: 'Up to date before going home.' },
|
|
46
|
+
{ icon: 'health', title: 'Vet checked', text: 'Seen by our vet, with notes you can read.' },
|
|
47
|
+
{ icon: 'heart', title: 'Lifetime support', text: 'We are a message away after adoption.' },
|
|
48
|
+
],
|
|
49
|
+
align: 'center',
|
|
50
|
+
background: 'none',
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
type: 'PetGrid',
|
|
55
|
+
props: { id: 'pets', heading: 'Ready for adoption', species: '', status: '', featuredOnly: false, limit: 4, showViewAll: true, background: 'tint' },
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
type: 'CostTable',
|
|
59
|
+
props: {
|
|
60
|
+
id: 'cost',
|
|
61
|
+
heading: 'What does it cost?',
|
|
62
|
+
headingStyle: 'normal',
|
|
63
|
+
intro: 'Highlighted rows, borders and muted text.',
|
|
64
|
+
image: null,
|
|
65
|
+
imageSide: 'left',
|
|
66
|
+
itemLabel: 'Care',
|
|
67
|
+
valueLabel: 'Average cost',
|
|
68
|
+
rows: [
|
|
69
|
+
{ label: 'Vaccinations', value: 'RM 100 – 140', highlight: 'none' },
|
|
70
|
+
{ label: 'Total for a healthy rescue', value: 'RM 320 – 450', highlight: 'total' },
|
|
71
|
+
{ label: 'Emergency care', value: 'RM 600 +', highlight: 'strong' },
|
|
72
|
+
],
|
|
73
|
+
note: '',
|
|
74
|
+
background: 'none',
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
type: 'CallToAction',
|
|
79
|
+
props: { id: 'cta', heading: 'Ready to meet them?', text: 'A dark band, as used for calls to action.', action: 'link', buttonLabel: 'Get in touch', href: '#', background: 'dark' },
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export default async function ThemePreviewPage() {
|
|
85
|
+
const user = await getSessionUser()
|
|
86
|
+
if (!user) redirect('/admin/login?redirect=%2Fadmin%2Ftheme')
|
|
87
|
+
if (!can(user.role, 'theme:view')) redirect('/admin')
|
|
88
|
+
return (
|
|
89
|
+
<main>
|
|
90
|
+
<BuilderContent data={SAMPLE} title="Theme preview" />
|
|
91
|
+
<ThemePreviewBridge />
|
|
92
|
+
</main>
|
|
93
|
+
)
|
|
94
|
+
}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
/* Editor-only styles: header actions, the dark preview switch, the media picker field, and Puck's
|
|
2
|
+
own colours in dark mode. Colours here come from Puck's variables, so they follow its palette. */
|
|
3
|
+
|
|
4
|
+
/* The builders' own interface font. Puck names "Inter" / "InterVariable", which its full stylesheet
|
|
5
|
+
fetches from an outside host; the layout loads the stylesheet without that request, and this
|
|
6
|
+
points Puck at the Inter this site serves itself ('Inter Variable', src/app/(frontend)/fonts.ts),
|
|
7
|
+
then Puck's own system stack. Puck sets the variable in @layer puck-tokens, so this unlayered
|
|
8
|
+
rule wins. Blocks on the canvas keep the theme's fonts (--font-body, --font-heading). */
|
|
9
|
+
:root { --puck-font-family: 'Inter Variable', var(--puck-fallback-font-stack); }
|
|
10
|
+
|
|
11
|
+
/* The canvas: page blocks in the site's colours (light, or dark when the switch is on). */
|
|
12
|
+
.editor-canvas { min-height: 100%; background: var(--bg); color: var(--ink); }
|
|
13
|
+
|
|
14
|
+
.editor-actions { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--puck-color-text); white-space: nowrap; }
|
|
15
|
+
.editor-actions a { color: inherit; }
|
|
16
|
+
.editor-actions button:not([role='switch']) {
|
|
17
|
+
padding: 6px 14px; border: 1px solid var(--puck-color-grey-08); background: var(--puck-color-white);
|
|
18
|
+
color: var(--puck-color-text); border-radius: 6px; cursor: pointer; font: inherit;
|
|
19
|
+
}
|
|
20
|
+
.editor-actions button:disabled { opacity: 0.6; cursor: default; }
|
|
21
|
+
.editor-actions .editor-primary { background: var(--puck-color-grey-01); border-color: var(--puck-color-grey-01); color: var(--puck-color-white); }
|
|
22
|
+
.editor-msg { color: var(--puck-color-green-04); }
|
|
23
|
+
.editor-msg-error { color: var(--puck-color-red-04); }
|
|
24
|
+
|
|
25
|
+
/* "Dark preview": shadcn's Switch (Base UI renders a button with role="switch" and data-checked /
|
|
26
|
+
data-unchecked). The editor does not load Tailwind, so its look is defined here. */
|
|
27
|
+
.editor-mode-switch { display: inline-flex; align-items: center; gap: 6px; color: var(--puck-color-text-muted); }
|
|
28
|
+
.editor-mode-switch svg { width: 16px; height: 16px; flex: none; }
|
|
29
|
+
.editor-mode-switch [data-slot='switch'] {
|
|
30
|
+
position: relative; display: inline-flex; align-items: center; flex: none; width: 34px; height: 20px; padding: 2px;
|
|
31
|
+
border: 1px solid transparent; border-radius: 999px; background: var(--puck-color-grey-08); cursor: pointer;
|
|
32
|
+
transition: background-color 0.15s;
|
|
33
|
+
}
|
|
34
|
+
.editor-mode-switch [data-slot='switch'][data-checked] { background: var(--puck-color-azure-05); }
|
|
35
|
+
.editor-mode-switch [data-slot='switch']:focus-visible { outline: 2px solid var(--puck-color-azure-05); outline-offset: 2px; }
|
|
36
|
+
.editor-mode-switch [data-slot='switch-thumb'] {
|
|
37
|
+
display: block; width: 14px; height: 14px; border-radius: 999px; background: #ffffff;
|
|
38
|
+
box-shadow: 0 1px 2px rgb(0 0 0 / 0.3); transition: transform 0.15s;
|
|
39
|
+
}
|
|
40
|
+
.editor-mode-switch [data-slot='switch-thumb'][data-checked] { transform: translateX(14px); }
|
|
41
|
+
@media (prefers-reduced-motion: reduce) {
|
|
42
|
+
.editor-mode-switch [data-slot='switch'], .editor-mode-switch [data-slot='switch-thumb'] { transition: none; }
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.media-picker-preview { display: block; width: 100%; max-height: 140px; object-fit: cover; border-radius: 6px; }
|
|
46
|
+
.media-picker-empty { padding: 20px; text-align: center; border: 1px dashed var(--puck-color-grey-08); border-radius: 6px; color: var(--puck-color-text-muted); font-size: 13px; }
|
|
47
|
+
.media-picker-actions { display: flex; gap: 8px; margin-top: 8px; }
|
|
48
|
+
/* Wraps the picker's controls so read-only mode (view-only roles) can disable them all at once. */
|
|
49
|
+
.media-picker-fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
|
|
50
|
+
.media-picker-fieldset:disabled button { opacity: 0.5; cursor: not-allowed; }
|
|
51
|
+
.media-picker button { padding: 4px 10px; border: 1px solid var(--puck-color-grey-08); background: var(--puck-color-white); color: var(--puck-color-text); border-radius: 6px; cursor: pointer; font: inherit; font-size: 13px; }
|
|
52
|
+
.media-picker-panel { margin-top: 8px; padding: 8px; border: 1px solid var(--puck-color-grey-09); border-radius: 6px; background: var(--puck-color-grey-12); }
|
|
53
|
+
.media-picker-upload, .media-picker-library { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--puck-color-text); }
|
|
54
|
+
.media-picker-upload { margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--puck-color-grey-09); }
|
|
55
|
+
.media-picker-subtitle { margin: 0; font-weight: 600; }
|
|
56
|
+
/* The public demo: uploads are turned off, and this note stands where the upload form would be. */
|
|
57
|
+
.media-picker-demo { margin: 0 0 12px; padding: 6px 8px; border: 1px solid var(--puck-color-grey-09); border-radius: 6px; background: var(--puck-color-white); color: var(--puck-color-text); font-size: 13px; }
|
|
58
|
+
.media-picker-upload p, .media-picker-library p { margin: 0; }
|
|
59
|
+
.media-picker-hint { color: var(--puck-color-text-muted); font-size: 12px; }
|
|
60
|
+
.media-picker-panel input[type='text'], .media-picker-panel input[type='search'] { padding: 6px; border: 1px solid var(--puck-color-grey-08); border-radius: 6px; background: var(--puck-color-white); color: var(--puck-color-text); font: inherit; }
|
|
61
|
+
.media-picker-panel input[aria-invalid='true'] { border-color: var(--puck-color-red-04); }
|
|
62
|
+
.media-picker-panel input[type='file'] { font: inherit; max-width: 100%; }
|
|
63
|
+
.media-picker-error { color: var(--puck-color-red-04); font-size: 13px; margin: 0; }
|
|
64
|
+
.media-picker-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; max-height: 220px; overflow: auto; margin: 0; padding: 0; list-style: none; }
|
|
65
|
+
.media-picker-grid button { display: block; width: 100%; padding: 0; border: 2px solid transparent; overflow: hidden; aspect-ratio: 4 / 3; }
|
|
66
|
+
.media-picker-grid button:hover { border-color: #e8590c; }
|
|
67
|
+
.media-picker-grid button:focus-visible { outline: 2px solid var(--puck-color-azure-05); outline-offset: 1px; }
|
|
68
|
+
.media-picker-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
|
|
69
|
+
.media-picker-pages { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
|
|
70
|
+
.media-picker button[aria-disabled='true'] { opacity: 0.6; cursor: default; }
|
|
71
|
+
|
|
72
|
+
/* --- Puck in dark mode ------------------------------------------------------------------------
|
|
73
|
+
Puck's greys, white, black and azure come from the site theme's dark colours (puckDarkCss in
|
|
74
|
+
src/lib/theme.ts, injected by the editor layout), so the builder matches the rest of the admin.
|
|
75
|
+
Here: Puck's status tints, which have no theme counterpart, made dark, plus disabled text and the
|
|
76
|
+
dialog backdrop. Same conditions: the owner's choice on data-mode, else the system setting, and
|
|
77
|
+
only when the layout sets data-follow-mode. Puck defines its variables in @layer puck-tokens, so
|
|
78
|
+
these unlayered rules win. */
|
|
79
|
+
@media (prefers-color-scheme: dark) {
|
|
80
|
+
html[data-follow-mode]:not([data-mode='light']) {
|
|
81
|
+
--puck-color-green-10: #173a24;
|
|
82
|
+
--puck-color-green-11: #12291b;
|
|
83
|
+
--puck-color-green-12: #0f2016;
|
|
84
|
+
--puck-color-red-10: #4a1d24;
|
|
85
|
+
--puck-color-red-11: #33151a;
|
|
86
|
+
--puck-color-red-12: #261014;
|
|
87
|
+
--puck-color-rose-10: #44192f;
|
|
88
|
+
--puck-color-rose-11: #301222;
|
|
89
|
+
--puck-color-rose-12: #240e1a;
|
|
90
|
+
--puck-color-yellow-10: #3d3412;
|
|
91
|
+
--puck-color-yellow-11: #2a240d;
|
|
92
|
+
--puck-color-yellow-12: #201b0a;
|
|
93
|
+
--puck-color-text-disabled: var(--puck-color-grey-07);
|
|
94
|
+
--puck-color-overlay-backdrop: color-mix(in srgb, #000000 75%, transparent);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
html[data-follow-mode][data-mode='dark'] {
|
|
98
|
+
--puck-color-green-10: #173a24;
|
|
99
|
+
--puck-color-green-11: #12291b;
|
|
100
|
+
--puck-color-green-12: #0f2016;
|
|
101
|
+
--puck-color-red-10: #4a1d24;
|
|
102
|
+
--puck-color-red-11: #33151a;
|
|
103
|
+
--puck-color-red-12: #261014;
|
|
104
|
+
--puck-color-rose-10: #44192f;
|
|
105
|
+
--puck-color-rose-11: #301222;
|
|
106
|
+
--puck-color-rose-12: #240e1a;
|
|
107
|
+
--puck-color-yellow-10: #3d3412;
|
|
108
|
+
--puck-color-yellow-11: #2a240d;
|
|
109
|
+
--puck-color-yellow-12: #201b0a;
|
|
110
|
+
--puck-color-text-disabled: var(--puck-color-grey-07);
|
|
111
|
+
--puck-color-overlay-backdrop: color-mix(in srgb, #000000 75%, transparent);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/* The Pet spotlight's pet picker (a native select, in Puck's colours). */
|
|
115
|
+
.pet-picker select {
|
|
116
|
+
width: 100%; padding: 8px; border: 1px solid var(--puck-color-grey-08); border-radius: 6px;
|
|
117
|
+
background: var(--puck-color-white); color: var(--puck-color-text); font: inherit; font-size: 14px;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/* Why a picker's list did not load (a plugin that is not set up yet). */
|
|
121
|
+
.pet-picker-note { margin: 6px 0 0; font-size: 13px; line-height: 1.4; color: var(--puck-color-text); overflow-wrap: anywhere; }
|
|
122
|
+
|
|
123
|
+
/* The email builder (/edit/email/<id>): the placeholder list in the root's sidebar, the "send test"
|
|
124
|
+
field in the header, and the list of problems a save found. */
|
|
125
|
+
.email-placeholder-help { font-size: 13px; line-height: 1.5; color: var(--puck-color-text); }
|
|
126
|
+
.email-placeholder-help p { margin: 0 0 8px; }
|
|
127
|
+
.email-placeholder-help dl { margin: 0; display: grid; gap: 6px; }
|
|
128
|
+
.email-placeholder-help dt code { font-size: 12px; background: var(--puck-color-grey-11); padding: 1px 4px; border-radius: 4px; }
|
|
129
|
+
.email-placeholder-help dd { margin: 0; color: var(--puck-color-text-muted); }
|
|
130
|
+
.editor-actions .email-test-label { color: var(--puck-color-text); }
|
|
131
|
+
.editor-actions .email-test-to { width: 200px; padding: 6px 8px; border: 1px solid var(--puck-color-grey-08); border-radius: 6px; font: inherit; background: var(--puck-color-white); color: var(--puck-color-text); }
|
|
132
|
+
.email-problems {
|
|
133
|
+
position: fixed; top: 64px; right: 16px; z-index: 10; max-width: 420px; padding: 12px 16px; border-radius: 8px;
|
|
134
|
+
border: 1px solid var(--puck-color-red-06); background: var(--puck-color-white); color: var(--puck-color-text);
|
|
135
|
+
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15); font-size: 14px;
|
|
136
|
+
}
|
|
137
|
+
.email-problems p { margin: 0 0 6px; font-weight: 600; }
|
|
138
|
+
.email-problems ul { margin: 0 0 8px; padding-left: 18px; }
|
|
139
|
+
.email-problems button { font: inherit; padding: 4px 10px; border: 1px solid var(--puck-color-grey-08); border-radius: 6px; background: var(--puck-color-white); color: var(--puck-color-text); cursor: pointer; }
|
|
140
|
+
|
|
141
|
+
/* "← Back" to Page settings, first in the header's actions. */
|
|
142
|
+
.editor-actions .editor-back { text-decoration: none; padding: 6px 4px; }
|
|
143
|
+
.editor-actions .editor-back:hover { text-decoration: underline; }
|
|
144
|
+
|
|
145
|
+
/* "View live" in Puck's left rail: the link inside the icon is stretched over the whole item (the
|
|
146
|
+
item is Puck's, with hashed class names, hence :has), so the whole item opens the page. */
|
|
147
|
+
li:has(> div > span > .editor-nav-link) { position: relative; }
|
|
148
|
+
.editor-nav-link { color: inherit; }
|
|
149
|
+
.editor-nav-link::after { content: ''; position: absolute; inset: 0; }
|
|
150
|
+
.editor-nav-link:focus-visible { outline: none; }
|
|
151
|
+
.editor-nav-link:focus-visible::after { outline: 2px solid var(--puck-color-azure-05); outline-offset: -2px; border-radius: 6px; }
|
|
152
|
+
.editor-panel-note { padding: 16px; font-size: 14px; color: var(--puck-color-text); }
|
|
153
|
+
.editor-panel-note a { color: inherit; }
|
|
154
|
+
|
|
155
|
+
/* Preview controls in the right sidebar (PageEditor's FieldsPanel), shown with no block selected. */
|
|
156
|
+
.editor-preview-panel { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-bottom: 1px solid var(--puck-color-border); font-size: 14px; color: var(--puck-color-text); }
|
|
157
|
+
.editor-preview-heading { margin: 0; font-weight: 600; }
|
|
158
|
+
.editor-preview-hint { margin: 0; font-size: 12px; color: var(--puck-color-grey-05); }
|
|
159
|
+
.editor-preview-panel .editor-mode-switch { color: var(--puck-color-text); }
|
|
160
|
+
.editor-preview-panel .editor-pet-picker { flex-wrap: wrap; }
|
|
161
|
+
.editor-preview-panel .editor-pet-picker select { flex: 1; max-width: none; }
|
|
162
|
+
|
|
163
|
+
/* "Preview with" (Pet page template): which pet the canvas shows. */
|
|
164
|
+
.editor-pet-picker { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
|
|
165
|
+
.editor-pet-picker select {
|
|
166
|
+
max-width: 14rem; padding: 5px 8px; border: 1px solid var(--puck-color-grey-08); border-radius: 6px;
|
|
167
|
+
background: var(--puck-color-white); color: var(--puck-color-text); font: inherit;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/* Save / publish / send results (EditorToast): bottom-right, above the canvas; Puck's colours, so it
|
|
171
|
+
follows the editor's light or dark mode. */
|
|
172
|
+
.editor-toast-region {
|
|
173
|
+
position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 1000;
|
|
174
|
+
display: flex; flex-direction: column; align-items: flex-end; gap: 8px; max-width: min(26rem, calc(100vw - 32px));
|
|
175
|
+
pointer-events: none;
|
|
176
|
+
}
|
|
177
|
+
.editor-toast {
|
|
178
|
+
pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; padding: 12px 12px 12px 14px;
|
|
179
|
+
border: 1px solid var(--puck-color-grey-09); border-left: 4px solid var(--puck-color-green-06); border-radius: 8px;
|
|
180
|
+
background: var(--puck-color-white); color: var(--puck-color-text); font-size: 14px; line-height: 1.4;
|
|
181
|
+
box-shadow: 0 8px 24px rgb(0 0 0 / 0.18); animation: editor-toast-in 0.18s ease-out;
|
|
182
|
+
}
|
|
183
|
+
.editor-toast > svg { flex: none; width: 18px; height: 18px; margin-top: 1px; color: var(--puck-color-green-04); }
|
|
184
|
+
.editor-toast-error { border-left-color: var(--puck-color-red-06); }
|
|
185
|
+
.editor-toast-error > svg { color: var(--puck-color-red-04); }
|
|
186
|
+
.editor-toast > span { flex: 1; }
|
|
187
|
+
.editor-toast-close {
|
|
188
|
+
flex: none; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; margin: -2px -2px 0 0;
|
|
189
|
+
padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--puck-color-grey-05); cursor: pointer;
|
|
190
|
+
}
|
|
191
|
+
.editor-toast-close:hover { background: var(--puck-color-grey-11); color: var(--puck-color-text); }
|
|
192
|
+
.editor-toast-close:focus-visible { outline: 2px solid var(--puck-color-azure-05); outline-offset: 1px; }
|
|
193
|
+
.editor-toast-close svg { width: 16px; height: 16px; }
|
|
194
|
+
@keyframes editor-toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
|
|
195
|
+
@media (prefers-reduced-motion: reduce) { .editor-toast { animation: none; } }
|
|
196
|
+
/* "Edit <pet>" under the Preview with picker: opens the pet's admin page in a new tab. */
|
|
197
|
+
.editor-pet-edit { display: inline-flex; align-items: center; gap: 4px; flex-basis: 100%; color: inherit; font-size: 13px; }
|
|
198
|
+
.editor-pet-edit svg { width: 13px; height: 13px; }
|
|
199
|
+
|
|
200
|
+
/* Save draft / Publish while saving or with nothing to save (aria-disabled keeps focus on them). */
|
|
201
|
+
.editor-actions button[aria-disabled='true'] { opacity: 0.6; cursor: default; }
|
|
202
|
+
.editor-actions button { display: inline-flex; align-items: center; gap: 6px; }
|
|
203
|
+
.editor-spinner { width: 14px; height: 14px; animation: editor-spin 1s linear infinite; }
|
|
204
|
+
@keyframes editor-spin { to { transform: rotate(360deg); } }
|
|
205
|
+
@media (prefers-reduced-motion: reduce) { .editor-spinner { animation-duration: 3s; } }
|
|
206
|
+
/* Fixed minimum widths, fitting the longest labels ("Autosaving…", "Publishing…" with the spinner),
|
|
207
|
+
so the buttons never change size and nothing beside them moves. */
|
|
208
|
+
.editor-actions .editor-save { min-width: 8.75rem; justify-content: center; }
|
|
209
|
+
.editor-actions .editor-publish { min-width: 8rem; justify-content: center; }
|
|
210
|
+
/* A failed autosave (the reason came as a toast): a red outline on Save draft. */
|
|
211
|
+
.editor-actions .editor-save-paused { border-color: var(--puck-color-red-04); color: var(--puck-color-red-04); }
|
|
212
|
+
|
|
213
|
+
/* A builder failed (app/(editor)/error.tsx). */
|
|
214
|
+
.editor-error { max-width: 36rem; margin: 64px auto; padding: 0 16px; font-size: 15px; line-height: 1.5; color: var(--puck-color-text); }
|
|
215
|
+
.editor-error h1 { margin: 0 0 12px; font-size: 22px; }
|
|
216
|
+
.editor-error p { margin: 0 0 8px; }
|
|
217
|
+
.editor-error-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 16px; }
|
|
218
|
+
.editor-error-actions button {
|
|
219
|
+
padding: 6px 14px; border: 1px solid var(--puck-color-grey-08); background: var(--puck-color-white);
|
|
220
|
+
color: var(--puck-color-text); border-radius: 6px; cursor: pointer; font: inherit;
|
|
221
|
+
}
|
|
222
|
+
.editor-error-actions .editor-primary { background: var(--puck-color-grey-01); border-color: var(--puck-color-grey-01); color: var(--puck-color-white); }
|
|
223
|
+
.editor-error-actions a { color: inherit; }
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import React from 'react'
|
|
4
|
+
|
|
5
|
+
// A builder (page or email) failed: a server error while opening it, or an error in the editor
|
|
6
|
+
// itself. Inside the editor layout, so Puck's colours and editor.css apply (no Tailwind here). The
|
|
7
|
+
// error's own text is not shown: it may be technical, and in production Next replaces it anyway.
|
|
8
|
+
export default function EditorError({ reset }: { error: Error & { digest?: string }; reset: () => void }) {
|
|
9
|
+
return (
|
|
10
|
+
<main className="editor-error">
|
|
11
|
+
<div role="alert">
|
|
12
|
+
<h1>The builder stopped because of an error</h1>
|
|
13
|
+
<p>
|
|
14
|
+
What was saved before this is kept: drafts you saved, and the page builder’s autosave. Changes made since the last save may
|
|
15
|
+
be lost.
|
|
16
|
+
</p>
|
|
17
|
+
<p>If your session ended, sign in again in another tab, then reload this one.</p>
|
|
18
|
+
</div>
|
|
19
|
+
<div className="editor-error-actions">
|
|
20
|
+
<button type="button" className="editor-primary" onClick={() => window.location.reload()}>
|
|
21
|
+
Reload the builder
|
|
22
|
+
</button>
|
|
23
|
+
<button type="button" onClick={reset}>
|
|
24
|
+
Try again
|
|
25
|
+
</button>
|
|
26
|
+
{/* A full page load: the admin is another root layout, and a fresh start is the point here. */}
|
|
27
|
+
{/* eslint-disable-next-line @next/next/no-html-link-for-pages */}
|
|
28
|
+
<a href="/admin">Back to the admin</a>
|
|
29
|
+
</div>
|
|
30
|
+
</main>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// Puck's stylesheet without its first line, an @import of the Inter font from rsms.me: the two files
|
|
2
|
+
// are otherwise the same. The Content-Security-Policy refuses that host, so the import only logged
|
|
3
|
+
// an error on every builder page. The builders' font is set in editor.css, from this site's own files.
|
|
4
|
+
import '@puckeditor/core/no-external.css'
|
|
5
|
+
import type { Metadata } from 'next'
|
|
6
|
+
import { redirect } from 'next/navigation'
|
|
7
|
+
import React from 'react'
|
|
8
|
+
|
|
9
|
+
import { RemountOnNavigate } from '@/components/admin/RemountOnNavigate'
|
|
10
|
+
import { SiteDemoBanner } from '@/components/demo/SiteDemoBanner'
|
|
11
|
+
import { PRE_PAINT, ThemeStyle } from '@/components/site/ThemeStyle'
|
|
12
|
+
import { demoResetMinutes, isDemo } from '@/lib/demo'
|
|
13
|
+
import { getSettings, siteIcons } from '@/lib/queries'
|
|
14
|
+
import { EditorDemoMode } from '@/puck/demo-mode'
|
|
15
|
+
import { puckDarkCss, resolveTheme } from '@/lib/theme'
|
|
16
|
+
import { getSessionUser } from '@/server/session'
|
|
17
|
+
import { needsTwoFactorSetup } from '@/server/two-factor'
|
|
18
|
+
|
|
19
|
+
import '../(frontend)/fonts'
|
|
20
|
+
import '../(frontend)/styles.css'
|
|
21
|
+
import './editor.css'
|
|
22
|
+
|
|
23
|
+
// Cache Components: the builders and previews are drawn per request for the signed-in person and
|
|
24
|
+
// may wait for their data. Without this the build refuses them, because this layout reads the
|
|
25
|
+
// session first. It covers every page below; the pages repeat it only to keep `next dev` quiet.
|
|
26
|
+
export const instant = false
|
|
27
|
+
|
|
28
|
+
export async function generateMetadata(): Promise<Metadata> {
|
|
29
|
+
return { icons: siteIcons(await getSettings()) }
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export default async function EditorLayout({ children }: { children: React.ReactNode }) {
|
|
33
|
+
// Each page checks who may see it. Someone whose role requires two-factor and who has not set it
|
|
34
|
+
// up goes to the admin, which shows that setup instead.
|
|
35
|
+
const user = await getSessionUser()
|
|
36
|
+
if (user && (await needsTwoFactorSetup(user))) redirect('/admin')
|
|
37
|
+
const settings = await getSettings()
|
|
38
|
+
// The editor's own interface follows the owner's light/dark choice, like the admin: their saved
|
|
39
|
+
// choice (the pre-paint script sets data-mode), else their system setting. Only when the site has
|
|
40
|
+
// dark mode at all; otherwise the admin is light only, and so is this. See editor.css.
|
|
41
|
+
const theme = resolveTheme(settings)
|
|
42
|
+
const followMode = theme.allowModeToggle
|
|
43
|
+
return (
|
|
44
|
+
// suppressHydrationWarning: the pre-paint script may set data-mode before React hydrates.
|
|
45
|
+
<html lang="en" data-follow-mode={followMode ? '' : undefined} suppressHydrationWarning>
|
|
46
|
+
<head>
|
|
47
|
+
{/* The blocks use the site's theme, light only; the canvas has its own "Dark preview" switch. */}
|
|
48
|
+
<ThemeStyle settings={settings} lightOnly />
|
|
49
|
+
{/* A constant string: nothing from the settings goes into it. */}
|
|
50
|
+
{followMode ? <script dangerouslySetInnerHTML={{ __html: PRE_PAINT }} /> : null}
|
|
51
|
+
{/* Puck's colours in dark mode, from the site theme's dark colours (validated values only). */}
|
|
52
|
+
{followMode ? <style dangerouslySetInnerHTML={{ __html: puckDarkCss(theme) }} /> : null}
|
|
53
|
+
</head>
|
|
54
|
+
<body>
|
|
55
|
+
{/* The public demo (PET_ADOPT_DEMO=1): a strip above the builder, which then fills the rest
|
|
56
|
+
of the window; the previews drawn here leave it out (both in styles.css). */}
|
|
57
|
+
{isDemo() ? <SiteDemoBanner resetMinutes={demoResetMinutes()} editor /> : null}
|
|
58
|
+
{/* A fresh builder on every navigation, as before Cache Components (see RemountOnNavigate).
|
|
59
|
+
Today nothing navigates between two editor addresses in the browser; this keeps it so. */}
|
|
60
|
+
{/* The builders' own controls say what the demo turns off (uploads, Send test). */}
|
|
61
|
+
<EditorDemoMode value={isDemo()}>
|
|
62
|
+
<RemountOnNavigate>{children}</RemountOnNavigate>
|
|
63
|
+
</EditorDemoMode>
|
|
64
|
+
</body>
|
|
65
|
+
</html>
|
|
66
|
+
)
|
|
67
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { Metadata } from 'next'
|
|
2
|
+
import { notFound, redirect } from 'next/navigation'
|
|
3
|
+
import React from 'react'
|
|
4
|
+
|
|
5
|
+
import { BuilderContent } from '@/components/site/BuilderContent'
|
|
6
|
+
import { getPublishedPage, getSettings, oneBuilderPageSlug } from '@/lib/queries'
|
|
7
|
+
import { pageMetadata } from '@/lib/seo'
|
|
8
|
+
import { isPuckData, PET_PAGE_SLUG } from '@/puck/data'
|
|
9
|
+
|
|
10
|
+
// Rendered on a page's first visit, then cached, as `revalidate = 60` did: that first request waits
|
|
11
|
+
// for the complete page, gets the real status (404 for an unknown address) and is stored and sent
|
|
12
|
+
// with `s-maxage`. The price: everything this page, its metadata and the (frontend) layout read must
|
|
13
|
+
// come from the cached functions in src/lib/queries.ts. One uncached query, headers(), or new Date()
|
|
14
|
+
// outside them is a 500 for every real page at run time, and <Suspense> does not excuse it here.
|
|
15
|
+
export const ensureStatic = 'navigation'
|
|
16
|
+
|
|
17
|
+
// params is awaited at the top on purpose: a <Suspense> or loading.tsx above notFound() would answer
|
|
18
|
+
// 200 to link-preview bots and Bing for an unknown address. This export allows that, and keeps
|
|
19
|
+
// `next dev` quiet. Keep both exports: with generateStaticParams, params at the top and neither of
|
|
20
|
+
// them, the route builds and works, then answers 500 for every page after the first
|
|
21
|
+
// revalidatePath('/', 'layout').
|
|
22
|
+
export const instant = false
|
|
23
|
+
|
|
24
|
+
/** Never a real page: slugs are lower-case letters, digits and dashes (SLUG_PATTERN). */
|
|
25
|
+
const NO_SLUG = '__none__'
|
|
26
|
+
|
|
27
|
+
// Cache Components refuses an empty list. One live page when the database answers (not the homepage,
|
|
28
|
+
// the Pets page or the Pet page template, which this route does not draw), so the build checks a real
|
|
29
|
+
// page; with no database, an address that can never exist, which the page turns into a 404. Every
|
|
30
|
+
// other page is rendered on its first visit.
|
|
31
|
+
export async function generateStaticParams(): Promise<{ slug: string }[]> {
|
|
32
|
+
return [{ slug: (await oneBuilderPageSlug()) ?? NO_SLUG }]
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
type Args = { params: Promise<{ slug: string }> }
|
|
36
|
+
|
|
37
|
+
export async function generateMetadata({ params }: Args): Promise<Metadata> {
|
|
38
|
+
const { slug } = await params
|
|
39
|
+
// The Pet page template draws /pets/<slug>; it has no address of its own.
|
|
40
|
+
if (slug === PET_PAGE_SLUG) return {}
|
|
41
|
+
const [page, settings] = await Promise.all([getPublishedPage(slug), getSettings()])
|
|
42
|
+
if (!page) return {}
|
|
43
|
+
return pageMetadata({ path: `/${page.slug}`, siteName: settings.siteName, title: page.title, description: page.seo?.description, image: page.seo?.image })
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export default async function BuilderPage({ params }: Args) {
|
|
47
|
+
const { slug } = await params
|
|
48
|
+
if (slug === 'home') redirect('/')
|
|
49
|
+
if (slug === PET_PAGE_SLUG) notFound()
|
|
50
|
+
const page = await getPublishedPage(slug)
|
|
51
|
+
if (!page || !isPuckData(page.puckData)) notFound()
|
|
52
|
+
return <BuilderContent data={page.puckData} title={page.title} />
|
|
53
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Bundled web fonts for the themes (see FONTS in src/lib/theme.ts). Each import declares one
|
|
2
|
+
// variable font family served from this site, so no outside font host is involved and the
|
|
3
|
+
// Content-Security-Policy stays strict. Browsers only download a font file when a page uses it.
|
|
4
|
+
import '@fontsource-variable/dm-sans/index.css'
|
|
5
|
+
import '@fontsource-variable/inter/index.css'
|
|
6
|
+
import '@fontsource-variable/lora/index.css'
|
|
7
|
+
import '@fontsource-variable/nunito/index.css'
|
|
8
|
+
import '@fontsource-variable/playfair-display/index.css'
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import type { Metadata } from 'next'
|
|
2
|
+
import Image from 'next/image'
|
|
3
|
+
import Link from 'next/link'
|
|
4
|
+
import React from 'react'
|
|
5
|
+
|
|
6
|
+
import { SiteDemoBanner } from '@/components/demo/SiteDemoBanner'
|
|
7
|
+
import { RemountOnNavigate } from '@/components/site/RemountOnNavigate'
|
|
8
|
+
import { SmartLink } from '@/components/site/SmartLink'
|
|
9
|
+
import { SocialLinks } from '@/components/site/SocialIcons'
|
|
10
|
+
import { ThemeStyle } from '@/components/site/ThemeStyle'
|
|
11
|
+
import { ThemeToggle } from '@/components/site/ThemeToggle'
|
|
12
|
+
import { WhatsAppButton } from '@/components/site/WhatsAppButton'
|
|
13
|
+
import { demoResetMinutes, isDemo } from '@/lib/demo'
|
|
14
|
+
import { getPrivacyPolicy, getSettings, mediaOf, siteIcons } from '@/lib/queries'
|
|
15
|
+
import { robotsFor } from '@/lib/seo'
|
|
16
|
+
import { fillMessage } from '@/lib/whatsapp'
|
|
17
|
+
|
|
18
|
+
import '@pet-adopt/ui/globals.css'
|
|
19
|
+
import './fonts'
|
|
20
|
+
// Loaded after globals.css on purpose: this plain CSS is unlayered, so it wins over Tailwind's base.
|
|
21
|
+
import './styles.css'
|
|
22
|
+
|
|
23
|
+
const serverURL = process.env.NEXT_PUBLIC_SERVER_URL || 'http://localhost:3000'
|
|
24
|
+
|
|
25
|
+
// The homepage, pet pages and builder pages set `ensureStatic = 'navigation'`, which covers this
|
|
26
|
+
// layout too: it and its metadata may read only cached functions from src/lib/queries.ts and
|
|
27
|
+
// environment values. An uncached query, headers(), cookies() or new Date() here breaks every one of
|
|
28
|
+
// those pages. No segment config on the layout itself: /pets reads searchParams, which
|
|
29
|
+
// `ensureStatic` forbids.
|
|
30
|
+
|
|
31
|
+
export async function generateMetadata(): Promise<Metadata> {
|
|
32
|
+
const settings = await getSettings()
|
|
33
|
+
return {
|
|
34
|
+
metadataBase: new URL(serverURL),
|
|
35
|
+
title: { default: settings.siteName, template: `%s | ${settings.siteName}` },
|
|
36
|
+
description: settings.tagline ?? undefined,
|
|
37
|
+
openGraph: { siteName: settings.siteName, type: 'website' },
|
|
38
|
+
// Pages with their own metadata repeat this (pageMetadata in src/lib/seo.ts): a preview or
|
|
39
|
+
// staging copy of the site is never indexed.
|
|
40
|
+
robots: robotsFor(),
|
|
41
|
+
icons: siteIcons(settings),
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export default async function FrontendLayout({ children }: { children: React.ReactNode }) {
|
|
46
|
+
const [settings, privacy] = await Promise.all([getSettings(), getPrivacyPolicy()])
|
|
47
|
+
const logo = mediaOf(settings.logo)
|
|
48
|
+
const nav = settings.nav?.length
|
|
49
|
+
? settings.nav
|
|
50
|
+
: [
|
|
51
|
+
{ label: 'Pets', href: '/pets' },
|
|
52
|
+
]
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
// suppressHydrationWarning: a small script may set data-mode on <html> (the visitor's saved
|
|
56
|
+
// light/dark choice) before React loads.
|
|
57
|
+
<html lang="en" suppressHydrationWarning>
|
|
58
|
+
<head>
|
|
59
|
+
<ThemeStyle settings={settings} />
|
|
60
|
+
</head>
|
|
61
|
+
<body>
|
|
62
|
+
{/* The public demo (PET_ADOPT_DEMO=1) says so above everything. An environment value, so
|
|
63
|
+
it is allowed here (see the note above) and baked into pages built with the switch on. */}
|
|
64
|
+
{isDemo() ? <SiteDemoBanner resetMinutes={demoResetMinutes()} /> : null}
|
|
65
|
+
<header className="site-header">
|
|
66
|
+
<div className="container header-inner">
|
|
67
|
+
<Link href="/" className="brand">
|
|
68
|
+
{logo ? <Image src={logo.url} alt={logo.alt || settings.siteName} width={40} height={40} className="brand-logo" /> : null}
|
|
69
|
+
<span>{settings.siteName}</span>
|
|
70
|
+
</Link>
|
|
71
|
+
<nav className="nav">
|
|
72
|
+
{nav.map((item, i) => (
|
|
73
|
+
<SmartLink key={`${item.href}-${i}`} href={item.href}>
|
|
74
|
+
{item.label}
|
|
75
|
+
</SmartLink>
|
|
76
|
+
))}
|
|
77
|
+
{settings.allowModeToggle !== false && <ThemeToggle />}
|
|
78
|
+
<WhatsAppButton
|
|
79
|
+
phone={settings.whatsappNumber}
|
|
80
|
+
message={fillMessage(settings.whatsappMessage, null)}
|
|
81
|
+
label="WhatsApp"
|
|
82
|
+
className="btn-small"
|
|
83
|
+
/>
|
|
84
|
+
</nav>
|
|
85
|
+
</div>
|
|
86
|
+
</header>
|
|
87
|
+
<main>
|
|
88
|
+
<RemountOnNavigate>{children}</RemountOnNavigate>
|
|
89
|
+
</main>
|
|
90
|
+
<footer className="site-footer">
|
|
91
|
+
<div className="container footer-inner">
|
|
92
|
+
<div>
|
|
93
|
+
<strong>{settings.siteName}</strong>
|
|
94
|
+
{settings.footerText && <p className="pre-line">{settings.footerText}</p>}
|
|
95
|
+
{privacy ? (
|
|
96
|
+
<p className="footer-links">
|
|
97
|
+
<Link href={privacy.href}>{privacy.title}</Link>
|
|
98
|
+
</p>
|
|
99
|
+
) : null}
|
|
100
|
+
</div>
|
|
101
|
+
<SocialLinks items={settings.socials} />
|
|
102
|
+
</div>
|
|
103
|
+
</footer>
|
|
104
|
+
</body>
|
|
105
|
+
</html>
|
|
106
|
+
)
|
|
107
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Link from 'next/link'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
export default function NotFound() {
|
|
5
|
+
return (
|
|
6
|
+
<section className="section spacing-lg align-center">
|
|
7
|
+
<div className="container prose">
|
|
8
|
+
<h1>Page not found</h1>
|
|
9
|
+
<p>We could not find what you were looking for.</p>
|
|
10
|
+
<Link href="/pets" className="btn btn-primary">
|
|
11
|
+
See adoptable pets
|
|
12
|
+
</Link>
|
|
13
|
+
</div>
|
|
14
|
+
</section>
|
|
15
|
+
)
|
|
16
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Metadata } from 'next'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
import { BuilderContent } from '@/components/site/BuilderContent'
|
|
5
|
+
import { getPublishedPage, getSettings } from '@/lib/queries'
|
|
6
|
+
import { jsonLd, organizationLd, pageMetadata } from '@/lib/seo'
|
|
7
|
+
import { DEFAULT_HOME_DATA, isPuckData } from '@/puck/data'
|
|
8
|
+
|
|
9
|
+
// Static: rendered at build, then kept fresh by the cached reads it uses. After a minute the next visit
|
|
10
|
+
// starts a refresh in the background (stale-while-revalidate); saving a page, pet or setting refreshes
|
|
11
|
+
// it at once (safeRevalidate in src/lib/revalidate.ts).
|
|
12
|
+
// `ensureStatic` is a guard: the build fails if anything this page, its metadata or the (frontend)
|
|
13
|
+
// layout reads stops being cached (an uncached query, headers(), new Date() outside a cached function).
|
|
14
|
+
export const ensureStatic = 'navigation'
|
|
15
|
+
|
|
16
|
+
// The homepage's own search description and share image (Page settings), else the site's tagline;
|
|
17
|
+
// its title is the site's name as it is.
|
|
18
|
+
export async function generateMetadata(): Promise<Metadata> {
|
|
19
|
+
const [page, settings] = await Promise.all([getPublishedPage('home'), getSettings()])
|
|
20
|
+
return pageMetadata({
|
|
21
|
+
path: '/',
|
|
22
|
+
siteName: settings.siteName,
|
|
23
|
+
title: settings.siteName,
|
|
24
|
+
absoluteTitle: true,
|
|
25
|
+
description: page?.seo?.description || settings.tagline,
|
|
26
|
+
image: page?.seo?.image,
|
|
27
|
+
})
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default async function HomePage() {
|
|
31
|
+
const page = await getPublishedPage('home')
|
|
32
|
+
const data = page && isPuckData(page.puckData) ? page.puckData : DEFAULT_HOME_DATA
|
|
33
|
+
const settings = await getSettings()
|
|
34
|
+
const title = page?.title ?? settings.siteName
|
|
35
|
+
return (
|
|
36
|
+
<>
|
|
37
|
+
{/* Structured data (JSON, not run as a script): who runs the site, for search results. */}
|
|
38
|
+
<script type="application/ld+json" dangerouslySetInnerHTML={{ __html: jsonLd(organizationLd(settings)) }} />
|
|
39
|
+
<BuilderContent data={data} title={title} />
|
|
40
|
+
</>
|
|
41
|
+
)
|
|
42
|
+
}
|