Alex Mikhalev
7 years ago
8 changed files with 107 additions and 67 deletions
@ -0,0 +1,40 @@ |
|||||||
|
import * as React from "react"; |
||||||
|
import { Button, Segment } from "semantic-ui-react"; |
||||||
|
|
||||||
|
import { injectState, State } from "@app/state"; |
||||||
|
import { getRandomId } from "@common/utils"; |
||||||
|
|
||||||
|
class MessageTest extends React.Component<{ state: State }> { |
||||||
|
render() { |
||||||
|
return ( |
||||||
|
<Segment> |
||||||
|
<h2>Message Test</h2> |
||||||
|
<Button onClick={this.test1}>Add test message</Button> |
||||||
|
<Button onClick={this.test2}>Add test message w/ timeout</Button> |
||||||
|
<Button onClick={this.test3}>Add test message w/ content</Button> |
||||||
|
</Segment> |
||||||
|
); |
||||||
|
} |
||||||
|
|
||||||
|
private test1 = () => { |
||||||
|
this.props.state.uiStore.addMessage({ |
||||||
|
info: true, content: "Test Message! " + getRandomId(), header: "Header to test message", |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
private test2 = () => { |
||||||
|
this.props.state.uiStore.addMessage({ |
||||||
|
warning: true, content: "Im gonna dissapear in 5 seconds " + getRandomId(), |
||||||
|
header: "Header to test message", timeout: 5000, |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
private test3 = () => { |
||||||
|
this.props.state.uiStore.addMessage({ |
||||||
|
color: "brown", content: <div className="ui segment">I Have crazy content!</div>, |
||||||
|
header: "Header to test message", timeout: 5000, |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
export default injectState(MessageTest); |
@ -1,7 +1,11 @@ |
|||||||
|
import { Server } from "http"; |
||||||
import app from "./app"; |
import app from "./app"; |
||||||
|
|
||||||
|
const server = new Server(app); |
||||||
|
|
||||||
const port = +(process.env.PORT || 8080); |
const port = +(process.env.PORT || 8080); |
||||||
const host = process.env.HOST || "0.0.0.0"; |
const host = process.env.HOST || "0.0.0.0"; |
||||||
app.listen(port, host, () => { |
|
||||||
|
server.listen(port, host, () => { |
||||||
console.log(`listening at ${host}:${port}`); |
console.log(`listening at ${host}:${port}`); |
||||||
}); |
}); |
||||||
|
Loading…
Reference in new issue