cleanup
This commit is contained in:
parent
5fc6dd9b3d
commit
864d1546f8
4 changed files with 10 additions and 36 deletions
|
@ -1,5 +1,5 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { selectPublishFormValues, doUpdatePublishForm, doToast } from 'lbry-redux';
|
import { selectPublishFormValues, doUpdatePublishForm } from 'lbry-redux';
|
||||||
import PublishPage from './view';
|
import PublishPage from './view';
|
||||||
|
|
||||||
const select = state => ({
|
const select = state => ({
|
||||||
|
@ -8,7 +8,6 @@ const select = state => ({
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
updatePublishForm: value => dispatch(doUpdatePublishForm(value)),
|
updatePublishForm: value => dispatch(doUpdatePublishForm(value)),
|
||||||
showToast: message => dispatch(doToast({ isError: true, message })),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { FormField } from 'component/common/form';
|
import { FormField } from 'component/common/form';
|
||||||
import { CC_LICENSES, LEGACY_CC_LICENSES, COPYRIGHT, OTHER, PUBLIC_DOMAIN, NONE } from 'constants/licenses';
|
import { CC_LICENSES, LEGACY_CC_LICENSES, COPYRIGHT, OTHER, PUBLIC_DOMAIN, NONE } from 'constants/licenses';
|
||||||
import analytics from 'analytics';
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
licenseType: ?string,
|
licenseType: ?string,
|
||||||
|
@ -11,7 +10,6 @@ type Props = {
|
||||||
handleLicenseChange: (string, string) => void,
|
handleLicenseChange: (string, string) => void,
|
||||||
handleLicenseDescriptionChange: (SyntheticInputEvent<*>) => void,
|
handleLicenseDescriptionChange: (SyntheticInputEvent<*>) => void,
|
||||||
handleLicenseUrlChange: (SyntheticInputEvent<*>) => void,
|
handleLicenseUrlChange: (SyntheticInputEvent<*>) => void,
|
||||||
showToast: string => void,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class LicenseType extends React.PureComponent<Props> {
|
class LicenseType extends React.PureComponent<Props> {
|
||||||
|
@ -22,26 +20,14 @@ class LicenseType extends React.PureComponent<Props> {
|
||||||
}
|
}
|
||||||
|
|
||||||
handleLicenseOnChange(event: SyntheticInputEvent<*>) {
|
handleLicenseOnChange(event: SyntheticInputEvent<*>) {
|
||||||
const { handleLicenseChange, showToast } = this.props;
|
const { handleLicenseChange } = this.props;
|
||||||
// $FlowFixMe
|
// $FlowFixMe
|
||||||
const { options, selectedIndex } = event.target;
|
const { options, selectedIndex } = event.target;
|
||||||
|
const selectedOption = options[selectedIndex];
|
||||||
|
const licenseType = selectedOption.value;
|
||||||
|
const licenseUrl = selectedOption.getAttribute('data-url');
|
||||||
|
|
||||||
if (options !== null) {
|
handleLicenseChange(licenseType, licenseUrl);
|
||||||
const selectedOption = options[selectedIndex];
|
|
||||||
const licenseType = selectedOption.value;
|
|
||||||
const licenseUrl = selectedOption.getAttribute('data-url');
|
|
||||||
|
|
||||||
handleLicenseChange(licenseType, licenseUrl);
|
|
||||||
} else {
|
|
||||||
// There were users where this options were null for some reason
|
|
||||||
// This will at least make it so the app doesn't crash
|
|
||||||
// Hopefully this helps figure it out
|
|
||||||
analytics.error('Error changing the publish license\n' + JSON.stringify(this.props));
|
|
||||||
|
|
||||||
showToast(
|
|
||||||
__('There was an error updating the license type. If it continues to happen send an email to help@lbry.com.')
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
|
@ -15,11 +15,10 @@ type Props = {
|
||||||
licenseUrl: ?string,
|
licenseUrl: ?string,
|
||||||
disabled: boolean,
|
disabled: boolean,
|
||||||
updatePublishForm: ({}) => void,
|
updatePublishForm: ({}) => void,
|
||||||
showToast: string => void,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function PublishAdvanced(props: Props) {
|
function PublishAdvanced(props: Props) {
|
||||||
const { language, name, licenseType, otherLicenseDescription, licenseUrl, updatePublishForm, showToast } = props;
|
const { language, name, licenseType, otherLicenseDescription, licenseUrl, updatePublishForm } = props;
|
||||||
const [hideSection, setHideSection] = usePersistedState('publish-advanced-options', true);
|
const [hideSection, setHideSection] = usePersistedState('publish-advanced-options', true);
|
||||||
|
|
||||||
function toggleHideSection() {
|
function toggleHideSection() {
|
||||||
|
@ -67,7 +66,6 @@ function PublishAdvanced(props: Props) {
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|
||||||
<LicenseType
|
<LicenseType
|
||||||
showToast={showToast}
|
|
||||||
licenseType={licenseType}
|
licenseType={licenseType}
|
||||||
otherLicenseDescription={otherLicenseDescription}
|
otherLicenseDescription={otherLicenseDescription}
|
||||||
licenseUrl={licenseUrl}
|
licenseUrl={licenseUrl}
|
||||||
|
|
|
@ -5,13 +5,8 @@ import { FormField } from 'component/common/form';
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
import I18nMessage from 'component/i18nMessage';
|
import I18nMessage from 'component/i18nMessage';
|
||||||
import * as ICONS from 'constants/icons';
|
import * as ICONS from 'constants/icons';
|
||||||
|
|
||||||
import ServerInputRow from './internal/inputRow';
|
import ServerInputRow from './internal/inputRow';
|
||||||
|
|
||||||
type DaemonStatus = {
|
|
||||||
wallet: any,
|
|
||||||
};
|
|
||||||
|
|
||||||
type StatusOfServer = {
|
type StatusOfServer = {
|
||||||
host: string,
|
host: string,
|
||||||
port: string,
|
port: string,
|
||||||
|
@ -22,11 +17,6 @@ type StatusOfServer = {
|
||||||
type ServerTuple = [string, string]; // ['host', 'port']
|
type ServerTuple = [string, string]; // ['host', 'port']
|
||||||
type ServerStatus = Array<StatusOfServer>;
|
type ServerStatus = Array<StatusOfServer>;
|
||||||
type ServerConfig = Array<ServerTuple>;
|
type ServerConfig = Array<ServerTuple>;
|
||||||
|
|
||||||
type DaemonSettings = {
|
|
||||||
lbryum_servers: ServerConfig,
|
|
||||||
};
|
|
||||||
|
|
||||||
type DaemonStatus = {
|
type DaemonStatus = {
|
||||||
wallet: any,
|
wallet: any,
|
||||||
};
|
};
|
||||||
|
@ -152,10 +142,11 @@ function SettingWalletServer(props: Props) {
|
||||||
<p className="help">
|
<p className="help">
|
||||||
<I18nMessage
|
<I18nMessage
|
||||||
tokens={{
|
tokens={{
|
||||||
help_link: <Button button="link" href="http://lbry.com/faq/wallet-servers" label={__('Learn More')} />,
|
learn_more: <Button button="link" href="http://lbry.com/faq/wallet-servers" label={__('Learn More')} />,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Wallet servers control what content is trending, ..., idk. %help_link%.
|
Wallet servers are used to relay data to and from the LBRY blockchain. They also determine what content
|
||||||
|
shows in trending or is blocked. %learn_more%.
|
||||||
</I18nMessage>
|
</I18nMessage>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue