This is an automated email from the ASF dual-hosted git repository.

morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris-website.git


The following commit(s) were added to refs/heads/master by this push:
     new 81266e3517a fix: fix docs sidebar version error (#1101)
81266e3517a is described below

commit 81266e3517adafb3793a41519f3fafc9549fef72
Author: Jeffrey <[email protected]>
AuthorDate: Thu Sep 12 18:46:20 2024 +0800

    fix: fix docs sidebar version error (#1101)
    
    # Versions
    
    fix: fix docs sidebar version error
    
    
    
![image](https://github.com/user-attachments/assets/eed7d50d-7de4-4abc-859d-917a7cdfea82)
    
    Co-authored-by: jeffrey <[email protected]>
---
 src/theme/DocSidebar/Desktop/Content/index.js | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/theme/DocSidebar/Desktop/Content/index.js 
b/src/theme/DocSidebar/Desktop/Content/index.js
index 6c2c497be44..5bab7190870 100644
--- a/src/theme/DocSidebar/Desktop/Content/index.js
+++ b/src/theme/DocSidebar/Desktop/Content/index.js
@@ -8,6 +8,7 @@ import DownloadPdfActive from 
'@site/static/images/download-pdf-active.svg';
 import DocSidebarItems from '@theme/DocSidebarItems';
 import styles from './styles.module.css';
 import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
+// import { getLatestVersion } from '../../../../../docusaurus.config';
 // import { useActivePluginAndVersion } from 
'@docusaurus/plugin-content-docs/client';
 // import { useGlobalData } from '@docusaurus/useGlobalData';
 function useShowAnnouncementBar() {
@@ -30,19 +31,20 @@ export default function DocSidebarDesktopContent({ path, 
sidebar, className }) {
     const { siteConfig } = useDocusaurusContext()
     const [isDocs, setIsDocs] = useState(true)
     const [isEN, setIsEn] = useState(true)
-    const [showVersion, setShowVersion] =useState(false)
+    const [showVersion, setShowVersion] = useState(false)
     const [isHover, setIshover] = useState(false)
-    const [currentVersion, setCurrentVersion] = useState('3.0')
+    const DEFAULT_VERSION = '2.1';
+    const [currentVersion, setCurrentVersion] = useState(DEFAULT_VERSION);
     useEffect(() => {
         if (typeof window !== 'undefined') {
-            const tempPath = ['gettingStarted', 'benchmark', 'ecosystem', 
'faq', 'releasenotes','community'];
+            const tempPath = ['gettingStarted', 'benchmark', 'ecosystem', 
'faq', 'releasenotes', 'community'];
             const isShowVersion = tempPath.some(path => 
location.pathname.includes(path))
             const pathname = location.pathname.includes('zh-CN/docs') ? 
location.pathname.split('/')[2] : location.pathname.split('/')[1];
             const secPath = location.pathname.includes('zh-CN/docs') ? 
location.pathname.split('/')[3] : location.pathname.split('/')[2]
-            if (pathname === 'docs' && ['dev', '2.1', '2.0', 
'1.2'].includes(secPath)) {
-                setCurrentVersion(secPath)
+            if (pathname === 'docs' && ['dev', '3.0', '2.0', 
'1.2'].includes(secPath)) {
+                setCurrentVersion(secPath);
             } else {
-                setCurrentVersion('3.0')
+                setCurrentVersion(DEFAULT_VERSION);
             }
             setIsDocs(pathname === 'docs' ? true : false)
             setIsEn(location.pathname.includes('zh-CN') ? false : true)


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to