import map from 'lodash/map' import React from 'react' import Peer from 'simple-peer' import { Message } from '../actions/ChatActions' import { Alert, Notification } from '../actions/NotifyActions' import { TextMessage } from '../actions/PeerActions' import { AddStreamPayload } from '../actions/StreamActions' import * as constants from '../constants' import Alerts from './Alerts' import Chat from './Chat' import Notifications from './Notifications' import Toolbar from './Toolbar' import Video from './Video' import { Media } from './Media' export interface AppProps { active: string | null alerts: Alert[] dismissAlert: (alert: Alert) => void init: () => void notifications: Record messages: Message[] messagesCount: number peers: Record sendMessage: (message: TextMessage) => void streams: Record onSendFile: (file: File) => void toggleActive: (userId: string) => void } export interface AppState { videos: Record chatVisible: boolean } export default class App extends React.PureComponent { state: AppState = { videos: {}, chatVisible: false, } handleShowChat = () => { this.setState({ chatVisible: true, }) } handleHideChat = () => { this.setState({ chatVisible: false, }) } handleToggleChat = () => { return this.state.chatVisible ? this.handleHideChat() : this.handleShowChat() } componentDidMount () { const { init } = this.props init() } render () { const { active, alerts, dismissAlert, notifications, messages, messagesCount, onSendFile, peers, sendMessage, toggleActive, streams, } = this.props const { videos } = this.state return (
) } }