feat(SW-66, SW-348): search functionality and ui

This commit is contained in:
Simon Emanuelsson
2024-08-28 10:47:57 +02:00
parent b9dbcf7d90
commit af850c90e7
437 changed files with 7663 additions and 9881 deletions

View File

@@ -4,13 +4,19 @@ import { GetContactConfig } from "@/lib/graphql/Query/ContactConfig.graphql"
import {
GetCurrentFooter,
GetCurrentFooterRef,
} from "@/lib/graphql/Query/CurrentFooter.graphql"
} from "@/lib/graphql/Query/Current/Footer.graphql"
import {
GetCurrentHeader,
GetCurrentHeaderRef,
} from "@/lib/graphql/Query/CurrentHeader.graphql"
import { GetFooter, GetFooterRef } from "@/lib/graphql/Query/Footer.graphql"
import { GetHeader, GetHeaderRef } from "@/lib/graphql/Query/Header.graphql"
} from "@/lib/graphql/Query/Current/Header.graphql"
import {
GetFooter,
GetFooterRef,
} from "@/lib/graphql/Query/Footer.graphql"
import {
GetHeader,
GetHeaderRef,
} from "@/lib/graphql/Query/Header.graphql"
import { request } from "@/lib/graphql/request"
import { notFound } from "@/server/errors/trpc"
import { contentstackBaseProcedure, router } from "@/server/trpc"
@@ -23,19 +29,18 @@ import {
import { langInput } from "./input"
import {
type GetCurrentHeaderData,
type ContactConfigData,
CurrentFooterDataRaw,
CurrentFooterRefDataRaw,
CurrentHeaderData,
CurrentHeaderDataRaw,
CurrentHeaderRefDataRaw,
getHeaderRefSchema,
getHeaderSchema,
validateContactConfigSchema,
validateCurrentFooterConfigSchema,
validateCurrentHeaderConfigSchema,
validateFooterConfigSchema,
validateFooterRefConfigSchema,
validateCurrentHeaderConfigSchema,
} from "./output"
import { getConnections, getFooterConnections } from "./utils"
@@ -357,7 +362,7 @@ export const baseQueryRouter = router({
const currentHeaderUID =
responseRef.data.all_current_header.items[0].system.uid
// There's currently no error handling/validation for the responseRef, should it be added?
const response = await request<CurrentHeaderDataRaw>(
const response = await request<GetCurrentHeaderData>(
GetCurrentHeader,
{ locale: input.lang },
{
@@ -415,14 +420,8 @@ export const baseQueryRouter = router({
query: { lang: input.lang },
})
)
const logo =
validatedHeaderConfig.data.all_current_header.items[0].logoConnection
.edges?.[0]?.node
return {
...validatedHeaderConfig.data.all_current_header.items[0],
logo,
} as CurrentHeaderData
return validatedHeaderConfig.data
}),
currentFooter: contentstackBaseProcedure
.input(langInput)