Skip to content

Conversation

@shhdgit
Copy link
Member

@shhdgit shhdgit commented Dec 18, 2025

…gation

  • Introduced LeftNavDesktop and LeftNavMobile components to enhance the layout and navigation experience.
  • Added RightNav and RightNavMobile components for better accessibility and organization of content.
  • Integrated a new H1 component with TitleAction for enhanced header functionality.
  • Updated translation strings and styles for consistency across the application.
  • Removed the deprecated Contributors component to streamline the codebase.

…gation

- Introduced LeftNavDesktop and LeftNavMobile components to enhance the layout and navigation experience.
- Added RightNav and RightNavMobile components for better accessibility and organization of content.
- Integrated a new H1 component with TitleAction for enhanced header functionality.
- Updated translation strings and styles for consistency across the application.
- Removed the deprecated Contributors component to streamline the codebase.
@vercel
Copy link

vercel bot commented Dec 18, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
website-docs Ready Ready Preview, Comment Dec 19, 2025 6:18am

@gemini-code-assist
Copy link

Summary of Changes

Hello @shhdgit, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly refactors and enhances the application's navigation and content presentation. It introduces a modular approach to navigation with dedicated desktop and mobile components for both left and right navigation panels. A new H1 component now provides contextual actions for documentation pages, improving user interaction. Concurrently, the change removes an outdated Contributors component and updates styling and translation for a more cohesive user experience.

Highlights

  • New Navigation Components: Introduced LeftNavDesktop, LeftNavMobile, RightNav, and RightNavMobile components to modernize and improve the application's navigation system, including a new RightNav with Intersection Observer for active heading tracking.
  • Enhanced Header Functionality: Implemented a new H1 component that integrates a TitleAction component, providing quick access to actions like 'Contribute', 'Copy Markdown for LLM', 'View as Markdown', and 'Download PDF' directly below the main page title.
  • Codebase Streamlining: Removed the deprecated Contributors component, simplifying the codebase and removing its associated functionality.
  • Translation and Style Updates: Updated translation strings (specifically 'doc.toc') and refined theme color values for consistency across the application's UI.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

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

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 introduces significant improvements to the site's navigation by implementing new LeftNav and RightNav components, and enhances the page header with a new TitleAction component. The removal of the deprecated Contributors component is a good cleanup.

My review focuses on the new components. I've found a critical issue in RightNav.tsx related to an invalid hook call that will cause a runtime error. I've also identified a few areas for improvement, such as a missing "Edit this page" feature which was a regression, and some missing dependencies in React hooks.

Overall, this is a great feature addition. Please address the comments to ensure the new components are robust and error-free.

