Conversation
…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.
- 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.
- Changed the text color in the RightNav component from carbon[600] to carbon[700] to enhance readability and visual contrast.
- Updated the RightNav component to only display the Table of Contents (TOC) when it contains items, improving layout and preventing unnecessary empty space.
- Introduced a new header height management system with constants for different header states, improving layout consistency across components. - Updated the Header, LeftNav, RightNav, and various templates to utilize the new header height logic, ensuring proper spacing based on banner visibility. - Added a language switcher option in the HeaderAction component, allowing for better localization support. - Adjusted styles in typography to align with the new header heights, enhancing overall visual coherence.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Summary of ChangesHello @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 focuses on a significant restructuring of the website's layout and navigation components, aiming to enhance modularity and maintainability. It introduces a dynamic header height mechanism to ensure consistent visual alignment for sticky elements, improving overall layout responsiveness. Additionally, new interactive actions are now seamlessly integrated into documentation pages, offering users convenient options for contributing, viewing content in different formats, and downloading resources. Highlights
🧠 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 AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
This pull request introduces a significant and positive restructuring of the application's layout components. Key improvements include centralizing header height management into a dedicated shared/headerHeight.ts file, refactoring the main header into a two-row layout, and introducing a new TitleAction component to group page-related actions under the main title. These changes enhance code quality, maintainability, and user experience. I have a few minor suggestions to further improve the implementation.
src/components/MDXContent.tsx
Outdated
| {...props} | ||
| /> | ||
| ), | ||
| [pathConfig, filePath, pageUrl] |
There was a problem hiding this comment.
The dependency array for this useCallback is missing buildType and language. Since these props are passed down to the H1 component and used in its logic, they should be included in the dependency array to prevent stale closures if they ever change during the component's lifecycle.
| [pathConfig, filePath, pageUrl] | |
| [pathConfig, filePath, pageUrl, buildType, language] |
| setTimeout(() => { | ||
| // Observe all heading elements | ||
| headingIds.forEach((id) => { | ||
| const element = document.getElementById(id); | ||
| if (element) { | ||
| observer.observe(element); | ||
| } | ||
| }); | ||
| }, 1000); |
There was a problem hiding this comment.
Using a fixed setTimeout of 1000ms can be brittle, as it assumes the page will always render within that time. On slower devices or connections, this might not be enough time, causing the IntersectionObserver to miss elements.
Consider adding a comment to explain why this delay is necessary. For a more robust solution, you could explore using requestAnimationFrame or checking for the existence of the last element in headingIds before setting up the observers.
| height: "20px !important", | ||
| backgroundColor: `${theme.palette.carbon[400]} !important`, |
There was a problem hiding this comment.
The use of !important here should be avoided if possible, as it can make styles difficult to override and debug later. It's better to rely on CSS specificity. Have you tried removing !important to see if the styles are still applied correctly? MUI's sx prop usually has high enough specificity.
| height: "20px !important", | |
| backgroundColor: `${theme.palette.carbon[400]} !important`, | |
| height: "20px", | |
| backgroundColor: `${theme.palette.carbon[400]}`, |
…lity - Introduced HeaderAction, HeaderNav, and LangSwitch components to improve the header layout and user experience. - Implemented a TiDB AI button in HeaderAction for enhanced interactivity. - Added mobile and desktop navigation stacks in HeaderNav for better accessibility. - Integrated a language switcher in LangSwitch to support multiple locales. - Updated the theme with a color adjustment for improved visual consistency.
- Simplified HeaderAction by consolidating search and action button elements for improved layout. - Updated HeaderNav to remove unused imports and commented-out code, streamlining the component. - Added new HeaderNavMobile component for better mobile navigation experience. - Adjusted spacing and styles in various components for consistency and improved usability. - Enhanced LangSwitch with clearer language labels and updated button styles. - Increased search input width and height for better accessibility.
- Moved getPageType and PageType type definitions from shared/utils to shared/getPageType for better modularity. - Updated imports across various components to reflect the new location of getPageType, ensuring consistent usage throughout the codebase. - Cleaned up unused imports in several components, enhancing overall code clarity and maintainability.
- Replaced instances of getPageType with the new usePageType hook across various components to enhance code consistency and maintainability. - Updated imports to reflect the new structure, ensuring all components utilize the updated page type logic. - Removed the deprecated getPageType utility, streamlining the codebase and improving clarity.
…omponents - Updated multiple components to use the new ChevronDownIcon for consistency in the UI. - Removed imports of the deprecated KeyboardArrowDownIcon, streamlining the codebase. - Added ChevronDownIcon SVG file to the media/icons directory for improved visual representation.
- Introduced a new navigation configuration system in HeaderNav, allowing for dynamic rendering of navigation items and groups based on conditions. - Added NavGroup and NavMenuItem components to improve the structure and maintainability of the navigation logic. - Implemented a default navigation configuration generator to streamline the setup of navigation items based on user cloud plans. - Updated imports and added new icons for improved visual representation in the navigation menu. - Cleaned up unused code and optimized component rendering for better performance.
- Added onSelectedNavItemChange prop to Header, HeaderNavStack, and LeftNav components to manage selected navigation items. - Implemented a recursive function to find and notify the selected navigation item in HeaderNavStack. - Updated LeftNavDesktop to display the selected navigation item with improved styling and interaction. - Integrated selectedNavItem state management in DocTemplate for better navigation context. - Adjusted styles in various components for consistency and improved user experience.
- Replaced ActionButton with Button in HeaderAction for consistency in component usage. - Added secondary color styling for outlined and contained button variants in the theme. - Adjusted button styles to enhance visual coherence and user experience across the application.
…sistency - Removed the custom ActionButton component and replaced it with the standard Button component from MUI. - Updated button styles to use the secondary color variant for improved visual consistency across the FeedbackSection. - Cleaned up imports by removing the unused ActionButton import, streamlining the codebase.
- Simplified the LangSwitch component by removing unnecessary padding and adjusting the end icon styling. - Updated the theme to ensure consistent margin settings for button icons, enhancing overall button appearance across the application.
- Streamlined Box component styles in NavGroup by removing unnecessary sx prop and directly applying display, flexDirection, and gap properties. - Enhanced the layout of child components for better visual consistency and maintainability.
…nd scroll position - Removed custom StyledTreeItem in favor of MUI's TreeItem for consistency. - Implemented session storage handling for expanded tree nodes and scroll position restoration. - Updated theme styles for TreeItem to improve visual consistency and user experience. - Cleaned up unused imports and streamlined component logic for better maintainability.
…ement - Added clearAllNavStates function to clear session storage for navigation states across components. - Integrated clearAllNavStates in NavMenuItem and NavButton click handlers to ensure consistent navigation behavior. - Updated LeftNav component to utilize clearAllNavStates on item selection for improved user experience.
- Updated gatsby-config.js and documentation to incorporate the 'ai' namespace in URL mappings for better organization of AI-related content. - Enhanced link resolver and URL resolver configurations to support the new 'ai' folder, ensuring consistent URL structure across namespaces. - Added tests to validate the resolution of links and URLs for the 'ai' namespace, improving overall test coverage and reliability.
- Updated the subproject commit reference in the documentation to reflect the latest changes in the associated submodule, ensuring accurate linkage and versioning.
…espace enumeration - Introduced a new navigation item for the AI section in the header. - Updated the TOCNamespace enum and slug mapping to include the AI namespace, enhancing content organization and accessibility.
- Modified the README to change the mapping reference from 'develop/best-practices/api/releases' to 'ai/develop/best-practices/api/releases', ensuring accurate documentation of the URL resolution tests for the AI namespace.
…of nested tab structures - Updated the tab extraction logic to support nested tab elements and wrappers like <CustomContent>. - Refactored the component to use clearer type definitions and improve readability. - Preserved original top-level nodes for rendering, ensuring proper display of tab content.
- Introduced a new namespace rule for the AI section, specifying the repository, branch, folder, and minimum REST length for proper namespace matching in the table of contents.
…oss multiple languages - Expanded translation files for English, Japanese, and Chinese to include new terms related to product features, deployment options, and release information. - Added entries for "Product", "AI", "Developer", "Best Practices", "API", and various TiDB Cloud offerings to enhance localization support.
- Introduced a new optional property `leftNavLabel` to the `NavItemConfig` interface for displaying an alias label in the left navigation. - Updated the `LeftNavDesktop` component to utilize `leftNavLabel` when rendering navigation items, enhancing the display and organization of navigation elements.
…n support and new preview badge - Updated navigation configuration to utilize translation functions for labels and titles, improving localization. - Added a new `PreviewBadge` component to display a preview label for specific navigation items, enhancing visual clarity. - Refactored the `getDefaultNavConfig` function to accept a translation function as a parameter, streamlining the integration of localized text.
…gation and enhance version selection - Added a `LeftNavStickyContainer` component to improve the layout of the left navigation by making it sticky. - Updated the `LeftNavDesktop` component to utilize the new sticky container for better visual organization. - Enhanced the `VersionSelectButton` to accept a `disableStickyContainer` prop, allowing for flexible layout options. - Refactored the `CloudVersionSelect` and `VersionSelect` components to support the new prop, ensuring consistent behavior across version selection elements.
- Added a new `toc-ignore.ts` file to define rules for ignoring specific TOC files during the build process. - Introduced the `isIgnoredTocRelativePath` function to check if a given relative path should be ignored based on predefined substrings and environment variables. - Updated the `getFilesFromTocs` function in `toc-filter.ts` to utilize the new ignore logic, enhancing filtering capabilities. - Created unit tests in `toc-filter.test.ts` to validate the ignore rules and ensure correct functionality.
Uh oh!
There was an error while loading. Please reload this page.