From 989fb5c7dbba174f54f3ae69df788d6685fff46b Mon Sep 17 00:00:00 2001
From: jloup <jeanloup.jamet@gmail.com>
Date: Sat, 24 Feb 2018 17:06:57 +0100
Subject: Upgrade ReactJS. EC6 import modules.

---
 cmd/web/js/main.jsx | 61 +++++++++++++++++++++++------------------------------
 1 file changed, 26 insertions(+), 35 deletions(-)

(limited to 'cmd/web/js/main.jsx')

diff --git a/cmd/web/js/main.jsx b/cmd/web/js/main.jsx
index e5e505d..827b83d 100644
--- a/cmd/web/js/main.jsx
+++ b/cmd/web/js/main.jsx
@@ -1,20 +1,21 @@
-var SignupForm         = require('./signup.js').SignupForm;
-var SigninForm         = require('./signin.js').SigninForm;
-var OtpEnrollForm      = require('./otp.js').OtpEnrollForm;
-var PoloniexController = require('./poloniex.js').PoloniexController;
-var App                = require('./app.js');
-var Api                = require('./api.js').Api;
-var cookies            = require('./cookies.js');
+import SignupForm from './signup.js';
+import SigninForm from './signin.js';
+import OtpEnrollForm from './otp.js';
+import PoloniexController from './poloniex.js';
+import App from './app.js';
+import Api from './api.js';
+import cookies from './cookies.js';
+import React from 'react';
 
-var Logo = React.createClass({
-  render: function() {
-    return (<div className='row'>
-              <div id='logo' className='offset-4 col-4'>
-                <a href='/'>Cryptoportfolio</a>
+class Logo extends React.Component {
+  render() {
+    return <div className="row">
+              <div id="logo" className="offset-4 col-4">
+                <a href="/">Cryptoportfolio</a>
               </div>
-            </div>);
+            </div>;
   }
-});
+}
 
 App.page('/signup', false, function(context) {
   if (App.isUserSignedIn()) {
@@ -22,12 +23,10 @@ App.page('/signup', false, function(context) {
     return;
   }
 
-  App.mount(
-    <div>
+  App.mount(<div>
       <Logo />
       <SignupForm onSuccess={App.onUserSignUp}/>
-    </div>
-  );
+    </div>);
 });
 
 App.page('/signin', false, function(context) {
@@ -36,12 +35,10 @@ App.page('/signin', false, function(context) {
     return;
   }
 
-  App.mount(
-    <div>
+  App.mount(<div>
       <Logo />
       <SigninForm onSuccess={App.onUserSignIn}/>
-    </div>
-  );
+    </div>);
 });
 
 App.page('/signout', true, function(context) {
@@ -51,12 +48,10 @@ App.page('/signout', true, function(context) {
 });
 
 App.page('/me', true, function(context) {
-  App.mount(
-    <div>
+  App.mount(<div>
       <Logo />
       <PoloniexController/>
-    </div>
-  );
+    </div>);
 });
 
 App.page('/otp/setup', true, function(context) {
@@ -66,23 +61,19 @@ App.page('/otp/setup', true, function(context) {
       return;
     }
 
-    App.mount(
-      <div>
+    App.mount(<div>
         <Logo />
         <OtpEnrollForm onSuccess={App.onUserValidateOtp} img={'data:image/png;base64,' + data.base64img} secret={data.secret}/>
-      </div>
-    );
+      </div>);
 
-  }.bind(this));
+  });
 });
 
 App.page('/otp/validate', true, function(context) {
-  App.mount(
-    <div>
+  App.mount(<div>
       <Logo />
       <OtpEnrollForm onSuccess={App.onUserValidateOtp} />
-    </div>
-  );
+    </div>);
 });
 
 App.page('/', false, function(context) {
-- 
cgit v1.2.3

