Skip to content

Docs: unify navigation/versioning internals, add feedback + search scope + What's New - #498

Open
lessevv wants to merge 8 commits into
NativePHP:mainfrom
lessevv:docs/architecture-and-features
Open

Docs: unify navigation/versioning internals, add feedback + search scope + What's New#498
lessevv wants to merge 8 commits into
NativePHP:mainfrom
lessevv:docs/architecture-and-features

Conversation

@lessevv

@lessevv lessevv commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Summary

A larger docs-system PR spanning architecture cleanup and new features, landed as 6 focused commits:

  • DocsPlatform enum + DocsVersionRegistry — replaces bare 'desktop'/'mobile' strings and 4 hand-copied version-label arrays with a typed, single source of truth.
  • DocsNavigationService — unifies two independent filesystem-walking nav-tree builders (the controller's sidebar and the MCP search API's ordering) that had drifted to different ordering math.
  • Consolidated redirects — folds same-tree page renames into config('docs.renamed_pages'), removing 5 of 9 ad-hoc Route::redirect() calls; the remaining 4 stay as routes for documented, real reasons (route-matching precedence, or a many-to-one collision the config's reverse-lookup can't represent).
  • Docs feedback widget — thumbs up/down + optional comment per page, rate-limited, visible only in Filament (no public display of votes or comments).
  • Docs search scope indicator — Algolia DocSearch silently filters results to the current platform/version; now shows that scope and offers one click to search everywhere.
  • Desktop version-docs parity + What's New page: desktop had no versioning-policy page and zero <x-docs.version-badge> usage; adds one grounded in desktop's actual auto-updater model, plus a /whats-new page aggregating every version-badge across a platform/version into one browsable place.

🤖 Generated with Claude Code

lessevv and others added 6 commits September 5, 2026 00:28
Replaces bare 'desktop'/'mobile' strings scattered across DocsSearchService,
DocsLabels, and the docs controller with a typed DocsPlatform enum, and
collapses the four hand-copied version-label arrays in index.blade.php
into DocsVersionRegistry::switcherLabels(), sourced from config('docs')
instead of being duplicated per platform per render location.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…vice

ShowDocumentationController and DocsSearchService each walked the docs
filesystem with their own Finder-based tree builder and their own
ordering math (a nested tree vs. flat order*10000 ranks). Extracts that
into a single DocsNavigationService::build()/sectionRanks(), consumed by
both, so there's one place that defines "what's the sidebar order."

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…d_pages')

Five of the mobile v4 Route::redirect() calls for renamed pages were
redundant with config('docs.renamed_pages') + DocsVersionService, which
ShowDocumentationController's 404 catch-block already resolves. Fold
those into config and drop the routes.

The remaining four (device/file/system/dialog under plugins/core, plus
the super-native/architecture-overview URL aliases) stay as explicit
routes — the first four need route-registration precedence over the
generic core-plugin-to-marketplace redirect below them, and the latter
two were never real pages, so adding them to the renamed_pages map
would collide with the existing super-native/introduction entry's
reverse (older-version) lookup and silently resolve to the wrong page.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Adds a thumbs up/down + optional comment widget under every docs page's
content, backed by a new docs_feedback table. Rate-limited by IP (5/min,
mirroring LeadSubmissionForm's pattern) to discourage spam.

Results are visible only in Filament (DocsFeedbackResource) — there is
no public display of aggregate votes or comments anywhere on the site.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
On a docs page, Algolia DocSearch silently filters results to the
current platform/version via transformItems — a reader searching for
something that only exists elsewhere gets no results and no
explanation. Adds a visible "Searching {Platform} v{X} docs" label
next to the search box with a "Search everywhere" action that
re-initializes DocSearch without the scope filter (destroy + re-init,
since docsearch() has no API to update an existing instance's options),
preserving whatever the visitor had already typed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…rsion

Closes the gap Simon flagged as "a good start" on the version-badge system
(NativePHP#482): it was mobile-only (desktop had no versioning-policy page, and
version-badge/jump-badge saw zero desktop usage) and its badges were
isolated dots with no aggregate view.

- Adds desktop/2/getting-started/versioning.md, grounded in desktop's
  actual auto-updater release model (GitHub Releases/S3/Spaces) rather
  than mobile's native-rebuild/app-store distinction, which doesn't
  apply to desktop. Desktop already has a working releasenotes.md
  pulling from GitHub, so no duplicate changelog page was added.
- Adds DocsChangelogService::badgesForVersion(), which scans a
  platform/major's pages for <x-docs.version-badge> usage and groups it
  by minor version and type (added/changed/deprecated/removed),
  excluding the versioning-policy page's own illustrative examples.
- Adds a docs/{platform}/{version}/whats-new page rendering that
  aggregate, linked from both versioning.md pages.
- Points <x-docs.version-badge>'s link at the new What's New page
  instead of the generic versioning-policy page, since a badge's own
  minor version is far more useful context than the policy blurb.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ngelog

The What's New page grouped changes under a bare minor version heading, so
readers had no way to get from "4.2" to what actually shipped in it. Each
heading now carries a link to that minor's latest patch release on the
platform's changelog page.

config('docs.changelog') records, per platform and major, which page holds
the changelog, what it's called, and the GitHub repo whose releases it
renders. Mobile 1 and 2 are left out on purpose: their changelogs are
hand-written, so there's no release feed to line a link up with, and a link
would just land on the top of the page.

The anchor is slugged from the release name rather than the tag, because the
name is what the changelog prints in its heading and what HeadingRenderer
slugs into the id. Note Str::slug drops the dots, so 4.2.3 anchors as NativePHP#423.

The release lookup deliberately sits outside the page's day-long badge cache
— GitHub::releases() already caches for an hour, and releases move faster
than docs pages. If GitHub is unreachable the headings render on their own.

One rough edge: mobile v3's changelog only lists releases after 3.1.0, so a
badge labelled 3.1 whose latest patch is exactly 3.1.0 would point at an
anchor that isn't on the page. The link still lands on the changelog, just at
the top. Nothing is labelled in mobile 3 today.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A8RHq357KfTFsniMevuEkE
@simonhamp

Copy link
Copy Markdown
Member

Docs search scope indicator — Algolia DocSearch silently filters results to the current platform/version; now shows that scope and offers one click to search everywhere.

I don't think this is working... is there something I need to do to test this out?

docsearch() from @docsearch/js renders into its container and returns
undefined — there's no instance object, so the destroy()/open() calls
this relied on threw immediately, and initialQuery only seeds state on
first mount so it can't restore the query on a later re-render either.
Re-init in place instead, and restore the typed query by writing to
the (reused, same) input element directly.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@lessevv

lessevv commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

Docs search scope indicator — Algolia DocSearch silently filters results to the current platform/version; now shows that scope and offers one click to search everywhere.

I don't think this is working... is there something I need to do to test this out?

Had an issue to properly test it due to the Flux package, but deleted it and got it tested. Should work after the latest commit!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants