feat(docs): add page actions to all docs pages#331
Conversation
|
@BittuBarnwal7479 is attempting to deploy a commit to the Kaelio Team on Vercel. A member of the Team first needs to authorize it. |
luca-martial
left a comment
There was a problem hiding this comment.
Thanks for this, it's a genuinely useful addition (fixes #330), and the footer handling is done right: re-adding <PageFooter /> keeps prev/next nav because the Footer slot derives neighbours from context.
Two blockers stop it from shipping, plus a few design-cohesion items. Details are inline.
Blocking
lucide-reactis imported but not a dependency ofdocs-site; under the workspace'sshamefullyHoist: falsethis fails a cleannext build, and it contradicts the repo's "icons are inlined" convention. (docs-page-actions.tsx)- "Raise issue" points at the
bug_report.ymlissue form, which ignores thebodyquery param. The page/source context is silently dropped and the reader is forced into a bug form requiring repro steps and a KTX version, withblank_issues_enabled: falseblocking any escape. (page.tsx)
Design / UX
3. The three actions are split across two locations (Copy top-right, Suggest edits / Raise issue in the footer) with identical styling, and the hero page shows only 2 of them. Group them into one cluster.
4. Icon set is inconsistent (two buttons have icons, Copy has none), and CircleAlert reads as an error state rather than feedback.
Code quality
5. Hardcoded canonical URL duplicates llm-docs.ts siteOrigin/absoluteUrl.
6. The markdown file is read up to 3x per page.
7. footer.component is a deprecated fumadocs prop.
8. The new test asserts URL shape, not that the issue flow is usable.
| "use client"; | ||
|
|
||
| import { useState } from "react"; | ||
| import { CircleAlert, PencilLine } from "lucide-react"; |
There was a problem hiding this comment.
Blocking (build break). lucide-react is not a dependency of docs-site (docs-site/package.json lists only fumadocs/next/react). It exists only transitively under fumadocs-ui in the pnpm store, and the workspace runs shamefullyHoist: false, so this bare import is not resolvable from docs-site/node_modules. A clean pnpm install + next build fails with Can't resolve 'lucide-react' (the new dev-server test should already be red on this).
This also contradicts the existing convention documented in theme-toggle.tsx: "Icons are inlined (the project doesn't depend on lucide-react directly)". Please inline the two SVGs the same way theme-toggle.tsx does, or add lucide-react to docs-site deps. The inline approach matches the repo.
| rel="noreferrer noopener" | ||
| className={actionClassName} | ||
| > | ||
| <CircleAlert className="size-3.5" aria-hidden="true" /> |
There was a problem hiding this comment.
CircleAlert reads as an error/warning state ("something is broken on this page"), not "send feedback". A bug, flag, or message glyph fits "Raise issue" better.
Also: these two links carry icons but "Copy as Markdown" (same actionClassName) has none, so the family looks half-styled. Pick one rule: icons on all three, or none.
| ].join("\n"); | ||
|
|
||
| const params = new URLSearchParams({ | ||
| template: "bug_report.yml", |
There was a problem hiding this comment.
Blocking (feature doesn't do what it looks like it does). bug_report.yml is a GitHub issue form (YAML with a body: field list). Issue forms ignore the body query parameter entirely; they prefill only via per-field params keyed by each field's id. So the context built just above (page URL, source file, "What should change?") is silently discarded.
What the reader actually gets: the bug form, whose required fields are "How can we reproduce it?" and "KTX version" (labeled bug), for what is often a one-line docs typo. And config.yml sets blank_issues_enabled: false, so they can't fall back to a blank issue.
Recommend a dedicated docs-feedback issue form and prefill its fields by id, e.g. ?template=docs_feedback.yml&page=...&source=.... Ref: https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema
| const MDX = page.data.body; | ||
| const mdxSource = await readDocsPageMarkdown(page.slugs); | ||
| const sourcePath = await resolveDocsPageMarkdownPath(page.slugs); | ||
| const pageUrl = `https://docs.kaelio.com/ktx/docs/${page.slugs.join("/")}`; |
There was a problem hiding this comment.
This hardcodes the canonical origin, but lib/llm-docs.ts already owns it (siteOrigin = "https://docs.kaelio.com/ktx" plus an absoluteUrl() helper), and page.url already carries the canonical path. Two definitions of the same origin will drift. Reuse the existing helper / page.url for a single source of truth.
| <DocsPage | ||
| toc={page.data.toc} | ||
| className="!mx-0 min-w-0 justify-self-start md:!mx-auto" | ||
| footer={{ |
There was a problem hiding this comment.
footer.component is deprecated in this fumadocs version (the DocsPageProps type marks it @deprecated use slots.footer instead). It works today, but prefer slots={{ footer: ... }} to avoid breakage on the next fumadocs major.
(For the record, re-adding <PageFooter /> here is correct: the Footer slot derives prev/next from context via useFooterItems(), so navigation is preserved.)
| component: ( | ||
| <> | ||
| <div className="mt-10 mb-4"> | ||
| <DocsPageActions |
There was a problem hiding this comment.
Design. These two actions now live in the footer while "Copy as Markdown" stays top-right next to the title (line 101), all three sharing the same actionClassName. Same visual family, two locations, so it reads accidental rather than grouped.
It's also inconsistent per page: the hero page skips the header block ({!hero && ...}), so it shows only these 2 footer actions, while every other page shows 1 on top and 2 at the bottom. Suggest grouping all three into one cluster (all top-right, or all in the footer).
|
|
||
| try { | ||
| return await readFile(directPath, "utf8"); | ||
| await readFile(directPath, "utf8"); |
There was a problem hiding this comment.
Minor: this reads the file just to test existence and throws the content away; readDocsPageMarkdown then reads it again; and page.tsx calls both readDocsPageMarkdown and resolveDocsPageMarkdownPath, so the direct-path file is read up to 3x per page. Build-time only, so low priority, but consider returning { path, content } from one function, or probing with access/stat instead of readFile.
| ); | ||
| assert.match( | ||
| html, | ||
| /https:\/\/github\.com\/Kaelio\/ktx\/issues\/new\?[^"]*template=bug_report\.yml/, |
There was a problem hiding this comment.
This asserts the href contains template=bug_report.yml, which is true regardless of whether the resulting issue is usable, so it would pass on the broken flow described in the page.tsx comment (the form ignores the prefilled body). Once "Raise issue" points at a docs-feedback template with id-based prefill, assert on the field params that actually populate.
|
Hey @luca-martial i've addressed the latest feedback and pushed the requested changes. |

fixes: #330
Summary
Add Suggest edits and Raise issue actions to all documentation pages for a consistent user experience.