Fix widget delete modal

This commit is contained in:
ajnart
2023-01-13 10:57:13 +09:00
parent cb85bf4827
commit 5a2653a189
4 changed files with 8 additions and 7 deletions

View File

@@ -9,6 +9,7 @@
"version": "Version", "version": "Version",
"changePosition": "Change position", "changePosition": "Change position",
"remove": "Remove", "remove": "Remove",
"removeConfirm": "Are you sure that you want to remove {{item}} ?",
"sections": { "sections": {
"settings": "Settings", "settings": "Settings",
"dangerZone": "Danger zone" "dangerZone": "Danger zone"

View File

@@ -19,10 +19,6 @@
"url": { "url": {
"label": "Dash. URL" "label": "Dash. URL"
} }
},
"remove": {
"title": "Remove Dash. widget",
"confirm": "Are you sure, that you want to remove the Dash. widget?"
} }
}, },
"card": { "card": {

View File

@@ -36,7 +36,7 @@ export const WidgetsMenu = ({ integration, widget }: WidgetsMenuProps) => {
const handleDeleteClick = () => { const handleDeleteClick = () => {
openContextModalGeneric<WidgetsRemoveModalInnerProps>({ openContextModalGeneric<WidgetsRemoveModalInnerProps>({
modal: 'integrationRemove', modal: 'integrationRemove',
title: <Title order={4}>{t('descriptor.remove.title')}</Title>, title: <Title order={4}>{t('common:remove')}</Title>,
innerProps: { innerProps: {
widgetId: integration, widgetId: integration,
}, },

View File

@@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import { Button, Group, Stack, Text } from '@mantine/core'; import { Button, Group, Stack, Text } from '@mantine/core';
import { ContextModalProps } from '@mantine/modals'; import { ContextModalProps } from '@mantine/modals';
import { useTranslation } from 'next-i18next'; import { Trans, useTranslation } from 'next-i18next';
import { useConfigContext } from '../../../../config/provider'; import { useConfigContext } from '../../../../config/provider';
import { useConfigStore } from '../../../../config/store'; import { useConfigStore } from '../../../../config/store';
@@ -32,7 +32,11 @@ export const WidgetsRemoveModal = ({
return ( return (
<Stack> <Stack>
<Text>{t('descriptor.remove.confirm')}</Text> <Trans
i18nKey="common:removeConfirm"
components={[<Text weight={500} />]}
values={{ item: innerProps.widgetId }}
/>
<Group position="right"> <Group position="right">
<Button onClick={() => context.closeModal(id)} variant="light"> <Button onClick={() => context.closeModal(id)} variant="light">
{t('common:cancel')} {t('common:cancel')}