diff --git a/src/app/layout.tsx b/src/app/layout.tsx index b640959c..95d5f3b4 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -2,12 +2,12 @@ import { Metadata } from "next"; import { Darker_Grotesque, Figtree } from "next/font/google"; import { draftMode } from "next/headers"; +import { generateMetadataFromSeo } from "src/utils/seo"; import LiveVisualEditing from "studio/lib/loaders/AutomaticVisualEditing"; import { CompanyInfo } from "studio/lib/payloads/companyDetails"; import { COMPANY_INFO_QUERY } from "studio/lib/queries/companyDetails"; import { loadQuery } from "studio/lib/store"; import "src/styles/global.css"; -import { generateMetadataFromSeo } from "src/utils/seo"; const darkerGrotesque = Darker_Grotesque({ subsets: ["latin"], diff --git a/src/utils/hooks/useConvertImage.tsx b/src/utils/hooks/useConvertImage.tsx index 4420eb35..b2625789 100644 --- a/src/utils/hooks/useConvertImage.tsx +++ b/src/utils/hooks/useConvertImage.tsx @@ -1,12 +1,12 @@ import Image from "next/image"; import { useNextSanityImage } from "next-sanity-image"; - -// TODO: add support for sharedClient import { JSX } from "react"; import { client } from "studio/lib/client"; import { IImage } from "studio/lib/payloads/media"; +// TODO: add support for sharedClient + const MockImage = ({ image }: { image: IImage }) => { if (!image.src) { return null; diff --git a/src/utils/hooks/useFetchPosts.ts b/src/utils/hooks/useFetchPosts.ts index 00e9815f..e0c95c0e 100644 --- a/src/utils/hooks/useFetchPosts.ts +++ b/src/utils/hooks/useFetchPosts.ts @@ -60,6 +60,7 @@ export const useFetchPosts = ({ setPostsCount(count); } catch (error) { + console.log("Error when fetching posts:", error); setPosts((prevState) => ({ ...prevState, initialLoading: false, diff --git a/src/utils/renderSection.tsx b/src/utils/renderSection.tsx index 5025a4ee..413cf31e 100644 --- a/src/utils/renderSection.tsx +++ b/src/utils/renderSection.tsx @@ -162,7 +162,6 @@ const renderContactFormSection = ( section: ContactFormSection, sectionIndex: number, isDraftMode: boolean, - initialData: QueryResponseInitial, ) => { return isDraftMode ?
: ; }; @@ -237,7 +236,6 @@ const SectionRenderer = ({ section as ContactFormSection, sectionIndex, isDraftMode, - initialData, ); default: return null; diff --git a/studio/components/AnchorSelect.tsx b/studio/components/AnchorSelect.tsx index 2eed950e..1d68f3d9 100644 --- a/studio/components/AnchorSelect.tsx +++ b/studio/components/AnchorSelect.tsx @@ -53,7 +53,7 @@ const AnchorSelect = ({ value, onChange, path }: AnchorSelectProps) => { }); const formattedResponseToListItems = response.sections.map( - (section: AnchorItem, index: number) => { + (section: AnchorItem) => { const title = section.basicTitle || fromCamelCase(section._type); return { basicTitle: title, diff --git a/studio/components/CategorySelect.tsx b/studio/components/CategorySelect.tsx index 4cb42642..2af1c92a 100644 --- a/studio/components/CategorySelect.tsx +++ b/studio/components/CategorySelect.tsx @@ -1,5 +1,5 @@ import { Select } from "@sanity/ui"; -import React, { useEffect, useState } from "react"; +import React, { forwardRef, useEffect, useState } from "react"; import { PatchEvent, StringInputProps, set, useClient } from "sanity"; import { fetchWithToken } from "studio/lib/fetchWithToken"; @@ -9,49 +9,48 @@ interface Category { name: string; } -interface CategorySelectorProps extends StringInputProps {} - -const CategorySelector = React.forwardRef< - HTMLSelectElement, - CategorySelectorProps ->((props, ref) => { - const { value, onChange } = props; - const client = useClient(); - const [categories, setCategories] = useState([]); - - useEffect(() => { - async function fetchCategories() { - const result = await fetchWithToken( - `*[_type == "blog"][0].categories`, - ); - - setCategories(result || []); - } - fetchCategories(); - }, [client]); - - const handleChange = (event: React.ChangeEvent) => { - onChange(PatchEvent.from(set(event.target.value))); - }; - - return ( - + - ))} - - ); -}); + {categories.map((category) => ( + + ))} + + ); + }, +); CategorySelector.displayName = "CategorySelector"; diff --git a/studio/components/ReferenceSlugInput.tsx b/studio/components/ReferenceSlugInput.tsx index a1afd182..d37adb77 100644 --- a/studio/components/ReferenceSlugInput.tsx +++ b/studio/components/ReferenceSlugInput.tsx @@ -29,8 +29,7 @@ interface ReferenceSlugInputProps { } const ReferenceSlugInput: React.FC = (props) => { - const { value, readOnly, schemaType, onChange, elementProps, document } = - props; + const { value, readOnly, onChange, elementProps, document } = props; const [slug, setSlug] = useState(value || null); const client = useClient(); diff --git a/studio/components/salariesInput/components/SalariesTableEditor.tsx b/studio/components/salariesInput/components/SalariesTableEditor.tsx index 22ff0743..7de3b974 100644 --- a/studio/components/salariesInput/components/SalariesTableEditor.tsx +++ b/studio/components/salariesInput/components/SalariesTableEditor.tsx @@ -24,7 +24,7 @@ const SalariesTableEditor = ({ {Object.entries(salaries) .toSorted(([a], [b]) => Number(b) - Number(a)) - .map(([year, salary], index) => ( + .map(([year, salary]) => ( <>