Merge pull request #2119 from lbryio/constants

standardize constant naming/imports
This commit is contained in:
Sean Yesmunt 2018-11-27 13:30:11 -05:00 committed by GitHub
commit 8d0730fb68
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 113 additions and 115 deletions

View file

@ -1,14 +1,10 @@
// @flow // @flow
import * as ICONS from 'constants/icons';
import * as React from 'react'; import * as React from 'react';
import { clipboard } from 'electron'; import { clipboard } from 'electron';
import { FormRow } from 'component/common/form'; import { FormRow } from 'component/common/form';
import Button from 'component/button'; import Button from 'component/button';
import * as icons from 'constants/icons';
/*
noSnackbar added due to issue 1945
https://github.com/lbryio/lbry-desktop/issues/1945
"Snackbars and modals can't be displayed at the same time"
*/
type Props = { type Props = {
address: string, address: string,
doToast: ({ message: string }) => void, doToast: ({ message: string }) => void,
@ -44,7 +40,7 @@ export default class Address extends React.PureComponent<Props> {
<Button <Button
noPadding noPadding
button="secondary" button="secondary"
icon={icons.CLIPBOARD} icon={ICONS.CLIPBOARD}
onClick={() => { onClick={() => {
clipboard.writeText(address); clipboard.writeText(address);
doToast({ doToast({

View file

@ -1,7 +1,7 @@
// @flow // @flow
import * as ICONS from 'constants/icons';
import React from 'react'; import React from 'react';
import Button from 'component/button'; import Button from 'component/button';
import * as icons from 'constants/icons';
let scriptLoading = false; let scriptLoading = false;
let scriptLoaded = false; let scriptLoaded = false;
@ -159,7 +159,7 @@ class CardVerify extends React.Component {
<Button <Button
button="primary" button="primary"
label={this.props.label} label={this.props.label}
icon={icons.LOCK} icon={ICONS.LOCK}
disabled={this.props.disabled || this.state.open || this.hasPendingClick} disabled={this.props.disabled || this.state.open || this.hasPendingClick}
onClick={this.onClick.bind(this)} onClick={this.onClick.bind(this)}
/> />

View file

@ -1,11 +1,11 @@
// @flow // @flow
import type { Claim } from 'types/claim'; import type { Claim } from 'types/claim';
import React, { PureComponent } from 'react'; import * as ICONS from 'constants/icons';
import * as React from 'react';
import { normalizeURI } from 'lbry-redux'; import { normalizeURI } from 'lbry-redux';
import ToolTip from 'component/common/tooltip'; import ToolTip from 'component/common/tooltip';
import FileCard from 'component/fileCard'; import FileCard from 'component/fileCard';
import Button from 'component/button'; import Button from 'component/button';
import * as icons from 'constants/icons';
import SubscribeButton from 'component/subscribeButton'; import SubscribeButton from 'component/subscribeButton';
type Props = { type Props = {
@ -239,13 +239,13 @@ class CategoryList extends PureComponent<Props, State> {
className="btn--arrow" className="btn--arrow"
disabled={!canScrollPrevious} disabled={!canScrollPrevious}
onClick={this.handleScrollPrevious} onClick={this.handleScrollPrevious}
icon={icons.ARROW_LEFT} icon={ICONS.ARROW_LEFT}
/> />
<Button <Button
className="btn--arrow" className="btn--arrow"
disabled={!canScrollNext} disabled={!canScrollNext}
onClick={this.handleScrollNext} onClick={this.handleScrollNext}
icon={icons.ARROW_RIGHT} icon={ICONS.ARROW_RIGHT}
/> />
</div> </div>
)} )}

View file

@ -1,10 +1,10 @@
// @flow // @flow
import * as ICONS from 'constants/icons';
import fs from 'fs'; import fs from 'fs';
import path from 'path'; import path from 'path';
import React from 'react'; import React from 'react';
import Button from 'component/button'; import Button from 'component/button';
import parseData from 'util/parse-data'; import parseData from 'util/parse-data';
import * as icons from 'constants/icons';
import { remote } from 'electron'; import { remote } from 'electron';
type Props = { type Props = {
@ -77,7 +77,7 @@ class FileExporter extends React.PureComponent<Props> {
return ( return (
<Button <Button
button="primary" button="primary"
icon={icons.DOWNLOAD} icon={ICONS.DOWNLOAD}
label={label || __('Export')} label={label || __('Export')}
onClick={this.handleButtonClick} onClick={this.handleButtonClick}
/> />

View file

@ -1,7 +1,7 @@
// @flow // @flow
import * as ICONS from 'constants/icons';
import React from 'react'; import React from 'react';
import * as FeatherIcons from 'react-feather'; import * as FeatherIcons from 'react-feather';
import * as icons from 'constants/icons';
import Tooltip from 'component/common/tooltip'; import Tooltip from 'component/common/tooltip';
// It would be nice to standardize this somehow // It would be nice to standardize this somehow
@ -20,9 +20,9 @@ type Props = {
class IconComponent extends React.PureComponent<Props> { class IconComponent extends React.PureComponent<Props> {
getTooltip = (icon: string) => { getTooltip = (icon: string) => {
switch (icon) { switch (icon) {
case icons.FEATURED: case ICONS.FEATURED:
return __('Featured content. Earn rewards for watching.'); return __('Featured content. Earn rewards for watching.');
case icons.LOCAL: case ICONS.LOCAL:
return __('This file is downloaded.'); return __('This file is downloaded.');
default: default:
return null; return null;
@ -56,8 +56,8 @@ class IconComponent extends React.PureComponent<Props> {
} }
let iconSize = size || 14; let iconSize = size || 14;
// Arrow icons are quite a bit smaller than the other icons we use // Arrow ICONS are quite a bit smaller than the other ICONS we use
if (icon === icons.ARROW_LEFT || icon === icons.ARROW_RIGHT) { if (icon === ICONS.ARROW_LEFT || icon === ICONS.ARROW_RIGHT) {
iconSize = 20; iconSize = 20;
} }

View file

@ -1,9 +1,9 @@
// @flow // @flow
import * as ICONS from 'constants/icons';
import * as React from 'react'; import * as React from 'react';
import { clipboard } from 'electron'; import { clipboard } from 'electron';
import { FormRow } from 'component/common/form'; import { FormRow } from 'component/common/form';
import Button from 'component/button'; import Button from 'component/button';
import * as icons from 'constants/icons';
type Props = { type Props = {
copyable: string, copyable: string,
@ -41,7 +41,7 @@ export default class CopyableText extends React.PureComponent<Props> {
<Button <Button
noPadding noPadding
button="secondary" button="secondary"
icon={icons.CLIPBOARD} icon={ICONS.CLIPBOARD}
onClick={() => { onClick={() => {
clipboard.writeText(copyable); clipboard.writeText(copyable);
doToast({ doToast({

View file

@ -1,12 +1,12 @@
// @flow // @flow
import type { Claim, Metadata } from 'types/claim';
import * as ICONS from 'constants/icons';
import * as React from 'react'; import * as React from 'react';
import { normalizeURI, convertToShareLink } from 'lbry-redux'; import { normalizeURI, convertToShareLink } from 'lbry-redux';
import type { Claim, Metadata } from 'types/claim';
import CardMedia from 'component/cardMedia'; import CardMedia from 'component/cardMedia';
import TruncatedText from 'component/common/truncated-text'; import TruncatedText from 'component/common/truncated-text';
import Icon from 'component/common/icon'; import Icon from 'component/common/icon';
import UriIndicator from 'component/uriIndicator'; import UriIndicator from 'component/uriIndicator';
import * as icons from 'constants/icons';
import classnames from 'classnames'; import classnames from 'classnames';
import FilePrice from 'component/filePrice'; import FilePrice from 'component/filePrice';
import { openCopyLinkMenu } from 'util/context-menu'; import { openCopyLinkMenu } from 'util/context-menu';
@ -119,9 +119,9 @@ class FileCard extends React.PureComponent<Props> {
<div className="card__file-properties"> <div className="card__file-properties">
<FilePrice hideFree uri={uri} /> <FilePrice hideFree uri={uri} />
{isRewardContent && <Icon iconColor="red" icon={icons.FEATURED} />} {isRewardContent && <Icon iconColor="red" icon={ICONS.FEATURED} />}
{showSubscribedLogo && isSubscribed && <Icon icon={icons.HEART} />} {showSubscribedLogo && isSubscribed && <Icon icon={ICONS.HEART} />}
{fileInfo && <Icon icon={icons.LOCAL} />} {fileInfo && <Icon icon={ICONS.LOCAL} />}
</div> </div>
</div> </div>
{isNew && ( {isNew && (

View file

@ -1,10 +1,10 @@
// @flow // @flow
import type { Claim } from 'types/claim';
import * as ICONS from 'constants/icons';
import React from 'react'; import React from 'react';
import Button from 'component/button'; import Button from 'component/button';
import * as icons from 'constants/icons';
import ToolTip from 'component/common/tooltip'; import ToolTip from 'component/common/tooltip';
import analytics from 'analytics'; import analytics from 'analytics';
import type { Claim } from 'types/claim';
type Props = { type Props = {
claim: Claim, claim: Claim,
@ -80,7 +80,7 @@ class FileDownloadLink extends React.PureComponent<Props> {
<ToolTip onComponent body={__('Download')}> <ToolTip onComponent body={__('Download')}>
<Button <Button
button="alt" button="alt"
icon={icons.DOWNLOAD} icon={ICONS.DOWNLOAD}
iconColor="green" iconColor="green"
onClick={() => { onClick={() => {
purchaseUri(uri); purchaseUri(uri);
@ -97,7 +97,7 @@ class FileDownloadLink extends React.PureComponent<Props> {
} else if (fileInfo && fileInfo.download_path) { } else if (fileInfo && fileInfo.download_path) {
return ( return (
<ToolTip onComponent body={__('Open file')}> <ToolTip onComponent body={__('Open file')}>
<Button button="alt" iconColor="green" icon={icons.LOCAL} onClick={() => openFile()} /> <Button button="alt" iconColor="green" icon={ICONS.LOCAL} onClick={() => openFile()} />
</ToolTip> </ToolTip>
); );
} }

View file

@ -1,7 +1,7 @@
// @flow // @flow
import * as React from 'react';
import * as icons from 'constants/icons';
import type { Claim, Metadata } from 'types/claim'; import type { Claim, Metadata } from 'types/claim';
import * as ICONS from 'constants/icons';
import * as React from 'react';
import { normalizeURI, parseURI } from 'lbry-redux'; import { normalizeURI, parseURI } from 'lbry-redux';
import CardMedia from 'component/cardMedia'; import CardMedia from 'component/cardMedia';
import TruncatedText from 'component/common/truncated-text'; import TruncatedText from 'component/common/truncated-text';
@ -55,9 +55,9 @@ class FileTile extends React.PureComponent<Props> {
return ( return (
<div className={classnames('card__file-properties', { card__subtitle: size === 'large' })}> <div className={classnames('card__file-properties', { card__subtitle: size === 'large' })}>
<FilePrice hideFree uri={uri} /> <FilePrice hideFree uri={uri} />
{isSubscribed && <Icon icon={icons.HEART} />} {isSubscribed && <Icon icon={ICONS.HEART} />}
{isRewardContent && <Icon iconColor="red" icon={icons.FEATURED} />} {isRewardContent && <Icon iconColor="red" icon={ICONS.FEATURED} />}
{isDownloaded && <Icon icon={icons.LOCAL} />} {isDownloaded && <Icon icon={ICONS.LOCAL} />}
</div> </div>
); );
} }

View file

@ -1,7 +1,7 @@
// @flow // @flow
import * as ICONS from 'constants/icons';
import React from 'react'; import React from 'react';
import Button from 'component/button'; import Button from 'component/button';
import * as icons from 'constants/icons';
type Props = { type Props = {
play: () => void, play: () => void,
@ -15,7 +15,7 @@ class VideoPlayButton extends React.PureComponent<Props> {
const { fileInfo, mediaType, isLoading, play } = this.props; const { fileInfo, mediaType, isLoading, play } = this.props;
const disabled = isLoading || fileInfo === undefined; const disabled = isLoading || fileInfo === undefined;
const doesPlayback = ['audio', 'video'].indexOf(mediaType) !== -1; const doesPlayback = ['audio', 'video'].indexOf(mediaType) !== -1;
const icon = doesPlayback ? icons.PLAY : icons.EYE; const icon = doesPlayback ? ICONS.PLAY : ICONS.EYE;
const label = doesPlayback ? __('Play') : __('View'); const label = doesPlayback ? __('Play') : __('View');
return <Button button="primary" disabled={disabled} label={label} icon={icon} onClick={play} />; return <Button button="primary" disabled={disabled} label={label} icon={icon} onClick={play} />;

View file

@ -1,8 +1,8 @@
// @flow // @flow
import * as ICONS from 'constants/icons';
import * as React from 'react'; import * as React from 'react';
import Button from 'component/button'; import Button from 'component/button';
import WunderBar from 'component/wunderbar'; import WunderBar from 'component/wunderbar';
import * as icons from 'constants/icons';
type Props = { type Props = {
autoUpdateDownloaded: boolean, autoUpdateDownloaded: boolean,
@ -40,7 +40,7 @@ const Header = (props: Props) => {
<Button <Button
noPadding noPadding
button="alt" button="alt"
icon={icons.HOME} icon={ICONS.HOME}
className="btn--home-nav" className="btn--home-nav"
description={__('Home')} description={__('Home')}
onClick={() => navigate('/discover')} onClick={() => navigate('/discover')}
@ -48,14 +48,14 @@ const Header = (props: Props) => {
<div className="header__history"> <div className="header__history">
<Button <Button
className="btn--arrow" className="btn--arrow"
icon={icons.ARROW_LEFT} icon={ICONS.ARROW_LEFT}
description={__('Navigate back')} description={__('Navigate back')}
onClick={back} onClick={back}
disabled={isBackDisabled} disabled={isBackDisabled}
/> />
<Button <Button
className="btn--arrow" className="btn--arrow"
icon={icons.ARROW_RIGHT} icon={ICONS.ARROW_RIGHT}
description={__('Navigate forward')} description={__('Navigate forward')}
onClick={forward} onClick={forward}
disabled={isForwardDisabled} disabled={isForwardDisabled}
@ -89,7 +89,7 @@ const Header = (props: Props) => {
button="primary" button="primary"
className="btn--header-publish" className="btn--header-publish"
onClick={() => navigate('/publish')} onClick={() => navigate('/publish')}
icon={icons.UPLOAD} icon={ICONS.UPLOAD}
label={isUpgradeAvailable ? '' : __('Publish')} label={isUpgradeAvailable ? '' : __('Publish')}
description={__('Publish content')} description={__('Publish content')}
/> />
@ -98,7 +98,7 @@ const Header = (props: Props) => {
<Button <Button
button="primary" button="primary"
onClick={downloadUpgradeRequested} onClick={downloadUpgradeRequested}
icon={icons.DOWNLOAD} icon={ICONS.DOWNLOAD}
label={__('Upgrade App')} label={__('Upgrade App')}
/> />
)} )}

View file

@ -1,9 +1,9 @@
// @flow // @flow
import * as ICONS from 'constants/icons';
import React from 'react'; import React from 'react';
import Icon from 'component/common/icon'; import Icon from 'component/common/icon';
import RewardLink from 'component/rewardLink'; import RewardLink from 'component/rewardLink';
import { rewards } from 'lbryinc'; import { rewards } from 'lbryinc';
import * as icons from 'constants/icons';
type Props = { type Props = {
invitees: ?Array<{ invitees: ?Array<{
@ -46,14 +46,14 @@ class InviteList extends React.PureComponent<Props> {
<td>{invitee.email}</td> <td>{invitee.email}</td>
<td className="text-center"> <td className="text-center">
{invitee.invite_accepted ? ( {invitee.invite_accepted ? (
<Icon icon={icons.CHECK} /> <Icon icon={ICONS.CHECK} />
) : ( ) : (
<span className="empty">{__('unused')}</span> <span className="empty">{__('unused')}</span>
)} )}
</td> </td>
<td className="text-center"> <td className="text-center">
{invitee.invite_reward_claimed ? ( {invitee.invite_reward_claimed ? (
<Icon icon={icons.CHECK} /> <Icon icon={ICONS.CHECK} />
) : invitee.invite_reward_claimable ? ( ) : invitee.invite_reward_claimable ? (
<RewardLink label={__('claim')} reward_type={rewards.TYPE_REFERRAL} /> <RewardLink label={__('claim')} reward_type={rewards.TYPE_REFERRAL} />
) : ( ) : (

View file

@ -1,17 +1,17 @@
// @flow // @flow
import type { Claim } from 'types/claim';
import type { PublishParams, UpdatePublishFormData } from 'redux/reducers/publish';
import { COPYRIGHT, OTHER } from 'constants/licenses';
import { CHANNEL_NEW, CHANNEL_ANONYMOUS, MINIMUM_PUBLISH_BID } from 'constants/claim';
import * as ICONS from 'constants/icons';
import * as React from 'react'; import * as React from 'react';
import { isNameValid, buildURI, regexInvalidURI, THUMBNAIL_STATUSES } from 'lbry-redux'; import { isNameValid, buildURI, regexInvalidURI, THUMBNAIL_STATUSES } from 'lbry-redux';
import { Form, FormField, FormRow, FormFieldPrice, Submit } from 'component/common/form'; import { Form, FormField, FormRow, FormFieldPrice, Submit } from 'component/common/form';
import Button from 'component/button'; import Button from 'component/button';
import ChannelSection from 'component/selectChannel'; import ChannelSection from 'component/selectChannel';
import classnames from 'classnames'; import classnames from 'classnames';
import type { PublishParams, UpdatePublishFormData } from 'redux/reducers/publish';
import FileSelector from 'component/common/file-selector'; import FileSelector from 'component/common/file-selector';
import SelectThumbnail from 'component/selectThumbnail'; import SelectThumbnail from 'component/selectThumbnail';
import { COPYRIGHT, OTHER } from 'constants/licenses';
import { CHANNEL_NEW, CHANNEL_ANONYMOUS, MINIMUM_PUBLISH_BID } from 'constants/claim';
import * as icons from 'constants/icons';
import type { Claim } from 'types/claim';
import BidHelpText from './internal/bid-help-text'; import BidHelpText from './internal/bid-help-text';
import NameHelpText from './internal/name-help-text'; import NameHelpText from './internal/name-help-text';
import LicenseType from './internal/license-type'; import LicenseType from './internal/license-type';
@ -354,7 +354,7 @@ class PublishForm extends React.PureComponent<Props> {
<div className="card__actions-top-corner"> <div className="card__actions-top-corner">
<Button <Button
button="inverse" button="inverse"
icon={icons.CLOSE} icon={ICONS.CLOSE}
label={__('Clear')} label={__('Clear')}
onClick={clearPublish} onClick={clearPublish}
/> />

View file

@ -1,10 +1,10 @@
// @flow // @flow
import * as ICONS from 'constants/icons';
import React from 'react'; import React from 'react';
import Icon from 'component/common/icon'; import Icon from 'component/common/icon';
import RewardLink from 'component/rewardLink'; import RewardLink from 'component/rewardLink';
import Button from 'component/button'; import Button from 'component/button';
import { rewards } from 'lbryinc'; import { rewards } from 'lbryinc';
import * as icons from 'constants/icons';
type Props = { type Props = {
openRewardCodeModal: () => void, openRewardCodeModal: () => void,
@ -37,7 +37,7 @@ const RewardTile = (props: Props) => {
{reward.reward_type !== rewards.TYPE_REFERRAL && {reward.reward_type !== rewards.TYPE_REFERRAL &&
(claimed ? ( (claimed ? (
<span> <span>
<Icon icon={icons.CHECK} /> {__('Reward claimed.')} <Icon icon={ICONS.CHECK} /> {__('Reward claimed.')}
</span> </span>
) : ( ) : (
<RewardLink button reward_type={reward.reward_type} /> <RewardLink button reward_type={reward.reward_type} />

View file

@ -1,8 +1,8 @@
// @flow // @flow
import React from 'react';
import type { Claim } from 'types/claim'; import type { Claim } from 'types/claim';
import * as ICONS from 'constants/icons';
import React from 'react';
import Button from 'component/button'; import Button from 'component/button';
import * as icons from 'constants/icons';
import CopyableText from 'component/copyableText'; import CopyableText from 'component/copyableText';
import ToolTip from 'component/common/tooltip'; import ToolTip from 'component/common/tooltip';
@ -65,7 +65,7 @@ class SocialShare extends React.PureComponent<Props> {
<ToolTip onComponent body={__('Facebook')}> <ToolTip onComponent body={__('Facebook')}>
<Button <Button
iconColor="blue" iconColor="blue"
icon={icons.FACEBOOK} icon={ICONS.FACEBOOK}
button="alt" button="alt"
label={__('')} label={__('')}
href={`https://facebook.com/sharer/sharer.php?u=${speechURL}`} href={`https://facebook.com/sharer/sharer.php?u=${speechURL}`}
@ -74,7 +74,7 @@ class SocialShare extends React.PureComponent<Props> {
<ToolTip onComponent body={__('Twitter')}> <ToolTip onComponent body={__('Twitter')}>
<Button <Button
iconColor="blue" iconColor="blue"
icon={icons.TWITTER} icon={ICONS.TWITTER}
button="alt" button="alt"
label={__('')} label={__('')}
href={`https://twitter.com/home?status=${speechURL}`} href={`https://twitter.com/home?status=${speechURL}`}
@ -82,7 +82,7 @@ class SocialShare extends React.PureComponent<Props> {
</ToolTip> </ToolTip>
<ToolTip onComponent body={__('View on Spee.ch')}> <ToolTip onComponent body={__('View on Spee.ch')}>
<Button <Button
icon={icons.GLOBE} icon={ICONS.GLOBE}
iconColor="blue" iconColor="blue"
button="alt" button="alt"
label={__('')} label={__('')}
@ -99,7 +99,7 @@ class SocialShare extends React.PureComponent<Props> {
<ToolTip onComponent body={__('Facebook')}> <ToolTip onComponent body={__('Facebook')}>
<Button <Button
iconColor="blue" iconColor="blue"
icon={icons.FACEBOOK} icon={ICONS.FACEBOOK}
button="alt" button="alt"
label={__('')} label={__('')}
href={`https://facebook.com/sharer/sharer.php?u=${lbryURL}`} href={`https://facebook.com/sharer/sharer.php?u=${lbryURL}`}
@ -108,7 +108,7 @@ class SocialShare extends React.PureComponent<Props> {
<ToolTip onComponent body={__('Twitter')}> <ToolTip onComponent body={__('Twitter')}>
<Button <Button
iconColor="blue" iconColor="blue"
icon={icons.TWITTER} icon={ICONS.TWITTER}
button="alt" button="alt"
label={__('')} label={__('')}
href={`https://twitter.com/home?status=${lbryURL}`} href={`https://twitter.com/home?status=${lbryURL}`}

View file

@ -1,7 +1,7 @@
// @flow // @flow
import * as ICONS from 'constants/icons';
import React, { Fragment } from 'react'; import React, { Fragment } from 'react';
import Icon from 'component/common/icon'; import Icon from 'component/common/icon';
import * as icons from 'constants/icons';
import Spinner from 'component/spinner'; import Spinner from 'component/spinner';
import Button from 'component/button'; import Button from 'component/button';
@ -52,7 +52,7 @@ class LoadScreen extends React.PureComponent<Props> {
<Fragment> <Fragment>
{isWarning ? ( {isWarning ? (
<span className="load-screen__message"> <span className="load-screen__message">
<Icon size={20} icon={icons.ALERT} /> <Icon size={20} icon={ICONS.ALERT} />
{` ${message}`} {` ${message}`}
</span> </span>
) : ( ) : (

View file

@ -1,4 +1,6 @@
// @flow // @flow
import type { Transaction } from '../view';
import * as ICONS from 'constants/icons';
import React from 'react'; import React from 'react';
import ButtonTransaction from 'component/common/transaction-link'; import ButtonTransaction from 'component/common/transaction-link';
import CreditAmount from 'component/common/credit-amount'; import CreditAmount from 'component/common/credit-amount';
@ -6,8 +8,6 @@ import DateTime from 'component/dateTime';
import Button from 'component/button'; import Button from 'component/button';
import { buildURI } from 'lbry-redux'; import { buildURI } from 'lbry-redux';
import * as txnTypes from 'constants/transaction_types'; import * as txnTypes from 'constants/transaction_types';
import * as ICONS from 'constants/icons';
import type { Transaction } from '../view';
type Props = { type Props = {
transaction: Transaction, transaction: Transaction,

View file

@ -101,7 +101,7 @@ class TransactionList extends React.PureComponent<Props> {
postfix={ postfix={
<Button <Button
button="link" button="link"
icon={icons.HELP} icon={ICONS.HELP}
href="https://lbry.io/faq/transaction-types" href="https://lbry.io/faq/transaction-types"
title={__('Help')} title={__('Help')}
/> />

View file

@ -1,10 +1,10 @@
// @flow // @flow
import type { Transaction } from 'component/transactionList/view'; import type { Transaction } from 'component/transactionList/view';
import * as ICONS from 'constants/icons';
import React, { Fragment } from 'react'; import React, { Fragment } from 'react';
import BusyIndicator from 'component/common/busy-indicator'; import BusyIndicator from 'component/common/busy-indicator';
import Button from 'component/button'; import Button from 'component/button';
import TransactionList from 'component/transactionList'; import TransactionList from 'component/transactionList';
import * as icons from 'constants/icons';
import RefreshTransactionButton from 'component/transactionRefreshButton'; import RefreshTransactionButton from 'component/transactionRefreshButton';
type Props = { type Props = {
@ -53,7 +53,7 @@ class TransactionListRecent extends React.PureComponent<Props> {
button="primary" button="primary"
navigate="/history" navigate="/history"
label={__('Full History')} label={__('Full History')}
icon={icons.CLOCK} icon={ICONS.CLOCK}
/> />
</div> </div>
</Fragment> </Fragment>

View file

@ -1,9 +1,9 @@
// @flow // @flow
import * as ICONS from 'constants/icons';
import * as React from 'react'; import * as React from 'react';
import Button from 'component/button'; import Button from 'component/button';
import CardVerify from 'component/cardVerify'; import CardVerify from 'component/cardVerify';
import { Lbryio } from 'lbryinc'; import { Lbryio } from 'lbryinc';
import * as icons from 'constants/icons';
type Props = { type Props = {
errorMessage: ?string, errorMessage: ?string,
@ -43,7 +43,9 @@ class UserVerify extends React.PureComponent<Props> {
<p className="card__content"> <p className="card__content">
{`${__( {`${__(
'If you have a valid credit or debit card, you can use it to instantly prove your humanity.' 'If you have a valid credit or debit card, you can use it to instantly prove your humanity.'
)} ${__('LBRY does not store your credit card information. There is no charge at all for this, now or in the future.')} `} )} ${__(
'LBRY does not store your credit card information. There is no charge at all for this, now or in the future.'
)} `}
</p> </p>
<div className="card__actions"> <div className="card__actions">
{errorMessage && <p className="form-field__error">{errorMessage}</p>} {errorMessage && <p className="form-field__error">{errorMessage}</p>}
@ -78,7 +80,7 @@ class UserVerify extends React.PureComponent<Props> {
verifyPhone(); verifyPhone();
}} }}
button="primary" button="primary"
icon={icons.PHONE} icon={ICONS.PHONE}
label={__('Submit Phone Number')} label={__('Submit Phone Number')}
/> />
</div> </div>
@ -107,7 +109,7 @@ class UserVerify extends React.PureComponent<Props> {
<Button <Button
href="https://chat.lbry.io" href="https://chat.lbry.io"
button="primary" button="primary"
icon={icons.MESSAGE} icon={ICONS.MESSAGE}
label={__('Join LBRY Chat')} label={__('Join LBRY Chat')}
/> />
</div> </div>

View file

@ -1,6 +1,6 @@
// @flow // @flow
import * as ICONS from 'constants/icons';
import React from 'react'; import React from 'react';
import * as icons from 'constants/icons';
import Button from 'component/button'; import Button from 'component/button';
type Props = { type Props = {
@ -16,7 +16,7 @@ export default (props: Props) => {
return claimId && claimName ? ( return claimId && claimName ? (
<Button <Button
icon={icons.GLOBE} icon={ICONS.GLOBE}
button="alt" button="alt"
label={__('Share')} label={__('Share')}
href={`https://spee.ch/${speechURL}`} href={`https://spee.ch/${speechURL}`}

View file

@ -1,9 +1,9 @@
// @flow // @flow
import * as ICONS from 'constants/icons';
import React from 'react'; import React from 'react';
import Button from 'component/button'; import Button from 'component/button';
import Address from 'component/address'; import Address from 'component/address';
import QRCode from 'component/common/qr-code'; import QRCode from 'component/common/qr-code';
import * as icons from 'constants/icons';
type Props = { type Props = {
checkAddressIsMine: string => void, checkAddressIsMine: string => void,
@ -63,7 +63,7 @@ class WalletAddress extends React.PureComponent<Props, State> {
<Button <Button
button="primary" button="primary"
label={__('Get New Address')} label={__('Get New Address')}
icon={icons.REFRESH} icon={ICONS.REFRESH}
onClick={getNewAddress} onClick={getNewAddress}
disabled={gettingNewAddress} disabled={gettingNewAddress}
/> />

View file

@ -1,10 +1,10 @@
// @flow // @flow
import * as ICONS from 'constants/icons';
import React from 'react'; import React from 'react';
import classnames from 'classnames'; import classnames from 'classnames';
import { normalizeURI, SEARCH_TYPES, isURIValid } from 'lbry-redux'; import { normalizeURI, SEARCH_TYPES, isURIValid } from 'lbry-redux';
import Icon from 'component/common/icon'; import Icon from 'component/common/icon';
import { parseQueryParams } from 'util/query-params'; import { parseQueryParams } from 'util/query-params';
import * as icons from 'constants/icons';
import Autocomplete from './internal/autocomplete'; import Autocomplete from './internal/autocomplete';
const L_KEY_CODE = 76; const L_KEY_CODE = 76;
@ -43,11 +43,11 @@ class WunderBar extends React.PureComponent<Props> {
getSuggestionIcon = (type: string) => { getSuggestionIcon = (type: string) => {
switch (type) { switch (type) {
case 'file': case 'file':
return icons.LOCAL; return ICONS.LOCAL;
case 'channel': case 'channel':
return icons.AT_SIGN; return ICONS.AT_SIGN;
default: default:
return icons.SEARCH; return ICONS.SEARCH;
} }
}; };
@ -138,7 +138,7 @@ class WunderBar extends React.PureComponent<Props> {
return ( return (
<div className="wunderbar"> <div className="wunderbar">
<Icon icon={icons.SEARCH} /> <Icon icon={ICONS.SEARCH} />
<Autocomplete <Autocomplete
autoHighlight autoHighlight
wrapperStyle={{ flex: 1, position: 'relative' }} wrapperStyle={{ flex: 1, position: 'relative' }}

View file

@ -1,4 +1,7 @@
// @flow // @flow
import type { Claim } from 'types/claim';
import * as ICONS from 'constants/icons';
import * as MODALS from 'constants/modal_types';
import React from 'react'; import React from 'react';
import BusyIndicator from 'component/common/busy-indicator'; import BusyIndicator from 'component/common/busy-indicator';
import { FormField, FormRow } from 'component/common/form'; import { FormField, FormRow } from 'component/common/form';
@ -7,10 +10,7 @@ import SubscribeButton from 'component/subscribeButton';
import Page from 'component/page'; import Page from 'component/page';
import FileList from 'component/fileList'; import FileList from 'component/fileList';
import HiddenNsfwClaims from 'component/hiddenNsfwClaims'; import HiddenNsfwClaims from 'component/hiddenNsfwClaims';
import type { Claim } from 'types/claim';
import Button from 'component/button'; import Button from 'component/button';
import { MODALS } from 'lbry-redux';
import * as icons from 'constants/icons';
type Props = { type Props = {
uri: string, uri: string,
@ -101,7 +101,7 @@ class ChannelPage extends React.PureComponent<Props> {
<SubscribeButton uri={`lbry://${permanentUrl}`} /> <SubscribeButton uri={`lbry://${permanentUrl}`} />
<Button <Button
button="alt" button="alt"
icon={icons.GLOBE} icon={ICONS.GLOBE}
label={__('Share Channel')} label={__('Share Channel')}
onClick={() => onClick={() =>
openModal( openModal(

View file

@ -1,9 +1,10 @@
// @flow // @flow
import type { Claim, Metadata } from 'types/claim'; import type { Claim, Metadata } from 'types/claim';
import type { FileInfo } from 'types/file_info'; import type { FileInfo } from 'types/file_info';
import * as MODALS from 'constants/modal_types';
import * as ICONS from 'constants/icons';
import * as React from 'react'; import * as React from 'react';
import * as settings from 'constants/settings'; import * as settings from 'constants/settings';
import * as MODALS from 'constants/modal_types';
import { buildURI, normalizeURI } from 'lbry-redux'; import { buildURI, normalizeURI } from 'lbry-redux';
import FileViewer from 'component/fileViewer'; import FileViewer from 'component/fileViewer';
import Thumbnail from 'component/common/thumbnail'; import Thumbnail from 'component/common/thumbnail';
@ -13,7 +14,6 @@ import FileActions from 'component/fileActions';
import UriIndicator from 'component/uriIndicator'; import UriIndicator from 'component/uriIndicator';
import Icon from 'component/common/icon'; import Icon from 'component/common/icon';
import DateTime from 'component/dateTime'; import DateTime from 'component/dateTime';
import * as icons from 'constants/icons';
import Button from 'component/button'; import Button from 'component/button';
import SubscribeButton from 'component/subscribeButton'; import SubscribeButton from 'component/subscribeButton';
import Page from 'component/page'; import Page from 'component/page';
@ -183,9 +183,9 @@ class FilePage extends React.Component<Props> {
<div className="card__content"> <div className="card__content">
<div className="card--space-between"> <div className="card--space-between">
<h1>{title}</h1> <h1>{title}</h1>
<div className="card__title-identity-icons"> <div className="card__title-identity-ICONS">
{isRewardContent && ( {isRewardContent && (
<Icon size={20} iconColor="red" tooltip="bottom" icon={icons.FEATURED} /> <Icon size={20} iconColor="red" tooltip="bottom" icon={ICONS.FEATURED} />
)} )}
<FilePrice badge uri={normalizeURI(uri)} /> <FilePrice badge uri={normalizeURI(uri)} />
</div> </div>
@ -200,7 +200,7 @@ class FilePage extends React.Component<Props> {
{claimIsMine ? ( {claimIsMine ? (
<Button <Button
button="primary" button="primary"
icon={icons.EDIT} icon={ICONS.EDIT}
label={__('Edit')} label={__('Edit')}
onClick={() => { onClick={() => {
prepareEdit(claim, editUri); prepareEdit(claim, editUri);
@ -213,14 +213,14 @@ class FilePage extends React.Component<Props> {
{!claimIsMine && ( {!claimIsMine && (
<Button <Button
button="alt" button="alt"
icon={icons.GIFT} icon={ICONS.GIFT}
label={__('Send a tip')} label={__('Send a tip')}
onClick={() => openModal(MODALS.SEND_TIP, { uri })} onClick={() => openModal(MODALS.SEND_TIP, { uri })}
/> />
)} )}
<Button <Button
button="alt" button="alt"
icon={icons.GLOBE} icon={ICONS.GLOBE}
label={__('Share')} label={__('Share')}
onClick={() => openModal(MODALS.SOCIAL_SHARE, { uri, speechShareable })} onClick={() => openModal(MODALS.SOCIAL_SHARE, { uri, speechShareable })}
/> />

View file

@ -1,5 +1,6 @@
// @TODO: Customize advice based on OS // @TODO: Customize advice based on OS
// @flow // @flow
import * as ICONS from 'constants/icons';
import * as React from 'react'; import * as React from 'react';
import { shell } from 'electron'; import { shell } from 'electron';
import { Lbry } from 'lbry-redux'; import { Lbry } from 'lbry-redux';
@ -7,7 +8,6 @@ import Native from 'native';
import Button from 'component/button'; import Button from 'component/button';
import BusyIndicator from 'component/common/busy-indicator'; import BusyIndicator from 'component/common/busy-indicator';
import Page from 'component/page'; import Page from 'component/page';
import * as icons from 'constants/icons';
type DeamonSettings = { type DeamonSettings = {
data_dir: string | any, data_dir: string | any,
@ -126,7 +126,7 @@ class HelpPage extends React.PureComponent<Props, State> {
<Button <Button
href="https://lbry.io/faq" href="https://lbry.io/faq"
label={__('Read the FAQ')} label={__('Read the FAQ')}
icon={icons.HELP} icon={ICONS.HELP}
button="primary" button="primary"
/> />
</div> </div>
@ -142,7 +142,7 @@ class HelpPage extends React.PureComponent<Props, State> {
<Button <Button
button="primary" button="primary"
label={__('Join Our Chat')} label={__('Join Our Chat')}
icon={icons.MESSAGE} icon={ICONS.MESSAGE}
href="https://chat.lbry.io" href="https://chat.lbry.io"
/> />
</div> </div>
@ -158,13 +158,13 @@ class HelpPage extends React.PureComponent<Props, State> {
<Button <Button
button="primary" button="primary"
label={__('Open Log')} label={__('Open Log')}
icon={icons.REPORT} icon={ICONS.REPORT}
onClick={() => this.openLogFile(dataDirectory)} onClick={() => this.openLogFile(dataDirectory)}
/> />
<Button <Button
button="primary" button="primary"
label={__('Open Log Folder')} label={__('Open Log Folder')}
icon={icons.REPORT} icon={ICONS.REPORT}
onClick={() => shell.openItem(dataDirectory)} onClick={() => shell.openItem(dataDirectory)}
/> />
</div> </div>
@ -180,7 +180,7 @@ class HelpPage extends React.PureComponent<Props, State> {
<Button <Button
navigate="/report" navigate="/report"
label={__('Submit a Bug Report/Feature Request')} label={__('Submit a Bug Report/Feature Request')}
icon={icons.REPORT} icon={ICONS.REPORT}
button="primary" button="primary"
/> />
</div> </div>

View file

@ -1,6 +1,7 @@
// @flow // @flow
import * as ICONS from 'constants/icons';
import * as SETTINGS from 'constants/settings';
import * as React from 'react'; import * as React from 'react';
import * as settings from 'constants/settings';
import { isURIValid, normalizeURI, parseURI } from 'lbry-redux'; import { isURIValid, normalizeURI, parseURI } from 'lbry-redux';
import { FormField, FormRow } from 'component/common/form'; import { FormField, FormRow } from 'component/common/form';
import FileTile from 'component/fileTile'; import FileTile from 'component/fileTile';
@ -9,7 +10,6 @@ import FileListSearch from 'component/fileListSearch';
import Page from 'component/page'; import Page from 'component/page';
import ToolTip from 'component/common/tooltip'; import ToolTip from 'component/common/tooltip';
import Icon from 'component/common/icon'; import Icon from 'component/common/icon';
import * as icons from 'constants/icons';
type Props = { type Props = {
query: ?string, query: ?string,
@ -27,11 +27,11 @@ class SearchPage extends React.PureComponent<Props> {
onSearchResultCountChange(event: SyntheticInputEvent<*>) { onSearchResultCountChange(event: SyntheticInputEvent<*>) {
const count = Number(event.target.value); const count = Number(event.target.value);
this.props.setClientSetting(settings.RESULT_COUNT, count); this.props.setClientSetting(SETTINGS.RESULT_COUNT, count);
} }
onShowUnavailableChange(event: SyntheticInputEvent<*>) { onShowUnavailableChange(event: SyntheticInputEvent<*>) {
this.props.setClientSetting(settings.SHOW_UNAVAILABLE, event.target.checked); this.props.setClientSetting(SETTINGS.SHOW_UNAVAILABLE, event.target.checked);
} }
render() { render() {
@ -57,7 +57,7 @@ class SearchPage extends React.PureComponent<Props> {
icon icon
body={__('This is the resolution of a LBRY URL and not controlled by LBRY Inc.')} body={__('This is the resolution of a LBRY URL and not controlled by LBRY Inc.')}
> >
<Icon icon={icons.HELP} /> <Icon icon={ICONS.HELP} />
</ToolTip> </ToolTip>
</div> </div>
{isChannel ? ( {isChannel ? (

View file

@ -1,8 +1,8 @@
// @flow // @flow
import * as ICONS from 'constants/icons';
import * as SETTINGS from 'constants/settings';
import * as React from 'react'; import * as React from 'react';
import { FormField, FormFieldPrice } from 'component/common/form'; import { FormField, FormFieldPrice } from 'component/common/form';
import * as settings from 'constants/settings';
import * as icons from 'constants/icons';
import Button from 'component/button'; import Button from 'component/button';
import Page from 'component/page'; import Page from 'component/page';
import FileSelector from 'component/common/file-selector'; import FileSelector from 'component/common/file-selector';
@ -98,31 +98,31 @@ class SettingsPage extends React.PureComponent<Props, State> {
this.onAutomaticDarkModeChange(false); this.onAutomaticDarkModeChange(false);
} }
this.props.setClientSetting(settings.THEME, value); this.props.setClientSetting(SETTINGS.THEME, value);
} }
onAutomaticDarkModeChange(value: boolean) { onAutomaticDarkModeChange(value: boolean) {
this.props.setClientSetting(settings.AUTOMATIC_DARK_MODE_ENABLED, value); this.props.setClientSetting(SETTINGS.AUTOMATIC_DARK_MODE_ENABLED, value);
} }
onAutoplayChange(event: SyntheticInputEvent<*>) { onAutoplayChange(event: SyntheticInputEvent<*>) {
this.props.setClientSetting(settings.AUTOPLAY, event.target.checked); this.props.setClientSetting(SETTINGS.AUTOPLAY, event.target.checked);
} }
onInstantPurchaseEnabledChange(enabled: boolean) { onInstantPurchaseEnabledChange(enabled: boolean) {
this.props.setClientSetting(settings.INSTANT_PURCHASE_ENABLED, enabled); this.props.setClientSetting(SETTINGS.INSTANT_PURCHASE_ENABLED, enabled);
} }
onInstantPurchaseMaxChange(newValue: Price) { onInstantPurchaseMaxChange(newValue: Price) {
this.props.setClientSetting(settings.INSTANT_PURCHASE_MAX, newValue); this.props.setClientSetting(SETTINGS.INSTANT_PURCHASE_MAX, newValue);
} }
onShowNsfwChange(event: SyntheticInputEvent<*>) { onShowNsfwChange(event: SyntheticInputEvent<*>) {
this.props.setClientSetting(settings.SHOW_NSFW, event.target.checked); this.props.setClientSetting(SETTINGS.SHOW_NSFW, event.target.checked);
} }
onAutoDownloadChange(event: SyntheticInputEvent<*>) { onAutoDownloadChange(event: SyntheticInputEvent<*>) {
this.props.setClientSetting(settings.AUTO_DOWNLOAD, event.target.checked); this.props.setClientSetting(SETTINGS.AUTO_DOWNLOAD, event.target.checked);
} }
onChangeEncryptWallet() { onChangeEncryptWallet() {
@ -135,7 +135,7 @@ class SettingsPage extends React.PureComponent<Props, State> {
} }
onDesktopNotificationsChange(event: SyntheticInputEvent<*>) { onDesktopNotificationsChange(event: SyntheticInputEvent<*>) {
this.props.setClientSetting(settings.OS_NOTIFICATIONS_ENABLED, event.target.checked); this.props.setClientSetting(SETTINGS.OS_NOTIFICATIONS_ENABLED, event.target.checked);
} }
setDaemonSetting(name: string, value: boolean | string | Price) { setDaemonSetting(name: string, value: boolean | string | Price) {
@ -378,7 +378,7 @@ class SettingsPage extends React.PureComponent<Props, State> {
<Button <Button
button="primary" button="primary"
label={this.state.clearingCache ? __('Clearing') : __('Clear the cache')} label={this.state.clearingCache ? __('Clearing') : __('Clear the cache')}
icon={icons.ALERT} icon={ICONS.ALERT}
onClick={this.clearCache} onClick={this.clearCache}
disabled={this.state.clearingCache} disabled={this.state.clearingCache}
/> />