import RequirePermissions from "@dashboard/components/RequirePermissions"; import { PermissionEnum } from "@dashboard/graphql"; import { Box, Button, Text } from "@saleor/macaw-ui/next"; import React from "react"; import { useIntl } from "react-intl"; import { DashboardCard } from "../Card"; export interface ChannelsAvailabilityWrapperProps { selectedChannelsCount: number; allChannelsCount: number; children: React.ReactNode; managePermissions: PermissionEnum[]; openModal: () => void; } export const ChannelsAvailabilityCardWrapper: React.FC< ChannelsAvailabilityWrapperProps > = props => { const { selectedChannelsCount, allChannelsCount, children, managePermissions, openModal, } = props; const intl = useIntl(); const channelsAvailabilityText = intl.formatMessage( { id: "AD1PlC", defaultMessage: "In {selectedChannelsCount} out of {allChannelsCount, plural, one {# channel} other {# channels}}", description: "channels availability text", }, { allChannelsCount, selectedChannelsCount, }, ); return (
{intl.formatMessage({ id: "5A6/2C", defaultMessage: "Availability", description: "section header", })}
{!!channelsAvailabilityText && ( {channelsAvailabilityText} )}
{children}
); };