diff --git a/packages/admin/dashboard/src/i18n/translations/en.json b/packages/admin/dashboard/src/i18n/translations/en.json index 510d176b1e..9e6f766bbd 100644 --- a/packages/admin/dashboard/src/i18n/translations/en.json +++ b/packages/admin/dashboard/src/i18n/translations/en.json @@ -612,6 +612,7 @@ "subtitle": "Organize products into collections.", "createCollection": "Create Collection", "createCollectionHint": "Create a new collection to organize your products.", + "createSuccess": "Collection created successfully.", "editCollection": "Edit Collection", "handleTooltip": "The handle is used to reference the collection in your storefront. If not specified, the handle will be generated from the collection title.", "deleteWarning": "You are about to delete the collection {{title}}. This action cannot be undone.", diff --git a/packages/admin/dashboard/src/routes/collections/collection-create/components/create-collection-form/create-collection-form.tsx b/packages/admin/dashboard/src/routes/collections/collection-create/components/create-collection-form/create-collection-form.tsx index 4807527706..9ed6e88897 100644 --- a/packages/admin/dashboard/src/routes/collections/collection-create/components/create-collection-form/create-collection-form.tsx +++ b/packages/admin/dashboard/src/routes/collections/collection-create/components/create-collection-form/create-collection-form.tsx @@ -1,5 +1,5 @@ import { zodResolver } from "@hookform/resolvers/zod" -import { Button, Heading, Input, Text } from "@medusajs/ui" +import { Button, Heading, Input, Text, toast } from "@medusajs/ui" import { useForm } from "react-hook-form" import { useTranslation } from "react-i18next" import * as zod from "zod" @@ -35,6 +35,10 @@ export const CreateCollectionForm = () => { await mutateAsync(data, { onSuccess: ({ collection }) => { handleSuccess(`/collections/${collection.id}`) + toast.success(t("general.success"), { + description: t("collections.createSuccess"), + dismissLabel: t("actions.close"), + }) }, }) }) diff --git a/packages/admin/dashboard/src/routes/collections/collection-detail/components/collection-general-section/collection-general-section.tsx b/packages/admin/dashboard/src/routes/collections/collection-detail/components/collection-general-section/collection-general-section.tsx index 145c31c467..8d438ae111 100644 --- a/packages/admin/dashboard/src/routes/collections/collection-detail/components/collection-general-section/collection-general-section.tsx +++ b/packages/admin/dashboard/src/routes/collections/collection-detail/components/collection-general-section/collection-general-section.tsx @@ -4,6 +4,7 @@ import { Container, Heading, Text, usePrompt } from "@medusajs/ui" import { useTranslation } from "react-i18next" import { ActionMenu } from "../../../../../components/common/action-menu" import { useDeleteCollection } from "../../../../../hooks/api/collections" +import { useNavigate } from "react-router-dom" type CollectionGeneralSectionProps = { collection: HttpTypes.AdminCollection @@ -14,6 +15,7 @@ export const CollectionGeneralSection = ({ }: CollectionGeneralSectionProps) => { const { t } = useTranslation() const prompt = usePrompt() + const navigate = useNavigate() const { mutateAsync } = useDeleteCollection(collection.id!) @@ -22,6 +24,7 @@ export const CollectionGeneralSection = ({ title: t("general.areYouSure"), description: t("collections.deleteWarning", { count: 1, + title: collection.title, }), }) @@ -30,6 +33,7 @@ export const CollectionGeneralSection = ({ } await mutateAsync() + navigate("../", { replace: true }) } return (