lbry-desktop/ui/component/claimCollectionAddButton/view.jsx
Rafael c1b84368a9 Fixes
Rename FileReactions index import

Fix fileAction undefined logic

Fix live comment menu

Fix superchats
2022-02-08 12:35:40 -05:00

41 lines
1.3 KiB
JavaScript

// @flow
import * as MODALS from 'constants/modal_types';
import * as ICONS from 'constants/icons';
import React from 'react';
import Button from 'component/button';
import classnames from 'classnames';
import Tooltip from 'component/common/tooltip';
type Props = {
uri: string,
fileAction?: boolean,
type?: boolean,
// redux
streamType: Claim,
isSaved: boolean,
doOpenModal: (id: string, {}) => void,
};
export default function CollectionAddButton(props: Props) {
const { uri, fileAction, type = 'playlist', isSaved, streamType, doOpenModal } = props;
const isPlayable = streamType === 'video' || streamType === 'audio';
return !isPlayable ? null : (
<Tooltip title={__('Add this claim to a list')} arrow={false}>
<Button
button={!fileAction ? 'alt' : undefined}
className={classnames({ 'button--file-action': fileAction })}
icon={fileAction ? (!isSaved ? ICONS.ADD : ICONS.STACK) : ICONS.LIBRARY}
iconSize={fileAction ? 22 : undefined}
label={uri ? (!isSaved ? __('Save') : __('Saved')) : __('New List')}
requiresAuth
onClick={(e) => {
e.preventDefault();
e.stopPropagation();
doOpenModal(MODALS.COLLECTION_ADD, { uri, type });
}}
/>
</Tooltip>
);
}