diff --git a/.changeset/neat-lamps-repeat.md b/.changeset/neat-lamps-repeat.md new file mode 100644 index 0000000000..d268ff9034 --- /dev/null +++ b/.changeset/neat-lamps-repeat.md @@ -0,0 +1,5 @@ +--- +"@medusajs/admin-ui": patch +--- + +fix(admin-ui): Revamps gift card manage page diff --git a/packages/admin-ui/ui/src/components/atoms/switch/index.tsx b/packages/admin-ui/ui/src/components/atoms/switch/index.tsx index 71b9584f00..11c419a484 100644 --- a/packages/admin-ui/ui/src/components/atoms/switch/index.tsx +++ b/packages/admin-ui/ui/src/components/atoms/switch/index.tsx @@ -1,25 +1,30 @@ import * as RadixSwitch from "@radix-ui/react-switch" import clsx from "clsx" +import React from "react" /** * A controlled switch component atom. */ -function Switch(props: RadixSwitch.SwitchProps) { - return ( - - ( + (props, ref) => { + return ( + - - ) -} + > + + + ) + } +) + +Switch.displayName = "Switch" export default Switch diff --git a/packages/admin-ui/ui/src/components/atoms/tooltip/index.tsx b/packages/admin-ui/ui/src/components/atoms/tooltip/index.tsx index a279a817c4..cf313f86c1 100644 --- a/packages/admin-ui/ui/src/components/atoms/tooltip/index.tsx +++ b/packages/admin-ui/ui/src/components/atoms/tooltip/index.tsx @@ -42,7 +42,7 @@ const Tooltip = ({ sideOffset={8} align="center" className={clsx( - "inter-small-semibold text-grey-50", + "inter-small-semibold text-grey-50 z-[999]", "bg-grey-0 shadow-dropdown rounded-rounded py-2 px-3", "border-grey-20 border border-solid", className diff --git a/packages/admin-ui/ui/src/domain/products/components/prices-form/index.tsx b/packages/admin-ui/ui/src/components/forms/general/prices-form/index.tsx similarity index 100% rename from packages/admin-ui/ui/src/domain/products/components/prices-form/index.tsx rename to packages/admin-ui/ui/src/components/forms/general/prices-form/index.tsx diff --git a/packages/admin-ui/ui/src/domain/products/components/prices-form/nested-price.tsx b/packages/admin-ui/ui/src/components/forms/general/prices-form/nested-price.tsx similarity index 91% rename from packages/admin-ui/ui/src/domain/products/components/prices-form/nested-price.tsx rename to packages/admin-ui/ui/src/components/forms/general/prices-form/nested-price.tsx index a45647edb2..aa72df7a32 100644 --- a/packages/admin-ui/ui/src/domain/products/components/prices-form/nested-price.tsx +++ b/packages/admin-ui/ui/src/components/forms/general/prices-form/nested-price.tsx @@ -1,13 +1,13 @@ import clsx from "clsx" import { Controller } from "react-hook-form" import { NestedPriceObject, PricesFormType } from "." -import IncludesTaxTooltip from "../../../../components/atoms/includes-tax-tooltip" -import CoinsIcon from "../../../../components/fundamentals/icons/coins-icon" -import MapPinIcon from "../../../../components/fundamentals/icons/map-pin-icon" -import TriangleRightIcon from "../../../../components/fundamentals/icons/triangle-right-icon" import useToggleState from "../../../../hooks/use-toggle-state" import { currencies } from "../../../../utils/currencies" import { NestedForm } from "../../../../utils/nested-form" +import IncludesTaxTooltip from "../../../atoms/includes-tax-tooltip" +import CoinsIcon from "../../../fundamentals/icons/coins-icon" +import MapPinIcon from "../../../fundamentals/icons/map-pin-icon" +import TriangleRightIcon from "../../../fundamentals/icons/triangle-right-icon" import PriceFormInput from "./price-form-input" type Props = { @@ -21,7 +21,7 @@ const NestedPrice = ({ form, nestedPrice }: Props) => { const { control, path } = form const { currencyPrice, regionPrices } = nestedPrice return ( -
+
) diff --git a/packages/admin-ui/ui/src/domain/products/components/general-form/index.tsx b/packages/admin-ui/ui/src/components/forms/product/general-form/index.tsx similarity index 73% rename from packages/admin-ui/ui/src/domain/products/components/general-form/index.tsx rename to packages/admin-ui/ui/src/components/forms/product/general-form/index.tsx index 82c0b5251c..c399dd0453 100644 --- a/packages/admin-ui/ui/src/domain/products/components/general-form/index.tsx +++ b/packages/admin-ui/ui/src/components/forms/product/general-form/index.tsx @@ -1,7 +1,7 @@ -import InputField from "../../../../components/molecules/input" -import TextArea from "../../../../components/molecules/textarea" import FormValidator from "../../../../utils/form-validator" import { NestedForm } from "../../../../utils/nested-form" +import InputField from "../../../molecules/input" +import TextArea from "../../../molecules/textarea" export type GeneralFormType = { title: string @@ -14,9 +14,10 @@ export type GeneralFormType = { type Props = { form: NestedForm requireHandle?: boolean + isGiftCard?: boolean } -const GeneralForm = ({ form, requireHandle = true }: Props) => { +const GeneralForm = ({ form, requireHandle = true, isGiftCard }: Props) => { const { register, path, @@ -28,7 +29,7 @@ const GeneralForm = ({ form, requireHandle = true }: Props) => {
{ />

- Give your product a short and clear title. + Give your {isGiftCard ? "gift card" : "product"} a short and clear + title.
50-60 characters is the recommended length for search engines.

@@ -59,10 +61,12 @@ const GeneralForm = ({ form, requireHandle = true }: Props) => { label="Handle" tooltipContent={ !requireHandle - ? "The handle is the part of the URL that identifies the product. If not specified, it will be generated from the title." + ? `The handle is the part of the URL that identifies the ${ + isGiftCard ? "gift card" : "product" + }. If not specified, it will be generated from the title.` : undefined } - placeholder="winter-jacket" + placeholder={isGiftCard ? "gift-card" : "winter-jacket"} required={requireHandle} {...register(path("handle"), { required: requireHandle ? "Handle is required" : undefined, @@ -74,7 +78,7 @@ const GeneralForm = ({ form, requireHandle = true }: Props) => { /> {