feat(medusa, admin-ui): add description field to product categories (#3768)
* feat(medusa): add description field to product categories * chore: set nullable to false * chore: added UI for description * chore: added codegen files
This commit is contained in:
@@ -10,6 +10,7 @@ import { useQueryClient } from "@tanstack/react-query"
|
||||
import Button from "../../../components/fundamentals/button"
|
||||
import CrossIcon from "../../../components/fundamentals/icons/cross-icon"
|
||||
import InputField from "../../../components/molecules/input"
|
||||
import TextArea from "../../../components/molecules/textarea"
|
||||
import FocusModal from "../../../components/molecules/modal/focus-modal"
|
||||
import { NextSelect } from "../../../components/molecules/select/next-select"
|
||||
import useNotification from "../../../hooks/use-notification"
|
||||
@@ -44,6 +45,7 @@ function CreateProductCategory(props: CreateProductCategoryProps) {
|
||||
|
||||
const [name, setName] = useState("")
|
||||
const [handle, setHandle] = useState("")
|
||||
const [description, setDescription] = useState("")
|
||||
const [isActive, setIsActive] = useState(true)
|
||||
const [isPublic, setIsPublic] = useState(true)
|
||||
|
||||
@@ -54,6 +56,7 @@ function CreateProductCategory(props: CreateProductCategoryProps) {
|
||||
await createProductCategory({
|
||||
name,
|
||||
handle,
|
||||
description,
|
||||
is_active: isActive,
|
||||
is_internal: !isPublic,
|
||||
parent_category_id: parentCategory?.id ?? null,
|
||||
@@ -132,6 +135,16 @@ function CreateProductCategory(props: CreateProductCategoryProps) {
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="mb-8">
|
||||
<TextArea
|
||||
label="Description"
|
||||
name="description"
|
||||
value={description}
|
||||
placeholder="Give this category a description"
|
||||
onChange={(ev) => setDescription(ev.target.value)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="mb-8 flex justify-between gap-6">
|
||||
<div className="flex-1">
|
||||
<NextSelect
|
||||
|
||||
@@ -6,6 +6,7 @@ import { useAdminUpdateProductCategory } from "medusa-react"
|
||||
import Button from "../../../components/fundamentals/button"
|
||||
import CrossIcon from "../../../components/fundamentals/icons/cross-icon"
|
||||
import InputField from "../../../components/molecules/input"
|
||||
import TextArea from "../../../components/molecules/textarea"
|
||||
import SideModal from "../../../components/molecules/modal/side-modal"
|
||||
import { NextSelect } from "../../../components/molecules/select/next-select"
|
||||
import useNotification from "../../../hooks/use-notification"
|
||||
@@ -42,6 +43,7 @@ function EditProductCategoriesSideModal(
|
||||
|
||||
const [name, setName] = useState("")
|
||||
const [handle, setHandle] = useState("")
|
||||
const [description, setDescription] = useState("")
|
||||
const [isActive, setIsActive] = useState(true)
|
||||
const [isPublic, setIsPublic] = useState(true)
|
||||
|
||||
@@ -55,6 +57,7 @@ function EditProductCategoriesSideModal(
|
||||
if (activeCategory) {
|
||||
setName(activeCategory.name)
|
||||
setHandle(activeCategory.handle)
|
||||
setDescription(activeCategory.description)
|
||||
setIsActive(activeCategory.is_active)
|
||||
setIsPublic(!activeCategory.is_internal)
|
||||
}
|
||||
@@ -65,6 +68,7 @@ function EditProductCategoriesSideModal(
|
||||
await updateCategory({
|
||||
name,
|
||||
handle,
|
||||
description,
|
||||
is_active: isActive,
|
||||
is_internal: !isPublic,
|
||||
})
|
||||
@@ -130,6 +134,15 @@ function EditProductCategoriesSideModal(
|
||||
onChange={(ev) => setHandle(ev.target.value)}
|
||||
/>
|
||||
|
||||
<TextArea
|
||||
label="Description"
|
||||
name="description"
|
||||
value={description}
|
||||
className="my-6"
|
||||
placeholder="Give this category a description"
|
||||
onChange={(ev) => setDescription(ev.target.value)}
|
||||
/>
|
||||
|
||||
<NextSelect
|
||||
label="Status"
|
||||
options={statusOptions}
|
||||
|
||||
Reference in New Issue
Block a user