2023-03-02 09:22:01 +00:00
|
|
|
import HorizontalSpacer from "@dashboard/components/HorizontalSpacer";
|
2023-01-16 09:45:12 +00:00
|
|
|
import { CollectionFragment } from "@dashboard/graphql";
|
|
|
|
import ScrollableContent from "@dashboard/plugins/components/PluginsList/PluginAvailabilityStatusPopup/ScrollableContent";
|
2022-02-17 11:08:17 +00:00
|
|
|
import { Typography } from "@material-ui/core";
|
|
|
|
import { Pill, PillColor } from "@saleor/macaw-ui";
|
|
|
|
import React from "react";
|
2022-03-09 08:56:55 +00:00
|
|
|
import { MessageDescriptor, useIntl } from "react-intl";
|
2022-02-17 11:08:17 +00:00
|
|
|
|
|
|
|
import { messages } from "../ChannelsAvailabilityDropdown/messages";
|
|
|
|
import { useStyles } from "./styles";
|
|
|
|
|
|
|
|
export interface ChannelsAvailabilityMenuContentProps {
|
|
|
|
pills: Pill[];
|
|
|
|
}
|
|
|
|
export interface Pill {
|
2022-03-09 08:56:55 +00:00
|
|
|
channel: CollectionFragment["channelListings"][0]["channel"];
|
2022-02-17 11:08:17 +00:00
|
|
|
color: PillColor;
|
|
|
|
label: MessageDescriptor;
|
|
|
|
}
|
|
|
|
|
2023-03-02 09:22:01 +00:00
|
|
|
export const ChannelsAvailabilityMenuContent: React.FC<
|
|
|
|
ChannelsAvailabilityMenuContentProps
|
|
|
|
> = ({ pills }) => {
|
2022-02-17 11:08:17 +00:00
|
|
|
const intl = useIntl();
|
|
|
|
const classes = useStyles({});
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className={classes.menuContainer}>
|
|
|
|
<div className={classes.row}>
|
|
|
|
<Typography variant="caption" className={classes.caption}>
|
|
|
|
{intl.formatMessage(messages.channel)}
|
|
|
|
</Typography>
|
|
|
|
<Typography variant="caption" className={classes.caption}>
|
|
|
|
{intl.formatMessage(messages.status)}
|
|
|
|
</Typography>
|
|
|
|
</div>
|
|
|
|
<ScrollableContent>
|
|
|
|
{pills.map(pill => (
|
|
|
|
<div key={pill.channel.id} className={classes.row}>
|
|
|
|
<Typography>{pill.channel.name}</Typography>
|
|
|
|
<HorizontalSpacer spacing={4} />
|
|
|
|
<Pill label={intl.formatMessage(pill.label)} color={pill.color} />
|
|
|
|
</div>
|
|
|
|
))}
|
|
|
|
</ScrollableContent>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
ChannelsAvailabilityMenuContent.displayName = "ChannelsAvailabilityMenuContent";
|
|
|
|
export default ChannelsAvailabilityMenuContent;
|