mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-10 23:45:48 +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 { openContextModalGeneric } from '../../../../tools/mantineModalManagerExtensions';
|
||||||
import { AppType } from '../../../../types/app';
|
import { AppType } from '../../../../types/app';
|
||||||
import { GenericTileMenu } from '../GenericTileMenu';
|
import { GenericTileMenu } from '../GenericTileMenu';
|
||||||
@@ -7,6 +9,9 @@ interface TileMenuProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const AppMenu = ({ app }: TileMenuProps) => {
|
export const AppMenu = ({ app }: TileMenuProps) => {
|
||||||
|
const { config, name: configName } = useConfigContext();
|
||||||
|
const { updateConfig } = useConfigStore();
|
||||||
|
|
||||||
const handleClickEdit = () => {
|
const handleClickEdit = () => {
|
||||||
openContextModalGeneric<{ app: AppType; allowAppNamePropagation: boolean }>({
|
openContextModalGeneric<{ app: AppType; allowAppNamePropagation: boolean }>({
|
||||||
modal: 'editApp',
|
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 (
|
return (
|
||||||
<GenericTileMenu
|
<GenericTileMenu
|
||||||
|
|||||||
Reference in New Issue
Block a user