From 24dd72e44b9457798bf6bc8d6c50ca3752b670a1 Mon Sep 17 00:00:00 2001 From: Beier Luo Date: Sat, 8 Oct 2022 14:51:39 +1100 Subject: [PATCH 1/3] change Object to object --- src/components/ApiErrors.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ApiErrors.tsx b/src/components/ApiErrors.tsx index 96afd196b..d64227e96 100644 --- a/src/components/ApiErrors.tsx +++ b/src/components/ApiErrors.tsx @@ -27,7 +27,7 @@ export default React.memo( errors:{" "} {`Record`} + >{`Record`} From 803b6a4fb6d32ae644fb305c9856eb8b1b842969 Mon Sep 17 00:00:00 2001 From: Soumik Date: Sat, 8 Oct 2022 16:44:15 +0530 Subject: [PATCH 2/3] fix: edit links for api and advanced pages (#842) --- src/components/layout.tsx | 7 ++++++- src/components/logic/getEditLink.tsx | 15 ++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/components/layout.tsx b/src/components/layout.tsx index 099a10c49..b2b39a27d 100644 --- a/src/components/layout.tsx +++ b/src/components/layout.tsx @@ -22,6 +22,7 @@ const Layout = (props: { const { currentLanguage } = language && language.currentLanguage ? language : { currentLanguage: "en" } const lightMode = state?.setting?.lightMode + const currentVersion = state?.setting?.version const [show, setShow] = React.useState(false) const scrollHandler = () => { if (window.scrollY > 75) { @@ -30,7 +31,11 @@ const Layout = (props: { setShow(false) } } - const editLink = getEditLink(currentLanguage, props.location?.pathname) + const editLink = getEditLink( + currentVersion, + currentLanguage, + props.location?.pathname + ) React.useEffect(() => { window.addEventListener("scroll", scrollHandler) diff --git a/src/components/logic/getEditLink.tsx b/src/components/logic/getEditLink.tsx index b4c0641b5..5bae1e8ec 100644 --- a/src/components/logic/getEditLink.tsx +++ b/src/components/logic/getEditLink.tsx @@ -1,22 +1,31 @@ const preFix = - "https://github.com/react-hook-form/documentation/edit/master/src/data/" + "https://github.com/react-hook-form/documentation/edit/v6-v5/src/data/" export const getEditLink = ( + currentVersion: number, currentLanguage: string, pathname: string ): string => { if (!pathname) return "" + let versionTag = "" + if (currentVersion === 6) { + versionTag = "V6/" + } else if (currentVersion === 5) { + versionTag = "V5/" + } + if (pathname === "/" || pathname === "") { return preFix + "home.tsx" } else if (pathname.includes("get-started")) { return `${preFix}${currentLanguage}/getStarted.tsx` } else if (pathname.includes("api")) { - return `${preFix}${currentLanguage}/api.tsx` + return `${preFix}${versionTag}${currentLanguage}/api.tsx` } else if (pathname.includes("ts")) { return `${preFix}ts.tsx` } else if (pathname.includes("advanced-usage")) { - return `${preFix}${currentLanguage}/advanced.tsx` + const tag = currentVersion < 7 && currentLanguage === "en" ? "V6/" : "" + return `${preFix}${tag}${currentLanguage}/advanced.tsx` } else if (pathname.includes("faqs")) { return `${preFix}${currentLanguage}/faq.tsx` } else if (pathname.includes("dev-tools")) { From 88f0abf91692d996e4e3d98d1782dc785758b6e4 Mon Sep 17 00:00:00 2001 From: Cassian Andor <126653425+Cassian-Andor@users.noreply.github.com> Date: Fri, 17 Mar 2023 16:08:45 -0500 Subject: [PATCH 3/3] Fixed typos in watch pages (#920) --- src/components/ApiWatch.tsx | 2 +- src/components/UseWatchContent.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/ApiWatch.tsx b/src/components/ApiWatch.tsx index 42e60f90c..d8d21fc24 100644 --- a/src/components/ApiWatch.tsx +++ b/src/components/ApiWatch.tsx @@ -107,7 +107,7 @@ export default function ApiWatch({ watch('inputName') - unkown + unknown diff --git a/src/components/UseWatchContent.tsx b/src/components/UseWatchContent.tsx index 0ab11feb9..c41fbccc5 100644 --- a/src/components/UseWatchContent.tsx +++ b/src/components/UseWatchContent.tsx @@ -140,7 +140,7 @@ export default function UseFieldArray({ useWatch('inputName') - unkown + unknown