Merged in feat/footer (pull request #11)

Feat/footer

* chore: correct type

* fix: remove redundant return type

* chore: align code formatting

* chore: format code to avoid diffing noise

* chore: clean up format diffing noise

* chore: move props tying to types folder

* fix: update app_downloads usage and types

* fix: improve footer query and typings

* refactor: add Image.graphql

* fix: correct typings
This commit is contained in:
Arvid Norlin
2024-02-08 14:22:13 +00:00
committed by Simon.Emanuelsson
parent 7926568eae
commit 2bd4e25403
22 changed files with 504 additions and 1723 deletions

View File

@@ -3,13 +3,13 @@ import { notFound } from "next/navigation";
import { request } from "@/lib/request"
import { GetCurrentBlockPage } from "@/lib/graphql/Query/CurrentBlockPage.graphql"
import Aside from "@/components/Current/Aside";
import Blocks from "@/components/Current/Blocks";
import Header from "@/components/Current/Header";
import Hero from "@/components/Current/Hero";
import Aside from "@/components/Current/Aside"
import Blocks from "@/components/Current/Blocks"
import Header from "@/components/Current/Header"
import Hero from "@/components/Current/Hero"
import type { PageArgs, LangParams, UriParams } from "@/types/params";
import type { GetCurrentBlockPageData } from "@/types/requests/currentBlockPage";
import type { PageArgs, LangParams, UriParams } from "@/types/params"
import type { GetCurrentBlockPageData } from "@/types/requests/currentBlockPage"
export default async function CurrentContentPage({
params,
@@ -17,10 +17,13 @@ export default async function CurrentContentPage({
}: PageArgs<LangParams, UriParams>) {
try {
if (!searchParams.uri) {
throw new Error("Bad URI");
throw new Error("Bad URI")
}
const response = await request<GetCurrentBlockPageData>(GetCurrentBlockPage, { locale: params.lang, url: searchParams.uri })
const response = await request<GetCurrentBlockPageData>(GetCurrentBlockPage, {
locale: params.lang,
url: searchParams.uri,
})
if (!response.data?.all_current_blocks_page?.total) {
console.log("#### DATA ####")
@@ -36,17 +39,13 @@ export default async function CurrentContentPage({
<>
<Header lang={params.lang} pathname={searchParams.uri} />
{images?.totalCount ? <Hero images={images.edges} /> : null}
<main
className="main l-sections-wrapper"
id="maincontent"
role="main"
>
<main className="main l-sections-wrapper" id="maincontent" role="main">
<Blocks blocks={page.blocks} />
<Aside blocks={page.aside} />
</main>
</>
);
)
} catch (err) {
return notFound();
return notFound()
}
}