Skip to content

Commit 78966f5

Browse files
authored
Merge pull request #680 from AppQuality/add-notification-toast
added notification toast on drawer close
2 parents 6bf5510 + e51633b commit 78966f5

File tree

4 files changed

+37
-3
lines changed

4 files changed

+37
-3
lines changed

src/locales/en/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@
112112
"__BUGS_PAGE_CUSTOM_STATUS_CLOSE_DRAWER_MODAL_QUIT_BUTTON": "Quit and discard",
113113
"__BUGS_PAGE_CUSTOM_STATUS_DRAWER_BODY_DESCRIPTION": "Here you can create and add a new status to those in process or edit it",
114114
"__BUGS_PAGE_CUSTOM_STATUS_DRAWER_CONFIRM_BUTTON": "Save changes",
115+
"__BUGS_PAGE_CUSTOM_STATUS_DRAWER_CONFIRM_TOAST": "Changes saved",
115116
"__BUGS_PAGE_CUSTOM_STATUS_DRAWER_CREATE_CUSTOM_STATUS_BUTTON": "Create a new status",
116117
"__BUGS_PAGE_CUSTOM_STATUS_DRAWER_CUSTOM_STATUS_MAX": "This name is a bit long. We recommend sticking to a maximum of 17 characters including spaces.",
117118
"__BUGS_PAGE_CUSTOM_STATUS_DRAWER_CUSTOM_STATUS_REQUIRED": "Choose a name up to 17 characters including spaces.",

src/locales/it/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@
117117
"__BUGS_PAGE_CUSTOM_STATUS_CLOSE_DRAWER_MODAL_QUIT_BUTTON": "Esci",
118118
"__BUGS_PAGE_CUSTOM_STATUS_DRAWER_BODY_DESCRIPTION": "",
119119
"__BUGS_PAGE_CUSTOM_STATUS_DRAWER_CONFIRM_BUTTON": "",
120+
"__BUGS_PAGE_CUSTOM_STATUS_DRAWER_CONFIRM_TOAST": "Modifiche salvate",
120121
"__BUGS_PAGE_CUSTOM_STATUS_DRAWER_CREATE_CUSTOM_STATUS_BUTTON": "",
121122
"__BUGS_PAGE_CUSTOM_STATUS_DRAWER_CUSTOM_STATUS_MAX": "",
122123
"__BUGS_PAGE_CUSTOM_STATUS_DRAWER_CUSTOM_STATUS_REQUIRED": "",

src/pages/Bug/Drawer/index.tsx

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
import { Button, Drawer, MD } from '@appquality/unguess-design-system';
1+
import {
2+
Button,
3+
Drawer,
4+
MD,
5+
Notification,
6+
useToast,
7+
} from '@appquality/unguess-design-system';
28
import { useTranslation } from 'react-i18next';
39
import { useAppDispatch, useAppSelector } from 'src/app/hooks';
410
import {
@@ -20,6 +26,7 @@ import { MigrationModal } from '../Modals/MigrationModal';
2026

2127
export const CustomStatusDrawer = () => {
2228
const { campaignId } = useParams();
29+
const { addToast } = useToast();
2330
const { t } = useTranslation();
2431
const dispatch = useAppDispatch();
2532
const {
@@ -99,7 +106,18 @@ export const CustomStatusDrawer = () => {
99106
})),
100107
});
101108
}
102-
109+
addToast(
110+
({ close }) => (
111+
<Notification
112+
onClose={close}
113+
type="success"
114+
message={t('__BUGS_PAGE_CUSTOM_STATUS_DRAWER_CONFIRM_TOAST')}
115+
closeText={t('__TOAST_CLOSE_TEXT')}
116+
isPrimary
117+
/>
118+
),
119+
{ placement: 'top' }
120+
);
103121
dispatch(setCustomStatusDrawerOpen(false));
104122
};
105123

src/pages/Bug/Modals/MigrationModal/index.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import {
99
Span,
1010
Dropdown,
1111
Select,
12+
useToast,
13+
Notification,
1214
} from '@appquality/unguess-design-system';
1315
import { Label, MediaInput } from '@zendeskgarden/react-forms';
1416
import { Trans, useTranslation } from 'react-i18next';
@@ -61,6 +63,7 @@ export const MigrationModal = ({
6163
setIsMigrationModalOpen: (isOpen: boolean) => void;
6264
}) => {
6365
const { t } = useTranslation();
66+
const { addToast } = useToast();
6467
const { campaignId } = useParams();
6568
const dispatch = useAppDispatch();
6669
const [patchCustomStatuses] = usePatchCampaignsByCidCustomStatusesMutation();
@@ -134,7 +137,18 @@ export const MigrationModal = ({
134137
],
135138
});
136139
}
137-
140+
addToast(
141+
({ close }) => (
142+
<Notification
143+
onClose={close}
144+
type="success"
145+
message={t('__BUGS_PAGE_CUSTOM_STATUS_DRAWER_CONFIRM_TOAST')}
146+
closeText={t('__TOAST_CLOSE_TEXT')}
147+
isPrimary
148+
/>
149+
),
150+
{ placement: 'top' }
151+
);
138152
setIsMigrationModalOpen(false);
139153
dispatch(setCustomStatusDrawerOpen(false));
140154
};

0 commit comments

Comments
 (0)