2025-10-14 15:42:40 +08:00
|
|
|
import React from 'react';
|
|
|
|
|
import { SpeedDial, SpeedDialAction } from '@mui/material';
|
|
|
|
|
import {
|
2025-10-14 18:06:12 +08:00
|
|
|
Dashboard as DashboardIcon,
|
2025-10-14 15:42:40 +08:00
|
|
|
Search as TestIcon,
|
|
|
|
|
Settings as ConfigIcon,
|
2025-11-04 15:32:55 +08:00
|
|
|
ListAlt as OverviewIcon,
|
2025-10-14 15:42:40 +08:00
|
|
|
} from '@mui/icons-material';
|
2025-10-29 16:40:20 +08:00
|
|
|
import { useTranslation } from 'react-i18next';
|
2025-10-14 15:42:40 +08:00
|
|
|
|
|
|
|
|
interface FloatingActionButtonsProps {
|
|
|
|
|
onTestClick: () => void;
|
|
|
|
|
onConfigClick: () => void;
|
2025-11-04 15:32:55 +08:00
|
|
|
onOverviewClick: () => void;
|
2025-10-14 15:42:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const FloatingActionButtons: React.FC<FloatingActionButtonsProps> = ({
|
|
|
|
|
onTestClick,
|
|
|
|
|
onConfigClick,
|
2025-11-04 15:32:55 +08:00
|
|
|
onOverviewClick,
|
2025-10-14 15:42:40 +08:00
|
|
|
}) => {
|
2025-10-29 16:40:20 +08:00
|
|
|
const { t } = useTranslation();
|
|
|
|
|
|
2025-10-14 15:42:40 +08:00
|
|
|
const actions = [
|
|
|
|
|
{
|
|
|
|
|
icon: <TestIcon />,
|
2025-10-29 16:40:20 +08:00
|
|
|
name: t('knowledge.retrievalTest'),
|
2025-10-14 15:42:40 +08:00
|
|
|
onClick: onTestClick,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
icon: <ConfigIcon />,
|
2025-10-29 16:40:20 +08:00
|
|
|
name: t('knowledge.configSettings'),
|
2025-10-14 15:42:40 +08:00
|
|
|
onClick: onConfigClick,
|
|
|
|
|
},
|
2025-11-07 13:30:59 +08:00
|
|
|
// {
|
|
|
|
|
// icon: <OverviewIcon />,
|
|
|
|
|
// name: t('knowledgeDetails.overview'),
|
|
|
|
|
// onClick: onOverviewClick,
|
|
|
|
|
// },
|
2025-10-14 15:42:40 +08:00
|
|
|
];
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<SpeedDial
|
2025-10-29 16:40:20 +08:00
|
|
|
ariaLabel={t('knowledge.knowledgeBaseActions')}
|
2025-10-14 15:42:40 +08:00
|
|
|
sx={{
|
|
|
|
|
position: 'fixed',
|
|
|
|
|
bottom: 128,
|
|
|
|
|
right: 64,
|
|
|
|
|
'& .MuiSpeedDial-fab': {
|
|
|
|
|
bgcolor: 'primary.main',
|
|
|
|
|
'&:hover': {
|
|
|
|
|
bgcolor: 'primary.dark',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}}
|
2025-10-14 18:06:12 +08:00
|
|
|
icon={<DashboardIcon />}
|
2025-10-14 15:42:40 +08:00
|
|
|
>
|
|
|
|
|
{actions.map((action) => (
|
|
|
|
|
<SpeedDialAction
|
|
|
|
|
key={action.name}
|
|
|
|
|
icon={action.icon}
|
|
|
|
|
slotProps={{
|
|
|
|
|
tooltip: {
|
|
|
|
|
title: action.name,
|
|
|
|
|
sx: {
|
|
|
|
|
bgcolor: 'primary.main',
|
|
|
|
|
color: 'white',
|
|
|
|
|
":hover": {
|
|
|
|
|
bgcolor: 'primary.dark',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}}
|
|
|
|
|
onClick={action.onClick}
|
|
|
|
|
/>
|
|
|
|
|
))}
|
|
|
|
|
</SpeedDial>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default FloatingActionButtons;
|