standardize constant naming/imports

This commit is contained in:
Sean Yesmunt 2018-11-25 20:21:25 -05:00
parent 1dd6a9e42f
commit a56831db2c
28 changed files with 113 additions and 115 deletions

View file

@ -1,14 +1,10 @@
// @flow
import * as ICONS from 'constants/icons';
import * as React from 'react';
import { clipboard } from 'electron';
import { FormRow } from 'component/common/form';
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 = {
address: string,
doToast: ({ message: string }) => void,
@ -44,7 +40,7 @@ export default class Address extends React.PureComponent<Props> {
<Button
noPadding
button="secondary"
icon={icons.CLIPBOARD}
icon={ICONS.CLIPBOARD}
onClick={() => {
clipboard.writeText(address);
doToast({

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,7 +1,7 @@
// @flow
import * as ICONS from 'constants/icons';
import React from 'react';
import Button from 'component/button';
import * as icons from 'constants/icons';
type Props = {
play: () => void,
@ -15,7 +15,7 @@ class VideoPlayButton extends React.PureComponent<Props> {
const { fileInfo, mediaType, isLoading, play } = this.props;
const disabled = isLoading || fileInfo === undefined;
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');
return <Button button="primary" disabled={disabled} label={label} icon={icon} onClick={play} />;

View file

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

View file

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

View file

@ -1,17 +1,17 @@
// @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 { isNameValid, buildURI, regexInvalidURI, THUMBNAIL_STATUSES } from 'lbry-redux';
import { Form, FormField, FormRow, FormFieldPrice, Submit } from 'component/common/form';
import Button from 'component/button';
import ChannelSection from 'component/selectChannel';
import classnames from 'classnames';
import type { PublishParams, UpdatePublishFormData } from 'redux/reducers/publish';
import FileSelector from 'component/common/file-selector';
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 NameHelpText from './internal/name-help-text';
import LicenseType from './internal/license-type';
@ -354,7 +354,7 @@ class PublishForm extends React.PureComponent<Props> {
<div className="card__actions-top-corner">
<Button
button="inverse"
icon={icons.CLOSE}
icon={ICONS.CLOSE}
label={__('Clear')}
onClick={clearPublish}
/>

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,9 +1,9 @@
// @flow
import * as ICONS from 'constants/icons';
import * as React from 'react';
import Button from 'component/button';
import CardVerify from 'component/cardVerify';
import { Lbryio } from 'lbryinc';
import * as icons from 'constants/icons';
type Props = {
errorMessage: ?string,
@ -43,7 +43,9 @@ class UserVerify extends React.PureComponent<Props> {
<p className="card__content">
{`${__(
'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>
<div className="card__actions">
{errorMessage && <p className="form-field__error">{errorMessage}</p>}
@ -78,7 +80,7 @@ class UserVerify extends React.PureComponent<Props> {
verifyPhone();
}}
button="primary"
icon={icons.PHONE}
icon={ICONS.PHONE}
label={__('Submit Phone Number')}
/>
</div>
@ -107,7 +109,7 @@ class UserVerify extends React.PureComponent<Props> {
<Button
href="https://chat.lbry.io"
button="primary"
icon={icons.MESSAGE}
icon={ICONS.MESSAGE}
label={__('Join LBRY Chat')}
/>
</div>

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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