From afa8cc7b137a09e3eabc90a7493d05185bd28798 Mon Sep 17 00:00:00 2001 From: "Son, Joon" Date: Thu, 1 Oct 2015 16:15:41 -0700 Subject: [PATCH 1/3] :bug: Fix gender --- app/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/main.js b/app/main.js index 84de50a..776b60d 100644 --- a/app/main.js +++ b/app/main.js @@ -56,7 +56,7 @@ class Main extends React.Component {
Welcome to ShitJoonSays!
-

What did she say today?!?!?

+

What did he say today?!?!?

From 1825276442229a130d195763f5afc546422afa36 Mon Sep 17 00:00:00 2001 From: "Son, Joon" Date: Sun, 21 Feb 2016 08:50:25 -0800 Subject: [PATCH 2/3] Sort messages in reverse chronological order --- app/main.js | 7 ++++++- config.js | 18 ++++++++++++++++++ package.json | 3 ++- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/app/main.js b/app/main.js index 776b60d..c995471 100644 --- a/app/main.js +++ b/app/main.js @@ -66,7 +66,12 @@ class Main extends React.Component {
-
{comments.map(this.renderComments)}
+
+ {comments + .sort((a, b) => { a.timestamp > b.timestamp }) + .map(this.renderComments) + } +
) } diff --git a/config.js b/config.js index c587031..2f4800c 100644 --- a/config.js +++ b/config.js @@ -24,6 +24,7 @@ System.config({ "react": "npm:react@0.13.3", "react-bootstrap": "npm:react-bootstrap@0.25.2", "react-dom": "npm:react-dom@0.14.0-beta3", + "systemjs": "npm:systemjs@0.19.22", "github:jspm/nodelibs-assert@0.1.0": { "assert": "npm:assert@1.3.0" }, @@ -248,6 +249,13 @@ System.config({ "process": "github:jspm/nodelibs-process@0.1.1", "through": "npm:through@2.3.8" }, + "npm:es6-module-loader@0.17.11": { + "fs": "github:jspm/nodelibs-fs@0.1.2", + "process": "github:jspm/nodelibs-process@0.1.1", + "systemjs-json": "github:systemjs/plugin-json@0.1.0", + "util": "github:jspm/nodelibs-util@0.1.0", + "when": "npm:when@3.7.7" + }, "npm:esprima-fb@13001.1001.0-dev-harmony-fb": { "fs": "github:jspm/nodelibs-fs@0.1.2", "process": "github:jspm/nodelibs-process@0.1.1" @@ -449,6 +457,13 @@ System.config({ "npm:string_decoder@0.10.31": { "buffer": "github:jspm/nodelibs-buffer@0.1.0" }, + "npm:systemjs@0.19.22": { + "es6-module-loader": "npm:es6-module-loader@0.17.11", + "fs": "github:jspm/nodelibs-fs@0.1.2", + "process": "github:jspm/nodelibs-process@0.1.1", + "systemjs-json": "github:systemjs/plugin-json@0.1.0", + "when": "npm:when@3.7.7" + }, "npm:through@2.3.8": { "process": "github:jspm/nodelibs-process@0.1.1", "stream": "github:jspm/nodelibs-stream@0.1.0" @@ -491,6 +506,9 @@ System.config({ }, "npm:websocket-extensions@0.1.1": { "process": "github:jspm/nodelibs-process@0.1.1" + }, + "npm:when@3.7.7": { + "process": "github:jspm/nodelibs-process@0.1.1" } } }); diff --git a/package.json b/package.json index aba4563..aee1662 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,8 @@ "jspm": { "dependencies": { "firebase": "npm:firebase@^2.3.1", - "react": "npm:react@^0.13.3" + "react": "npm:react@^0.13.3", + "systemjs": "npm:systemjs@^0.19.22" }, "devDependencies": { "babel": "npm:babel-core@^5.8.24", From 9a0868cae26e5830e3eee4887430f203f8a9558f Mon Sep 17 00:00:00 2001 From: "Son, Joon" Date: Sun, 21 Feb 2016 09:26:29 -0800 Subject: [PATCH 3/3] Stupid merge --- app/main.js | 80 ----------------------------------------------------- config.js | 19 ++++--------- 2 files changed, 5 insertions(+), 94 deletions(-) delete mode 100644 app/main.js diff --git a/app/main.js b/app/main.js deleted file mode 100644 index c995471..0000000 --- a/app/main.js +++ /dev/null @@ -1,80 +0,0 @@ -import React from "react"; -import Firebase from "firebase"; - -class Main extends React.Component { - state = { - comments: [] - } - - componentWillMount() { - this.firebaseRef = new Firebase('https://popping-fire-6215.firebaseio.com/shitjoonsays/'); - this.firebaseRef.on("child_added", this.childAdded); - } - - childAdded = (dataSnapshot) => { - const val = dataSnapshot.val(); - const key = dataSnapshot.key(); - const comments = [ - { - ...val, - key: key - }, - ...this.state.comments - ]; - - this.setState({comments}); - } - - renderComments = (comment) => { - if (comment) - return ( - -

{comment.comment} - {comment.timestamp}

-
- ); - - return null; - } - - onClick = (e) => { - e.preventDefault(); - const comment = React.findDOMNode(this.refs.comment).value; - - if (comment === "") - return; - - this.firebaseRef.push({ - timestamp: new Date().toLocaleString(), - comment - }) - } - - render() { - const {comments} = this.state; - return ( -
-
Welcome to ShitJoonSays!
-
-
-

What did he say today?!?!?

-
- - -
-
- -
-
-
-
- {comments - .sort((a, b) => { a.timestamp > b.timestamp }) - .map(this.renderComments) - } -
-
- ) - } -} - -React.render(
, document.getElementById("app")); diff --git a/config.js b/config.js index 2c56bb7..dea84b8 100644 --- a/config.js +++ b/config.js @@ -24,7 +24,7 @@ System.config({ "immutable": "npm:immutable@3.7.5", "react": "npm:react@0.14.1", "react-bootstrap": "npm:react-bootstrap@0.25.2", - "react-dom": "npm:react-dom@0.14.0-beta3", + "react-dom": "npm:react-dom@0.14.1", "react-pure-render": "npm:react-pure-render@1.0.2", "redux": "npm:redux@3.0.4", "redux-thunk": "npm:redux-thunk@1.0.0", @@ -262,7 +262,7 @@ System.config({ }, "npm:es6-module-loader@0.17.11": { "fs": "github:jspm/nodelibs-fs@0.1.2", - "process": "github:jspm/nodelibs-process@0.1.1", + "process": "github:jspm/nodelibs-process@0.1.2", "systemjs-json": "github:systemjs/plugin-json@0.1.0", "util": "github:jspm/nodelibs-util@0.1.0", "when": "npm:when@3.7.7" @@ -289,14 +289,6 @@ System.config({ "util": "github:jspm/nodelibs-util@0.1.0", "websocket-driver": "npm:websocket-driver@0.6.2" }, - "npm:fbjs@0.1.0-alpha.4": { - "core-js": "npm:core-js@1.2.3", - "fs": "github:jspm/nodelibs-fs@0.1.2", - "path": "github:jspm/nodelibs-path@0.1.0", - "process": "github:jspm/nodelibs-process@0.1.2", - "promise": "npm:promise@7.0.4", - "whatwg-fetch": "npm:whatwg-fetch@0.9.0" - }, "npm:fbjs@0.3.2": { "core-js": "npm:core-js@1.2.3", "loose-envify": "npm:loose-envify@1.1.0", @@ -412,8 +404,7 @@ System.config({ "react-overlays": "npm:react-overlays@0.4.4", "uncontrollable": "npm:uncontrollable@3.1.2" }, - "npm:react-dom@0.14.0-beta3": { - "fbjs": "npm:fbjs@0.1.0-alpha.4", + "npm:react-dom@0.14.1": { "react": "npm:react@0.14.1" }, "npm:react-overlays@0.4.4": { @@ -471,7 +462,7 @@ System.config({ "npm:systemjs@0.19.22": { "es6-module-loader": "npm:es6-module-loader@0.17.11", "fs": "github:jspm/nodelibs-fs@0.1.2", - "process": "github:jspm/nodelibs-process@0.1.1", + "process": "github:jspm/nodelibs-process@0.1.2", "systemjs-json": "github:systemjs/plugin-json@0.1.0", "when": "npm:when@3.7.7" }, @@ -522,7 +513,7 @@ System.config({ "process": "github:jspm/nodelibs-process@0.1.1" }, "npm:when@3.7.7": { - "process": "github:jspm/nodelibs-process@0.1.1" + "process": "github:jspm/nodelibs-process@0.1.2" } } });