From cf7a05f80f68b5b1c8bcc0089679dd497cec2506 Mon Sep 17 00:00:00 2001
From: =Corey Hulen <corey@hulen.com>
Date: Sun, 14 Jun 2015 23:53:32 -0800
Subject: first commit

---
 web/react/components/find_team.jsx | 72 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 72 insertions(+)
 create mode 100644 web/react/components/find_team.jsx

(limited to 'web/react/components/find_team.jsx')

diff --git a/web/react/components/find_team.jsx b/web/react/components/find_team.jsx
new file mode 100644
index 000000000..329592a73
--- /dev/null
+++ b/web/react/components/find_team.jsx
@@ -0,0 +1,72 @@
+// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+
+var utils = require('../utils/utils.jsx');
+var client = require('../utils/client.jsx');
+
+module.exports = React.createClass({
+     handleSubmit: function(e) {
+        e.preventDefault();
+
+        var state = { };
+
+        var email = this.refs.email.getDOMNode().value.trim().toLowerCase();
+        if (!email || !utils.isEmail(email)) {
+            state.email_error = "Please enter a valid email address";
+            this.setState(state);
+            return;
+        }
+        else {
+            state.email_error = "";
+        }
+
+        client.findTeamsSendEmail(email,
+            function(data) {
+                state.sent = true;
+                this.setState(state);
+            }.bind(this),
+            function(err) {
+                state.email_error = err.message;
+                this.setState(state);
+            }.bind(this)
+        );
+    },
+    getInitialState: function() {
+        return {  };
+    },
+    render: function() {
+
+        var email_error = this.state.email_error ? <label className='control-label'>{ this.state.email_error }</label> : null;
+
+        var divStyle = {
+            "marginTop": "50px",
+        }
+
+        if (this.state.sent) {
+            return (
+                <div>
+                    <h4>{"Find Your " + utils.toTitleCase(strings.Team)}</h4>
+                    <p>{"An email was sent with links to any " + strings.TeamPlural}</p>
+                </div>
+            );
+        }
+
+        return (
+        <div>
+                <h4>Find Your Team</h4>
+                <form onSubmit={this.handleSubmit}>
+                    <p>{"An email will be sent to this address with links to any " + strings.TeamPlural}</p>
+                    <div className="form-group">
+                        <label className='control-label'>Email</label>
+                        <div className={ email_error ? "form-group has-error" : "form-group" }>
+                            <input type="text" ref="email" className="form-control" placeholder="you@domain.com" maxLength="128" />
+                            { email_error }
+                        </div>
+                    </div>
+                    <button className="btn btn-md btn-primary" type="submit">Send</button>
+                </form>
+                </div>
+        );
+    }
+});
-- 
cgit v1.2.3-1-g7c22

