@ -1,7 +1,7 @@
import type { FC } from 'react'
import type { FC } from 'react'
import { useState } from 'react'
import { useState } from 'react'
import { useTranslation } from 'react-i18next'
import { useTranslation } from 'react-i18next'
import { use SelectedLayoutSegment, useRouter } from 'next/navigation'
import { use Router, use SelectedLayoutSegment } from 'next/navigation'
import classNames from 'classnames'
import classNames from 'classnames'
import { CircleStackIcon , PuzzlePieceIcon } from '@heroicons/react/24/outline'
import { CircleStackIcon , PuzzlePieceIcon } from '@heroicons/react/24/outline'
import { CommandLineIcon , Squares2X2Icon } from '@heroicons/react/24/solid'
import { CommandLineIcon , Squares2X2Icon } from '@heroicons/react/24/solid'
@ -15,9 +15,9 @@ import NewAppDialog from '@/app/(commonLayout)/apps/NewAppDialog'
import { WorkspaceProvider } from '@/context/workspace-context'
import { WorkspaceProvider } from '@/context/workspace-context'
import { useDatasetsContext } from '@/context/datasets-context'
import { useDatasetsContext } from '@/context/datasets-context'
const BuildAppsIcon = ( { isSelected } : { isSelected : boolean } ) = > (
const BuildAppsIcon = ( { isSelected } : { isSelected : boolean } ) = > (
< svg className = 'mr-1' width = "16" height = "16" viewBox = "0 0 16 16" fill = "none" xmlns = "http://www.w3.org/2000/svg" >
< svg className = 'mr-1' width = "16" height = "16" viewBox = "0 0 16 16" fill = "none" xmlns = "http://www.w3.org/2000/svg" >
< path d = "M13.6666 4.85221L7.99998 8.00036M7.99998 8.00036L2.33331 4.85221M7.99998 8.00036L8 14.3337M14 10.7061V5.29468C14 5.06625 14 4.95204 13.9663 4.85017C13.9366 4.76005 13.8879 4.67733 13.8236 4.60754C13.7509 4.52865 13.651 4.47318 13.4514 4.36224L8.51802 1.6215C8.32895 1.51646 8.23442 1.46395 8.1343 1.44336C8.0457 1.42513 7.95431 1.42513 7.8657 1.44336C7.76559 1.46395 7.67105 1.51646 7.48198 1.6215L2.54865 4.36225C2.34896 4.47318 2.24912 4.52865 2.17642 4.60754C2.11211 4.67733 2.06343 4.76005 2.03366 4.85017C2 4.95204 2 5.06625 2 5.29468V10.7061C2 10.9345 2 11.0487 2.03366 11.1506C2.06343 11.2407 2.11211 11.3234 2.17642 11.3932C2.24912 11.4721 2.34897 11.5276 2.54865 11.6385L7.48198 14.3793C7.67105 14.4843 7.76559 14.5368 7.8657 14.5574C7.95431 14.5756 8.0457 14.5756 8.1343 14.5574C8.23442 14.5368 8.32895 14.4843 8.51802 14.3793L13.4514 11.6385C13.651 11.5276 13.7509 11.4721 13.8236 11.3932C13.8879 11.3234 13.9366 11.2407 13.9663 11.1506C14 11.0487 14 10.9345 14 10.7061Z" stroke = { isSelected ? '#155EEF' : '#667085' } strokeWidth = "1.25" strokeLinecap = "round" strokeLinejoin = "round" / >
< path d = "M13.6666 4.85221L7.99998 8.00036M7.99998 8.00036L2.33331 4.85221M7.99998 8.00036L8 14.3337M14 10.7061V5.29468C14 5.06625 14 4.95204 13.9663 4.85017C13.9366 4.76005 13.8879 4.67733 13.8236 4.60754C13.7509 4.52865 13.651 4.47318 13.4514 4.36224L8.51802 1.6215C8.32895 1.51646 8.23442 1.46395 8.1343 1.44336C8.0457 1.42513 7.95431 1.42513 7.8657 1.44336C7.76559 1.46395 7.67105 1.51646 7.48198 1.6215L2.54865 4.36225C2.34896 4.47318 2.24912 4.52865 2.17642 4.60754C2.11211 4.67733 2.06343 4.76005 2.03366 4.85017C2 4.95204 2 5.06625 2 5.29468V10.7061C2 10.9345 2 11.0487 2.03366 11.1506C2.06343 11.2407 2.11211 11.3234 2.17642 11.3932C2.24912 11.4721 2.34897 11.5276 2.54865 11.6385L7.48198 14.3793C7.67105 14.4843 7.76559 14.5368 7.8657 14.5574C7.95431 14.5756 8.0457 14.5756 8.1343 14.5574C8.23442 14.5368 8.32895 14.4843 8.51802 14.3793L13.4514 11.6385C13.651 11.5276 13.7509 11.4721 13.8236 11.3932C13.8879 11.3234 13.9366 11.2407 13.9663 11.1506C14 11.0487 14 10.9345 14 10.7061Z" stroke = { isSelected ? '#155EEF' : '#667085' } strokeWidth = "1.25" strokeLinecap = "round" strokeLinejoin = "round" / >
< / svg >
< / svg >
)
)
@ -51,22 +51,22 @@ const Header: FC<IHeaderProps> = ({ appItems, curApp, userProfile, onLogout, lan
< div className = { classNames (
< div className = { classNames (
'sticky top-0 left-0 right-0 z-20 flex bg-gray-100 grow-0 shrink-0 basis-auto h-14' ,
'sticky top-0 left-0 right-0 z-20 flex bg-gray-100 grow-0 shrink-0 basis-auto h-14' ,
s . header ,
s . header ,
isBordered ? 'border-b border-gray-200' : ''
isBordered ? 'border-b border-gray-200' : '' ,
) } >
) } >
< div className = { classNames (
< div className = { classNames (
s [ ` header- ${ langeniusVersionInfo . current_env } ` ] ,
s [ ` header- ${ langeniusVersionInfo . current_env } ` ] ,
'flex flex-1 items-center justify-between px-4'
'flex flex-1 items-center justify-between px-4' ,
) } >
) } >
< div className = 'flex items-center' >
< div className = 'flex items-center' >
< Link href = "/apps" className = 'flex items-center mr-3' >
< Link href = "/apps" className = 'flex items-center mr-3' >
< div className = { s ['logo' ] } / >
< div className = { s .logo } / >
< / Link >
< / Link >
{ /* Add it when has many stars */ }
{ /* Add it when has many stars */ }
< div className = '
< div className = '
flex items - center h - [ 26 px ] px - 2 bg - white
flex items - center h - [ 26 px ] px - 2 bg - white
border border - solid border - [ # E5E7EB ] rounded - l - [ 6 px ] rounded - r - [ 6 px ]
border border - solid border - [ # E5E7EB ] rounded - l - [ 6 px ] rounded - r - [ 6 px ]
' >
' >
< div className = { s ['alpha' ] } / >
< div className = { s .alpha } / >
< div className = 'ml-1 text-xs font-semibold text-gray-700' > { t ( 'common.menus.status' ) } < / div >
< div className = 'ml-1 text-xs font-semibold text-gray-700' > { t ( 'common.menus.status' ) } < / div >
< / div >
< / div >
< / div >
< / div >
@ -74,7 +74,7 @@ const Header: FC<IHeaderProps> = ({ appItems, curApp, userProfile, onLogout, lan
< Link href = "/explore/apps" className = { classNames (
< Link href = "/explore/apps" className = { classNames (
navClassName , 'group' ,
navClassName , 'group' ,
isExplore && 'bg-white shadow-[0_2px_5px_-1px_rgba(0,0,0,0.05),0_2px_4px_-2px_rgba(0,0,0,0.05)]' ,
isExplore && 'bg-white shadow-[0_2px_5px_-1px_rgba(0,0,0,0.05),0_2px_4px_-2px_rgba(0,0,0,0.05)]' ,
isExplore ? 'text-primary-600' : 'text-gray-500 hover:bg-gray-200 hover:text-gray-700'
isExplore ? 'text-primary-600' : 'text-gray-500 hover:bg-gray-200 hover:text-gray-700' ,
) } >
) } >
< Squares2X2Icon className = 'mr-1 w-[18px] h-[18px]' / >
< Squares2X2Icon className = 'mr-1 w-[18px] h-[18px]' / >
{ t ( 'common.menus.explore' ) }
{ t ( 'common.menus.explore' ) }
@ -84,13 +84,13 @@ const Header: FC<IHeaderProps> = ({ appItems, curApp, userProfile, onLogout, lan
text = { t ( 'common.menus.apps' ) }
text = { t ( 'common.menus.apps' ) }
activeSegment = { [ 'apps' , 'app' ] }
activeSegment = { [ 'apps' , 'app' ] }
link = '/apps'
link = '/apps'
curNav = { curApp && { id : curApp.id , name : curApp.name , icon : curApp.icon , icon_background : curApp.icon_background } }
curNav = { curApp && { id : curApp.id , name : curApp.name , icon : curApp.icon , icon_background : curApp.icon_background } }
navs = { appItems . map ( item = > ( {
navs = { appItems . map ( item = > ( {
id : item.id ,
id : item.id ,
name : item.name ,
name : item.name ,
link : ` /app/ ${ item . id } /overview ` ,
link : ` /app/ ${ item . id } /overview ` ,
icon : item.icon ,
icon : item.icon ,
icon_background : item.icon_background
icon_background : item.icon_background ,
} ) ) }
} ) ) }
createText = { t ( 'common.menus.newApp' ) }
createText = { t ( 'common.menus.newApp' ) }
onCreate = { ( ) = > setShowNewAppDialog ( true ) }
onCreate = { ( ) = > setShowNewAppDialog ( true ) }
@ -98,7 +98,7 @@ const Header: FC<IHeaderProps> = ({ appItems, curApp, userProfile, onLogout, lan
< Link href = "/plugins-coming-soon" className = { classNames (
< Link href = "/plugins-coming-soon" className = { classNames (
navClassName , 'group' ,
navClassName , 'group' ,
isPluginsComingSoon && 'bg-white shadow-[0_2px_5px_-1px_rgba(0,0,0,0.05),0_2px_4px_-2px_rgba(0,0,0,0.05)]' ,
isPluginsComingSoon && 'bg-white shadow-[0_2px_5px_-1px_rgba(0,0,0,0.05),0_2px_4px_-2px_rgba(0,0,0,0.05)]' ,
isPluginsComingSoon ? 'text-primary-600' : 'text-gray-500 hover:bg-gray-200 hover:text-gray-700'
isPluginsComingSoon ? 'text-primary-600' : 'text-gray-500 hover:bg-gray-200 hover:text-gray-700' ,
) } >
) } >
< PuzzlePieceIcon className = 'mr-1 w-[18px] h-[18px]' / >
< PuzzlePieceIcon className = 'mr-1 w-[18px] h-[18px]' / >
{ t ( 'common.menus.plugins' ) }
{ t ( 'common.menus.plugins' ) }
@ -114,7 +114,7 @@ const Header: FC<IHeaderProps> = ({ appItems, curApp, userProfile, onLogout, lan
name : dataset.name ,
name : dataset.name ,
link : ` /datasets/ ${ dataset . id } /documents ` ,
link : ` /datasets/ ${ dataset . id } /documents ` ,
icon : dataset.icon ,
icon : dataset.icon ,
icon_background : dataset.icon_background
icon_background : dataset.icon_background ,
} ) ) }
} ) ) }
createText = { t ( 'common.menus.newDataset' ) }
createText = { t ( 'common.menus.newDataset' ) }
onCreate = { ( ) = > router . push ( '/datasets/create' ) }
onCreate = { ( ) = > router . push ( '/datasets/create' ) }