fix(docs): populate docs nav entries on login page#171
Merged
Conversation
- Pass DocsNavEntries into LoginPageProps so the navbar Docs dropdown renders on the public login page - Use NavbarDocsEntriesFor with the resolved locale so the dropdown respects the docs_lang cookie and Accept-Language header - Covers the initial login render and both error re-renders (invalid credentials, session save failure) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes the unauthenticated /login navbar “Docs” dropdown being empty by ensuring templates.LoginPageProps includes localized NavbarProps.DocsNavEntries, consistent with other pages that use buildNavbarProps.
Changes:
- Populate
templates.LoginPageProps.NavbarProps.DocsNavEntriesduring the initial/loginrender. - Populate
DocsNavEntriesfor the invalid-credentials re-render. - Populate
DocsNavEntriesfor the session-save-failure re-render (so the dropdown remains populated even on error paths), usingresolveLocale(c).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
101
to
+105
| templates.RenderTempl(c, http.StatusOK, templates.LoginPage(templates.LoginPageProps{ | ||
| BaseProps: templates.BaseProps{CSRFToken: middleware.GetCSRFToken(c)}, | ||
| BaseProps: templates.BaseProps{CSRFToken: middleware.GetCSRFToken(c)}, | ||
| NavbarProps: templates.NavbarProps{ | ||
| DocsNavEntries: NavbarDocsEntriesFor(resolveLocale(c)), | ||
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/login. After4dbe23dthe dropdown is driven byNavbarProps.DocsNavEntries, butLoginPagePropswas constructed directly (bypassingbuildNavbarProps), so the field stayed at its zero value.DocsNavEntriesviaNavbarDocsEntriesFor(resolveLocale(c))at all threeLoginPagePropsconstruction sites (initial render, invalid-credentials re-render, session-save failure re-render), so the dropdown also honorsdocs_lang/Accept-Language.Test plan
make generate && make buildsucceedsmake fmt && make lintcleango test ./internal/handlers/...passes/loginwhile logged out → navbar Docs dropdown lists all 8 entriesdocs_lang=zh-TW, reload/login→ dropdown shows Traditional Chinese titles/account/sessions) still render the dropdown correctly🤖 Generated with Claude Code