import { ActionIcon, Menu, Text } from '@mantine/core'; import { openContextModal } from '@mantine/modals'; import { showNotification } from '@mantine/notifications'; import { IconCheck, IconEdit, IconMenu, IconTrash } from '@tabler/icons'; import { useTranslation } from 'next-i18next'; import { useConfigContext } from '../../../config/provider'; import { useConfigStore } from '../../../config/store'; import { useColorTheme } from '../../../tools/color'; import { ServiceType } from '../../../types/service'; interface TileMenuProps { service: ServiceType; } export const TileMenu = ({ service }: TileMenuProps) => { const { secondaryColor } = useColorTheme(); const { t } = useTranslation('layout/app-shelf-menu'); const updateConfig = useConfigStore((x) => x.updateConfig); const { name: configName } = useConfigContext(); return ( {t('menu.labels.settings')} } onClick={() => openContextModal({ modal: 'changeTilePosition', innerProps: { type: 'service', tile: service, }, }) } > {t('menu.actions.edit')} {t('menu.labels.dangerZone')} { if (!configName) { return; } updateConfig(configName, (previousConfig) => ({ ...previousConfig, services: previousConfig.services.filter((x) => x.id !== service.id), })).then(() => { showNotification({ autoClose: 5000, title: ( Service {service.name} removed successfully! ), color: 'green', icon: , message: undefined, }); }); }} icon={} > {t('menu.actions.delete')} ); };