fix(dashboard,medusa): Fixes to Customer and Customer Groups domains (#7081)

**What**
- Cleanup of domains
- Adds toasts
- Adds delete customer hook
- Fixes validation of create and update customer endpoints.
This commit is contained in:
Kasper Fabricius Kristensen
2024-04-17 10:32:21 +02:00
committed by GitHub
parent 122b3ea76b
commit 7e66dd0dd0
29 changed files with 636 additions and 390 deletions

View File

@@ -1,3 +1,5 @@
import { PlaceholderCell } from "../placeholder-cell"
type CellProps = {
text?: string | number
}
@@ -7,6 +9,10 @@ type HeaderProps = {
}
export const TextCell = ({ text }: CellProps) => {
if (!text) {
return <PlaceholderCell />
}
return (
<div className="flex h-full w-full items-center gap-x-3 overflow-hidden">
<span className="truncate">{text}</span>
@@ -16,8 +22,8 @@ export const TextCell = ({ text }: CellProps) => {
export const TextHeader = ({ text }: HeaderProps) => {
return (
<div className=" flex h-full w-full items-center">
<span>{text}</span>
<div className="flex h-full w-full items-center">
<span className="truncate">{text}</span>
</div>
)
}

View File

@@ -9,7 +9,9 @@ export const AccountCell = ({ hasAccount }: AccountCellProps) => {
const { t } = useTranslation()
const color = hasAccount ? "green" : ("orange" as const)
const text = hasAccount ? t("customers.registered") : t("customers.guest")
const text = hasAccount
? t("customers.fields.registered")
: t("customers.fields.guest")
return <StatusCell color={color}>{text}</StatusCell>
}

View File

@@ -1,11 +1,16 @@
import { useTranslation } from "react-i18next"
import { DateCell } from "../../common/date-cell"
import { PlaceholderCell } from "../../common/placeholder-cell"
type FirstSeenCellProps = {
createdAt: Date
createdAt?: Date | string | null
}
export const FirstSeenCell = ({ createdAt }: FirstSeenCellProps) => {
if (!createdAt) {
return <PlaceholderCell />
}
return <DateCell date={createdAt} />
}
@@ -14,7 +19,7 @@ export const FirstSeenHeader = () => {
return (
<div className="flex h-full w-full items-center">
<span className="truncate">{t("customers.firstSeen")}</span>
<span className="truncate">{t("fields.createdAt")}</span>
</div>
)
}