Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
67 lines (63 sloc) 2.72 KB
import * as React from "react";
import { reduxify } from './utils';
@reduxify(
(state) => ({
channels: state.channels,
selectedChannel: state.selectedChannel,
isAuthenticated: state.isAuthenticated,
activeSub: state.activeSub
}),
(dispatch) => ({
clearMessages: () => dispatch({ type: 'MESSAGES_CLEAR' })
})
)
export class Header extends React.Component<any, any> {
openChannel() {
const chan = prompt("Join another Channel?", "ChannelName");
if (chan)
location.href = `?channels=${[...this.props.channels, chan.replace(/\s+/g, "")].join(",")}`;
}
selectChannel(e) {
this.props.onChannelelected(e.target.getAttribute("data-channel"));
}
render() {
return (
<div id="top">
<a href="https://github.com/ServiceStackApps/LiveDemos">
<img src={require("./assets/img/logo-32-inverted.png")}
style={{ height: "34px", padding: "10px 0 0 0" }} />
</a>
<div id="social">
<div id="welcome">
{this.props.activeSub
? <span>
<span>Welcome, {this.props.activeSub.displayName}</span>
<img src={this.props.activeSub.profileUrl} />
</span>
: null}
</div>
{this.props.isAuthenticated
? null
: <span>
<a href="/auth/twitter" className="twitter"></a>
<a href="/auth/facebook" className="facebook"></a>
<a href="/auth/github" className="github"></a>
</span>}
</div>
<ul id="channels" style={{ margin: "0 0 0 30px" }}>
{this.props.channels.map(channel => <li className={this.props.selectedChannel === channel ? "selected" : ""}
data-channel={channel}
onClick={this.selectChannel.bind(this)}>
{channel}
</li>) }
<li style={{ background: "none", padding: "0 0 0 5px" }}>
<button onClick={this.openChannel.bind(this)}>+</button>
</li>
<li style={{ background: "none", padding: 0 }}>
<span style={{ fontSize: 13, color: "#ccc", paddingLeft: 10 }} onClick={this.props.clearMessages}>clear</span>
</li>
</ul>
</div>
);
}
}
You can’t perform that action at this time.