This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
children = [ | |
supervisor(Sling.Repo, []), | |
supervisor(Sling.Endpoint, []), | |
supervisor(Sling.Presence, []), # add this line | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @flow | |
import React, { Component } from 'react'; | |
import { Field, reduxForm } from 'redux-form'; | |
import { css, StyleSheet } from 'aphrodite'; | |
const styles = StyleSheet.create({ | |
form: { | |
padding: '0px 10px 10px 10px', | |
background: '#fff', | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @flow | |
import React from 'react'; | |
import md5 from 'md5'; | |
type Props = { | |
email: string, | |
size?: number, | |
style?: Object, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @flow | |
import React from 'react'; | |
import moment from 'moment'; | |
import Avatar from '../Avatar'; | |
type Props = { | |
message: { | |
text: string, | |
inserted_at: string, | |
user: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @flow | |
import React, { Component } from 'react'; | |
import moment from 'moment'; | |
import groupBy from 'lodash/groupBy'; | |
import mapKeys from 'lodash/mapKeys'; | |
import { css, StyleSheet } from 'aphrodite'; | |
import Message from '../Message'; | |
const styles = StyleSheet.create({ | |
container: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @flow | |
import React from 'react'; | |
import { css, StyleSheet } from 'aphrodite'; | |
const styles = StyleSheet.create({ | |
navbar: { | |
padding: '15px', | |
background: '#fff', | |
borderBottom: '1px solid rgb(240,240,240)', | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @flow | |
import React, { Component } from 'react'; | |
import { connect } from 'react-redux'; | |
import { connectToChannel, leaveChannel, createMessage } from '../../actions/room'; | |
import MessageList from '../../components/MessageList'; | |
import MessageForm from '../../components/MessageForm'; | |
import RoomNavbar from '../../components/RoomNavbar'; | |
type MessageType = { | |
id: number, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Sling.MessageView do | |
use Sling.Web, :view | |
def render("message.json", %{message: message}) do | |
%{ | |
id: message.id, | |
inserted_at: message.inserted_at, | |
text: message.text, | |
user: %{ | |
email: message.user.email, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const initialState = { | |
channel: null, | |
currentRoom: {}, | |
messages: [], // new line | |
}; | |
export default function (state = initialState, action) { | |
switch (action.type) { | |
case 'ROOM_CONNECTED_TO_CHANNEL': | |
return { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { reset } from 'redux-form'; | |
export function connectToChannel(socket, roomId) { | |
return (dispatch) => { | |
if (!socket) { return false; } | |
const channel = socket.channel(`rooms:${roomId}`); | |
// new function | |
channel.on('message_created', (message) => { | |
dispatch({ type: 'MESSAGE_CREATED', message }); |