From dc2856c4c8c56fd72dd6642aeba1338fc4cb3cb3 Mon Sep 17 00:00:00 2001 From: Henrik Larsson Date: Thu, 10 Aug 2023 20:49:53 +0200 Subject: [PATCH] Tested to add algolia search --- .env.example | 7 +- app/[locale]/[...slug]/page.tsx | 1 + app/[locale]/layout.tsx | 8 +- components/cart/modal.tsx | 53 ++++ components/cart/open-cart.tsx | 4 +- .../dynamic-content-manager.tsx | 246 ++++++---------- components/layout/header/header.tsx | 30 +- .../layout/header/main-menu/main-menu.tsx | 33 --- .../layout/header/mobile-menu/modal.tsx | 18 +- components/layout/header/search/modal.tsx | 2 + .../layout/header/search/open-search.tsx | 2 +- components/layout/header/user-menu/modal.tsx | 11 - .../header/user-menu/open-user-menu.tsx | 2 +- components/search/search.tsx | 52 ++++ components/ui/tabs.tsx | 55 ---- package.json | 3 +- pnpm-lock.yaml | 275 ++++++++++++++++-- 17 files changed, 486 insertions(+), 316 deletions(-) delete mode 100644 components/layout/header/main-menu/main-menu.tsx create mode 100644 components/search/search.tsx delete mode 100644 components/ui/tabs.tsx diff --git a/.env.example b/.env.example index 3f31f2612..0bd5e33e6 100644 --- a/.env.example +++ b/.env.example @@ -20,11 +20,14 @@ VERCEL_GIT_PULL_REQUEST_ID="" NEXT_PUBLIC_SANITY_PROJECT_ID="" NEXT_PUBLIC_SANITY_DATASET="" NEXT_PUBLIC_SANITY_API_VERSION="" - -# Preview SANITY_API_READ_TOKEN="" SANITY_WEBHOOK_SECRET="" +# Algolia +NEXT_PUBLIC_ALGOLIA_APPLICATION_ID="YOUR_ALGOLIA_APPLICATION_ID" +NEXT_PUBLIC_ALGOLIA_SEARCH_ONLY_API_KEY="YOUR_ALGOLIA_SEARCH_ONLY_APY_KEY" +ALGOLIA_ADMIN_KEY="YOUR_ALGOLIA_ADMIN_KEY" + # Site TWITTER_CREATOR="@kodamera" TWITTER_SITE="https://kodamera.se" diff --git a/app/[locale]/[...slug]/page.tsx b/app/[locale]/[...slug]/page.tsx index 6a621b175..61735ac6c 100644 --- a/app/[locale]/[...slug]/page.tsx +++ b/app/[locale]/[...slug]/page.tsx @@ -29,6 +29,7 @@ export async function generateMetadata({ slug: `${params.slug}` }; } + const page = await clientFetch(pageQuery, queryParams); if (!page) return notFound(); diff --git a/app/[locale]/layout.tsx b/app/[locale]/layout.tsx index d49d8502a..0546880c4 100644 --- a/app/[locale]/layout.tsx +++ b/app/[locale]/layout.tsx @@ -3,7 +3,7 @@ import Header from 'components/layout/header/header'; import { NextIntlClientProvider } from 'next-intl'; import { Inter } from 'next/font/google'; import { notFound } from 'next/navigation'; -import { ReactNode, Suspense } from 'react'; +import { ReactNode } from 'react'; import { supportedLanguages } from '../../i18n-config'; import './globals.css'; @@ -58,10 +58,8 @@ export default async function LocaleLayout({ children, params: { locale } }: Loc
- -
{children}
-