import React from 'react';
import Tooltip, { TooltipProps, tooltipClasses } from '@mui/material/Tooltip';
import { styled, SxProps } from '@mui/material/styles';
// import Box from '@mui/material/Box';
import { Divider, Box } from '@mui/material';
import { IconName, IconUrl, IconMap } from './agents';
import { IAgent } from '@/apis/get-agents';
import { ActionType } from '@/storage/plan';
interface ITooltipInfo extends IAgent {
action?: { type: ActionType; description: string; style: SxProps };
}
export interface IAgentIconProps {
name?: IconName | string;
style?: React.CSSProperties;
tooltipInfo?: ITooltipInfo;
}
const HtmlTooltip = styled(({ className, ...props }: TooltipProps) => (
))(({ theme }) => ({
[`& .${tooltipClasses.tooltip}`]: {
backgroundColor: '#f2f2f2',
color: 'rgba(0, 0, 0, 0.87)',
width: 'fit-content',
fontSize: theme.typography.pxToRem(12),
border: '1px solid #0003',
boxShadow: '1px 1px 4px #0003',
},
}));
const generateTooltip = (info: ITooltipInfo) => {
return (
{info.name}
{info.profile}
{info.action && (
{info.action.type}
{info.action.description}
)}
);
};
export default React.memo(
({ style = {}, name = 'Unknown', tooltipInfo }) => {
const _name = React.useMemo(() => IconMap[name], [name]);
return tooltipInfo ? (
) : (
);
},
);
export { IconName, IconMap, IconUrl } from './agents';