diff --git a/apps/roboshield/src/components/BlockRenderer/BlockRenderer.tsx b/apps/roboshield/src/components/BlockRenderer/BlockRenderer.tsx index b18531da2..759cf72b4 100644 --- a/apps/roboshield/src/components/BlockRenderer/BlockRenderer.tsx +++ b/apps/roboshield/src/components/BlockRenderer/BlockRenderer.tsx @@ -1,22 +1,17 @@ import PageHeader from "@/roboshield/components/PageHeader/PageHeader"; import { Page } from "@/root/payload-types"; -type BlockType = Page["blocks"]; -interface BlockRendererProps { - blocks: BlockType; -} +interface BlockRendererProps extends Pick {} const components = { "page-header": PageHeader, }; -type BlockSlug = keyof typeof components; - export default function BlockRenderer({ blocks }: BlockRendererProps) { return ( <> {blocks?.map((block, index) => { - const Component = components[block.blockType as BlockSlug]; + const Component = components[block.blockType]; if (Component) { return ; diff --git a/apps/roboshield/src/payload/fields/richText.ts b/apps/roboshield/src/payload/fields/richText.ts index a5c67f60a..0aa6f0e0d 100644 --- a/apps/roboshield/src/payload/fields/richText.ts +++ b/apps/roboshield/src/payload/fields/richText.ts @@ -1,7 +1,7 @@ import { deepmerge } from "@mui/utils"; import mapLinkTypeToHref, { NodeType } from "../utils/mapLinkTypeToHref"; -import { Field, PayloadRequest } from "payload/types"; +import { Field, FieldHook, PayloadRequest } from "payload/types"; async function insertHref(nodes: NodeType[] | null, payload: PayloadRequest) { if (!nodes?.length) { @@ -53,15 +53,17 @@ async function mapLinkToHrefAfterRead({ return insertHref(value, payload); } -function richText(overrides: Partial) { - const richTextResult = { +function richText(overrides: Partial): Field { + const richTextResult: Partial = { type: "richText", hooks: { - afterRead: [mapLinkToHrefAfterRead], + afterRead: [ + mapLinkToHrefAfterRead as unknown as FieldHook, + ], }, }; - return deepmerge(richTextResult, overrides); + return deepmerge(richTextResult, overrides) as Field; } export default richText; diff --git a/apps/roboshield/src/payload/globals/Site/EngagementTab.ts b/apps/roboshield/src/payload/globals/Site/EngagementTab.ts index d7dc53f33..d61390ad6 100644 --- a/apps/roboshield/src/payload/globals/Site/EngagementTab.ts +++ b/apps/roboshield/src/payload/globals/Site/EngagementTab.ts @@ -1,6 +1,7 @@ +import { Tab } from "payload/types"; import socialLinks from "../../fields/socialLinks"; -const EngagementTab = { +const EngagementTab: Tab = { label: "Engagement", fields: [ { diff --git a/apps/roboshield/src/payload/globals/Site/GeneralTab.ts b/apps/roboshield/src/payload/globals/Site/GeneralTab.ts index a1fa6fb64..5ea5155de 100644 --- a/apps/roboshield/src/payload/globals/Site/GeneralTab.ts +++ b/apps/roboshield/src/payload/globals/Site/GeneralTab.ts @@ -1,7 +1,8 @@ +import { Tab } from "payload/types"; import image from "../../fields/image"; import richText from "../../fields/richText"; -const GeneralTab = { +const GeneralTab: Tab = { label: "General", fields: [ { diff --git a/apps/roboshield/src/payload/globals/Site/InitiativeTab.ts b/apps/roboshield/src/payload/globals/Site/InitiativeTab.ts index cf1d069da..cff569bf2 100644 --- a/apps/roboshield/src/payload/globals/Site/InitiativeTab.ts +++ b/apps/roboshield/src/payload/globals/Site/InitiativeTab.ts @@ -1,8 +1,9 @@ +import { Tab } from "payload/types"; import image from "../../fields/image"; import link from "../../fields/links/link"; import richText from "../../fields/richText"; -const PartnersTab = { +const PartnersTab: Tab = { label: "Initiative", fields: [ { diff --git a/apps/roboshield/src/payload/globals/Site/NavigationTab.ts b/apps/roboshield/src/payload/globals/Site/NavigationTab.ts index 6c2a3cf8b..769e0c006 100644 --- a/apps/roboshield/src/payload/globals/Site/NavigationTab.ts +++ b/apps/roboshield/src/payload/globals/Site/NavigationTab.ts @@ -1,3 +1,4 @@ +import { Tab } from "payload/types"; import link from "../../fields/links/link"; import linkArray from "../../fields/links/linkArray"; import { socialMediaOptions } from "../../fields/socialLinks"; @@ -6,7 +7,7 @@ const linkField = link({ disableOpenInNewTab: true, }); -const NavigationTab = { +const NavigationTab: Tab = { label: "Navigation", fields: [ { diff --git a/apps/roboshield/src/payload/globals/Site/index.ts b/apps/roboshield/src/payload/globals/Site/index.ts index f439b60f0..be6070119 100644 --- a/apps/roboshield/src/payload/globals/Site/index.ts +++ b/apps/roboshield/src/payload/globals/Site/index.ts @@ -2,8 +2,9 @@ import EngagementTab from "./EngagementTab"; import GeneralTab from "./GeneralTab"; import NavigationTab from "./NavigationTab"; import InitiativeTab from "./InitiativeTab"; +import { GlobalConfig } from "payload/types"; -const Site = { +const Site: GlobalConfig = { slug: "settings-site", label: "Site", access: {