| | |
| | | import { useState } from 'react'; |
| | | import { LoadingIndicator, LocalesMenuButton } from 'react-admin'; |
| | | import { IconButton, Tooltip } from '@mui/material'; |
| | | import SmartToyOutlinedIcon from '@mui/icons-material/SmartToyOutlined'; |
| | | import { ThemeSwapper } from '../themes/ThemeSwapper'; |
| | | import { TenantTip } from './TenantTip'; |
| | | import { AiChatWidget } from '@/ai/AiChatWidget'; |
| | | import AiChatDrawer from './AiChatDrawer'; |
| | | |
| | | export const AppBarToolbar = () => ( |
| | | <> |
| | | <LocalesMenuButton /> |
| | | <ThemeSwapper /> |
| | | <LoadingIndicator /> |
| | | <AiChatWidget |
| | | trigger="button" |
| | | buttonText="AI 对话" |
| | | buttonVariant="text" |
| | | buttonSx={{ |
| | | minWidth: 'auto', |
| | | px: 1.25, |
| | | color: '#fff', |
| | | borderRadius: 2, |
| | | whiteSpace: 'nowrap', |
| | | '&:hover': { |
| | | backgroundColor: 'rgba(255,255,255,0.12)' |
| | | } |
| | | }} |
| | | /> |
| | | <TenantTip /> |
| | | </> |
| | | ); |
| | | export const AppBarToolbar = () => { |
| | | const [drawerOpen, setDrawerOpen] = useState(false); |
| | | |
| | | return ( |
| | | <> |
| | | <Tooltip title="AI 对话"> |
| | | <IconButton color="inherit" onClick={() => setDrawerOpen(true)}> |
| | | <SmartToyOutlinedIcon /> |
| | | </IconButton> |
| | | </Tooltip> |
| | | <LocalesMenuButton /> |
| | | <ThemeSwapper /> |
| | | <LoadingIndicator /> |
| | | <TenantTip /> |
| | | <AiChatDrawer open={drawerOpen} onClose={() => setDrawerOpen(false)} /> |
| | | </> |
| | | ); |
| | | }; |