Skip to content

feat: add related tools section to tool pages - #103

Merged
anurag629 merged 2 commits into
codercops:developfrom
varun-pahuja:feat/related-tools-section
Oct 1, 2026
Merged

anurag629 merged 2 commits into
codercops:developfrom
varun-pahuja:feat/related-tools-section

Conversation

@varun-pahuja

Copy link
Copy Markdown
Contributor

What and why

Tool pages only linked home. This adds a small Related tools block to the
shared tool page layout so every tool page surfaces 2–3 relevant sibling tools
with descriptive, keyword-rich anchors (the tool name) — internal links that
spread authority and keep visitors on-site. Closes #40.

  • lib/tools.ts: deterministic getRelatedTools(currentSlug, limit = 3, tools = TOOLS)
    — same applicationCategory first, then the rest of the registry in declaration
    order, excluding the current tool; unknown slug returns []; no randomness.
  • components/shared/ToolPageLayout.tsx: // Related tools heading +
    <nav aria-label="Related tools"> grid, placed after the FAQ and before the
    CTA banner. Anchor text is the tool name; cardDescription sits under it,
    clamped to 2 lines. Existing tokens only (card, --fg, --fg-muted,
    --fg-dim, --cyan) — no hardcoded colors, so light and dark themes are
    unaffected.

Type of change

  • Bug fix
  • New tool or feature
  • Refactor or cleanup
  • Docs

Checklist

  • npm run lint && npm run test && npm run build passes locally
  • Logic changes live in lib/ and have a test in lib/__tests__/
  • No analytics, trackers, or calls that send user data off-device
  • Works in both light and dark themes (if UI changed)

Notes for reviewers

Exact results under Node v22.23.3 (matches .nvmrc):

  • npm run lint → 0 errors, 13 warnings (identical to unmodified develop)
  • npm run test → 5 files, 34 tests passed (baseline: 4 files / 27; the 7 new tests cover getRelatedTools)
  • npm run build → exit 0

Red/green: lib/__tests__/tools-related.test.ts fails 7/7 on the
unmodified tree (the helper doesn't exist yet) and passes 7/7 with this
change. Verified at 375px viewport: cards stack full-width, no horizontal
overflow (document.scrollWidth === window.innerWidth).

Screenshots (3 tool pages × light and dark, plus 375px mobile) are attached below.

The Maximum update depth exceeded console error from CommandPalette.tsx
also occurs on unmodified develop and is unrelated to this change.

@varun-pahuja

Copy link
Copy Markdown
Contributor Author
image image

@anurag629 anurag629 left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @varun-pahuja, nice work on this! Code looks clean and thanks for the screenshots in both themes.

One thing before I merge. The lists same-category tools first, in registry order test checks the exact list ["jwt-decoder", "base64", "invoice-generator"]. We have 7 new-tool issues open right now and each one adds a DeveloperApplication tool at the end of TOOLS. So once the first one gets merged, json-formatter's third related tool changes and this test starts failing for everyone after that.

Can you move that exact-order check to your mini registry? Or on the real registry, just check that the first two are jwt-decoder and base64. The invoice-generator test has the same problem (it assumes there's no other business tool), so same fix there.

Also thanks for pointing out the Maximum update depth exceeded error in CommandPalette.tsx, I'll check that one separately.

Let me know if you have any questions.

@varun-pahuja

Copy link
Copy Markdown
Contributor Author

Thanks @anurag629, good catch! Pushed 8de94c4: the exact-order checks now run against small mini registries passed through the tools argument, and the real-registry tests only assert things that stay true as tools are added (current tool excluded, limit honored, deterministic, unknown slug, and jwt-decoder then base64 first for json-formatter). I also tried appending fake DeveloperApplication and BusinessApplication tools to TOOLS locally and all tests still passed (then reverted).

The new CI run is waiting for approval when you have a moment. Ready for another look!

@anurag629 anurag629 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @varun-pahuja, looks great, thanks for the quick fix! Running the exact-order checks on the mini registries is exactly what I had in mind, and CI is green. Merging this now.

@anurag629 anurag629 added the hacktoberfest-accepted PR counts for Hacktoberfest label Oct 1, 2026
@anurag629
anurag629 merged commit 384e044 into codercops:develop Oct 1, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hacktoberfest-accepted PR counts for Hacktoberfest

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a Related tools section to tool pages

2 participants