From a52fee4f8f02742c5ff3839c26f6bc9100fcaec2 Mon Sep 17 00:00:00 2001 From: Utkarsh Pant Date: Fri, 2 Feb 2024 15:30:10 -0600 Subject: [PATCH 1/4] Fix #98: Redirect to main branch when only lang slug is present (#167) * Add docs/$lang.ts file for redirection --- app/routes/docs.$lang.ts | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 app/routes/docs.$lang.ts diff --git a/app/routes/docs.$lang.ts b/app/routes/docs.$lang.ts new file mode 100644 index 00000000..4a7e2b20 --- /dev/null +++ b/app/routes/docs.$lang.ts @@ -0,0 +1,5 @@ +import { redirect, type LoaderFunctionArgs } from "@remix-run/node"; +export async function loader({ params }: LoaderFunctionArgs) { + const { lang, ref } = params; + return !ref ? redirect(`/docs/${lang}/main`) : null; +} \ No newline at end of file From 05f2bdaa225e42f74a0142d5f072cee3c33b8330 Mon Sep 17 00:00:00 2001 From: Remix Run Bot Date: Fri, 2 Feb 2024 21:30:41 +0000 Subject: [PATCH 2/4] chore: format [skip ci] --- app/routes/docs.$lang.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/routes/docs.$lang.ts b/app/routes/docs.$lang.ts index 4a7e2b20..225be0ed 100644 --- a/app/routes/docs.$lang.ts +++ b/app/routes/docs.$lang.ts @@ -1,5 +1,5 @@ import { redirect, type LoaderFunctionArgs } from "@remix-run/node"; export async function loader({ params }: LoaderFunctionArgs) { - const { lang, ref } = params; - return !ref ? redirect(`/docs/${lang}/main`) : null; -} \ No newline at end of file + const { lang, ref } = params; + return !ref ? redirect(`/docs/${lang}/main`) : null; +} From a7dadf086d93b5927fda6dfca1e3b152a89d458e Mon Sep 17 00:00:00 2001 From: Pierre Berger Date: Fri, 2 Feb 2024 22:36:16 +0100 Subject: [PATCH 3/4] fix: docsearch modal hover cursor (#169) --- app/styles/docsearch.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/styles/docsearch.css b/app/styles/docsearch.css index 2fa15a85..ef58bf0f 100644 --- a/app/styles/docsearch.css +++ b/app/styles/docsearch.css @@ -48,3 +48,7 @@ @apply grid h-5 w-3.5 place-items-center rounded bg-white px-1 text-xs text-gray-600 dark:bg-gray-600 dark:text-gray-200; } + +.DocSearch-Container { + cursor: auto; +} From 5263bb4ea472dacdd75f6e69bc1a71074e3187c9 Mon Sep 17 00:00:00 2001 From: Logan McAnsh Date: Fri, 2 Feb 2024 17:16:14 -0500 Subject: [PATCH 4/4] feat: query and render the changelog (#172) * feat: query and render the changelog probably a better alternative approach to this, but it works... closes #165 Signed-off-by: Logan McAnsh * chore: pr review suggestions Signed-off-by: Logan McAnsh --------- Signed-off-by: Logan McAnsh --- app/lib/gh-docs/docs.ts | 2 +- app/routes/$.tsx | 2 +- app/routes/docs.$lang.$ref.$.tsx | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/lib/gh-docs/docs.ts b/app/lib/gh-docs/docs.ts index b5720b1b..9227b5cc 100644 --- a/app/lib/gh-docs/docs.ts +++ b/app/lib/gh-docs/docs.ts @@ -92,7 +92,7 @@ global.docCache ??= new LRUCache({ async function fetchDoc(key: string): Promise { let [repo, ref, slug] = key.split(":"); - let filename = `docs/${slug}.md`; + let filename = `${slug}.md`; let md = await getRepoContent(repo, ref, filename); if (md === null) { throw Error(`Could not find ${filename} in ${repo}@${ref}`); diff --git a/app/routes/$.tsx b/app/routes/$.tsx index b81b5768..d81f9b21 100644 --- a/app/routes/$.tsx +++ b/app/routes/$.tsx @@ -55,7 +55,7 @@ export const loader = async ({ request, params }: LoaderFunctionArgs) => { try { let ref = "main"; let lang = "en"; - let doc = await getRepoDoc(ref, params["*"]!); + let doc = await getRepoDoc(ref, `docs/${params["*"]}`); if (!doc) throw null; // FIXME: This results in two fetches, as the loader for the docs page will // repeat the request cycle. This isn't a problem if the doc is in the LRU diff --git a/app/routes/docs.$lang.$ref.$.tsx b/app/routes/docs.$lang.$ref.$.tsx index 1aef7426..5091a43d 100644 --- a/app/routes/docs.$lang.$ref.$.tsx +++ b/app/routes/docs.$lang.$ref.$.tsx @@ -30,7 +30,10 @@ export async function loader({ params, request }: LoaderFunctionArgs) { let pageUrl = url.protocol + "//" + url.host + url.pathname; invariant(params.ref, "expected `ref` params"); try { - let doc = await getRepoDoc(params.ref, params["*"] || "index"); + let slug = params["*"]?.endsWith("/changelog") + ? "CHANGELOG" + : `docs/${params["*"] || "index"}`; + let doc = await getRepoDoc(params.ref, slug); if (!doc) throw null; return json( { doc, pageUrl },