Comment on lines +132 to +182
const generateToc = (items: TableOfContent[], level = 0, activeId = "") => {
const theme = useTheme();

return (
<Typography
component="ul"
sx={{
listStyle: "none",
padding: 0,
}}
>
{items.map((item) => {
const { url, title, items } = item;
const { label: newLabel, anchor: newAnchor } = transformCustomId(
title,
url
);
const itemId = url?.replace(/^#/, "") || "";
const isActive = itemId && itemId === activeId;

return (
<Typography key={`${level}-${item.title}`} component="li">
<Typography
component="a"
href={newAnchor?.replace(sliceVersionMark, "")}
sx={{
display: "flex",
textDecoration: "none",
fontSize: "14px",
lineHeight: "1.25rem",
borderLeft: `1px solid transparent`,
paddingLeft: `${0.5 + 1 * level}rem`,
paddingTop: "0.25rem",
paddingBottom: "0.25rem",
fontWeight: isActive ? "700" : "400",
color: isActive ? theme.palette.website.f1 : "inherit",
"&:hover": {
color: theme.palette.website.f3,
borderLeft: `1px solid ${theme.palette.website.f3}`,
},
}}
>
{removeHtmlTag(newLabel)}
</Typography>
{items && generateToc(items, level + 1, activeId)}
</Typography>
);
})}
</Typography>
);
};

Choose a reason for hiding this comment

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

critical

The useTheme hook is being called inside generateToc, which is a regular JavaScript function, not a React component or a custom hook. This will cause a runtime error.

To fix this, generateToc should be refactored into a proper React component. Please replace the generateToc function with the TocItems component I've suggested below. After that, you'll need to update line 125 to call <TocItems items={toc} activeId={activeId} /> instead of generateToc(...).

const TocItems = ({
  items,
  level = 0,
  activeId = "",
}: {
  items: TableOfContent[];
  level?: number;
  activeId?: string;
}) => {
  const theme = useTheme();

  return (
    <Typography
      component="ul"
      sx={{
        listStyle: "none",
        padding: 0,
      }}
    >
      {items.map((item, index) => {
        const { url, title, items: children } = item;
        const { label: newLabel, anchor: newAnchor } = transformCustomId(
          title,
          url
        );
        const itemId = url?.replace(/^#/, "") || "";
        const isActive = itemId && itemId === activeId;

        return (
          <Typography key={`${level}-${item.title}-${index}`} component="li">
            <Typography
              component="a"
              href={newAnchor?.replace(sliceVersionMark, "")}
              sx={{
                display: "flex",
                textDecoration: "none",
                fontSize: "14px",
                lineHeight: "1.25rem",
                borderLeft: `1px solid transparent`,
                paddingLeft: `${0.5 + 1 * level}rem`,
                paddingTop: "0.25rem",
                paddingBottom: "0.25rem",
                fontWeight: isActive ? "700" : "400",
                color: isActive ? theme.palette.website.f1 : "inherit",
                "&:hover": {
                  color: theme.palette.website.f3,
                  borderLeft: `1px solid ${theme.palette.website.f3}`,
                },
              }}
            >
              {removeHtmlTag(newLabel)}
            </Typography>
            {children && (
              <TocItems items={children} level={level + 1} activeId={activeId} />
            )}
          </Typography>
        );
      })}
    </Typography>
  );
};

Comment on lines +173 to +189
{feedbackUrl && (
<MenuItem
component="a"
href={feedbackUrl}
target="_blank"
rel="noreferrer"
onClick={handleContributeClose}
disableRipple
sx={{
textDecoration: "none",
}}
>
<Typography component="span" color={theme.palette.carbon[900]}>
{t("doc.feedback")}
</Typography>
</MenuItem>
)}

Choose a reason for hiding this comment

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

medium

This "Contribute" menu is missing the "Edit this page" option, which was available in the previous implementation for dev branches. This is a useful feature for contributors and its removal seems like a regression. Please consider adding it back to the menu. I've also included the logic to generate the edit URL.

            {pathConfig.version === "dev" && (
              <MenuItem
                component="a"
                href={`https://github.com/${getRepoFromPathCfg(
                  pathConfig
                )}/edit/${pathConfig.branch}/${filePath}`}
                target="_blank"
                rel="noreferrer"
                onClick={handleContributeClose}
                disableRipple
                sx={{
                  textDecoration: "none",
                }}
              >
                <Typography component="span" color={theme.palette.carbon[900]}>
                  {t("doc.improve")}
                </Typography>
              </MenuItem>
            )}
            {feedbackUrl && (
              <MenuItem
                component="a"
                href={feedbackUrl}
                target="_blank"
                rel="noreferrer"
                onClick={handleContributeClose}
                disableRipple
                sx={{
                  textDecoration: "none",
                }}
              >
                <Typography component="span" color={theme.palette.carbon[900]}>
                  {t("doc.feedback")}
                </Typography>
              </MenuItem>
            )}

Comment on lines +73 to +81
setTimeout(() => {
// Observe all heading elements
headingIds.forEach((id) => {
const element = document.getElementById(id);
if (element) {
observer.observe(element);
}
});
}, 1000);

Choose a reason for hiding this comment

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

low

The setTimeout with a 1000ms delay is a "magic number" and might be brittle, as it's not guaranteed that the elements will be ready after exactly 1 second on all connections or devices. Consider adding a comment to explain why this delay is necessary (e.g., waiting for MDX content to render) for future maintainability.

Comment on lines +184 to +185
export function RightNavMobile(props: RightNavProps) {
const { toc = [], pathConfig, filePath, buildType } = props;

Choose a reason for hiding this comment

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

low

The RightNavMobile component receives pathConfig, filePath, and buildType as props, but they are not used. These unused props should be removed to keep the component signature clean. You'll also need to remove them from the call site in src/templates/DocTemplate.tsx.

export function RightNavMobile(props: { toc?: TableOfContent[] }) {
  const { toc = [] } = props;

Comment on lines +242 to +265
{generateMobileTocList(toc).map((item) => {
return (
<MenuItem
key={`${item.depth}-${item.label}`}
onClick={handleClose}
dense
sx={{
width: "calc(100vw - 2rem)",
}}
>
<Typography
component="a"
href={item.anchor}
sx={{
width: "100%",
textDecoration: "none",
paddingLeft: `${0.5 + 1 * item.depth}rem`,
}}
>
{item.label}
</Typography>
</MenuItem>
);
})}

Choose a reason for hiding this comment

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

low

The key for this MenuItem is ${item.depth}-${item.label}. If there are multiple items with the same label at the same depth, this will result in non-unique keys, which can cause rendering issues in React. Using the index from the map function would guarantee uniqueness.

        {generateMobileTocList(toc).map((item, index) => {
          return (
            <MenuItem
              key={`${item.depth}-${item.label}-${index}`}
              onClick={handleClose}
              dense
              sx={{
                width: "calc(100vw - 2rem)",
              }}
            >
              <Typography
                component="a"
                href={item.anchor}
                sx={{
                  width: "100%",
                  textDecoration: "none",
                  paddingLeft: `${0.5 + 1 * item.depth}rem`,
                }}
              >
                {item.label}
              </Typography>
            </MenuItem>
          );
        })}

Comment on lines +40 to +43
const pageType = React.useMemo(
() => getPageType(language, pageUrl),
[pageUrl]
);

Choose a reason for hiding this comment

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

low

The useMemo hook for calculating pageType uses the language variable, but it's missing from the dependency array. This could lead to stale data if the language changes.

Suggested change
const pageType = React.useMemo(
() => getPageType(language, pageUrl),
[pageUrl]
);
const pageType = React.useMemo(
() => getPageType(language, pageUrl),
[language, pageUrl]
);

Comment on lines +59 to +71
const H1WithProps = React.useCallback(
(props: { children: React.ReactNode }) => (
<H1
pathConfig={pathConfig}
filePath={filePath}
pageUrl={pageUrl}
buildType={buildType}
language={language}
{...props}
/>
),
[pathConfig, filePath, pageUrl]
);

Choose a reason for hiding this comment

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

low

The useCallback hook for H1WithProps is missing buildType and language in its dependency array. These props are passed to the H1 component inside the callback, so they should be included to ensure the callback is updated when they change.

Suggested change
const H1WithProps = React.useCallback(
(props: { children: React.ReactNode }) => (
<H1
pathConfig={pathConfig}
filePath={filePath}
pageUrl={pageUrl}
buildType={buildType}
language={language}
{...props}
/>
),
[pathConfig, filePath, pageUrl]
);
const H1WithProps = React.useCallback(
(props: { children: React.ReactNode }) => (
<H1
pathConfig={pathConfig}
filePath={filePath}
pageUrl={pageUrl}
buildType={buildType}
language={language}
{...props}
/>
),
[pathConfig, filePath, pageUrl, buildType, language]
);

- Introduced a new feature that generates a GitHub edit link for the current document, allowing users to easily contribute improvements.
- The link is conditionally rendered based on the presence of pathConfig and filePath, enhancing user engagement with documentation.
- Changed the feedback string from "Request docs changes" to "Report a doc issue" in both English and Japanese translation files for improved clarity and user understanding.
- Added flexWrap property to the TitleAction component to enhance layout responsiveness.
- Changed button text from "Copy Markdown for LLM" to "Copy for LLM" for brevity and clarity.
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