mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-11 16:05:47 +01:00
🐛 Fixed tile delete handler
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { useConfigContext } from '../../../../config/provider';
|
||||
import { useConfigStore } from '../../../../config/store';
|
||||
import { openContextModalGeneric } from '../../../../tools/mantineModalManagerExtensions';
|
||||
import { AppType } from '../../../../types/app';
|
||||
import { GenericTileMenu } from '../GenericTileMenu';
|
||||
@@ -7,6 +9,9 @@ interface TileMenuProps {
|
||||
}
|
||||
|
||||
export const AppMenu = ({ app }: TileMenuProps) => {
|
||||
const { config, name: configName } = useConfigContext();
|
||||
const { updateConfig } = useConfigStore();
|
||||
|
||||
const handleClickEdit = () => {
|
||||
openContextModalGeneric<{ app: AppType; allowAppNamePropagation: boolean }>({
|
||||
modal: 'editApp',
|
||||
@@ -37,7 +42,16 @@ export const AppMenu = ({ app }: TileMenuProps) => {
|
||||
});
|
||||
};
|
||||
|
||||
const handleClickDelete = () => {};
|
||||
const handleClickDelete = () => {
|
||||
if (configName === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
updateConfig(configName, (previousConfig) => ({
|
||||
...previousConfig,
|
||||
apps: previousConfig.apps.filter((a) => a.id !== app.id),
|
||||
}));
|
||||
};
|
||||
|
||||
return (
|
||||
<GenericTileMenu
|
||||
|
||||
Reference in New Issue
Block a user