import type { FC } from 'react' import { useState } from 'react' import { useTranslation } from 'react-i18next' import { useSelectedLayoutSegment, useRouter } from 'next/navigation' import classNames from 'classnames' import { CircleStackIcon, PuzzlePieceIcon } from '@heroicons/react/24/outline' import { CommandLineIcon, Squares2X2Icon } from '@heroicons/react/24/solid' import Link from 'next/link' import AccountDropdown from './account-dropdown' import Nav from './nav' import s from './index.module.css' import type { AppDetailResponse } from '@/models/app' import type { LangGeniusVersionResponse, UserProfileResponse } from '@/models/common' import NewAppDialog from '@/app/(commonLayout)/apps/NewAppDialog' import { WorkspaceProvider } from '@/context/workspace-context' import { useDatasetsContext } from '@/context/datasets-context' export type IHeaderProps = { appItems: AppDetailResponse[] curApp: AppDetailResponse userProfile: UserProfileResponse onLogout: () => void langeniusVersionInfo: LangGeniusVersionResponse isBordered: boolean } const navClassName = ` flex items-center relative mr-3 px-3 h-8 rounded-xl font-medium text-[14px] cursor-pointer ` const headerEnvClassName: { [k: string]: string } = { DEVELOPMENT: 'bg-[#FEC84B] border-[#FDB022] text-[#93370D]', TESTING: 'bg-[#A5F0FC] border-[#67E3F9] text-[#164C63]', } const Header: FC = ({ appItems, curApp, userProfile, onLogout, langeniusVersionInfo, isBordered }) => { const { t } = useTranslation() const [showNewAppDialog, setShowNewAppDialog] = useState(false) const { datasets, currentDataset } = useDatasetsContext() const router = useRouter() const showEnvTag = langeniusVersionInfo.current_env === 'TESTING' || langeniusVersionInfo.current_env === 'DEVELOPMENT' const isPluginsComingSoon = useSelectedLayoutSegment() === 'plugins-coming-soon' return (
{/* Add it when has many stars */}
{t('common.menus.status')}
{ showEnvTag && (
{ langeniusVersionInfo.current_env === 'TESTING' && ( <>
{t('common.environment.testing')} ) } { langeniusVersionInfo.current_env === 'DEVELOPMENT' && ( <> {t('common.environment.development')} ) }
) }
setShowNewAppDialog(false)} />
) } export default Header