Add links back to home with the same ID and a QR code
This commit is contained in:
parent
8440fb036b
commit
d940ecb970
|
@ -22,6 +22,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"body-parser": "^1.15.2",
|
"body-parser": "^1.15.2",
|
||||||
"freezer-js": "^0.6.0",
|
"freezer-js": "^0.6.0",
|
||||||
|
"qrcode.react": "^0.6.1",
|
||||||
"react": "^0.13.0",
|
"react": "^0.13.0",
|
||||||
"react-router": "^0.13.3",
|
"react-router": "^0.13.3",
|
||||||
"shortid": "^2.2.6",
|
"shortid": "^2.2.6",
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { Router, Route, Link } from 'react-router';
|
||||||
|
|
||||||
export default class Home extends React.Component {
|
export default class Home extends React.Component {
|
||||||
render(){
|
render(){
|
||||||
let id = Shortid.generate();
|
let id = this.props.urlid || Shortid.generate();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="container">
|
<div className="container">
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import io from 'socket.io-client';
|
import io from 'socket.io-client';
|
||||||
|
import { Router, Route, Link } from 'react-router';
|
||||||
|
import QRCode from 'qrcode.react';
|
||||||
|
|
||||||
export default class NotifPage extends React.Component {
|
export default class NotifPage extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
|
@ -87,6 +89,7 @@ export default class NotifPage extends React.Component {
|
||||||
let supported = this.state.supported;
|
let supported = this.state.supported;
|
||||||
let haveperm = this.state.haveperm;
|
let haveperm = this.state.haveperm;
|
||||||
let connected = this.state.connected;
|
let connected = this.state.connected;
|
||||||
|
let urlid = this.props.urlid;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="container">
|
<div className="container">
|
||||||
|
@ -162,6 +165,16 @@ export default class NotifPage extends React.Component {
|
||||||
$ notica "This is awesome :)"
|
$ notica "This is awesome :)"
|
||||||
</code>
|
</code>
|
||||||
</p>
|
</p>
|
||||||
|
<p>
|
||||||
|
Need to set Notica up again? <br />
|
||||||
|
<Link to={'/home/' + urlid}>
|
||||||
|
Click here to go back to the instructions.
|
||||||
|
</Link>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Open this page on your phone:
|
||||||
|
<center><QRCode value={'https://notica.us/' + urlid} /></center>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -8,14 +8,20 @@ import { Router, Route, Link } from 'react-router';
|
||||||
|
|
||||||
export default class Site extends React.Component {
|
export default class Site extends React.Component {
|
||||||
render(){
|
render(){
|
||||||
let urlid = this.props.splat;
|
let url = this.props.splat;
|
||||||
let page = null;
|
let page = null;
|
||||||
|
let id = '';
|
||||||
|
|
||||||
if (urlid == '') {
|
if (url == '') {
|
||||||
page = <Home />;
|
page = <Home />;
|
||||||
}
|
}
|
||||||
else if (Shortid.isValid(urlid)) {
|
else if (url.substring(0, 4) == 'home') {
|
||||||
page = <NotifPage urlid={urlid} />;
|
id = url.substring(5);
|
||||||
|
page = <Home urlid={id} />;
|
||||||
|
}
|
||||||
|
else if (Shortid.isValid(url)) {
|
||||||
|
id = url;
|
||||||
|
page = <NotifPage urlid={url} />;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
page = <Error />;
|
page = <Error />;
|
||||||
|
@ -25,7 +31,7 @@ export default class Site extends React.Component {
|
||||||
<div>
|
<div>
|
||||||
<div className="hero">
|
<div className="hero">
|
||||||
<div className="title">
|
<div className="title">
|
||||||
<Link to={'/'}>
|
<Link to={'/home/' + id}>
|
||||||
<img src="/assets/img/logo.svg" />
|
<img src="/assets/img/logo.svg" />
|
||||||
<span className="name">Notica</span>
|
<span className="name">Notica</span>
|
||||||
</Link>
|
</Link>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user