diff --git a/src/components/Dashboard/Tiles/Apps/AppMenu.tsx b/src/components/Dashboard/Tiles/Apps/AppMenu.tsx index 0b960d1c5..fea3a6e2c 100644 --- a/src/components/Dashboard/Tiles/Apps/AppMenu.tsx +++ b/src/components/Dashboard/Tiles/Apps/AppMenu.tsx @@ -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 (