// @flow
import 'scss/component/_comment-selectors.scss';
import { EMOTES_48px as EMOTES } from 'constants/emotes';
import * as ICONS from 'constants/icons';
import Button from 'component/button';
import CreditAmount from 'component/common/credit-amount';
import React from 'react';
import { Tabs, TabList, Tab, TabPanels, TabPanel } from 'component/common/tabs';
import { FREE_GLOBAL_STICKERS, PAID_GLOBAL_STICKERS } from 'constants/stickers';
export const SELECTOR_TABS = {
EMOJI: 0,
STICKER: 1,
};
type Props = {
claimIsMine?: boolean,
openTab?: number,
addEmoteToComment: (string) => void,
handleSelectSticker: (any) => void,
closeSelector?: () => void,
};
export default function CommentSelectors(props: Props) {
const { claimIsMine, openTab, addEmoteToComment, handleSelectSticker, closeSelector } = props;
const tabProps = { closeSelector };
return (
{__('Emojis')}
{__('Stickers')}
addEmoteToComment(emote)} {...tabProps} />
handleSelectSticker(sticker)}
claimIsMine={claimIsMine}
{...tabProps}
/>
);
}
type EmojisProps = {
handleSelect: (emoteName: string) => void,
closeSelector: () => void,
};
const EmojisPanel = (emojisProps: EmojisProps) => {
const { handleSelect, closeSelector } = emojisProps;
return (
{EMOTES.map((emote) => {
const { name, url } = emote;
return (
);
})}
);
};
type StickersProps = {
claimIsMine: any,
handleSelect: (any) => void,
closeSelector: () => void,
};
const StickersPanel = (stickersProps: StickersProps) => {
const { claimIsMine, handleSelect, closeSelector } = stickersProps;
const defaultRowProps = { handleSelect };
return (
{!claimIsMine && }
);
};
type RowProps = {
title: string,
stickers: any,
handleSelect: (string) => void,
};
const StickersRow = (rowProps: RowProps) => {
const { title, stickers, handleSelect } = rowProps;
return (
{stickers.map((sticker) => {
const { price, url, name } = sticker;
return (
);
})}
);
};
type StickerProps = {
price?: number,
children: any,
};
const StickerWrapper = (stickerProps: StickerProps) => {
const { price, children } = stickerProps;
return price ? {children}
: children;
};