create-snapify-app 0.0.0-stage → 1.1.1
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 +24 -0
- package/README.md +55 -2
- package/bin/create-snapify-app.mjs +174 -0
- package/lib/args.mjs +59 -0
- package/lib/copy.mjs +44 -0
- package/lib/env.mjs +84 -0
- package/lib/prompt.mjs +63 -0
- package/package.json +35 -4
- package/template/.env.example +79 -0
- package/template/.github/workflows/ci.yml +23 -0
- package/template/.github/workflows/deploy.yml +26 -0
- package/template/.github/workflows/ping.yml +8 -0
- package/template/.github/workflows/release.yml +67 -0
- package/template/.snapify-install.json +5 -0
- package/template/CHANGELOG.md +28 -0
- package/template/LICENSE +14 -0
- package/template/README.md +287 -0
- package/template/administrator.html +23 -0
- package/template/apps/client/src/App.tsx +765 -0
- package/template/apps/client/src/auth.css +400 -0
- package/template/apps/client/src/lib/api.ts +22 -0
- package/template/apps/client/src/main.tsx +20 -0
- package/template/apps/community/src/App.tsx +592 -0
- package/template/apps/community/src/main.tsx +20 -0
- package/template/apps/community/src/styles.css +24 -0
- package/template/apps/developers/src/App.tsx +643 -0
- package/template/apps/developers/src/main.tsx +17 -0
- package/template/apps/developers/src/pages.tsx +1587 -0
- package/template/apps/developers/src/styles.css +98 -0
- package/template/apps/developers/src/ui.tsx +179 -0
- package/template/apps/landing/src/App.tsx +598 -0
- package/template/apps/landing/src/LegalPages.tsx +158 -0
- package/template/apps/landing/src/OrderPage.tsx +381 -0
- package/template/apps/landing/src/SeoPages.tsx +923 -0
- package/template/apps/landing/src/copy.ts +195 -0
- package/template/apps/landing/src/main.tsx +20 -0
- package/template/apps/landing/src/styles.css +803 -0
- package/template/apps/landing/src/types.ts +19 -0
- package/template/apps/marketplace/src/App.tsx +1229 -0
- package/template/apps/marketplace/src/developer/DeveloperApp.tsx +1266 -0
- package/template/apps/marketplace/src/main.tsx +20 -0
- package/template/apps/marketplace/src/styles.css +1001 -0
- package/template/apps/shared/AuthContext.tsx +65 -0
- package/template/apps/shared/Logo.tsx +33 -0
- package/template/apps/shared/api.ts +47 -0
- package/template/apps/shared/ui.tsx +128 -0
- package/template/apps/superadmin/src/App.tsx +1264 -0
- package/template/apps/superadmin/src/lib/api.ts +20 -0
- package/template/apps/superadmin/src/lib/hooks.ts +20 -0
- package/template/apps/superadmin/src/main.tsx +16 -0
- package/template/apps/superadmin/src/pages/ClientsPage.tsx +185 -0
- package/template/apps/superadmin/src/pages/InvoicesPage.tsx +157 -0
- package/template/apps/superadmin/src/pages/NewsletterPage.tsx +212 -0
- package/template/apps/superadmin/src/pages/OrdersPage.tsx +195 -0
- package/template/apps/superadmin/src/pages/PaymentsPage.tsx +150 -0
- package/template/apps/superadmin/src/pages/PayoutsPage.tsx +133 -0
- package/template/apps/superadmin/src/pages/PublishersPage.tsx +151 -0
- package/template/apps/superadmin/src/pages/SeoControlPage.tsx +692 -0
- package/template/apps/superadmin/src/pages/SettingsPage.tsx +199 -0
- package/template/apps/superadmin/src/pages/SystemPage.tsx +109 -0
- package/template/apps/superadmin/src/pages/TicketsPage.tsx +201 -0
- package/template/apps/superadmin/src/pages/UsersPage.tsx +167 -0
- package/template/client.html +21 -0
- package/template/community/hamdiayari/akhbar/README.md +23 -0
- package/template/community/hamdiayari/akhbar/screenshot.jpg +0 -0
- package/template/community/hamdiayari/akhbar/snapify.theme.json +76 -0
- package/template/community/hamdiayari/akhbar/src/Brand.tsx +26 -0
- package/template/community/hamdiayari/akhbar/src/Footer.tsx +182 -0
- package/template/community/hamdiayari/akhbar/src/Header.tsx +191 -0
- package/template/community/hamdiayari/akhbar/src/Layout.tsx +49 -0
- package/template/community/hamdiayari/akhbar/src/Social.tsx +33 -0
- package/template/community/hamdiayari/akhbar/src/Ticker.tsx +86 -0
- package/template/community/hamdiayari/akhbar/src/Views.tsx +285 -0
- package/template/community/hamdiayari/akhbar/src/blocks/CollectionBlocks.tsx +672 -0
- package/template/community/hamdiayari/akhbar/src/blocks/ContentBlocks.tsx +305 -0
- package/template/community/hamdiayari/akhbar/src/blocks/ConversionBlocks.tsx +569 -0
- package/template/community/hamdiayari/akhbar/src/blocks/HeaderBlocks.tsx +287 -0
- package/template/community/hamdiayari/akhbar/src/index.tsx +51 -0
- package/template/community/hamdiayari/akhbar/src/kit.tsx +357 -0
- package/template/community/hamdiayari/akhbar/src/site.ts +96 -0
- package/template/community/hamdiayari/akhbar/src/styles.css +566 -0
- package/template/community/hamdiayari/akhbar-actualites/README.md +28 -0
- package/template/community/hamdiayari/akhbar-actualites/screenshot.jpg +0 -0
- package/template/community/hamdiayari/akhbar-actualites/snapify.module.json +107 -0
- package/template/community/hamdiayari/akhbar-actualites/src/admin/AudiencePage.tsx +185 -0
- package/template/community/hamdiayari/akhbar-actualites/src/admin/index.tsx +11 -0
- package/template/community/hamdiayari/akhbar-actualites/src/public/Archive.tsx +142 -0
- package/template/community/hamdiayari/akhbar-actualites/src/public/cards.tsx +152 -0
- package/template/community/hamdiayari/akhbar-actualites/src/public/index.tsx +71 -0
- package/template/community/hamdiayari/akhbar-actualites/src/public/posts.ts +103 -0
- package/template/community/hamdiayari/akhbar-actualites/src/public/styles.css +568 -0
- package/template/community/hamdiayari/akhbar-actualites/src/public/widgets.tsx +226 -0
- package/template/community/hamdiayari/akhbar-actualites/src/server.ts +119 -0
- package/template/community/hamdiayari/akhbar-actualites/src/types.ts +25 -0
- package/template/community/hamdiayari/akhbar-urgent/README.md +36 -0
- package/template/community/hamdiayari/akhbar-urgent/screenshot.jpg +0 -0
- package/template/community/hamdiayari/akhbar-urgent/snapify.module.json +64 -0
- package/template/community/hamdiayari/akhbar-urgent/src/admin/FlashesPage.tsx +229 -0
- package/template/community/hamdiayari/akhbar-urgent/src/admin/index.tsx +11 -0
- package/template/community/hamdiayari/akhbar-urgent/src/public/Ticker.tsx +81 -0
- package/template/community/hamdiayari/akhbar-urgent/src/public/index.tsx +63 -0
- package/template/community/hamdiayari/akhbar-urgent/src/public/styles.css +142 -0
- package/template/community/hamdiayari/akhbar-urgent/src/server.ts +101 -0
- package/template/community/hamdiayari/akhbar-urgent/src/types.ts +35 -0
- package/template/community.html +21 -0
- package/template/developers.html +24 -0
- package/template/docker-compose.db.yml +24 -0
- package/template/docs/BACKOFFICE_SNAPIFY.md +130 -0
- package/template/docs/CI_CD.md +66 -0
- package/template/docs/MODULES.md +346 -0
- package/template/docs/PLATFORM_DEPLOY.md +54 -0
- package/template/docs/logo.svg +10 -0
- package/template/drizzle/0000_init.sql +147 -0
- package/template/drizzle/0001_page_project.sql +5 -0
- package/template/drizzle/0002_modules.sql +23 -0
- package/template/drizzle/0003_themes.sql +4 -0
- package/template/drizzle/0004_security.sql +82 -0
- package/template/drizzle/0005_module_records.sql +16 -0
- package/template/drizzle/0006_avatars.sql +4 -0
- package/template/drizzle/0007_platform.sql +264 -0
- package/template/drizzle/0008_mp_validation.sql +3 -0
- package/template/drizzle/0009_saas_ops.sql +77 -0
- package/template/drizzle/0010_cms_chrome.sql +13 -0
- package/template/drizzle/0011_client_portal.sql +26 -0
- package/template/drizzle/meta/0000_snapshot.json +998 -0
- package/template/drizzle/meta/0001_snapshot.json +1004 -0
- package/template/drizzle/meta/_journal.json +90 -0
- package/template/drizzle.config.ts +16 -0
- package/template/ecosystem.snapify.cjs +24 -0
- package/template/for.html +1 -0
- package/template/index.html +29 -0
- package/template/landing.html +37 -0
- package/template/marketplace/catalog.json +373 -0
- package/template/marketplace/gallery/hamdiayari.preveris/01-home.jpg +0 -0
- package/template/marketplace/gallery/hamdiayari.recaptcha/01-reglages.jpg +0 -0
- package/template/marketplace/gallery/hamdiayari.recaptcha/02-logo.jpg +0 -0
- package/template/marketplace/gallery/novalabs.ai-articles/01-generer.jpg +0 -0
- package/template/marketplace/gallery/novalabs.ai-articles/02-fournisseur-ia.jpg +0 -0
- package/template/marketplace/gallery/novalabs.calendar/01-agenda-site.jpg +0 -0
- package/template/marketplace/gallery/novalabs.calendar/02-evenements-admin.jpg +0 -0
- package/template/marketplace/gallery/novalabs.calendar/03-reglages.jpg +0 -0
- package/template/marketplace/screenshots/hamdiayari.preveris-1.0.6.jpg +0 -0
- package/template/marketplace/screenshots/hamdiayari.recaptcha-1.0.0.jpg +0 -0
- package/template/marketplace/screenshots/hamdiayari.wp-seo-migrator-1.1.1.jpg +0 -0
- package/template/marketplace/screenshots/novalabs.ai-articles-1.0.1.jpg +0 -0
- package/template/marketplace/screenshots/novalabs.ai-chat-1.0.1.jpg +0 -0
- package/template/marketplace/screenshots/novalabs.calendar-1.0.1.jpg +0 -0
- package/template/marketplace/screenshots/novalabs.cart-1.0.0.jpg +0 -0
- package/template/marketplace/screenshots/novalabs.checkout-1.0.0.jpg +0 -0
- package/template/marketplace/screenshots/novalabs.customers-1.1.0.jpg +0 -0
- package/template/marketplace/screenshots/novalabs.dogga-1.0.0.jpg +0 -0
- package/template/marketplace/screenshots/novalabs.mahdia-1.0.0.jpg +0 -0
- package/template/marketplace/screenshots/novalabs.shop-1.0.0.jpg +0 -0
- package/template/marketplace/screenshots/novalabs.sidibou-1.0.0.jpg +0 -0
- package/template/marketplace/screenshots/novalabs.whatsapp-1.0.1.jpg +0 -0
- package/template/marketplace.html +21 -0
- package/template/metadata.json +7 -0
- package/template/modules/ai-articles/screenshot.jpg +0 -0
- package/template/modules/ai-articles/snapify.module.json +74 -0
- package/template/modules/ai-articles/src/admin/ArticlesPage.tsx +162 -0
- package/template/modules/ai-articles/src/admin/GeneratePage.tsx +118 -0
- package/template/modules/ai-articles/src/admin/index.tsx +12 -0
- package/template/modules/ai-articles/src/public/index.tsx +119 -0
- package/template/modules/ai-articles/src/server.ts +287 -0
- package/template/modules/ai-articles/src/types.ts +30 -0
- package/template/modules/ai-chat/screenshot.jpg +0 -0
- package/template/modules/ai-chat/snapify.module.json +217 -0
- package/template/modules/ai-chat/src/public.tsx +198 -0
- package/template/modules/ai-chat/src/server.ts +142 -0
- package/template/modules/ai-theme-studio/README.md +15 -0
- package/template/modules/ai-theme-studio/screenshot.jpg +0 -0
- package/template/modules/ai-theme-studio/snapify.module.json +175 -0
- package/template/modules/ai-theme-studio/src/admin/HistoryPage.tsx +91 -0
- package/template/modules/ai-theme-studio/src/admin/StudioPage.tsx +414 -0
- package/template/modules/ai-theme-studio/src/admin/index.tsx +11 -0
- package/template/modules/ai-theme-studio/src/lib/images.ts +240 -0
- package/template/modules/ai-theme-studio/src/lib/llm.ts +123 -0
- package/template/modules/ai-theme-studio/src/lib/normalize.ts +714 -0
- package/template/modules/ai-theme-studio/src/lib/prompts.ts +198 -0
- package/template/modules/ai-theme-studio/src/server.ts +137 -0
- package/template/modules/ai-theme-studio/src/types.ts +112 -0
- package/template/modules/calendar/screenshot.jpg +0 -0
- package/template/modules/calendar/snapify.module.json +45 -0
- package/template/modules/calendar/src/admin/EventsPage.tsx +217 -0
- package/template/modules/calendar/src/admin/index.tsx +11 -0
- package/template/modules/calendar/src/public/index.tsx +231 -0
- package/template/modules/calendar/src/server.ts +143 -0
- package/template/modules/calendar/src/types.ts +25 -0
- package/template/modules/cart/screenshot.jpg +0 -0
- package/template/modules/cart/snapify.module.json +90 -0
- package/template/modules/cart/src/admin/index.tsx +265 -0
- package/template/modules/cart/src/public/CartPage.tsx +198 -0
- package/template/modules/cart/src/public/index.tsx +261 -0
- package/template/modules/cart/src/public/useQuote.ts +67 -0
- package/template/modules/cart/src/server.ts +148 -0
- package/template/modules/cart/src/types.ts +31 -0
- package/template/modules/checkout/screenshot.jpg +0 -0
- package/template/modules/checkout/snapify.module.json +264 -0
- package/template/modules/checkout/src/admin/OrderDetailPage.tsx +304 -0
- package/template/modules/checkout/src/admin/badges.tsx +28 -0
- package/template/modules/checkout/src/admin/index.tsx +236 -0
- package/template/modules/checkout/src/public/CheckoutPage.tsx +461 -0
- package/template/modules/checkout/src/public/OrderPages.tsx +153 -0
- package/template/modules/checkout/src/public/index.tsx +23 -0
- package/template/modules/checkout/src/server.ts +383 -0
- package/template/modules/checkout/src/types.ts +70 -0
- package/template/modules/customers/screenshot.jpg +0 -0
- package/template/modules/customers/snapify.module.json +115 -0
- package/template/modules/customers/src/admin/CustomerDetailPage.tsx +274 -0
- package/template/modules/customers/src/admin/index.tsx +194 -0
- package/template/modules/customers/src/public/AccountPages.tsx +470 -0
- package/template/modules/customers/src/public/AddressForm.tsx +115 -0
- package/template/modules/customers/src/public/AuthPages.tsx +349 -0
- package/template/modules/customers/src/public/Avatar.tsx +29 -0
- package/template/modules/customers/src/public/ProfileSection.tsx +291 -0
- package/template/modules/customers/src/public/index.tsx +137 -0
- package/template/modules/customers/src/public/session.ts +51 -0
- package/template/modules/customers/src/server.ts +421 -0
- package/template/modules/customers/src/types.ts +53 -0
- package/template/modules/recaptcha/logo.jpg +0 -0
- package/template/modules/recaptcha/screenshot.jpg +0 -0
- package/template/modules/recaptcha/snapify.module.json +99 -0
- package/template/modules/recaptcha/src/public/index.tsx +94 -0
- package/template/modules/recaptcha/src/server.ts +65 -0
- package/template/modules/recaptcha/src/types.ts +18 -0
- package/template/modules/shop/screenshot.jpg +0 -0
- package/template/modules/shop/snapify.module.json +340 -0
- package/template/modules/shop/src/admin/CategoriesPage.tsx +224 -0
- package/template/modules/shop/src/admin/ProductEditor.tsx +313 -0
- package/template/modules/shop/src/admin/ProductsPage.tsx +307 -0
- package/template/modules/shop/src/admin/index.tsx +14 -0
- package/template/modules/shop/src/public/Catalog.tsx +244 -0
- package/template/modules/shop/src/public/NotFound.tsx +22 -0
- package/template/modules/shop/src/public/ProductPage.tsx +195 -0
- package/template/modules/shop/src/public/index.tsx +134 -0
- package/template/modules/shop/src/public/useFetch.ts +26 -0
- package/template/modules/shop/src/server.ts +493 -0
- package/template/modules/shop/src/shared.ts +41 -0
- package/template/modules/shop/src/types.ts +60 -0
- package/template/modules/whatsapp/screenshot.jpg +0 -0
- package/template/modules/whatsapp/snapify.module.json +121 -0
- package/template/modules/whatsapp/src/public.tsx +119 -0
- package/template/modules/wp-seo-migrator/ARCHITECTURE.md +113 -0
- package/template/modules/wp-seo-migrator/README.md +21 -0
- package/template/modules/wp-seo-migrator/fixtures/aioseo-sample.csv +3 -0
- package/template/modules/wp-seo-migrator/fixtures/sample-exporter.json +39 -0
- package/template/modules/wp-seo-migrator/fixtures/sample-page.html +12 -0
- package/template/modules/wp-seo-migrator/fixtures/sample.htaccess +3 -0
- package/template/modules/wp-seo-migrator/screenshot.jpg +0 -0
- package/template/modules/wp-seo-migrator/snapify.module.json +87 -0
- package/template/modules/wp-seo-migrator/src/admin/HistoryPage.tsx +64 -0
- package/template/modules/wp-seo-migrator/src/admin/WizardPage.tsx +788 -0
- package/template/modules/wp-seo-migrator/src/admin/i18n.ts +156 -0
- package/template/modules/wp-seo-migrator/src/admin/index.tsx +11 -0
- package/template/modules/wp-seo-migrator/src/connectors/CUSTOM_CONNECTOR.md +31 -0
- package/template/modules/wp-seo-migrator/src/connectors/csvSeoFactory.ts +106 -0
- package/template/modules/wp-seo-migrator/src/connectors/exporter.ts +96 -0
- package/template/modules/wp-seo-migrator/src/connectors/gscCsv.ts +53 -0
- package/template/modules/wp-seo-migrator/src/connectors/htaccess.ts +65 -0
- package/template/modules/wp-seo-migrator/src/connectors/htmlCrawler.ts +90 -0
- package/template/modules/wp-seo-migrator/src/connectors/index.ts +113 -0
- package/template/modules/wp-seo-migrator/src/connectors/pluginCsv.ts +77 -0
- package/template/modules/wp-seo-migrator/src/connectors/rankMathCsv.ts +77 -0
- package/template/modules/wp-seo-migrator/src/connectors/redirection.ts +62 -0
- package/template/modules/wp-seo-migrator/src/connectors/sitemap.ts +44 -0
- package/template/modules/wp-seo-migrator/src/connectors/utils.ts +111 -0
- package/template/modules/wp-seo-migrator/src/connectors/wxr.ts +103 -0
- package/template/modules/wp-seo-migrator/src/connectors/yoastCsv.ts +56 -0
- package/template/modules/wp-seo-migrator/src/pipeline/analyze.ts +158 -0
- package/template/modules/wp-seo-migrator/src/pipeline/htmlParse.ts +58 -0
- package/template/modules/wp-seo-migrator/src/pipeline/remoteAuto.ts +328 -0
- package/template/modules/wp-seo-migrator/src/server.ts +492 -0
- package/template/modules/wp-seo-migrator/src/types.ts +151 -0
- package/template/modules/wp-seo-migrator/tests/connectors-extra.test.ts +39 -0
- package/template/modules/wp-seo-migrator/tests/merge.test.ts +25 -0
- package/template/package-lock.json +6016 -0
- package/template/package.json +74 -0
- package/template/public/images/photos/caravane-chameaux-desert.webp +0 -0
- package/template/public/images/photos/hammamet-medina-plage.jpg +0 -0
- package/template/public/images/photos/maison-campagne-collines.webp +0 -0
- package/template/public/images/photos/maisons-troglodytes-desert.jpg +0 -0
- package/template/public/images/photos/panorama-ville.jpg +0 -0
- package/template/public/images/photos/preveris-accessibilite-erp.jpg +0 -0
- package/template/public/images/photos/preveris-collectivites.jpg +0 -0
- package/template/public/images/photos/preveris-etudes-plans.jpg +0 -0
- package/template/public/images/photos/preveris-hero-erp.jpg +0 -0
- package/template/public/images/photos/preveris-ssi-incendie.jpg +0 -0
- package/template/public/images/photos/preveris-suivi-hotel.jpg +0 -0
- package/template/public/images/photos/ruelle-bleue-medina.jpg +0 -0
- package/template/public/images/photos/sidi-bou-said-port.webp +0 -0
- package/template/public/images/photos/terrasse-blanche-mer-voilier.jpg +0 -0
- package/template/public/landing/hero-ai-cms.jpg +0 -0
- package/template/public/landing/shot-dogga.jpg +0 -0
- package/template/public/landing/shot-mahdia.jpg +0 -0
- package/template/public/landing/shot-sidibou.jpg +0 -0
- package/template/public/llms.txt +35 -0
- package/template/public/logo.svg +10 -0
- package/template/scripts/app-pack.ts +155 -0
- package/template/scripts/app-publish.ts +123 -0
- package/template/scripts/apply-ecommerce-home.ts +196 -0
- package/template/scripts/auto-deploy-poll.sh +13 -0
- package/template/scripts/db-backup.sh +16 -0
- package/template/scripts/db-restore.sh +11 -0
- package/template/scripts/deploy.sh +34 -0
- package/template/scripts/github-webhook-deploy.sh +7 -0
- package/template/scripts/install-new-modules.ts +96 -0
- package/template/scripts/refresh-demo-baseline.ts +9 -0
- package/template/scripts/reinstall-marketplace-packs.ts +51 -0
- package/template/scripts/restore-classic-home.ts +13 -0
- package/template/scripts/sdk-pack.ts +289 -0
- package/template/scripts/sdk-publish.ts +75 -0
- package/template/scripts/seed-demo-products.ts +120 -0
- package/template/scripts/seed-theme-content-packs.ts +42 -0
- package/template/scripts/snapify-module.ts +207 -0
- package/template/scripts/test-theme-switch.ts +24 -0
- package/template/sdk/admin.css +18 -0
- package/template/sdk/admin.ts +95 -0
- package/template/sdk/build.ts +249 -0
- package/template/sdk/commerce.ts +512 -0
- package/template/sdk/content.ts +76 -0
- package/template/sdk/icons.ts +101 -0
- package/template/sdk/image.ts +60 -0
- package/template/sdk/index.ts +500 -0
- package/template/sdk/package.ts +298 -0
- package/template/sdk/recaptcha.tsx +122 -0
- package/template/sdk/settings.ts +84 -0
- package/template/sdk/theme.css +29 -0
- package/template/sdk/theme.ts +100 -0
- package/template/sdk/ui/commerce.tsx +385 -0
- package/template/sdk/ui/orders.tsx +136 -0
- package/template/sdk-kit/CHANGELOG.md +17 -0
- package/template/sdk-kit/LICENSE.md +47 -0
- package/template/sdk-kit/README.md +81 -0
- package/template/sdk-kit/cli.ts +339 -0
- package/template/sdk-kit/create-snapify/README.md +28 -0
- package/template/sdk-kit/create-snapify/create-snapify.mjs +11 -0
- package/template/sdk-kit/create-snapify/package.template.json +16 -0
- package/template/sdk-kit/package.template.json +95 -0
- package/template/sdk-kit/templates/common/README.md.tpl +27 -0
- package/template/sdk-kit/templates/common/_gitignore +3 -0
- package/template/sdk-kit/templates/common/package.json.tpl +19 -0
- package/template/sdk-kit/templates/common/src/snapify-env.d.ts +2 -0
- package/template/sdk-kit/templates/common/tsconfig.json +15 -0
- package/template/sdk-kit/templates/module/snapify.module.json.tpl +33 -0
- package/template/sdk-kit/templates/module/src/admin.tsx +53 -0
- package/template/sdk-kit/templates/module/src/public.tsx +49 -0
- package/template/sdk-kit/templates/module/src/server.ts +30 -0
- package/template/sdk-kit/templates/module/src/types.ts +19 -0
- package/template/sdk-kit/templates/theme/snapify.theme.json.tpl +22 -0
- package/template/sdk-kit/templates/theme/src/Footer.tsx +40 -0
- package/template/sdk-kit/templates/theme/src/Header.tsx +47 -0
- package/template/sdk-kit/templates/theme/src/Views.tsx +36 -0
- package/template/sdk-kit/templates/theme/src/blocks.tsx +93 -0
- package/template/sdk-kit/templates/theme/src/index.tsx +30 -0
- package/template/sdk-kit/templates/theme/src/site.tsx +59 -0
- package/template/sdk-kit/templates/theme/src/styles.css +71 -0
- package/template/server/client/routes.ts +252 -0
- package/template/server/cms/analyticsStore.ts +180 -0
- package/template/server/cms/auth.ts +155 -0
- package/template/server/cms/blockCatalog.ts +342 -0
- package/template/server/cms/blocks.ts +521 -0
- package/template/server/cms/contentMigration.ts +1119 -0
- package/template/server/cms/defaults.ts +303 -0
- package/template/server/cms/permissions.ts +154 -0
- package/template/server/cms/restoreClassicHome.ts +183 -0
- package/template/server/cms/revisions.ts +99 -0
- package/template/server/cms/scheduler.ts +78 -0
- package/template/server/cms/seed.ts +72 -0
- package/template/server/cms/seoAnalyzer.ts +213 -0
- package/template/server/cms/store.ts +122 -0
- package/template/server/cms/themeContent.ts +1386 -0
- package/template/server/cms/themePacks/sidibou-branding.json +1 -0
- package/template/server/cms/themePacks/sidibou-home.json +1 -0
- package/template/server/cms/themePacks/sidibou-menus.json +1 -0
- package/template/server/cms/types.ts +432 -0
- package/template/server/community/routes.ts +410 -0
- package/template/server/db/client.ts +43 -0
- package/template/server/db/repository.ts +389 -0
- package/template/server/db/schema.ts +726 -0
- package/template/server/demo/cmsReset.ts +196 -0
- package/template/server/developers/sdk.ts +85 -0
- package/template/server/geoip.ts +15 -0
- package/template/server/http.ts +53 -0
- package/template/server/mail.ts +216 -0
- package/template/server/marketplace/catalog.ts +74 -0
- package/template/server/marketplace/packageValidate.ts +475 -0
- package/template/server/marketplace/payments.ts +193 -0
- package/template/server/marketplace/routes.ts +850 -0
- package/template/server/marketplace/signing.ts +116 -0
- package/template/server/marketplace/syncOfficial.ts +282 -0
- package/template/server/media/images.ts +63 -0
- package/template/server/middleware/adminAuth.ts +134 -0
- package/template/server/modules/legacy.ts +44 -0
- package/template/server/modules/manager.ts +1122 -0
- package/template/server/modules/marketplace.ts +178 -0
- package/template/server/modules/outbound.ts +178 -0
- package/template/server/modules/purchases.ts +149 -0
- package/template/server/modules/records.ts +168 -0
- package/template/server/modules/themeHtml.ts +32 -0
- package/template/server/modules/trust.ts +16 -0
- package/template/server/modules/types.ts +147 -0
- package/template/server/platform/auth.ts +223 -0
- package/template/server/platform/clientWelcome.ts +168 -0
- package/template/server/platform/clients.ts +139 -0
- package/template/server/platform/dailyImprove.ts +356 -0
- package/template/server/platform/flouci.ts +126 -0
- package/template/server/platform/host.ts +69 -0
- package/template/server/platform/hostingProviders.ts +143 -0
- package/template/server/platform/licenseOrders.ts +291 -0
- package/template/server/platform/money.ts +42 -0
- package/template/server/platform/passwords.ts +41 -0
- package/template/server/platform/region.ts +86 -0
- package/template/server/platform/routes.ts +225 -0
- package/template/server/platform/seed.ts +82 -0
- package/template/server/platform/settings.ts +72 -0
- package/template/server/routes/adminAccount.ts +403 -0
- package/template/server/routes/adminCms.ts +808 -0
- package/template/server/routes/adminSystem.ts +243 -0
- package/template/server/routes/adminUsers.ts +449 -0
- package/template/server/routes/googleOAuth.ts +327 -0
- package/template/server/routes/modules.ts +323 -0
- package/template/server/routes/publicCms.ts +313 -0
- package/template/server/routes/seoPublic.ts +158 -0
- package/template/server/security/accounts.ts +121 -0
- package/template/server/security/audit.ts +143 -0
- package/template/server/security/authTokens.ts +74 -0
- package/template/server/security/ip.ts +68 -0
- package/template/server/security/rateLimit.ts +85 -0
- package/template/server/security/retention.ts +46 -0
- package/template/server/security/secrets.ts +44 -0
- package/template/server/security/sessions.ts +140 -0
- package/template/server/security/totp.ts +101 -0
- package/template/server/superadmin/analytics.ts +109 -0
- package/template/server/superadmin/auth.ts +92 -0
- package/template/server/superadmin/backlinksCatalog.ts +210 -0
- package/template/server/superadmin/frSeoContent.ts +165 -0
- package/template/server/superadmin/landingSeo.ts +675 -0
- package/template/server/superadmin/ops.ts +238 -0
- package/template/server/superadmin/routes.ts +1095 -0
- package/template/server/superadmin/tnSeoContent.ts +130 -0
- package/template/server.ts +522 -0
- package/template/src/App.tsx +263 -0
- package/template/src/admin/AdminApp.tsx +162 -0
- package/template/src/admin/account/AuthLayout.tsx +57 -0
- package/template/src/admin/account/SecurityForms.tsx +276 -0
- package/template/src/admin/admin.css +127 -0
- package/template/src/admin/context/AuthContext.tsx +147 -0
- package/template/src/admin/context/SiteContext.tsx +50 -0
- package/template/src/admin/editor/BlockLibrary.tsx +173 -0
- package/template/src/admin/editor/BlocksPanel.tsx +396 -0
- package/template/src/admin/editor/EditorBits.tsx +106 -0
- package/template/src/admin/editor/PreviewFrame.tsx +145 -0
- package/template/src/admin/editor/RichTextEditor.tsx +276 -0
- package/template/src/admin/editor/SeoPanel.tsx +349 -0
- package/template/src/admin/editor/StyleEditor.tsx +114 -0
- package/template/src/admin/editor/blockSchemas.ts +699 -0
- package/template/src/admin/editor/fields.tsx +486 -0
- package/template/src/admin/layout/AdminShell.tsx +418 -0
- package/template/src/admin/layout/nav.ts +95 -0
- package/template/src/admin/lib/api.ts +408 -0
- package/template/src/admin/lib/audit.ts +141 -0
- package/template/src/admin/lib/format.ts +84 -0
- package/template/src/admin/lib/hooks.ts +125 -0
- package/template/src/admin/main.tsx +16 -0
- package/template/src/admin/modules/InstallDialog.tsx +160 -0
- package/template/src/admin/modules/SettingsForm.tsx +145 -0
- package/template/src/admin/modules/kit.tsx +127 -0
- package/template/src/admin/modules/labels.tsx +226 -0
- package/template/src/admin/pages/AccountSetupPage.tsx +62 -0
- package/template/src/admin/pages/AnalyticsPage.tsx +206 -0
- package/template/src/admin/pages/BrandingPage.tsx +154 -0
- package/template/src/admin/pages/DashboardPage.tsx +239 -0
- package/template/src/admin/pages/EngagementPage.tsx +168 -0
- package/template/src/admin/pages/FormsPage.tsx +435 -0
- package/template/src/admin/pages/GeneralPage.tsx +120 -0
- package/template/src/admin/pages/LoginPage.tsx +249 -0
- package/template/src/admin/pages/MaintenancePage.tsx +125 -0
- package/template/src/admin/pages/MarketplacePage.tsx +426 -0
- package/template/src/admin/pages/MediaPage.tsx +251 -0
- package/template/src/admin/pages/MenusPage.tsx +446 -0
- package/template/src/admin/pages/ModuleAdminPage.tsx +113 -0
- package/template/src/admin/pages/ModuleDetailPage.tsx +293 -0
- package/template/src/admin/pages/ModulesPage.tsx +135 -0
- package/template/src/admin/pages/NewsletterPage.tsx +193 -0
- package/template/src/admin/pages/PageEditorPage.tsx +322 -0
- package/template/src/admin/pages/PagesListPage.tsx +277 -0
- package/template/src/admin/pages/PostEditorPage.tsx +292 -0
- package/template/src/admin/pages/PostsListPage.tsx +187 -0
- package/template/src/admin/pages/ProfilePage.tsx +489 -0
- package/template/src/admin/pages/ResetPasswordPage.tsx +110 -0
- package/template/src/admin/pages/SeoPage.tsx +670 -0
- package/template/src/admin/pages/SettingsPage.tsx +189 -0
- package/template/src/admin/pages/ThemeCustomizePage.tsx +170 -0
- package/template/src/admin/pages/ThemesPage.tsx +292 -0
- package/template/src/admin/pages/UsersPage.tsx +57 -0
- package/template/src/admin/pages/WidgetsPage.tsx +200 -0
- package/template/src/admin/seo/GoogleSetup.tsx +529 -0
- package/template/src/admin/settings/EmailTab.tsx +293 -0
- package/template/src/admin/settings/OtherTabs.tsx +270 -0
- package/template/src/admin/settings/SecurityTab.tsx +172 -0
- package/template/src/admin/settings/controls.tsx +133 -0
- package/template/src/admin/ui/Pagination.tsx +170 -0
- package/template/src/admin/ui/SaveBar.tsx +77 -0
- package/template/src/admin/ui/TagInput.tsx +54 -0
- package/template/src/admin/ui/charts.tsx +108 -0
- package/template/src/admin/ui/media.tsx +265 -0
- package/template/src/admin/ui/overlays.tsx +239 -0
- package/template/src/admin/ui/primitives.tsx +544 -0
- package/template/src/admin/users/AuditTab.tsx +104 -0
- package/template/src/admin/users/RolesTab.tsx +368 -0
- package/template/src/admin/users/UsersTab.tsx +723 -0
- package/template/src/admin/users/shared.tsx +278 -0
- package/template/src/cms/icons.ts +7 -0
- package/template/src/components/CookieBanner.tsx +166 -0
- package/template/src/components/MaintenanceGate.tsx +66 -0
- package/template/src/components/SiteAnalytics.tsx +64 -0
- package/template/src/components/SnapifyLogo.tsx +44 -0
- package/template/src/components/cms/BlockRenderer.tsx +154 -0
- package/template/src/components/cms/WidgetArea.tsx +193 -0
- package/template/src/context/SiteConfigContext.tsx +130 -0
- package/template/src/demoBase.ts +23 -0
- package/template/src/index.css +90 -0
- package/template/src/main.tsx +16 -0
- package/template/src/modules/ModuleHost.tsx +197 -0
- package/template/src/preview.ts +63 -0
- package/template/src/runtime.ts +38 -0
- package/template/src/themes/ThemeHost.tsx +168 -0
- package/template/src/themes/fallback.tsx +71 -0
- package/template/src/types.ts +94 -0
- package/template/src/views/BlogPostView.tsx +68 -0
- package/template/src/views/CmsPageView.tsx +34 -0
- package/template/start-pm2.sh +3 -0
- package/template/superadmin.html +20 -0
- package/template/themes/ai-canvas/screenshot.jpg +0 -0
- package/template/themes/ai-canvas/snapify.theme.json +96 -0
- package/template/themes/ai-canvas/src/CeeSimulator.tsx +247 -0
- package/template/themes/ai-canvas/src/Footer.tsx +190 -0
- package/template/themes/ai-canvas/src/Header.tsx +324 -0
- package/template/themes/ai-canvas/src/Layout.tsx +56 -0
- package/template/themes/ai-canvas/src/NotFound.tsx +58 -0
- package/template/themes/ai-canvas/src/Post.tsx +26 -0
- package/template/themes/ai-canvas/src/SnapifyLogo.tsx +44 -0
- package/template/themes/ai-canvas/src/blocks/CollectionBlocks.tsx +711 -0
- package/template/themes/ai-canvas/src/blocks/ContentBlocks.tsx +318 -0
- package/template/themes/ai-canvas/src/blocks/ConversionBlocks.tsx +559 -0
- package/template/themes/ai-canvas/src/blocks/HeaderBlocks.tsx +341 -0
- package/template/themes/ai-canvas/src/index.tsx +54 -0
- package/template/themes/ai-canvas/src/kit.tsx +398 -0
- package/template/themes/ai-canvas/src/site.ts +29 -0
- package/template/themes/ai-canvas/src/styles.css +317 -0
- package/template/themes/dogga/screenshot.jpg +0 -0
- package/template/themes/dogga/snapify.theme.json +55 -0
- package/template/themes/dogga/src/Brand.tsx +41 -0
- package/template/themes/dogga/src/Footer.tsx +202 -0
- package/template/themes/dogga/src/Header.tsx +239 -0
- package/template/themes/dogga/src/Layout.tsx +43 -0
- package/template/themes/dogga/src/Views.tsx +71 -0
- package/template/themes/dogga/src/blocks/CollectionBlocks.tsx +674 -0
- package/template/themes/dogga/src/blocks/ContentBlocks.tsx +307 -0
- package/template/themes/dogga/src/blocks/ConversionBlocks.tsx +571 -0
- package/template/themes/dogga/src/blocks/HeaderBlocks.tsx +289 -0
- package/template/themes/dogga/src/index.tsx +53 -0
- package/template/themes/dogga/src/kit.tsx +362 -0
- package/template/themes/dogga/src/site.ts +56 -0
- package/template/themes/dogga/src/styles.css +396 -0
- package/template/themes/mahdia/screenshot.jpg +0 -0
- package/template/themes/mahdia/snapify.theme.json +65 -0
- package/template/themes/mahdia/src/Brand.tsx +39 -0
- package/template/themes/mahdia/src/Footer.tsx +210 -0
- package/template/themes/mahdia/src/Header.tsx +291 -0
- package/template/themes/mahdia/src/Layout.tsx +44 -0
- package/template/themes/mahdia/src/Views.tsx +79 -0
- package/template/themes/mahdia/src/blocks/CollectionBlocks.tsx +674 -0
- package/template/themes/mahdia/src/blocks/ContentBlocks.tsx +307 -0
- package/template/themes/mahdia/src/blocks/ConversionBlocks.tsx +571 -0
- package/template/themes/mahdia/src/blocks/HeaderBlocks.tsx +289 -0
- package/template/themes/mahdia/src/index.tsx +53 -0
- package/template/themes/mahdia/src/kit.tsx +362 -0
- package/template/themes/mahdia/src/site.ts +75 -0
- package/template/themes/mahdia/src/styles.css +446 -0
- package/template/themes/preveris/screenshot.jpg +0 -0
- package/template/themes/preveris/snapify.theme.json +126 -0
- package/template/themes/preveris/src/Brand.tsx +44 -0
- package/template/themes/preveris/src/Footer.tsx +202 -0
- package/template/themes/preveris/src/Header.tsx +239 -0
- package/template/themes/preveris/src/Layout.tsx +42 -0
- package/template/themes/preveris/src/Views.tsx +71 -0
- package/template/themes/preveris/src/blocks/CollectionBlocks.tsx +678 -0
- package/template/themes/preveris/src/blocks/ContentBlocks.tsx +307 -0
- package/template/themes/preveris/src/blocks/ConversionBlocks.tsx +571 -0
- package/template/themes/preveris/src/blocks/HeaderBlocks.tsx +299 -0
- package/template/themes/preveris/src/index.tsx +53 -0
- package/template/themes/preveris/src/kit.tsx +365 -0
- package/template/themes/preveris/src/site.ts +79 -0
- package/template/themes/preveris/src/styles.css +446 -0
- package/template/themes/sidibou/screenshot.jpg +0 -0
- package/template/themes/sidibou/snapify.theme.json +21 -0
- package/template/themes/sidibou/src/CeeSimulator.tsx +247 -0
- package/template/themes/sidibou/src/Footer.tsx +203 -0
- package/template/themes/sidibou/src/Header.tsx +324 -0
- package/template/themes/sidibou/src/Layout.tsx +53 -0
- package/template/themes/sidibou/src/NotFound.tsx +58 -0
- package/template/themes/sidibou/src/Post.tsx +26 -0
- package/template/themes/sidibou/src/SnapifyLogo.tsx +44 -0
- package/template/themes/sidibou/src/blocks/CollectionBlocks.tsx +711 -0
- package/template/themes/sidibou/src/blocks/ContentBlocks.tsx +318 -0
- package/template/themes/sidibou/src/blocks/ConversionBlocks.tsx +559 -0
- package/template/themes/sidibou/src/blocks/HeaderBlocks.tsx +341 -0
- package/template/themes/sidibou/src/index.tsx +54 -0
- package/template/themes/sidibou/src/kit.tsx +398 -0
- package/template/themes/sidibou/src/site.ts +28 -0
- package/template/themes/sidibou/src/styles.css +317 -0
- package/template/tsconfig.json +33 -0
- package/template/vite.config.ts +42 -0
|
@@ -0,0 +1,670 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Snapify
|
|
3
|
+
* © 2026 NOVALABS WEB DESIGN — Tunisie
|
|
4
|
+
* Contact : contact@novalabs.tn · +216 24 734 647
|
|
5
|
+
* Tous droits réservés. Toute reproduction, modification ou diffusion sans autorisation écrite est interdite.
|
|
6
|
+
*/
|
|
7
|
+
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
8
|
+
import { Link, useSearchParams } from 'react-router-dom';
|
|
9
|
+
import { toast } from 'sonner';
|
|
10
|
+
import {
|
|
11
|
+
AlertTriangle,
|
|
12
|
+
ArrowRight,
|
|
13
|
+
BarChart3,
|
|
14
|
+
Copy,
|
|
15
|
+
ExternalLink,
|
|
16
|
+
FileCode2,
|
|
17
|
+
Globe,
|
|
18
|
+
Link2,
|
|
19
|
+
LogOut,
|
|
20
|
+
MousePointerClick,
|
|
21
|
+
Percent,
|
|
22
|
+
Plus,
|
|
23
|
+
Search,
|
|
24
|
+
Settings2,
|
|
25
|
+
Target,
|
|
26
|
+
Trash2,
|
|
27
|
+
TrendingUp,
|
|
28
|
+
} from 'lucide-react';
|
|
29
|
+
import type { RedirectRule, SeoGlobalSettings } from '../../../server/cms/types';
|
|
30
|
+
import { api, type SeoOverviewRow } from '../lib/api';
|
|
31
|
+
import { errorMessage, useAsync, useEditable } from '../lib/hooks';
|
|
32
|
+
import { fmtDateTime, fmtNumber } from '../lib/format';
|
|
33
|
+
import { useAuth } from '../context/AuthContext';
|
|
34
|
+
import { publicUrl, useSite, useSiteData } from '../context/SiteContext';
|
|
35
|
+
import {
|
|
36
|
+
Alert,
|
|
37
|
+
Badge,
|
|
38
|
+
Button,
|
|
39
|
+
Card,
|
|
40
|
+
EmptyState,
|
|
41
|
+
ErrorState,
|
|
42
|
+
Field,
|
|
43
|
+
Input,
|
|
44
|
+
PageHeader,
|
|
45
|
+
PageSkeleton,
|
|
46
|
+
ScoreRing,
|
|
47
|
+
Section,
|
|
48
|
+
Segmented,
|
|
49
|
+
Select,
|
|
50
|
+
StatCard,
|
|
51
|
+
StatusBadge,
|
|
52
|
+
Switch,
|
|
53
|
+
Table,
|
|
54
|
+
Tabs,
|
|
55
|
+
Td,
|
|
56
|
+
Textarea,
|
|
57
|
+
Th,
|
|
58
|
+
} from '../ui/primitives';
|
|
59
|
+
import { useConfirm } from '../ui/overlays';
|
|
60
|
+
import { ImageField } from '../ui/media';
|
|
61
|
+
import { CredentialsCard, GoogleSetupWizard, GoogleTroubleshooting, googleErrorMessage, NoPropertyHelp } from '../seo/GoogleSetup';
|
|
62
|
+
import { SaveBar } from '../ui/SaveBar';
|
|
63
|
+
import { TagInput } from '../ui/TagInput';
|
|
64
|
+
import { Legend, TrendChart } from '../ui/charts';
|
|
65
|
+
import { Pagination, usePagination } from '../ui/Pagination';
|
|
66
|
+
|
|
67
|
+
type Tab = 'overview' | 'google' | 'settings' | 'redirects' | 'indexing';
|
|
68
|
+
|
|
69
|
+
/* ------------------------------------------------------------------ Vue d'ensemble */
|
|
70
|
+
|
|
71
|
+
function Overview() {
|
|
72
|
+
const { data, error, loading, reload } = useAsync(() => api.seoOverview(), []);
|
|
73
|
+
const [q, setQ] = useState('');
|
|
74
|
+
const [filter, setFilter] = useState<'all' | 'bad' | 'ok' | 'good'>('all');
|
|
75
|
+
|
|
76
|
+
const rows = useMemo(() => {
|
|
77
|
+
const nq = q.trim().toLowerCase();
|
|
78
|
+
return (data || [])
|
|
79
|
+
.filter((r) => !nq || r.title.toLowerCase().includes(nq) || r.url.includes(nq) || r.seo.focusKeyphrase.toLowerCase().includes(nq))
|
|
80
|
+
.filter((r) => filter === 'all' || (filter === 'bad' ? r.analysis.score < 50 : filter === 'ok' ? r.analysis.score >= 50 && r.analysis.score < 75 : r.analysis.score >= 75))
|
|
81
|
+
.sort((a, b) => a.analysis.score - b.analysis.score);
|
|
82
|
+
}, [data, q, filter]);
|
|
83
|
+
const pg = usePagination(rows, 'seo-overview', { resetKey: [q, filter] });
|
|
84
|
+
|
|
85
|
+
if (loading && !data) return <PageSkeleton />;
|
|
86
|
+
if (error || !data) return <ErrorState message={error || ''} onRetry={reload} />;
|
|
87
|
+
|
|
88
|
+
const published = data.filter((r) => r.status === 'published');
|
|
89
|
+
const avg = published.length ? Math.round(published.reduce((s, r) => s + r.analysis.score, 0) / published.length) : 0;
|
|
90
|
+
const noKeyphrase = data.filter((r) => !r.seo.focusKeyphrase.trim()).length;
|
|
91
|
+
const noDesc = data.filter((r) => !r.seo.metaDescription.trim()).length;
|
|
92
|
+
const noindex = data.filter((r) => r.seo.noindex).length;
|
|
93
|
+
const editLink = (r: SeoOverviewRow) => (r.kind === 'page' ? `/pages/${r.id}` : `/posts/${r.id}`);
|
|
94
|
+
|
|
95
|
+
return (
|
|
96
|
+
<div className="space-y-6">
|
|
97
|
+
<div className="grid gap-4 sm:grid-cols-2 xl:grid-cols-4">
|
|
98
|
+
<Card className="flex items-center gap-4">
|
|
99
|
+
<ScoreRing score={avg} size={60} />
|
|
100
|
+
<div>
|
|
101
|
+
<p className="text-[13px] font-medium text-slate-500">Score SEO moyen</p>
|
|
102
|
+
<p className="text-xs text-slate-400">{published.length} contenu(s) publié(s)</p>
|
|
103
|
+
</div>
|
|
104
|
+
</Card>
|
|
105
|
+
<StatCard label="Sans expression clé" value={noKeyphrase} icon={Target} tone="amber" hint="Analyse incomplète" />
|
|
106
|
+
<StatCard label="Sans meta description" value={noDesc} icon={FileCode2} tone="rose" hint="Google choisira un extrait" />
|
|
107
|
+
<StatCard label="Exclus de Google" value={noindex} icon={AlertTriangle} tone="violet" hint="Pages en noindex" />
|
|
108
|
+
</div>
|
|
109
|
+
|
|
110
|
+
<Card padded={false}>
|
|
111
|
+
<div className="flex flex-col gap-3 border-b border-slate-100 p-4 sm:flex-row sm:items-center sm:justify-between">
|
|
112
|
+
<Segmented
|
|
113
|
+
value={filter}
|
|
114
|
+
onChange={setFilter}
|
|
115
|
+
options={[
|
|
116
|
+
{ value: 'all', label: 'Tous' },
|
|
117
|
+
{ value: 'bad', label: 'À corriger' },
|
|
118
|
+
{ value: 'ok', label: 'À améliorer' },
|
|
119
|
+
{ value: 'good', label: 'Optimisés' },
|
|
120
|
+
]}
|
|
121
|
+
/>
|
|
122
|
+
<div className="relative sm:w-72">
|
|
123
|
+
<Search className="pointer-events-none absolute left-3 top-2.5 h-4 w-4 text-slate-400" />
|
|
124
|
+
<Input value={q} onChange={(e) => setQ(e.target.value)} placeholder="Titre, URL ou expression clé…" className="pl-9" />
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
{rows.length === 0 ? (
|
|
128
|
+
<EmptyState icon={Search} title="Aucun contenu" />
|
|
129
|
+
) : (
|
|
130
|
+
<Table>
|
|
131
|
+
<thead>
|
|
132
|
+
<tr>
|
|
133
|
+
<Th>Contenu</Th>
|
|
134
|
+
<Th>Expression clé</Th>
|
|
135
|
+
<Th>SEO</Th>
|
|
136
|
+
<Th>Lisibilité</Th>
|
|
137
|
+
<Th>Problèmes</Th>
|
|
138
|
+
<Th className="w-10" />
|
|
139
|
+
</tr>
|
|
140
|
+
</thead>
|
|
141
|
+
<tbody>
|
|
142
|
+
{pg.pageItems.map((r) => {
|
|
143
|
+
const fails = r.analysis.checks.filter((c) => c.status === 'fail');
|
|
144
|
+
return (
|
|
145
|
+
<tr key={`${r.kind}-${r.id}`} className="group hover:bg-slate-50/60">
|
|
146
|
+
<Td>
|
|
147
|
+
<Link to={editLink(r)} className="block">
|
|
148
|
+
<span className="flex items-center gap-2">
|
|
149
|
+
<span className="font-medium text-slate-900 group-hover:text-brand-700">{r.title}</span>
|
|
150
|
+
{r.kind === 'post' ? <Badge>Article</Badge> : null}
|
|
151
|
+
{r.status !== 'published' ? <StatusBadge status={r.status} /> : null}
|
|
152
|
+
</span>
|
|
153
|
+
<span className="block text-xs text-slate-500">{r.url}</span>
|
|
154
|
+
</Link>
|
|
155
|
+
</Td>
|
|
156
|
+
<Td>{r.seo.focusKeyphrase ? <span className="text-slate-700">{r.seo.focusKeyphrase}</span> : <span className="text-xs text-amber-600">Non définie</span>}</Td>
|
|
157
|
+
<Td>
|
|
158
|
+
<ScoreRing score={r.analysis.score} size={36} />
|
|
159
|
+
</Td>
|
|
160
|
+
<Td>
|
|
161
|
+
<ScoreRing score={r.analysis.readabilityScore} size={36} />
|
|
162
|
+
</Td>
|
|
163
|
+
<Td className="max-w-[280px]">
|
|
164
|
+
{fails.length ? (
|
|
165
|
+
<span className="text-xs text-slate-600" title={fails.map((f) => f.label).join('\n')}>
|
|
166
|
+
<span className="font-medium text-rose-600">{fails.length}</span> · {fails[0].label}
|
|
167
|
+
</span>
|
|
168
|
+
) : (
|
|
169
|
+
<span className="text-xs text-emerald-600">Aucun</span>
|
|
170
|
+
)}
|
|
171
|
+
</Td>
|
|
172
|
+
<Td>
|
|
173
|
+
<Link to={editLink(r)} className="text-slate-400 hover:text-slate-700" aria-label="Optimiser">
|
|
174
|
+
<ArrowRight className="h-4 w-4" />
|
|
175
|
+
</Link>
|
|
176
|
+
</Td>
|
|
177
|
+
</tr>
|
|
178
|
+
);
|
|
179
|
+
})}
|
|
180
|
+
</tbody>
|
|
181
|
+
</Table>
|
|
182
|
+
)}
|
|
183
|
+
<Pagination {...pg.props} noun="contenus" />
|
|
184
|
+
</Card>
|
|
185
|
+
</div>
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/* ------------------------------------------------------------------ Google Search Console */
|
|
190
|
+
|
|
191
|
+
const GSC_SERIES = [
|
|
192
|
+
{ key: 'clicks', label: 'Clics', color: '#00a89d' },
|
|
193
|
+
{ key: 'impressions', label: 'Impressions', color: '#6366f1' },
|
|
194
|
+
];
|
|
195
|
+
|
|
196
|
+
function GoogleTab({ errorReason, onDismissError, onOpenSettings }: { errorReason: string | null; onDismissError: () => void; onOpenSettings: () => void }) {
|
|
197
|
+
const { can } = useAuth();
|
|
198
|
+
const { patchSite, site } = useSite();
|
|
199
|
+
const confirm = useConfirm();
|
|
200
|
+
const canManage = can('settings.manage');
|
|
201
|
+
const { data: status, error, loading, reload } = useAsync(() => api.google.status(), []);
|
|
202
|
+
const [days, setDays] = useState('28');
|
|
203
|
+
const sites = useAsync(() => (status?.connected ? api.google.sites() : Promise.resolve([])), [status?.connected]);
|
|
204
|
+
const perf = useAsync(() => (status?.connected && status.property ? api.google.performance(Number(days)) : Promise.resolve(null)), [status?.connected, status?.property, days]);
|
|
205
|
+
const [connecting, setConnecting] = useState(false);
|
|
206
|
+
|
|
207
|
+
if (loading && !status) return <PageSkeleton />;
|
|
208
|
+
if (error || !status) return <ErrorState message={error || ''} onRetry={reload} />;
|
|
209
|
+
|
|
210
|
+
const connect = async () => {
|
|
211
|
+
setConnecting(true);
|
|
212
|
+
try {
|
|
213
|
+
const { authUrl } = await api.google.connect();
|
|
214
|
+
window.location.href = authUrl;
|
|
215
|
+
} catch (e) {
|
|
216
|
+
toast.error(errorMessage(e));
|
|
217
|
+
setConnecting(false);
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
const errorBanner = errorReason ? (
|
|
222
|
+
<Alert tone="danger" title="La connexion à Google a échoué" action={<Button size="sm" variant="ghost" onClick={onDismissError}>Fermer</Button>}>
|
|
223
|
+
{googleErrorMessage(errorReason)}
|
|
224
|
+
</Alert>
|
|
225
|
+
) : null;
|
|
226
|
+
|
|
227
|
+
if (!status.configured) {
|
|
228
|
+
return (
|
|
229
|
+
<div className="space-y-6">
|
|
230
|
+
{errorBanner}
|
|
231
|
+
<GoogleSetupWizard status={status} canManage={canManage} onConfigured={() => void reload()} />
|
|
232
|
+
<GoogleTroubleshooting />
|
|
233
|
+
</div>
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
if (!status.connected) {
|
|
238
|
+
return (
|
|
239
|
+
<div className="space-y-6">
|
|
240
|
+
{errorBanner}
|
|
241
|
+
<Card className="py-12 text-center">
|
|
242
|
+
<div className="mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-xl bg-emerald-50">
|
|
243
|
+
<Globe className="h-6 w-6 text-emerald-600" />
|
|
244
|
+
</div>
|
|
245
|
+
<h2 className="text-lg font-semibold text-slate-900">Dernière étape : connectez votre compte Google</h2>
|
|
246
|
+
<p className="mx-auto mt-1 max-w-lg text-sm text-slate-500">
|
|
247
|
+
Choisissez le compte qui a accès au site dans Search Console. Snapify demande uniquement un accès en lecture : requêtes, positions, clics et pages les plus performantes.
|
|
248
|
+
</p>
|
|
249
|
+
<Button className="mt-6" variant="primary" size="lg" loading={connecting} onClick={() => void connect()}>
|
|
250
|
+
Se connecter avec Google
|
|
251
|
+
</Button>
|
|
252
|
+
<p className="mx-auto mt-4 max-w-lg text-xs text-slate-400">
|
|
253
|
+
Si Google affiche « Google n’a pas validé cette application », cliquez sur « Paramètres avancés » puis « Accéder à … » : c’est votre propre application.
|
|
254
|
+
</p>
|
|
255
|
+
</Card>
|
|
256
|
+
<CredentialsCard status={status} canManage={canManage} onChanged={() => void reload()} />
|
|
257
|
+
<GoogleTroubleshooting />
|
|
258
|
+
</div>
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
const saveProperty = async (property: string) => {
|
|
263
|
+
try {
|
|
264
|
+
await api.saveSection('google', { searchConsoleProperty: property });
|
|
265
|
+
if (site) patchSite('google', { ...site.google, searchConsoleProperty: property });
|
|
266
|
+
await reload();
|
|
267
|
+
toast.success('Propriété sélectionnée');
|
|
268
|
+
} catch (e) {
|
|
269
|
+
toast.error(errorMessage(e));
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
const p = perf.data;
|
|
274
|
+
return (
|
|
275
|
+
<div className="space-y-6">
|
|
276
|
+
<Card className="flex flex-col gap-4 md:flex-row md:items-center md:justify-between">
|
|
277
|
+
<div className="flex items-center gap-3">
|
|
278
|
+
<span className="flex h-10 w-10 items-center justify-center rounded-lg bg-emerald-50 text-emerald-600">
|
|
279
|
+
<Globe className="h-5 w-5" />
|
|
280
|
+
</span>
|
|
281
|
+
<div>
|
|
282
|
+
<p className="text-sm font-medium text-slate-900">{status.accountEmail ? `Connecté : ${status.accountEmail}` : 'Compte Google connecté'}</p>
|
|
283
|
+
<p className="text-xs text-slate-500">Dernière synchronisation : {fmtDateTime(status.lastSyncAt)}</p>
|
|
284
|
+
</div>
|
|
285
|
+
</div>
|
|
286
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
287
|
+
<Select
|
|
288
|
+
value={status.property || ''}
|
|
289
|
+
onChange={(v) => v && void saveProperty(v)}
|
|
290
|
+
options={[{ value: '', label: sites.loading ? 'Chargement des propriétés…' : 'Choisir une propriété…' }, ...(sites.data || []).map((s) => ({ value: s.siteUrl, label: s.siteUrl }))]}
|
|
291
|
+
className="w-72"
|
|
292
|
+
/>
|
|
293
|
+
{can('settings.manage') ? (
|
|
294
|
+
<Button
|
|
295
|
+
icon={LogOut}
|
|
296
|
+
variant="ghost"
|
|
297
|
+
onClick={async () => {
|
|
298
|
+
if (!(await confirm({ title: 'Déconnecter Google ?', message: 'Les données Search Console ne seront plus affichées.', confirmLabel: 'Déconnecter', danger: true }))) return;
|
|
299
|
+
await api.google.disconnect();
|
|
300
|
+
await reload();
|
|
301
|
+
}}
|
|
302
|
+
>
|
|
303
|
+
Déconnecter
|
|
304
|
+
</Button>
|
|
305
|
+
) : null}
|
|
306
|
+
</div>
|
|
307
|
+
</Card>
|
|
308
|
+
|
|
309
|
+
{errorBanner}
|
|
310
|
+
{sites.error || perf.error ? (
|
|
311
|
+
<Alert
|
|
312
|
+
tone="danger"
|
|
313
|
+
action={
|
|
314
|
+
<Button size="sm" loading={connecting} onClick={() => void connect()}>
|
|
315
|
+
Reconnecter
|
|
316
|
+
</Button>
|
|
317
|
+
}
|
|
318
|
+
>
|
|
319
|
+
{sites.error || perf.error}
|
|
320
|
+
</Alert>
|
|
321
|
+
) : null}
|
|
322
|
+
{!sites.loading && !sites.error && sites.data && sites.data.length === 0 ? (
|
|
323
|
+
<NoPropertyHelp status={status} onOpenSettings={onOpenSettings} />
|
|
324
|
+
) : !status.property ? (
|
|
325
|
+
<Alert tone="info">Sélectionnez la propriété Search Console correspondant à votre site pour afficher les performances.</Alert>
|
|
326
|
+
) : perf.loading && !p ? (
|
|
327
|
+
<PageSkeleton />
|
|
328
|
+
) : perf.error ? null : p ? (
|
|
329
|
+
<>
|
|
330
|
+
<div className="flex justify-end">
|
|
331
|
+
<Segmented
|
|
332
|
+
value={days}
|
|
333
|
+
onChange={setDays}
|
|
334
|
+
options={[
|
|
335
|
+
{ value: '7', label: '7 jours' },
|
|
336
|
+
{ value: '28', label: '28 jours' },
|
|
337
|
+
{ value: '90', label: '3 mois' },
|
|
338
|
+
{ value: '480', label: '16 mois' },
|
|
339
|
+
]}
|
|
340
|
+
/>
|
|
341
|
+
</div>
|
|
342
|
+
<div className="grid gap-4 sm:grid-cols-2 xl:grid-cols-4">
|
|
343
|
+
<StatCard label="Clics" value={fmtNumber(p.totals.clicks)} icon={MousePointerClick} />
|
|
344
|
+
<StatCard label="Impressions" value={fmtNumber(p.totals.impressions)} icon={BarChart3} tone="violet" />
|
|
345
|
+
<StatCard label="CTR moyen" value={`${(p.totals.ctr * 100).toFixed(1).replace('.', ',')} %`} icon={Percent} tone="sky" />
|
|
346
|
+
<StatCard label="Position moyenne" value={p.totals.position.toFixed(1).replace('.', ',')} icon={TrendingUp} tone="amber" />
|
|
347
|
+
</div>
|
|
348
|
+
<Card>
|
|
349
|
+
<div className="mb-4 flex items-center justify-between">
|
|
350
|
+
<h2 className="text-[15px] font-semibold text-slate-900">Performances dans la recherche Google</h2>
|
|
351
|
+
<Legend series={GSC_SERIES} />
|
|
352
|
+
</div>
|
|
353
|
+
<TrendChart data={p.timeseries} series={GSC_SERIES} />
|
|
354
|
+
</Card>
|
|
355
|
+
<div className="grid gap-6 xl:grid-cols-2">
|
|
356
|
+
<GscTable title="Requêtes" rows={p.queries.map((r) => ({ key: r.query, ...r }))} />
|
|
357
|
+
<GscTable title="Pages" rows={p.pages.map((r) => ({ key: r.page.replace(/^https?:\/\/[^/]+/, '') || '/', ...r }))} />
|
|
358
|
+
</div>
|
|
359
|
+
</>
|
|
360
|
+
) : null}
|
|
361
|
+
<CredentialsCard status={status} canManage={canManage} onChanged={() => void reload()} />
|
|
362
|
+
</div>
|
|
363
|
+
);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
function GscTable({ title, rows }: { title: string; rows: { key: string; clicks: number; impressions: number; ctr: number; position: number }[] }) {
|
|
367
|
+
const pg = usePagination(rows, `gsc-${title}`, { defaultSize: 10 });
|
|
368
|
+
return (
|
|
369
|
+
<Card padded={false}>
|
|
370
|
+
<div className="border-b border-slate-100 px-5 py-4">
|
|
371
|
+
<h2 className="text-[15px] font-semibold text-slate-900">{title}</h2>
|
|
372
|
+
</div>
|
|
373
|
+
{rows.length === 0 ? (
|
|
374
|
+
<p className="py-10 text-center text-sm text-slate-400">Pas encore de données</p>
|
|
375
|
+
) : (
|
|
376
|
+
<Table>
|
|
377
|
+
<thead>
|
|
378
|
+
<tr>
|
|
379
|
+
<Th>{title.slice(0, -1)}</Th>
|
|
380
|
+
<Th className="text-right">Clics</Th>
|
|
381
|
+
<Th className="text-right">Impr.</Th>
|
|
382
|
+
<Th className="text-right">CTR</Th>
|
|
383
|
+
<Th className="text-right">Pos.</Th>
|
|
384
|
+
</tr>
|
|
385
|
+
</thead>
|
|
386
|
+
<tbody>
|
|
387
|
+
{pg.pageItems.map((r) => (
|
|
388
|
+
<tr key={r.key} className="hover:bg-slate-50/60">
|
|
389
|
+
<Td className="max-w-[260px] truncate text-slate-800">{r.key}</Td>
|
|
390
|
+
<Td className="text-right tabular-nums">{fmtNumber(r.clicks)}</Td>
|
|
391
|
+
<Td className="text-right tabular-nums text-slate-500">{fmtNumber(r.impressions)}</Td>
|
|
392
|
+
<Td className="text-right tabular-nums text-slate-500">{(r.ctr * 100).toFixed(1)} %</Td>
|
|
393
|
+
<Td className="text-right tabular-nums">
|
|
394
|
+
<span className={r.position <= 3 ? 'font-medium text-emerald-600' : r.position <= 10 ? 'text-slate-800' : 'text-slate-400'}>{r.position.toFixed(1)}</span>
|
|
395
|
+
</Td>
|
|
396
|
+
</tr>
|
|
397
|
+
))}
|
|
398
|
+
</tbody>
|
|
399
|
+
</Table>
|
|
400
|
+
)}
|
|
401
|
+
<Pagination {...pg.props} noun="lignes" />
|
|
402
|
+
</Card>
|
|
403
|
+
);
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/* ------------------------------------------------------------------ Réglages globaux */
|
|
407
|
+
|
|
408
|
+
const SEPARATORS = ['–', '|', '·', '•', '—', '»', '/'];
|
|
409
|
+
|
|
410
|
+
function GlobalSettings() {
|
|
411
|
+
const site = useSiteData();
|
|
412
|
+
const { patchSite } = useSite();
|
|
413
|
+
const save = useCallback(
|
|
414
|
+
async (seo: SeoGlobalSettings) => {
|
|
415
|
+
await api.saveSection('seo-settings', seo);
|
|
416
|
+
patchSite('settings', { ...site.settings, seo });
|
|
417
|
+
},
|
|
418
|
+
[site.settings, patchSite]
|
|
419
|
+
);
|
|
420
|
+
const ed = useEditable<SeoGlobalSettings>(site.settings.seo, save, { successMessage: 'Réglages SEO enregistrés' });
|
|
421
|
+
if (!ed.value) return null;
|
|
422
|
+
const s = ed.value;
|
|
423
|
+
const example = `Audit énergétique ${s.titleSeparator} ${s.titleSuffix || site.branding.siteName}`;
|
|
424
|
+
|
|
425
|
+
return (
|
|
426
|
+
<div className="grid gap-6 xl:grid-cols-2">
|
|
427
|
+
<Section title="Format des titres" description="S’applique automatiquement aux pages dont le titre SEO ne contient pas déjà le nom du site.">
|
|
428
|
+
<Field label="Séparateur">
|
|
429
|
+
<div className="flex flex-wrap gap-2">
|
|
430
|
+
{SEPARATORS.map((sep) => (
|
|
431
|
+
<button
|
|
432
|
+
key={sep}
|
|
433
|
+
type="button"
|
|
434
|
+
onClick={() => ed.patch({ titleSeparator: sep })}
|
|
435
|
+
className={`flex h-10 w-10 items-center justify-center rounded-lg border text-lg transition ${s.titleSeparator === sep ? 'border-brand-500 bg-brand-50 text-brand-700 ring-3 ring-brand-500/15' : 'border-slate-200 hover:border-slate-300'}`}
|
|
436
|
+
>
|
|
437
|
+
{sep}
|
|
438
|
+
</button>
|
|
439
|
+
))}
|
|
440
|
+
</div>
|
|
441
|
+
</Field>
|
|
442
|
+
<Field label="Suffixe des titres">
|
|
443
|
+
<Input value={s.titleSuffix} onChange={(e) => ed.patch({ titleSuffix: e.target.value })} placeholder={site.branding.siteName} />
|
|
444
|
+
</Field>
|
|
445
|
+
<div className="rounded-xl border border-slate-200 bg-slate-50 p-4">
|
|
446
|
+
<p className="text-xs text-slate-500">Exemple dans Google</p>
|
|
447
|
+
<p className="mt-1 text-lg text-[#1a0dab]">{example}</p>
|
|
448
|
+
</div>
|
|
449
|
+
</Section>
|
|
450
|
+
|
|
451
|
+
<Section title="Organisation (données structurées)" description="Aide Google à afficher votre fiche entreprise (Knowledge Graph).">
|
|
452
|
+
<Field label="Nom de l’organisation">
|
|
453
|
+
<Input value={s.organizationName} onChange={(e) => ed.patch({ organizationName: e.target.value })} />
|
|
454
|
+
</Field>
|
|
455
|
+
<Field label="Logo de l’organisation" hint="Carré, 112 × 112 px minimum.">
|
|
456
|
+
<div className="w-40">
|
|
457
|
+
<ImageField value={s.organizationLogo} onChange={(organizationLogo) => ed.patch({ organizationLogo })} aspect="aspect-square" />
|
|
458
|
+
</div>
|
|
459
|
+
</Field>
|
|
460
|
+
<Field label="Profils sociaux" hint="URL complètes (LinkedIn, YouTube…).">
|
|
461
|
+
<TagInput value={s.socialProfiles} onChange={(socialProfiles) => ed.patch({ socialProfiles })} validate={(v) => /^https?:\/\//.test(v)} placeholder="https://www.linkedin.com/company/… puis Entrée" />
|
|
462
|
+
</Field>
|
|
463
|
+
</Section>
|
|
464
|
+
|
|
465
|
+
<Section title="Partage sur les réseaux sociaux">
|
|
466
|
+
<Field label="Image de partage par défaut" hint="Utilisée quand une page n’a pas sa propre image. 1200 × 630 px.">
|
|
467
|
+
<ImageField value={s.defaultOgImage} onChange={(defaultOgImage) => ed.patch({ defaultOgImage })} aspect="aspect-[1.91/1]" />
|
|
468
|
+
</Field>
|
|
469
|
+
</Section>
|
|
470
|
+
|
|
471
|
+
<Section title="Validation des outils pour webmasters" description="Collez uniquement le code (valeur de l’attribut content).">
|
|
472
|
+
<Field label="Google Search Console">
|
|
473
|
+
<Input value={s.googleVerification || ''} onChange={(e) => ed.patch({ googleVerification: e.target.value.replace(/.*content="([^"]+)".*/, '$1') })} placeholder="abc123…" className="font-mono" />
|
|
474
|
+
</Field>
|
|
475
|
+
<Field label="Bing Webmaster Tools">
|
|
476
|
+
<Input value={s.bingVerification || ''} onChange={(e) => ed.patch({ bingVerification: e.target.value.replace(/.*content="([^"]+)".*/, '$1') })} placeholder="ABC123…" className="font-mono" />
|
|
477
|
+
</Field>
|
|
478
|
+
</Section>
|
|
479
|
+
<SaveBar dirty={ed.dirty} saving={ed.saving} onSave={ed.commit} onReset={ed.reset} blocker={ed.blocker} />
|
|
480
|
+
</div>
|
|
481
|
+
);
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
/* ------------------------------------------------------------------ Redirections */
|
|
485
|
+
|
|
486
|
+
function Redirects() {
|
|
487
|
+
const site = useSiteData();
|
|
488
|
+
const { patchSite } = useSite();
|
|
489
|
+
const save = useCallback(
|
|
490
|
+
async (list: RedirectRule[]) => {
|
|
491
|
+
const clean = list.filter((r) => r.from.trim() && r.to.trim());
|
|
492
|
+
await api.saveRedirects(clean);
|
|
493
|
+
const fresh = await api.snapshot();
|
|
494
|
+
patchSite('redirects', fresh.redirects);
|
|
495
|
+
return fresh.redirects;
|
|
496
|
+
},
|
|
497
|
+
[patchSite]
|
|
498
|
+
);
|
|
499
|
+
const ed = useEditable<RedirectRule[]>(site.redirects, save, { successMessage: 'Redirections enregistrées' });
|
|
500
|
+
const [q, setQ] = useState('');
|
|
501
|
+
const visible = useMemo(() => (ed.value ?? []).map((r, i) => ({ r, i })).filter(({ r }) => !q || `${r.from} ${r.to}`.includes(q)), [ed.value, q]);
|
|
502
|
+
const pg = usePagination(visible, 'redirects', { resetKey: q });
|
|
503
|
+
if (!ed.value) return null;
|
|
504
|
+
const list = ed.value;
|
|
505
|
+
const update = (i: number, p: Partial<RedirectRule>) => ed.setValue(list.map((r, j) => (j === i ? { ...r, ...p } : r)));
|
|
506
|
+
const dupes = new Set(list.map((r) => r.from).filter((f, i, a) => f && a.indexOf(f) !== i));
|
|
507
|
+
|
|
508
|
+
return (
|
|
509
|
+
<Section
|
|
510
|
+
title="Redirections"
|
|
511
|
+
description="Redirigez une ancienne adresse vers une nouvelle pour conserver le référencement et éviter les erreurs 404."
|
|
512
|
+
actions={
|
|
513
|
+
<Button
|
|
514
|
+
size="sm"
|
|
515
|
+
variant="primary"
|
|
516
|
+
icon={Plus}
|
|
517
|
+
onClick={() => {
|
|
518
|
+
ed.setValue([{ from: '', to: '', permanent: true }, ...list]);
|
|
519
|
+
setQ('');
|
|
520
|
+
pg.setPage(1);
|
|
521
|
+
}}
|
|
522
|
+
>
|
|
523
|
+
Ajouter
|
|
524
|
+
</Button>
|
|
525
|
+
}
|
|
526
|
+
>
|
|
527
|
+
{list.length > 8 ? (
|
|
528
|
+
<div className="relative max-w-xs">
|
|
529
|
+
<Search className="pointer-events-none absolute left-3 top-2.5 h-4 w-4 text-slate-400" />
|
|
530
|
+
<Input value={q} onChange={(e) => setQ(e.target.value)} placeholder="Filtrer…" className="pl-9" />
|
|
531
|
+
</div>
|
|
532
|
+
) : null}
|
|
533
|
+
{list.length === 0 ? (
|
|
534
|
+
<EmptyState icon={Link2} title="Aucune redirection" />
|
|
535
|
+
) : (
|
|
536
|
+
<div className="overflow-hidden rounded-xl border border-slate-200">
|
|
537
|
+
<div className="hidden grid-cols-[1fr_24px_1fr_150px_40px] gap-3 border-b border-slate-200 bg-slate-50 px-4 py-2 text-xs font-medium uppercase tracking-wide text-slate-500 md:grid">
|
|
538
|
+
<span>Ancienne adresse</span>
|
|
539
|
+
<span />
|
|
540
|
+
<span>Nouvelle adresse</span>
|
|
541
|
+
<span>Type</span>
|
|
542
|
+
<span />
|
|
543
|
+
</div>
|
|
544
|
+
<div className="divide-y divide-slate-100">
|
|
545
|
+
{pg.pageItems.map(({ r, i }) =>
|
|
546
|
+
(
|
|
547
|
+
<div key={i} className="grid items-center gap-3 px-4 py-2.5 md:grid-cols-[1fr_24px_1fr_150px_40px]">
|
|
548
|
+
<Input value={r.from} onChange={(e) => update(i, { from: e.target.value })} placeholder="/ancienne-page/" invalid={dupes.has(r.from)} />
|
|
549
|
+
<ArrowRight className="hidden h-4 w-4 text-slate-300 md:block" />
|
|
550
|
+
<Input list="admin-site-links" value={r.to} onChange={(e) => update(i, { to: e.target.value })} placeholder="/nouvelle-page/" />
|
|
551
|
+
<Select
|
|
552
|
+
value={r.permanent ? '301' : '302'}
|
|
553
|
+
onChange={(v) => update(i, { permanent: v === '301' })}
|
|
554
|
+
options={[
|
|
555
|
+
{ value: '301', label: '301 · Définitive' },
|
|
556
|
+
{ value: '302', label: '302 · Temporaire' },
|
|
557
|
+
]}
|
|
558
|
+
/>
|
|
559
|
+
<Button size="icon" variant="ghost" className="text-rose-600 hover:bg-rose-50" onClick={() => ed.setValue(list.filter((_, j) => j !== i))} aria-label="Supprimer">
|
|
560
|
+
<Trash2 className="h-4 w-4" />
|
|
561
|
+
</Button>
|
|
562
|
+
</div>
|
|
563
|
+
)
|
|
564
|
+
)}
|
|
565
|
+
</div>
|
|
566
|
+
<Pagination {...pg.props} noun="redirections" />
|
|
567
|
+
</div>
|
|
568
|
+
)}
|
|
569
|
+
{dupes.size ? <Alert tone="danger">Certaines adresses d’origine sont en double.</Alert> : null}
|
|
570
|
+
<SaveBar dirty={ed.dirty} saving={ed.saving} onSave={ed.commit} onReset={ed.reset} blocker={ed.blocker} />
|
|
571
|
+
</Section>
|
|
572
|
+
);
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
/* ------------------------------------------------------------------ Indexation */
|
|
576
|
+
|
|
577
|
+
function Indexing() {
|
|
578
|
+
const site = useSiteData();
|
|
579
|
+
const { patchSite } = useSite();
|
|
580
|
+
const { can } = useAuth();
|
|
581
|
+
const initial = useMemo(() => ({ robotsTxtExtra: site.settings.robotsTxtExtra || '', sitemapAuto: site.settings.sitemapAuto }), [site.settings]);
|
|
582
|
+
const save = useCallback(
|
|
583
|
+
async (v: { robotsTxtExtra: string; sitemapAuto: boolean }) => {
|
|
584
|
+
await api.saveSection('seo-settings', { robotsTxtExtra: v.robotsTxtExtra });
|
|
585
|
+
if (v.sitemapAuto !== site.settings.sitemapAuto) await api.saveSection('settings', { sitemapAuto: v.sitemapAuto });
|
|
586
|
+
patchSite('settings', { ...site.settings, ...v });
|
|
587
|
+
},
|
|
588
|
+
[site.settings, patchSite]
|
|
589
|
+
);
|
|
590
|
+
const ed = useEditable(initial, save, { successMessage: 'Indexation mise à jour' });
|
|
591
|
+
const robots = useAsync(() => fetch('/robots.txt').then((r) => r.text()), [site.settings.robotsTxtExtra, site.settings.maintenance.enabled]);
|
|
592
|
+
if (!ed.value) return null;
|
|
593
|
+
|
|
594
|
+
return (
|
|
595
|
+
<div className="grid gap-6 xl:grid-cols-2">
|
|
596
|
+
<Section title="Plan du site (sitemap.xml)" description="Liste les pages publiées et indexables pour Google, avec leur date de mise à jour.">
|
|
597
|
+
<Switch
|
|
598
|
+
checked={ed.value.sitemapAuto}
|
|
599
|
+
disabled={!can('settings.manage')}
|
|
600
|
+
onChange={(sitemapAuto) => ed.patch({ sitemapAuto })}
|
|
601
|
+
label="Générer le sitemap automatiquement"
|
|
602
|
+
description="Mis à jour à chaque publication. Les pages en noindex en sont exclues."
|
|
603
|
+
/>
|
|
604
|
+
<div className="flex flex-wrap gap-2">
|
|
605
|
+
<a href={publicUrl(site, '/sitemap.xml')} target="_blank" rel="noreferrer">
|
|
606
|
+
<Button icon={ExternalLink}>Ouvrir le sitemap</Button>
|
|
607
|
+
</a>
|
|
608
|
+
<Button
|
|
609
|
+
icon={Copy}
|
|
610
|
+
onClick={async () => {
|
|
611
|
+
await navigator.clipboard.writeText(publicUrl(site, '/sitemap.xml'));
|
|
612
|
+
toast.success('Adresse copiée — soumettez-la dans Search Console › Sitemaps');
|
|
613
|
+
}}
|
|
614
|
+
>
|
|
615
|
+
Copier l’adresse
|
|
616
|
+
</Button>
|
|
617
|
+
</div>
|
|
618
|
+
</Section>
|
|
619
|
+
<Section title="Fichier robots.txt" description="Indique aux robots les zones à ne pas explorer. L’administration est toujours exclue.">
|
|
620
|
+
<Field label="Règles supplémentaires">
|
|
621
|
+
<Textarea value={ed.value.robotsTxtExtra} onChange={(e) => ed.patch({ robotsTxtExtra: e.target.value })} rows={5} className="font-mono text-xs" placeholder={'Disallow: /prive/\nUser-agent: GPTBot\nDisallow: /'} spellCheck={false} />
|
|
622
|
+
</Field>
|
|
623
|
+
<Field label="Fichier actuellement servi">
|
|
624
|
+
<pre className="max-h-56 overflow-auto rounded-lg bg-navy-950 p-4 font-mono text-xs leading-relaxed text-slate-200 scrollbar-thin">{robots.data || '…'}</pre>
|
|
625
|
+
</Field>
|
|
626
|
+
{site.settings.maintenance.enabled ? <Alert tone="warning">Mode maintenance actif : le robots.txt bloque actuellement toute l’exploration.</Alert> : null}
|
|
627
|
+
</Section>
|
|
628
|
+
<SaveBar dirty={ed.dirty} saving={ed.saving} onSave={ed.commit} onReset={ed.reset} blocker={ed.blocker} />
|
|
629
|
+
</div>
|
|
630
|
+
);
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
/* ------------------------------------------------------------------ Page */
|
|
634
|
+
|
|
635
|
+
export default function SeoPage() {
|
|
636
|
+
const [params, setParams] = useSearchParams();
|
|
637
|
+
const TABS: Tab[] = ['overview', 'google', 'settings', 'redirects', 'indexing'];
|
|
638
|
+
const tab = (TABS as string[]).includes(params.get('tab') || '') ? (params.get('tab') as Tab) : params.get('google') ? 'google' : 'overview';
|
|
639
|
+
const [googleError, setGoogleError] = useState<string | null>(params.get('google') === 'error' ? params.get('reason') || 'unknown' : null);
|
|
640
|
+
const setTab = (t: Tab) => setParams(t === 'overview' ? {} : { tab: t }, { replace: true });
|
|
641
|
+
|
|
642
|
+
useEffect(() => {
|
|
643
|
+
const g = params.get('google');
|
|
644
|
+
if (g === 'connected') toast.success('Compte Google connecté avec succès');
|
|
645
|
+
if (g) setParams({ tab: 'google' }, { replace: true });
|
|
646
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
647
|
+
}, []);
|
|
648
|
+
|
|
649
|
+
return (
|
|
650
|
+
<div className="space-y-6">
|
|
651
|
+
<PageHeader title="Référencement (SEO)" description="Analyse de chaque contenu, Google Search Console, redirections et réglages d’indexation." />
|
|
652
|
+
<Tabs
|
|
653
|
+
value={tab}
|
|
654
|
+
onChange={setTab}
|
|
655
|
+
tabs={[
|
|
656
|
+
{ value: 'overview', label: 'Analyse des contenus', icon: Target },
|
|
657
|
+
{ value: 'google', label: 'Google Search Console', icon: Globe },
|
|
658
|
+
{ value: 'settings', label: 'Réglages globaux', icon: Settings2 },
|
|
659
|
+
{ value: 'redirects', label: 'Redirections', icon: Link2 },
|
|
660
|
+
{ value: 'indexing', label: 'Sitemap & robots.txt', icon: FileCode2 },
|
|
661
|
+
]}
|
|
662
|
+
/>
|
|
663
|
+
{tab === 'overview' ? <Overview /> : null}
|
|
664
|
+
{tab === 'google' ? <GoogleTab errorReason={googleError} onDismissError={() => setGoogleError(null)} onOpenSettings={() => setTab('settings')} /> : null}
|
|
665
|
+
{tab === 'settings' ? <GlobalSettings /> : null}
|
|
666
|
+
{tab === 'redirects' ? <Redirects /> : null}
|
|
667
|
+
{tab === 'indexing' ? <Indexing /> : null}
|
|
668
|
+
</div>
|
|
669
|
+
);
|
|
670
|
+
}
|