|
1
|
import { useTranslation } from "react-i18next" |
|
2
|
import { PaymentProviderDTO } from "@medusajs/types" |
|
3
|
|
|
4
|
import { formatProvider } from "../../../../../lib/format-provider" |
|
5
|
import { PlaceholderCell } from "../../common/placeholder-cell" |
|
6
|
import { ListSummary } from "../../../../common/list-summary" |
|
7
|
|
|
8
|
type PaymentProvidersCellProps = { |
|
9
|
paymentProviders?: PaymentProviderDTO[] | null |
|
10
|
} |
|
11
|
|
|
12
|
export const PaymentProvidersCell = ({ |
|
13
|
paymentProviders, |
|
14
|
}: PaymentProvidersCellProps) => { |
|
15
|
if (!paymentProviders || paymentProviders.length === 0) { |
|
16
|
return <PlaceholderCell /> |
|
17
|
} |
|
18
|
|
|
19
|
const displayValues = paymentProviders.map((p) => formatProvider(p.id)) |
|
20
|
|
|
21
|
return ( |
|
22
|
<div className="flex size-full items-center overflow-hidden"> |
|
23
|
<ListSummary list={displayValues} /> |
|
24
|
</div> |
|
25
|
) |
|
26
|
} |
|
27
|
|
|
28
|
export const PaymentProvidersHeader = () => { |
|
29
|
const { t } = useTranslation() |
|
30
|
|
|
31
|
return ( |
|
32
|
<div className="flex size-full items-center overflow-hidden"> |
|
33
|
<span className="truncate">{t("fields.paymentProviders")}</span> |
|
34
|
</div> |
|
35
|
) |
|
36
|
} |