From 9d42f009bbf7c073d3a48bf65bb9b12775d68b3d Mon Sep 17 00:00:00 2001
From: Vitaly Takmazov
Date: Thu, 15 Mar 2018 20:11:33 +0300
Subject: LoginButton
---
vnext/src/app.js | 21 ++++++++++++++++-----
vnext/src/components/Discover.js | 13 +++++++------
vnext/src/components/LoginButton.js | 5 +++--
vnext/src/components/Thread.js | 23 +++++++++++++++++++++++
vnext/src/views/index.html | 2 +-
5 files changed, 50 insertions(+), 14 deletions(-)
create mode 100644 vnext/src/components/Thread.js
(limited to 'vnext/src')
diff --git a/vnext/src/app.js b/vnext/src/app.js
index 82209e45..1f323b51 100644
--- a/vnext/src/app.js
+++ b/vnext/src/app.js
@@ -4,6 +4,8 @@ import { BrowserRouter as Router, Route, Link } from "react-router-dom"
import Discover from "./components/Discover"
import Post from "./components/Post"
+import Thread from "./components/Thread"
+import LoginButton from "./components/LoginButton"
class App extends React.Component {
constructor(props) {
@@ -22,12 +24,17 @@ class App extends React.Component {
@@ -40,11 +47,15 @@ class App extends React.Component {
-
+
+
)
}
+ auth(data) {
+ console.log(data)
+ }
}
diff --git a/vnext/src/components/Discover.js b/vnext/src/components/Discover.js
index 2d962bda..7fde3d88 100644
--- a/vnext/src/components/Discover.js
+++ b/vnext/src/components/Discover.js
@@ -1,6 +1,7 @@
import "whatwg-fetch"
import React from "react"
import PropTypes from "prop-types"
+import queryString from "query-string"
import Message from "./Message"
@@ -9,7 +10,8 @@ export default class Discover extends React.Component {
super(props)
this.state = {
msgs: [],
- loading: false
+ loading: false,
+ search: this.props.location.search
}
this.loadMessages = this.loadMessages.bind(this);
}
@@ -22,8 +24,7 @@ export default class Discover extends React.Component {
}
}
loadMessages() {
- const search = new URLSearchParams(this.props.params);
- const url = "https://api.juick.com/messages";
+ const url = "https://api.juick.com/messages" + this.state.search;
fetch(url)
.then(response => {
return response.json()
@@ -38,13 +39,13 @@ export default class Discover extends React.Component {
render() {
var nodes = this.state.msgs.map(msg => {
return ()
- });
+ });
return (
- {nodes}
+ {nodes}
)
}
};
Discover.propTypes = {
- msgs: PropTypes.array
+ msgs: PropTypes.array
}
diff --git a/vnext/src/components/LoginButton.js b/vnext/src/components/LoginButton.js
index cdb62e1a..8d298fa2 100644
--- a/vnext/src/components/LoginButton.js
+++ b/vnext/src/components/LoginButton.js
@@ -8,14 +8,15 @@ export default class LoginButton extends React.Component {
this.props.onAuth(event.data);
}, false);
}
- login() {
+ login(event) {
+ event.preventDefault();
let loginWindow = window.open("https://juick.com/login?redirect=false", "Login to Juick", "width=400,height=300,resizeable=no,menubar=no,toolbar=no,scrollbars=no");
loginWindow.window.focus();
}
render() {
return (
- {this.props.title}
+ {this.props.title}
)
}
};
diff --git a/vnext/src/components/Thread.js b/vnext/src/components/Thread.js
new file mode 100644
index 00000000..49d9ea4d
--- /dev/null
+++ b/vnext/src/components/Thread.js
@@ -0,0 +1,23 @@
+import "whatwg-fetch"
+import React from "react"
+
+export default class Thread extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ replies: [],
+ loading: false
+ }
+ }
+ componentDidMount() {
+ }
+ render() {
+ const { user, mid } = this.props.match.params;
+ return (
+
+ )
+ }
+}
\ No newline at end of file
diff --git a/vnext/src/views/index.html b/vnext/src/views/index.html
index 9f8feae9..661634d6 100644
--- a/vnext/src/views/index.html
+++ b/vnext/src/views/index.html
@@ -40,6 +40,6 @@
-
+