diff --git a/ui/js/component/auth.js b/ui/js/component/auth.js
index 7b934f339..0ff99c26f 100644
--- a/ui/js/component/auth.js
+++ b/ui/js/component/auth.js
@@ -9,23 +9,28 @@ import {CreditAmount, Address} from "../component/common.js";
import {getLocal, getSession, setSession, setLocal} from '../utils.js';
-const SubmitEmailStage = React.createClass({
- getInitialState: function() {
- return {
+class SubmitEmailStage extends React.Component {
+ constructor(props) {
+ super(props);
+
+ this.state = {
rewardType: null,
email: '',
submitting: false
};
- },
- handleEmailChanged: function(event) {
+ }
+
+ handleEmailChanged(event) {
this.setState({
email: event.target.value,
});
- },
- onEmailSaved: function(email) {
+ }
+
+ onEmailSaved(email) {
this.props.setStage("confirm", { email: email })
- },
- handleSubmit: function(event) {
+ }
+
+ handleSubmit(event) {
event.preventDefault();
this.setState({
@@ -42,38 +47,43 @@ const SubmitEmailStage = React.createClass({
}
this.setState({ submitting: false });
});
- },
- render: function() {
+ }
+
+ render() {
return (
);
}
-});
+}
-const ConfirmEmailStage = React.createClass({
- getInitialState: function() {
- return {
+class ConfirmEmailStage extends React.Component {
+ constructor(props) {
+ super(props);
+
+ this.state = {
rewardType: null,
code: '',
submitting: false,
errorMessage: null,
};
- },
- handleCodeChanged: function(event) {
+ }
+
+ handleCodeChanged(event) {
this.setState({
code: event.target.value,
});
- },
- handleSubmit: function(event) {
+ }
+
+ handleSubmit(event) {
event.preventDefault();
this.setState({
submitting: true,
@@ -93,16 +103,17 @@ const ConfirmEmailStage = React.createClass({
onSubmitError(new Error("Your email is still not verified.")) //shouldn't happen?
}
}, onSubmitError);
- },
- render: function() {
+ }
+
+ render() {
return (
-
+ { this.handleSubmit(event) }} disabled={this.state.submitting} />
+ onConfirmed={(event) => { this.handlePublishStartedConfirmed(event) }}>
Your file has been published to LBRY at the address lbry://{this.state.name}
!
The file will take a few minutes to appear for other LBRY users. Until then it will be listed as "pending" under your published files.
+ onConfirmed={(event) => { this.closeModal(event) }}>
The following error occurred when attempting to publish your file: {this.state.errorMessage}
);
}
-});
+}
export default PublishPage;
diff --git a/ui/js/page/report.js b/ui/js/page/report.js
index 03f0bb915..5c8aee799 100644
--- a/ui/js/page/report.js
+++ b/ui/js/page/report.js
@@ -3,8 +3,17 @@ import Link from 'component/link';
import Modal from '../component/modal.js';
import lbry from '../lbry.js';
-var ReportPage = React.createClass({
- submitMessage: function() {
+class ReportPage extends React.Component {
+ constructor(props) {
+ super(props);
+
+ this.state = {
+ submitting: false,
+ modal: null,
+ };
+ }
+
+ submitMessage() {
if (this._messageArea.value) {
this.setState({
submitting: true
@@ -17,19 +26,15 @@ var ReportPage = React.createClass({
});
this._messageArea.value = '';
}
- },
- closeModal: function() {
+ }
+
+ closeModal() {
this.setState({
modal: null,
})
- },
- getInitialState: function() {
- return {
- submitting: false,
- modal: null,
- }
- },
- render: function() {
+ }
+
+ render() {
return (
@@ -39,7 +44,7 @@ var ReportPage = React.createClass({
@@ -47,12 +52,12 @@ var ReportPage = React.createClass({
You can also .
+ onConfirmed={(event) => { this.closeModal(event) }}>
Your bug report has been submitted! Thank you for your feedback.
);
}
-});
+}
export default ReportPage;
diff --git a/ui/js/page/rewards.js b/ui/js/page/rewards.js
index 6dcdcc4c5..115fcbdfb 100644
--- a/ui/js/page/rewards.js
+++ b/ui/js/page/rewards.js
@@ -4,16 +4,17 @@ import {CreditAmount, Icon} from 'component/common.js';
import SubHeader from 'component/subHeader'
import {RewardLink} from 'component/reward-link';
-const RewardTile = React.createClass({
- propTypes: {
+export class RewardTile extends React.Component {
+ static propTypes = {
type: React.PropTypes.string.isRequired,
title: React.PropTypes.string.isRequired,
description: React.PropTypes.string.isRequired,
claimed: React.PropTypes.bool.isRequired,
value: React.PropTypes.number.isRequired,
onRewardClaim: React.PropTypes.func
- },
- render: function() {
+ }
+
+ render() {
return (
@@ -31,19 +32,23 @@ const RewardTile = React.createClass({
);
}
-});
+}
-export let RewardsPage = React.createClass({
- componentWillMount: function() {
- this.loadRewards()
- },
- getInitialState: function() {
- return {
+export class RewardsPage extends React.Component {
+ constructor(props) {
+ super(props);
+
+ this.state = {
userRewards: null,
- failed: null
+ failed: null,
};
- },
- loadRewards: function() {
+ }
+
+ componentWillMount() {
+ this.loadRewards()
+ }
+
+ loadRewards() {
lbryio.call('reward', 'list', {}).then((userRewards) => {
this.setState({
userRewards: userRewards,
@@ -51,8 +56,9 @@ export let RewardsPage = React.createClass({
}, () => {
this.setState({failed: true })
});
- },
- render: function() {
+ }
+
+ render() {
return (
@@ -66,6 +72,6 @@ export let RewardsPage = React.createClass({
);
}
-});
+}
export default RewardsPage;
diff --git a/ui/js/page/settings/view.jsx b/ui/js/page/settings/view.jsx
index 201a92d96..0f0649bc2 100644
--- a/ui/js/page/settings/view.jsx
+++ b/ui/js/page/settings/view.jsx
@@ -3,62 +3,76 @@ import {FormField, FormRow} from 'component/form.js';
import SubHeader from 'component/subHeader'
import lbry from 'lbry.js';
-var SettingsPage = React.createClass({
- setDaemonSetting: function(name, value) {
+class SettingsPage extends React.Component {
+ constructor(props) {
+ super(props);
+
+ const daemonSettings = this.props.daemonSettings
+
+ this.state = {
+ isMaxUpload: daemonSettings && daemonSettings.max_upload != 0,
+ isMaxDownload: daemonSettings && daemonSettings.max_download != 0,
+ showNsfw: lbry.getClientSetting('showNsfw'),
+ showUnavailable: lbry.getClientSetting('showUnavailable'),
+ }
+ }
+
+ setDaemonSetting(name, value) {
this.props.setDaemonSetting(name, value)
- },
- setClientSetting: function(name, value) {
+ }
+
+ setClientSetting(name, value) {
lbry.setClientSetting(name, value)
this._onSettingSaveSuccess()
- },
- onRunOnStartChange: function (event) {
+ }
+
+ onRunOnStartChange(event) {
this.setDaemonSetting('run_on_startup', event.target.checked);
- },
- onShareDataChange: function (event) {
+ }
+
+ onShareDataChange(event) {
this.setDaemonSetting('share_usage_data', event.target.checked);
- },
- onDownloadDirChange: function(event) {
+ }
+
+ onDownloadDirChange(event) {
this.setDaemonSetting('download_directory', event.target.value);
- },
- onMaxUploadPrefChange: function(isLimited) {
+ }
+
+ onMaxUploadPrefChange(isLimited) {
if (!isLimited) {
this.setDaemonSetting('max_upload', 0.0);
}
this.setState({
isMaxUpload: isLimited
});
- },
- onMaxUploadFieldChange: function(event) {
+ }
+
+ onMaxUploadFieldChange(event) {
this.setDaemonSetting('max_upload', Number(event.target.value));
- },
- onMaxDownloadPrefChange: function(isLimited) {
+ }
+
+ onMaxDownloadPrefChange(isLimited) {
if (!isLimited) {
this.setDaemonSetting('max_download', 0.0);
}
this.setState({
isMaxDownload: isLimited
});
- },
- onMaxDownloadFieldChange: function(event) {
+ }
+
+ onMaxDownloadFieldChange(event) {
this.setDaemonSetting('max_download', Number(event.target.value));
- },
- getInitialState: function() {
- const daemonSettings = this.props.daemonSettings
+ }
- return {
- isMaxUpload: daemonSettings && daemonSettings.max_upload != 0,
- isMaxDownload: daemonSettings && daemonSettings.max_download != 0,
- showNsfw: lbry.getClientSetting('showNsfw'),
- showUnavailable: lbry.getClientSetting('showUnavailable'),
- }
- },
- onShowNsfwChange: function(event) {
+ onShowNsfwChange(event) {
lbry.setClientSetting('showNsfw', event.target.checked);
- },
- onShowUnavailableChange: function(event) {
+ }
- },
- render: function() {
+ onShowUnavailableChange(event) {
+
+ }
+
+ render() {
const {
daemonSettings
} = this.props
@@ -185,6 +199,6 @@ var SettingsPage = React.createClass({
);
}
-});
+}
export default SettingsPage;
diff --git a/ui/js/page/start.js b/ui/js/page/start.js
index e1cf6e7dd..9a2b388b1 100644
--- a/ui/js/page/start.js
+++ b/ui/js/page/start.js
@@ -1,11 +1,12 @@
import React from 'react';
import lbry from '../lbry.js';
-var StartPage = React.createClass({
- componentWillMount: function() {
+class StartPage extends React.Component {
+ componentWillMount() {
lbry.stop();
- },
- render: function() {
+ }
+
+ render() {
return (
LBRY is Closed
@@ -13,6 +14,6 @@ var StartPage = React.createClass({
);
}
-});
+}
export default StartPage;