import {APIButton} from "../Common"; import {Icon, Table} from "../Theme"; import React from "react"; import {TableBody, TableCell, TableHeader, TableHeaderCell, TableRow} from "semantic-ui-react"; import {TableRowPlaceholder} from "../Placeholder"; import {useNavigate} from "react-router-dom"; function WarningIcon({ok}) { return } function ConfigTableRow({config, importConfig, saveConfig, fetchConfigs}) { const {file_name, rel_path, valid, successful_import} = config; const navigate = useNavigate(); const localImportConfig = async () => { await importConfig(file_name); await fetchConfigs(); } const localSaveConfig = async () => { await saveConfig(file_name); await fetchConfigs(); } const importButton = ; let saveButton; if (successful_import) { saveButton = ; } else { // Warn the user they may overwrite because import was not successful. saveButton = ; } return navigate(`?preview=${rel_path}`)}>{file_name} {importButton} {saveButton} } export function ConfigsTable({configs, loading, importConfig, saveConfig, fetchConfigs}) { let body = if (loading) { // Configs are being fetched again. } else if (configs === undefined) { body = Failed to fetch configs ; } else if (configs && Object.keys(configs).length === 0) { body = No configs exist. Try tagging some files. ; } else if (configs) { body = Object.entries(configs).map(([key, value]) => ); } return File Name Imported Valid Import Save {body}
}