aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/components
diff options
context:
space:
mode:
Diffstat (limited to 'vnext/src/components')
-rw-r--r--vnext/src/components/Discover.js13
-rw-r--r--vnext/src/components/LoginButton.js5
-rw-r--r--vnext/src/components/Thread.js23
3 files changed, 33 insertions, 8 deletions
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 (<Message key={msg.mid} data={msg}/>)
- });
+ });
return (
- <div className="msgs" id="content">{nodes}</div>
+ <div className="msgs" id="content">{nodes}</div>
)
}
};
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 (
- <div onClick={this.login}>{this.props.title}</div>
+ <a href="/login" onClick={this.login}>{this.props.title}</a>
)
}
};
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 (
+ <div>
+ <h1>{user}</h1>
+ <p>{mid}</p>
+ </div>
+ )
+ }
+} \ No newline at end of file