@@ -25,7 +28,7 @@ export default async function Header({ locale }: HeaderProps) {
}>
- {/* */}
+
@@ -40,7 +43,9 @@ export default async function Header({ locale }: HeaderProps) {
- {/* */}
+
+
+
}>
diff --git a/components/layout/header/mobile-menu/modal.tsx b/components/layout/header/mobile-menu/modal.tsx
index bbdcaa112..1a278515f 100644
--- a/components/layout/header/mobile-menu/modal.tsx
+++ b/components/layout/header/mobile-menu/modal.tsx
@@ -6,12 +6,16 @@ import { useState } from 'react';
import OpenMobileMenu from './open-mobile-menu';
interface MobileMenuModalProps {
- items: [];
+ items: [] | null;
}
export default function MobileMenuModal({ items }: MobileMenuModalProps) {
const [isOpen, setIsOpen] = useState(false);
+ if (!items) {
+ return;
+ }
+
return (
<>
setIsOpen(!isOpen)}>
diff --git a/lib/sanity/queries.tsx b/lib/sanity/queries.tsx
index 358c364dc..0c264b209 100644
--- a/lib/sanity/queries.tsx
+++ b/lib/sanity/queries.tsx
@@ -269,7 +269,7 @@ export const categoryQuery = `*[_type == "category" && slug.current == $slug &&
}`;
// Categories query
-export const categoriesQuery = `*[_type == "category" && language == $locale] | order(title asc) {
+export const mainMenuQuery = `*[_type == "category" && language == $locale] | order(title asc) {
_type,
title,
"slug": slug.current,
diff --git a/lib/sanity/sanity.fetch.ts b/lib/sanity/sanity.fetch.ts
index 8ff472635..20af3081d 100644
--- a/lib/sanity/sanity.fetch.ts
+++ b/lib/sanity/sanity.fetch.ts
@@ -7,9 +7,9 @@ import { draftMode } from 'next/headers'
import { revalidateSecret } from './sanity.api'
-import { categoryQuery, homePageQuery, pageQuery, productQuery, searchPageQuery } from './queries'
+import { categoryQuery, homePageQuery, mainMenuQuery, pageQuery, productQuery, searchPageQuery } from './queries'
-import { CategoryPayload, HomePagePayload, PagePayload, ProductPayload, SearchPayload } from './sanity.types'
+import { CategoryPayload, HomePagePayload, MainMenuPayload, PagePayload, ProductPayload, SearchPayload } from './sanity.types'
export const token = process.env.SANITY_API_READ_TOKEN
@@ -56,7 +56,7 @@ export function getHomePage(locale: string) {
return sanityFetch({
query: homePageQuery,
params: { locale },
- tags: ['home', 'products', 'categories', 'page'],
+ tags: ['home', 'products', 'categories', 'page', 'menu'],
})
}
@@ -90,4 +90,12 @@ export function getSearch(slug: string, locale: string) {
params: { slug, locale },
tags: ['search'],
})
+}
+
+export function getMainMenu(locale: string) {
+ return sanityFetch({
+ query: mainMenuQuery,
+ params: { locale },
+ tags: ['menu'],
+ })
}
\ No newline at end of file
diff --git a/lib/sanity/sanity.types.ts b/lib/sanity/sanity.types.ts
index bffb8fd22..d692148f0 100644
--- a/lib/sanity/sanity.types.ts
+++ b/lib/sanity/sanity.types.ts
@@ -58,4 +58,10 @@ export interface SearchPayload {
description?: string;
image: Image
}
+}
+
+export interface MainMenuPayload {
+ title?: string
+ _type?: string
+ items: []
}
\ No newline at end of file
diff --git a/lib/sanity/utils/get-preview-url.ts b/lib/sanity/utils/get-preview-url.ts
index 813141ff1..47e8b2433 100644
--- a/lib/sanity/utils/get-preview-url.ts
+++ b/lib/sanity/utils/get-preview-url.ts
@@ -3,6 +3,7 @@ import { isDev, SanityDocument } from 'sanity'
import { localStorefrontPreviewUrl, publicStorefrontPreviewUrl } from '../constants'
const SANITY_STUDIO_API_READ_TOKEN = "skYG2HXNga8uxSL7rFIreJEnP0SdVjCZ2nzB8rUHD4wRWxXPGceXTuR5vCVBP99mWZ9ULhghmpUyX7EtzDmJusSk6Gwvdr3nLAsdWI9ZktIWvSWUNpHbu0Xfrrt0UUaktrLglk7ToABvjXlaPHLpOIR3dnjl4MGByutPmyra0b5t20kgDrmF"
+
// Customise this function to show the correct URL based on the current document
export default async function getPreviewUrl(doc: SanityDocument) {
diff --git a/package.json b/package.json
index 1be536e01..c77ac2bfa 100644
--- a/package.json
+++ b/package.json
@@ -42,7 +42,7 @@
"clsx": "^1.2.1",
"framer-motion": "^8.5.5",
"is-empty-iterable": "^3.0.0",
- "next": "13.4.13",
+ "next": "13.4.19",
"next-intl": "2.19.1",
"next-sanity": "^5.4.2",
"react": "18.2.0",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index e1fc5fdf8..7df9ebca3 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -75,14 +75,14 @@ dependencies:
specifier: ^3.0.0
version: 3.0.0
next:
- specifier: 13.4.13
- version: 13.4.13(@babel/core@7.22.10)(react-dom@18.2.0)(react@18.2.0)
+ specifier: 13.4.19
+ version: 13.4.19(@babel/core@7.22.10)(react-dom@18.2.0)(react@18.2.0)
next-intl:
specifier: 2.19.1
- version: 2.19.1(next@13.4.13)(react@18.2.0)
+ version: 2.19.1(next@13.4.19)(react@18.2.0)
next-sanity:
specifier: ^5.4.2
- version: 5.4.2(@sanity/client@6.4.4)(@sanity/icons@2.4.1)(@sanity/types@3.15.0)(@sanity/ui@1.7.4)(@types/styled-components@5.1.26)(next@13.4.13)(react@18.2.0)(sanity@3.15.0)(styled-components@5.3.11)
+ version: 5.4.2(@sanity/client@6.4.4)(@sanity/icons@2.4.1)(@sanity/types@3.15.0)(@sanity/ui@1.7.4)(@types/styled-components@5.1.26)(next@13.4.19)(react@18.2.0)(sanity@3.15.0)(styled-components@5.3.11)
react:
specifier: 18.2.0
version: 18.2.0
@@ -1284,8 +1284,8 @@ packages:
- utf-8-validate
dev: true
- /@next/env@13.4.13:
- resolution: {integrity: sha512-fwz2QgVg08v7ZL7KmbQBLF2PubR/6zQdKBgmHEl3BCyWTEDsAQEijjw2gbFhI1tcKfLdOOJUXntz5vZ4S0Polg==}
+ /@next/env@13.4.19:
+ resolution: {integrity: sha512-FsAT5x0jF2kkhNkKkukhsyYOrRqtSxrEhfliniIq0bwWbuXLgyt3Gv0Ml+b91XwjwArmuP7NxCiGd++GGKdNMQ==}
dev: false
/@next/eslint-plugin-next@13.4.13:
@@ -1294,8 +1294,8 @@ packages:
glob: 7.1.7
dev: true
- /@next/swc-darwin-arm64@13.4.13:
- resolution: {integrity: sha512-ZptVhHjzUuivnXMNCJ6lER33HN7lC+rZ01z+PM10Ows21NHFYMvGhi5iXkGtBDk6VmtzsbqnAjnx4Oz5um0FjA==}
+ /@next/swc-darwin-arm64@13.4.19:
+ resolution: {integrity: sha512-vv1qrjXeGbuF2mOkhkdxMDtv9np7W4mcBtaDnHU+yJG+bBwa6rYsYSCI/9Xm5+TuF5SbZbrWO6G1NfTh1TMjvQ==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [darwin]
@@ -1303,8 +1303,8 @@ packages:
dev: false
optional: true
- /@next/swc-darwin-x64@13.4.13:
- resolution: {integrity: sha512-t9nTiWCLApw8W4G1kqJyYP7y6/7lyal3PftmRturIxAIBlZss9wrtVN8nci50StDHmIlIDxfguYIEGVr9DbFTg==}
+ /@next/swc-darwin-x64@13.4.19:
+ resolution: {integrity: sha512-jyzO6wwYhx6F+7gD8ddZfuqO4TtpJdw3wyOduR4fxTUCm3aLw7YmHGYNjS0xRSYGAkLpBkH1E0RcelyId6lNsw==}
engines: {node: '>= 10'}
cpu: [x64]
os: [darwin]
@@ -1312,8 +1312,8 @@ packages:
dev: false
optional: true
- /@next/swc-linux-arm64-gnu@13.4.13:
- resolution: {integrity: sha512-xEHUqC8eqR5DHe8SOmMnDU1K3ggrJ28uIKltrQAwqFSSSmzjnN/XMocZkcVhuncuxYrpbri0iMQstRyRVdQVWg==}
+ /@next/swc-linux-arm64-gnu@13.4.19:
+ resolution: {integrity: sha512-vdlnIlaAEh6H+G6HrKZB9c2zJKnpPVKnA6LBwjwT2BTjxI7e0Hx30+FoWCgi50e+YO49p6oPOtesP9mXDRiiUg==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [linux]
@@ -1321,8 +1321,8 @@ packages:
dev: false
optional: true
- /@next/swc-linux-arm64-musl@13.4.13:
- resolution: {integrity: sha512-sNf3MnLAm8rquSSAoeD9nVcdaDeRYOeey4stOWOyWIgbBDtP+C93amSgH/LPTDoUV7gNiU6f+ghepTjTjRgIUQ==}
+ /@next/swc-linux-arm64-musl@13.4.19:
+ resolution: {integrity: sha512-aU0HkH2XPgxqrbNRBFb3si9Ahu/CpaR5RPmN2s9GiM9qJCiBBlZtRTiEca+DC+xRPyCThTtWYgxjWHgU7ZkyvA==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [linux]
@@ -1330,8 +1330,8 @@ packages:
dev: false
optional: true
- /@next/swc-linux-x64-gnu@13.4.13:
- resolution: {integrity: sha512-WhcRaJJSHyx9OWmKjjz+OWHumiPZWRqmM/09Bt7Up4UqUJFFhGExeztR4trtv3rflvULatu9IH/nTV8fUUgaMA==}
+ /@next/swc-linux-x64-gnu@13.4.19:
+ resolution: {integrity: sha512-htwOEagMa/CXNykFFeAHHvMJeqZfNQEoQvHfsA4wgg5QqGNqD5soeCer4oGlCol6NGUxknrQO6VEustcv+Md+g==}
engines: {node: '>= 10'}
cpu: [x64]
os: [linux]
@@ -1339,8 +1339,8 @@ packages:
dev: false
optional: true
- /@next/swc-linux-x64-musl@13.4.13:
- resolution: {integrity: sha512-+Y4LLhOWWZQIDKVwr2R17lq2KSN0F1c30QVgGIWfnjjHpH8nrIWHEndhqYU+iFuW8It78CiJjQKTw4f51HD7jA==}
+ /@next/swc-linux-x64-musl@13.4.19:
+ resolution: {integrity: sha512-4Gj4vvtbK1JH8ApWTT214b3GwUh9EKKQjY41hH/t+u55Knxi/0wesMzwQRhppK6Ddalhu0TEttbiJ+wRcoEj5Q==}
engines: {node: '>= 10'}
cpu: [x64]
os: [linux]
@@ -1348,8 +1348,8 @@ packages:
dev: false
optional: true
- /@next/swc-win32-arm64-msvc@13.4.13:
- resolution: {integrity: sha512-rWurdOR20uxjfqd1X9vDAgv0Jb26KjyL8akF9CBeFqX8rVaBAnW/Wf6A2gYEwyYY4Bai3T7p1kro6DFrsvBAAw==}
+ /@next/swc-win32-arm64-msvc@13.4.19:
+ resolution: {integrity: sha512-bUfDevQK4NsIAHXs3/JNgnvEY+LRyneDN788W2NYiRIIzmILjba7LaQTfihuFawZDhRtkYCv3JDC3B4TwnmRJw==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [win32]
@@ -1357,8 +1357,8 @@ packages:
dev: false
optional: true
- /@next/swc-win32-ia32-msvc@13.4.13:
- resolution: {integrity: sha512-E8bSPwRuY5ibJ3CzLQmJEt8qaWrPYuUTwnrwygPUEWoLzD5YRx9SD37oXRdU81TgGwDzCxpl7z5Nqlfk50xAog==}
+ /@next/swc-win32-ia32-msvc@13.4.19:
+ resolution: {integrity: sha512-Y5kikILFAr81LYIFaw6j/NrOtmiM4Sf3GtOc0pn50ez2GCkr+oejYuKGcwAwq3jiTKuzF6OF4iT2INPoxRycEA==}
engines: {node: '>= 10'}
cpu: [ia32]
os: [win32]
@@ -1366,8 +1366,8 @@ packages:
dev: false
optional: true
- /@next/swc-win32-x64-msvc@13.4.13:
- resolution: {integrity: sha512-4KlyC6jWRubPnppgfYsNTPeWfGCxtWLh5vaOAW/kdzAk9widqho8Qb5S4K2vHmal1tsURi7Onk2MMCV1phvyqA==}
+ /@next/swc-win32-x64-msvc@13.4.19:
+ resolution: {integrity: sha512-YzA78jBDXMYiINdPdJJwGgPNT3YqBNNGhsthsDoWHL9p24tEJn9ViQf/ZqTbwSpX/RrkPupLfuuTH2sf73JBAw==}
engines: {node: '>= 10'}
cpu: [x64]
os: [win32]
@@ -6090,7 +6090,7 @@ packages:
engines: {node: '>= 0.6'}
dev: false
- /next-intl@2.19.1(next@13.4.13)(react@18.2.0):
+ /next-intl@2.19.1(next@13.4.19)(react@18.2.0):
resolution: {integrity: sha512-fk+IGWXxA+UOk+3rIhQqSPYxka+Hk9qKaIpbeF3nNlf8dp1td0oT6srVrPw/uZl5Qoj8El3qQ2mVd3RTLA25cg==}
engines: {node: '>=10'}
peerDependencies:
@@ -6099,12 +6099,12 @@ packages:
dependencies:
'@formatjs/intl-localematcher': 0.2.32
negotiator: 0.6.3
- next: 13.4.13(@babel/core@7.22.10)(react-dom@18.2.0)(react@18.2.0)
+ next: 13.4.19(@babel/core@7.22.10)(react-dom@18.2.0)(react@18.2.0)
react: 18.2.0
use-intl: 2.19.1(react@18.2.0)
dev: false
- /next-sanity@5.4.2(@sanity/client@6.4.4)(@sanity/icons@2.4.1)(@sanity/types@3.15.0)(@sanity/ui@1.7.4)(@types/styled-components@5.1.26)(next@13.4.13)(react@18.2.0)(sanity@3.15.0)(styled-components@5.3.11):
+ /next-sanity@5.4.2(@sanity/client@6.4.4)(@sanity/icons@2.4.1)(@sanity/types@3.15.0)(@sanity/ui@1.7.4)(@types/styled-components@5.1.26)(next@13.4.19)(react@18.2.0)(sanity@3.15.0)(styled-components@5.3.11):
resolution: {integrity: sha512-gLpS0GlapXtDjRUaPcZ9DUeiNSznhtqh0kyxygQS9MDtecCiphVAhXYwvJMQcxfY1u5KVWAxZMyy+Bs6h8G+jA==}
engines: {node: '>=16.14'}
peerDependencies:
@@ -6126,7 +6126,7 @@ packages:
'@sanity/webhook': 2.0.0
'@types/styled-components': 5.1.26
groq: 3.15.0
- next: 13.4.13(@babel/core@7.22.10)(react-dom@18.2.0)(react@18.2.0)
+ next: 13.4.19(@babel/core@7.22.10)(react-dom@18.2.0)(react@18.2.0)
react: 18.2.0
sanity: 3.15.0(@types/node@18.13.0)(@types/react@18.2.19)(react-dom@18.2.0)(react@18.2.0)(styled-components@5.3.11)
styled-components: 5.3.11(@babel/core@7.22.10)(react-dom@18.2.0)(react-is@18.2.0)(react@18.2.0)
@@ -6134,8 +6134,8 @@ packages:
- supports-color
dev: false
- /next@13.4.13(@babel/core@7.22.10)(react-dom@18.2.0)(react@18.2.0):
- resolution: {integrity: sha512-A3YVbVDNeXLhWsZ8Nf6IkxmNlmTNz0yVg186NJ97tGZqPDdPzTrHotJ+A1cuJm2XfuWPrKOUZILl5iBQkIf8Jw==}
+ /next@13.4.19(@babel/core@7.22.10)(react-dom@18.2.0)(react@18.2.0):
+ resolution: {integrity: sha512-HuPSzzAbJ1T4BD8e0bs6B9C1kWQ6gv8ykZoRWs5AQoiIuqbGHHdQO7Ljuvg05Q0Z24E2ABozHe6FxDvI6HfyAw==}
engines: {node: '>=16.8.0'}
hasBin: true
peerDependencies:
@@ -6149,7 +6149,7 @@ packages:
sass:
optional: true
dependencies:
- '@next/env': 13.4.13
+ '@next/env': 13.4.19
'@swc/helpers': 0.5.1
busboy: 1.6.0
caniuse-lite: 1.0.30001519
@@ -6160,15 +6160,15 @@ packages:
watchpack: 2.4.0
zod: 3.21.4
optionalDependencies:
- '@next/swc-darwin-arm64': 13.4.13
- '@next/swc-darwin-x64': 13.4.13
- '@next/swc-linux-arm64-gnu': 13.4.13
- '@next/swc-linux-arm64-musl': 13.4.13
- '@next/swc-linux-x64-gnu': 13.4.13
- '@next/swc-linux-x64-musl': 13.4.13
- '@next/swc-win32-arm64-msvc': 13.4.13
- '@next/swc-win32-ia32-msvc': 13.4.13
- '@next/swc-win32-x64-msvc': 13.4.13
+ '@next/swc-darwin-arm64': 13.4.19
+ '@next/swc-darwin-x64': 13.4.19
+ '@next/swc-linux-arm64-gnu': 13.4.19
+ '@next/swc-linux-arm64-musl': 13.4.19
+ '@next/swc-linux-x64-gnu': 13.4.19
+ '@next/swc-linux-x64-musl': 13.4.19
+ '@next/swc-win32-arm64-msvc': 13.4.19
+ '@next/swc-win32-ia32-msvc': 13.4.19
+ '@next/swc-win32-x64-msvc': 13.4.19
transitivePeerDependencies:
- '@babel/core'
- babel-plugin-macros