Wangbo 1 month ago
parent
commit
314fad2799

+ 2 - 52
app/components/header/account-dropdown/index.tsx

@@ -103,7 +103,7 @@ export default function AppSelector({ isMobile }: IAppSelector) {
                     </div>
                   </Menu.Item>
                   <div className='px-1 py-1'>
-                    <div className='mt-2 px-3 text-xs font-medium text-gray-500'>{t('common.userProfile.workspace')}</div>
+                    {/* <div className='mt-2 px-3 text-xs font-medium text-gray-500'>{t('common.userProfile.workspace')}</div> */}
                     <WorkplaceSelector />
                   </div>
                   <div className="px-1 py-1">
@@ -130,57 +130,7 @@ export default function AppSelector({ isMobile }: IAppSelector) {
                         <ArrowUpRight className='hidden w-[14px] h-[14px] text-gray-500 group-hover:flex' />
                       </a>
                     </Menu.Item>}
-                    <Menu.Item>
-                      <Link
-                        className={classNames(itemClassName, 'group justify-between')}
-                        href='https://github.com/langgenius/dify/discussions/categories/feedbacks'
-                        target='_blank' rel='noopener noreferrer'>
-                        <div>{t('common.userProfile.communityFeedback')}</div>
-                        <ArrowUpRight className='hidden w-[14px] h-[14px] text-gray-500 group-hover:flex' />
-                      </Link>
-                    </Menu.Item>
-                    <Menu.Item>
-                      <Link
-                        className={classNames(itemClassName, 'group justify-between')}
-                        href='https://discord.gg/5AEfbxcd9k'
-                        target='_blank' rel='noopener noreferrer'>
-                        <div>{t('common.userProfile.community')}</div>
-                        <ArrowUpRight className='hidden w-[14px] h-[14px] text-gray-500 group-hover:flex' />
-                      </Link>
-                    </Menu.Item>
-                    <Menu.Item>
-                      <Link
-                        className={classNames(itemClassName, 'group justify-between')}
-                        href={
-                          locale !== LanguagesSupported[1] ? 'https://docs.dify.ai/' : `https://docs.dify.ai/v/${locale.toLowerCase()}/`
-                        }
-                        target='_blank' rel='noopener noreferrer'>
-                        <div>{t('common.userProfile.helpCenter')}</div>
-                        <ArrowUpRight className='hidden w-[14px] h-[14px] text-gray-500 group-hover:flex' />
-                      </Link>
-                    </Menu.Item>
-                    <Menu.Item>
-                      <Link
-                        className={classNames(itemClassName, 'group justify-between')}
-                        href='https://roadmap.dify.ai'
-                        target='_blank' rel='noopener noreferrer'>
-                        <div>{t('common.userProfile.roadmap')}</div>
-                        <ArrowUpRight className='hidden w-[14px] h-[14px] text-gray-500 group-hover:flex' />
-                      </Link>
-                    </Menu.Item>
-                    {
-                      document?.body?.getAttribute('data-public-site-about') !== 'hide' && (
-                        <Menu.Item>
-                          <div className={classNames(itemClassName, 'justify-between')} onClick={() => setAboutVisible(true)}>
-                            <div>{t('common.userProfile.about')}</div>
-                            <div className='flex items-center'>
-                              <div className='mr-2 text-xs font-normal text-gray-500'>{langeniusVersionInfo.current_version}</div>
-                              <Indicator color={langeniusVersionInfo.current_version === langeniusVersionInfo.latest_version ? 'green' : 'orange'} />
-                            </div>
-                          </div>
-                        </Menu.Item>
-                      )
-                    }
+                    
                   </div>
                   <Menu.Item>
                     <div className='p-1' onClick={() => handleLogout()}>

+ 5 - 4
app/components/header/app-nav/index.tsx

@@ -7,8 +7,8 @@ import useSWRInfinite from 'swr/infinite'
 import { flatten } from 'lodash-es'
 import produce from 'immer'
 import {
-  RiRobot2Fill,
-  RiRobot2Line,
+  RiInbox2Fill,
+  RiInbox2Line,
 } from '@remixicon/react'
 import Nav from '../nav'
 import { type NavItem } from '../nav/nav-selector'
@@ -115,10 +115,11 @@ const AppNav = () => {
 
   return (
     <>
+    {/* 工作室 */}
       <Nav
         isApp
-        icon={<RiRobot2Line className='w-4 h-4' />}
-        activeIcon={<RiRobot2Fill className='w-4 h-4' />}
+        icon={<RiInbox2Fill className='w-4 h-4' />}
+        activeIcon={<RiInbox2Line className='w-4 h-4' />}
         text={t('common.menus.apps')}
         activeSegment={['apps', 'app']}
         link='/apps'

+ 4 - 4
app/components/header/dataset-nav/index.tsx

@@ -4,8 +4,8 @@ import { useCallback } from 'react'
 import { useTranslation } from 'react-i18next'
 import { useParams, useRouter } from 'next/navigation'
 import {
-  RiBook2Fill,
-  RiBook2Line,
+  RiBookFill,
+  RiBookLine,
 } from '@remixicon/react'
 import useSWR from 'swr'
 import useSWRInfinite from 'swr/infinite'
@@ -42,8 +42,8 @@ const DatasetNav = () => {
 
   return (
     <Nav
-      icon={<RiBook2Line className='w-4 h-4' />}
-      activeIcon={<RiBook2Fill className='w-4 h-4' />}
+      icon={<RiBookFill className='w-4 h-4' />}
+      activeIcon={<RiBookLine className='w-4 h-4' />}
       text={t('common.menus.datasets')}
       activeSegment='datasets'
       link='/datasets'

+ 1 - 0
app/components/header/env-nav/index.tsx

@@ -19,6 +19,7 @@ const EnvNav = () => {
     return null
 
   return (
+    //开发环境
     <div className={`
       flex items-center h-[22px] mr-4 rounded-md px-2 text-xs font-medium border
       ${headerEnvClassName[langeniusVersionInfo.current_env]}

+ 17 - 0
app/components/header/explore-nav/index.tsx

@@ -1,38 +1,55 @@
 'use client'
 
+// 引入react-i18next库,用于翻译
 import { useTranslation } from 'react-i18next'
+// 引入Link组件,用于页面跳转
 import Link from 'next/link'
+// 引入next/navigation库,用于获取当前选中的布局片段
 import { useSelectedLayoutSegment } from 'next/navigation'
+// 引入RiPlanetFill和RiPlanetLine图标
 import {
   RiPlanetFill,
   RiPlanetLine,
 } from '@remixicon/react'
+// 引入classNames函数,用于处理类名
 import classNames from '@/utils/classnames'
+
+// 定义ExploreNav组件的props类型
 type ExploreNavProps = {
   className?: string
 }
 
+// 定义ExploreNav组件
 const ExploreNav = ({
   className,
 }: ExploreNavProps) => {
+  // 使用useTranslation钩子,获取翻译函数t
   const { t } = useTranslation()
+  // 使用useSelectedLayoutSegment钩子,获取当前选中的布局片段
   const selectedSegment = useSelectedLayoutSegment()
+  // 判断当前选中的布局片段是否为explore
   const activated = selectedSegment === 'explore'
 
+  // 返回Link组件,用于页面跳转
   return (
     <Link href="/explore/apps" className={classNames(
       className, 'group',
+      // 如果当前选中的布局片段为explore,则添加bg-components-main-nav-nav-button-bg-active和shadow-md类名
       activated && 'bg-components-main-nav-nav-button-bg-active shadow-md',
+      // 如果当前选中的布局片段为explore,则添加text-components-main-nav-nav-button-text-active类名,否则添加text-components-main-nav-nav-button-text和hover:bg-components-main-nav-nav-button-bg-hover类名
       activated ? 'text-components-main-nav-nav-button-text-active' : 'text-components-main-nav-nav-button-text hover:bg-components-main-nav-nav-button-bg-hover',
     )}>
       {
+        // 如果当前选中的布局片段为explore,则显示RiPlanetFill图标,否则显示RiPlanetLine图标
         activated
           ? <RiPlanetFill className='mr-2 w-4 h-4' />
           : <RiPlanetLine className='mr-2 w-4 h-4' />
       }
+      {/* // 显示翻译后的文本 */}
       {t('common.menus.explore')}
     </Link>
   )
 }
 
+// 导出ExploreNav组件
 export default ExploreNav

+ 7 - 2
app/components/header/header-wrapper.tsx

@@ -11,10 +11,15 @@ const HeaderWrapper = ({
   children,
 }: HeaderWrapperProps) => {
   const pathname = usePathname()
-  const isBordered = ['/apps', '/datasets', '/datasets/create', '/tools', '/account'].includes(pathname)
+  const isBordered = ['/apps', '/datasets','/datasets', '/datasets/create', '/tools', '/account'].includes(pathname)
 
   return (
-    <div className={classNames(
+    <div 
+    // style={{
+    //   background:'#fff'
+    // }
+    // }
+    className={classNames(
       'sticky top-0 left-0 right-0 z-30 flex flex-col grow-0 shrink-0 basis-auto min-h-[56px]',
       s.header,
       isBordered ? 'border-b border-gray-200' : '',

+ 9 - 4
app/components/header/index.tsx

@@ -9,6 +9,7 @@ import HeaderBillingBtn from '../billing/header-billing-btn'
 import AccountDropdown from './account-dropdown'
 import AppNav from './app-nav'
 import DatasetNav from './dataset-nav'
+import DatabaseNav from './database-nav'
 import EnvNav from './env-nav'
 import ExploreNav from './explore-nav'
 import ToolsNav from './tools-nav'
@@ -50,6 +51,7 @@ const Header = () => {
     // eslint-disable-next-line react-hooks/exhaustive-deps
   }, [selectedSegment])
   return (
+    //首页顶部导航栏nav 云脑
     <div className='flex flex-1 items-center justify-between px-4'>
       <div className='flex items-center'>
         {isMobile && <div
@@ -75,10 +77,12 @@ const Header = () => {
       )}
       {!isMobile && (
         <div className='flex items-center'>
-          {!isCurrentWorkspaceDatasetOperator && <ExploreNav className={navClassName} />}
+          {/* {!isCurrentWorkspaceDatasetOperator && <ExploreNav className={navClassName} />} */}
+          {/* 工作室nav */}
           {!isCurrentWorkspaceDatasetOperator && <AppNav />}
+          {(isCurrentWorkspaceEditor || isCurrentWorkspaceDatasetOperator) && <DatabaseNav />}
           {(isCurrentWorkspaceEditor || isCurrentWorkspaceDatasetOperator) && <DatasetNav />}
-          {!isCurrentWorkspaceDatasetOperator && <ToolsNav className={navClassName} />}
+          {/* {!isCurrentWorkspaceDatasetOperator && <ToolsNav className={navClassName} />} */}
         </div>
       )}
       <div className='flex items-center flex-shrink-0'>
@@ -95,10 +99,11 @@ const Header = () => {
       </div>
       {(isMobile && isShowNavMenu) && (
         <div className='w-full flex flex-col p-2 gap-y-1'>
-          {!isCurrentWorkspaceDatasetOperator && <ExploreNav className={navClassName} />}
+          {/* {!isCurrentWorkspaceDatasetOperator && <ExploreNav className={navClassName} />} */}
           {!isCurrentWorkspaceDatasetOperator && <AppNav />}
+          {(isCurrentWorkspaceEditor || isCurrentWorkspaceDatasetOperator) && <DatabaseNav />}
           {(isCurrentWorkspaceEditor || isCurrentWorkspaceDatasetOperator) && <DatasetNav />}
-          {!isCurrentWorkspaceDatasetOperator && <ToolsNav className={navClassName} />}
+          {/* {!isCurrentWorkspaceDatasetOperator && <ToolsNav className={navClassName} />} */}
         </div>
       )}
     </div>