import * as React from 'react' import Avatar from '@mui/joy/Avatar' import Chip from '@mui/joy/Chip' import IconButton from '@mui/joy/IconButton' import Stack from '@mui/joy/Stack' import Typography from '@mui/joy/Typography' import CircleIcon from '@mui/icons-material/Circle' import IndexIcon from '@mui/icons-material/SortRounded' import SettingsIcon from '@mui/icons-material/SettingsRounded' import HistoryRoundIcon from '@mui/icons-material/HistoryRounded' import AddRoundIcon from '@mui/icons-material/AddRounded' import LoginIcon from '@mui/icons-material/LoginRounded' import Tooltip from '@mui/joy/Tooltip' import { useNavigate } from 'react-router-dom' import { useCopilotContext } from '../Context' type ChatHeaderProps = {} export default function ChatHeader(props: ChatHeaderProps) { const { repo, setMessages, setThreadId, user } = useCopilotContext() const navigate = useNavigate() return ( {repo?.name && ( <> {repo?.avatarUrl ? ( ) : ( )}
} slotProps={{ root: { component: 'span' }, }} > {repo.status.lastIndexedCommit.substring( 0, 7, )} ) : repo?.status?.isIndexing ? ( <> } slotProps={{ root: { component: 'span' }, }} > Running ) : ( } slotProps={{ root: { component: 'span' }, }} > Index Unavailable ) } > {repo?.name} {repo?.owner}
)}
<> { setThreadId('') setMessages([]) navigate('message') }} > { navigate('history') }} > { if (repo) { navigate('/chat/index') } }} > navigate('settings')} > {user ? : }
) }