diff --git a/overrides.d.ts b/overrides.d.ts index a81d57a3cf2..4157be51b84 100644 --- a/overrides.d.ts +++ b/overrides.d.ts @@ -1,8 +1,8 @@ -declare module "*developer-docs-links.yaml" { - import { DeveloperDocsLink } from "./src/types" - const content: Array - export default content -} +// declare module "./src/data/developerDocsLinks.json" { +// import { DeveloperDocsLink } from "./src/types" +// const content: Array +// export default content +// } declare module "*.mp4" { const src: string diff --git a/src/components/DeveloperDocsLinks.tsx b/src/components/DeveloperDocsLinks.tsx index fc97525a68a..9cf6e795755 100644 --- a/src/components/DeveloperDocsLinks.tsx +++ b/src/components/DeveloperDocsLinks.tsx @@ -2,7 +2,9 @@ import React from "react" import { ListItem, UnorderedList } from "@chakra-ui/react" import Translation from "./Translation" import Link from "./Link" -import docLinks from "../data/developer-docs-links.yaml" +import { DeveloperDocsLink } from "../types" + +import docLinks from "../data/developerDocsLinks.json" export interface IProps { headerId: string @@ -10,7 +12,7 @@ export interface IProps { const DeveloperDocsLinks: React.FC = ({ headerId }) => ( - {docLinks + {(docLinks as Array) .filter(({ id }) => id.includes(headerId)) .map(({ items, id }) => ( @@ -26,7 +28,7 @@ const DeveloperDocsLinks: React.FC = ({ headerId }) => ( )} {" – "} - + = ({ relativePath }) => { getDocs(item.items) } else { // If object has no further 'items', add and continue - docsArray.push({ to: item.to, id: item.id }) + docsArray.push({ to: item.to!, id: item.id }) } } } - // Initiate recursive loop with full docLinks yaml - getDocs(docLinks) + // Initiate recursive loop with full docLinks json + getDocs(docLinks as Array) // Find index that matches current page let currentIndex = 0 diff --git a/src/components/SideNav.tsx b/src/components/SideNav.tsx index 836c6664d11..8c4c6a7026d 100644 --- a/src/components/SideNav.tsx +++ b/src/components/SideNav.tsx @@ -8,7 +8,7 @@ import Link from "./Link" import Translation from "./Translation" import { dropdownIconContainerVariant } from "./SharedStyledComponents" -import docLinks from "../data/developer-docs-links.yaml" +import docLinks from "../data/developerDocsLinks.json" import { translateMessageId } from "../utils/translations" import { DeveloperDocsLink } from "../types" @@ -87,7 +87,7 @@ export interface IPropsNavLink { } const NavLink: React.FC = ({ item, path }) => { - const isLinkInPath = path.includes(item.to) || path.includes(item.path) + const isLinkInPath = path.includes(item.to!) || path.includes(item.path) const [isOpen, setIsOpen] = useState(isLinkInPath) useEffect(() => { @@ -158,7 +158,7 @@ const SideNav: React.FC = ({ path }) => { return ( diff --git a/src/components/SideNavMobile.tsx b/src/components/SideNavMobile.tsx index 3b2f0086731..f6f3299ae8e 100644 --- a/src/components/SideNavMobile.tsx +++ b/src/components/SideNavMobile.tsx @@ -9,7 +9,7 @@ import { isLang } from "../utils/languages" import { dropdownIconContainerVariant } from "./SharedStyledComponents" import { IPropsNavLink as INavLinkProps } from "./SideNav" -import docLinks from "../data/developer-docs-links.yaml" +import docLinks from "../data/developerDocsLinks.json" import { DeveloperDocsLink } from "../types" import { TranslationKey } from "../utils/translations" @@ -182,7 +182,10 @@ const SideNavMobile: React.FC = ({ path }) => { if (isLang(pagePath.split("/")[1])) { pagePath = pagePath.substring(3) } - let pageTitleId = getPageTitleId(pagePath, docLinks) + let pageTitleId = getPageTitleId( + pagePath, + docLinks as Array + ) if (!pageTitleId) { console.warn(`No id found for "pagePath": `, pagePath) pageTitleId = `Change page` as TranslationKey @@ -219,7 +222,7 @@ const SideNavMobile: React.FC = ({ path }) => { }, }} > - {docLinks.map((item, idx) => ( + {(docLinks as Array).map((item, idx) => ( + to?: string + description?: TranslationKey } export type Direction = "rtl" | "ltr" | "auto"