diff --git a/src/components/Utilities/Renamer/ConfigModal.tsx b/src/components/Utilities/Renamer/ConfigModal.tsx index 2530ccb8..70e19bcf 100644 --- a/src/components/Utilities/Renamer/ConfigModal.tsx +++ b/src/components/Utilities/Renamer/ConfigModal.tsx @@ -107,7 +107,7 @@ const ConfigModal = (props: Props) => { > {renamers?.map(renamer => ( ))} diff --git a/src/pages/utilities/Renamer.tsx b/src/pages/utilities/Renamer.tsx index f070ccab..0c533009 100644 --- a/src/pages/utilities/Renamer.tsx +++ b/src/pages/utilities/Renamer.tsx @@ -38,7 +38,7 @@ import { useRenamerRelocateMutation, useRenamerSaveConfigMutation, } from '@/core/react-query/renamer/mutations'; -import { useRenamerByConfigQuery, useRenamerConfigsQuery } from '@/core/react-query/renamer/queries'; +import { useRenamerByConfigQuery, useRenamerConfigsQuery, useRenamersQuery } from '@/core/react-query/renamer/queries'; import { usePatchSettingsMutation } from '@/core/react-query/settings/mutations'; import { useSettingsQuery } from '@/core/react-query/settings/queries'; import { clearFiles, clearRenameResults, removeFiles } from '@/core/slices/utilities/renamer'; @@ -268,6 +268,30 @@ const Menu = React.memo((props: MenuProps) => { ); }); +const ConfigOption = React.memo(({ config }: { config: RenamerConfigType }) => { + const renamersQuery = useRenamersQuery(); + + const currentRenamer = useMemo( + () => find(renamersQuery.data, item => item.RenamerID === config.RenamerID), + [config.RenamerID, renamersQuery.data], + ); + + let configName: string; + if (renamersQuery.isPending) { + configName = 'Loading...'; + } else if (currentRenamer) { + configName = `${config.Name} (${currentRenamer.Name} - ${currentRenamer.Version})`; + } else { + configName = `${config.Name} ()`; + } + + return ( + + ); +}); + const Renamer = () => { const dispatch = useDispatch(); const addedFiles = useSelector((state: RootState) => state.utilities.renamer.files); @@ -521,9 +545,7 @@ const Renamer = () => { onChange={event => changeSelectedConfig(event.target.value)} > {renamerConfigsQuery.data.map(renamerConfig => ( - + ))} {renamerConfigsQuery.data.length === 0 && (