Skip to content

feat(nav): render Preview badges consistently#721

Open
qiancai wants to merge 6 commits into
pingcap:masterfrom
qiancai:show-preview-in-toc-entries
Open

feat(nav): render Preview badges consistently#721
qiancai wants to merge 6 commits into
pingcap:masterfrom
qiancai:show-preview-in-toc-entries

Conversation

@qiancai

@qiancai qiancai commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

Purpose

Render PREVIEW labels consistently across documentation navigation, including TOC image tags and the TiDB for AI left navigation title, using the existing neutral, localized Preview badge style.

Scope

  • Detect PREVIEW TOC tags case-insensitively and render a fixed neutral badge style.
  • Reuse the existing PreviewBadge for the TiDB for AI directory title.
  • Remove the now-unused BetaTagBadge component and Beta locale entries.
  • Preserve the generic BETA and custom tag color behavior for TOC compatibility.
  • Avoid generating a ?undefined tag query for TOC image URLs without query parameters.
  • Add TOC parser coverage for image tags with and without query parameters or alt text.

Validation

  • Prettier checks for updated components, parser, tests, and locale files.
  • JSON parsing for English, Chinese, and Japanese locale files.
  • Runtime assertion that TiDB for AI uses the shared PreviewBadge and preview translation key.
  • Jest coverage for the TOC tag parser and existing TOC namespace behavior.

Notes

PREVIEW TOC tags intentionally ignore a source color query parameter so their badge appearance remains consistent.

@vercel

vercel Bot commented Jul 10, 2026

Copy link
Copy Markdown

@qiancai is attempting to deploy a commit to the test-vi Team on Vercel.

A member of the Team first needs to authorize it.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request fixes an issue where TOC images without query parameters would emit a bogus ?undefined query, adds corresponding unit tests, and introduces translation support for the 'PREVIEW' badge in the left navigation tree. The review feedback focuses on improving type safety by avoiding unsafe non-null assertions on image.alt, and optimizing the LeftNavTree component by leveraging MUI's built-in theme resolution for custom palette colors, which simplifies the generateItemLabel function signature and prevents potential runtime errors.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread gatsby/toc.ts Outdated
Comment thread src/components/Layout/LeftNav/LeftNavTree.tsx
Comment thread src/components/Layout/LeftNav/LeftNavTree.tsx Outdated
Comment thread src/components/Layout/LeftNav/LeftNavTree.tsx Outdated
qiancai added 2 commits July 10, 2026 15:54
Avoid creating invalid navigation tags for TOC images without alt text.\n\nAddresses review comments #3557222898 and #3557222909.
Reuse the shared Preview badge for the TiDB for AI left navigation title and remove the now-unused Beta badge component and translations.
@qiancai qiancai changed the title feat(left-nav): render Preview TOC badges feat(nav): render Preview badges consistently Jul 10, 2026
qiancai added 2 commits July 10, 2026 17:07
Share one PreviewBadge component between directory titles and TOC entries so their visual treatment stays identical.
Remove the unintended flexShrink override from the shared badge and resolve the Preview translation once per left-nav render.
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.

1 participant