/******************************************************************************** * Copyright (c) 2026 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * https://www.eclipse.org/legal/epl-2.0 * * SPDX-License-Identifier: EPL-2.0 ********************************************************************************/ import { FunctionComponent } from 'react'; import { Dialog, DialogTitle, DialogContent, DialogActions, Button, Typography, List, ListItem, ListItemText, Box } from '@mui/material'; import { useDialogs } from '../../../hooks/scan-admin'; import { useTheme } from '@mui/material/styles'; import { FileDecision } from '../../../context/scan-admin'; /** * Confirmation dialog for file-level allow/block/delete actions. * Uses the useDialogs hook to consume context. */ export const FileDialog: FunctionComponent = () => { const theme = useTheme(); const { fileDialog } = useDialogs(); return ( {fileDialog.actionType === 'allow' ? 'Confirm Allow Files' : fileDialog.actionType === 'block' ? 'Confirm Block Files' : 'Confirm Delete Files'} Are you sure you want to {fileDialog.actionType} {fileDialog.selectedFiles.length !== 1 ? 'these' : 'this'} {fileDialog.selectedFiles.length} file{fileDialog.selectedFiles.length !== 1 ? 's' : ''}? {fileDialog.selectedFiles.map((file: FileDecision) => ( {file.fileName} } secondary={ Hash: {file.fileHash} {file.displayName} {file.namespace}.{file.extensionName} Version: {file.version} } /> ))} ); };