From 02cdc04a08d3d217f500199b7e9f9bb7c631cf81 Mon Sep 17 00:00:00 2001 From: Aurélien Bompard Date: Oct 27 2017 10:27:02 +0000 Subject: Light version of the IRC widget This version uses the Kiwi web IRC client. --- diff --git a/hubs/default_config.py b/hubs/default_config.py index fe46f94..b0e805d 100644 --- a/hubs/default_config.py +++ b/hubs/default_config.py @@ -63,6 +63,7 @@ WIDGETS = [ 'hubs.widgets.github_pr:GitHubPRs', 'hubs.widgets.githubissues:GitHubIssues', 'hubs.widgets.halp:Halp', + 'hubs.widgets.irc:IRC', 'hubs.widgets.meetings:Meetings', 'hubs.widgets.memberships:Memberships', 'hubs.widgets.pagure_pr:PagurePRs', diff --git a/hubs/static/client/app/widgets/irc/ChatClient.js b/hubs/static/client/app/widgets/irc/ChatClient.js new file mode 100644 index 0000000..eb16c50 --- /dev/null +++ b/hubs/static/client/app/widgets/irc/ChatClient.js @@ -0,0 +1,17 @@ +import React from 'react'; +import PropTypes from 'prop-types'; + + +export default class ChatClient extends React.Component { + + render() { + const url = `https://kiwiirc.com/client/${this.props.domain}/${this.props.channel}`; + return ( + + ); + } +} diff --git a/hubs/static/client/app/widgets/irc/Config.js b/hubs/static/client/app/widgets/irc/Config.js new file mode 100644 index 0000000..1fc4fa8 --- /dev/null +++ b/hubs/static/client/app/widgets/irc/Config.js @@ -0,0 +1,11 @@ +import React from 'react'; +import SimpleWidgetConfig from '../../components/SimpleWidgetConfig'; + + +// Use the default configuration, it's sufficient. + +export default function Config(props) { + return ( + + ); +} diff --git a/hubs/static/client/app/widgets/irc/IRCWidget.css b/hubs/static/client/app/widgets/irc/IRCWidget.css new file mode 100644 index 0000000..b1d1548 --- /dev/null +++ b/hubs/static/client/app/widgets/irc/IRCWidget.css @@ -0,0 +1,6 @@ +.IRCWidget iframe.webchat { + display: block; + width: 100%; + height: 450px; + border: 0; +} diff --git a/hubs/static/client/app/widgets/irc/Widget.js b/hubs/static/client/app/widgets/irc/Widget.js new file mode 100644 index 0000000..b397364 --- /dev/null +++ b/hubs/static/client/app/widgets/irc/Widget.js @@ -0,0 +1,40 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { connect } from 'react-redux'; +import WidgetChrome from '../../components/WidgetChrome'; +import ChatClient from './ChatClient'; +import "./IRCWidget.css"; + +class IRCWidget extends React.Component { + + render() { + return ( + +
+ +
+
+ ); + } +} +IRCWidget.propTypes = { + hub: PropTypes.object.isRequired, + widget: PropTypes.object.isRequired, + editMode: PropTypes.bool, + needsUpdate: PropTypes.bool, +}; + +const mapStateToProps = (state) => { + return { + hub: state.entities.hub, + } +}; + +export default connect(mapStateToProps)(IRCWidget); diff --git a/hubs/widgets/irc/__init__.py b/hubs/widgets/irc/__init__.py new file mode 100644 index 0000000..b884264 --- /dev/null +++ b/hubs/widgets/irc/__init__.py @@ -0,0 +1,20 @@ +from __future__ import unicode_literals, absolute_import + +from hubs.widgets import validators +from hubs.widgets.base import Widget + + +class IRC(Widget): + + name = "irc" + label = "Chat" + position = "both" + parameters = [ + dict( + name="height", + label="Height", + default="450", + validator=validators.Integer, + help="Height of the widget in pixels.", + )] + is_react = True