2025-08-15 14:43:30 +01:00
|
|
|
import { useMemo } from 'react';
|
|
|
|
|
|
|
|
// Material UI Icons
|
|
|
|
import CompressIcon from '@mui/icons-material/Compress';
|
|
|
|
import SwapHorizIcon from '@mui/icons-material/SwapHoriz';
|
|
|
|
import CleaningServicesIcon from '@mui/icons-material/CleaningServices';
|
|
|
|
import CropIcon from '@mui/icons-material/Crop';
|
|
|
|
import TextFieldsIcon from '@mui/icons-material/TextFields';
|
|
|
|
|
|
|
|
export interface SuggestedTool {
|
|
|
|
name: string;
|
|
|
|
title: string;
|
|
|
|
icon: React.ComponentType<any>;
|
|
|
|
navigate: () => void;
|
|
|
|
}
|
|
|
|
|
|
|
|
const ALL_SUGGESTED_TOOLS: Omit<SuggestedTool, 'navigate'>[] = [
|
|
|
|
{
|
|
|
|
name: 'compress',
|
|
|
|
title: 'Compress',
|
|
|
|
icon: CompressIcon
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'convert',
|
|
|
|
title: 'Convert',
|
|
|
|
icon: SwapHorizIcon
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'sanitize',
|
|
|
|
title: 'Sanitize',
|
|
|
|
icon: CleaningServicesIcon
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'split',
|
|
|
|
title: 'Split',
|
|
|
|
icon: CropIcon
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'ocr',
|
|
|
|
title: 'OCR',
|
|
|
|
icon: TextFieldsIcon
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
2025-08-19 16:50:55 +01:00
|
|
|
export function useSuggestedTools(selectedToolKey?: string | null, handleToolSelect?: (toolId: string) => void): SuggestedTool[] {
|
2025-08-15 14:43:30 +01:00
|
|
|
return useMemo(() => {
|
|
|
|
// Filter out the current tool
|
|
|
|
const filteredTools = ALL_SUGGESTED_TOOLS.filter(tool => tool.name !== selectedToolKey);
|
|
|
|
|
|
|
|
// Add navigation function to each tool
|
|
|
|
return filteredTools.map(tool => ({
|
|
|
|
...tool,
|
2025-08-19 16:50:55 +01:00
|
|
|
navigate: handleToolSelect ? () => handleToolSelect(tool.name) : () => {}
|
2025-08-15 14:43:30 +01:00
|
|
|
}));
|
|
|
|
}, [selectedToolKey, handleToolSelect]);
|
|
|
|
}
|