import { SalesChannel } from "@medusajs/medusa" import { useAdminSalesChannels } from "medusa-react" import React from "react" import Tooltip from "../../atoms/tooltip" import Badge from "../../fundamentals/badge" import { Trans, useTranslation } from "react-i18next" type Props = { channels?: SalesChannel[] } const SalesChannelsDisplay = ({ channels = [] }: Props) => { const { count } = useAdminSalesChannels() const remainder = Math.max(channels.length - 3, 0) const { t } = useTranslation() const availableChannelsCount = channels.length ? channels.length : 0 const totalChannelsCount = count || 0 return (
{channels.length > 0 && (
{channels.slice(0, 3).map((sc) => ( ))}
{remainder > 0 && ( {channels.slice(3).map((sc) => { return {sc.name} })}
} >
+ {remainder} more
)}
)}

Available in{" "} {{ availableChannelsCount }} {" "} out of{" "} {{ totalChannelsCount }} {" "} Sales Channels

) } type SalesChannelBadgeProps = { channel: SalesChannel } const SalesChannelBadge: React.FC = ({ channel }) => { return (
{channel.name}
) } export default SalesChannelsDisplay