Mailspring/internal_packages/composer/lib/main.cjsx
Evan Morikawa 0b7b76c70e feat(composer): new composer and button styles
Summary:
initial styling of image attachments

more styles for composer overflow

style composer toolbar

toolbar styling

Fixes to inline composer

Test Plan: edgehill --test

Reviewers: bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D1647
2015-06-17 16:03:50 -07:00

71 lines
1.9 KiB
CoffeeScript

_ = require 'underscore'
React = require 'react'
{NamespaceStore,
DatabaseStore,
Message,
ComponentRegistry,
WorkspaceStore} = require('nylas-exports')
ComposeButton = require('./compose-button')
ComposerView = require('./composer-view')
class ComposerWithWindowProps extends React.Component
@displayName: 'ComposerWithWindowProps'
@containerRequired: false
constructor: (@props) ->
@state = atom.getWindowProps()
componentDidMount: ->
@unlisten = atom.onWindowPropsReceived (windowProps) =>
{errorMessage} = windowProps
@_showInitialErrorDialog(errorMessage) if errorMessage
@setState(windowProps)
componentWillUnmount: ->
@unlisten()
render: ->
<div className="composer-full-window">
<ComposerView mode="fullwindow" localId={@state.draftLocalId} />
</div>
_showInitialErrorDialog: (msg) ->
remote = require('remote')
dialog = remote.require('dialog')
dialog.showMessageBox remote.getCurrentWindow(), {
type: 'warning'
buttons: ['Okay'],
message: "Error"
detail: msg
}
module.exports =
activate: (@state={}) ->
atom.registerHotWindow
windowType: 'composer'
replenishNum: 2
# Register our composer as the app-wide Composer
ComponentRegistry.register ComposerView,
role: 'Composer'
if atom.isMainWindow()
ComponentRegistry.register ComposeButton,
location: WorkspaceStore.Location.RootSidebar.Toolbar
else
atom.getCurrentWindow().setMinimumSize(480, 400)
WorkspaceStore.defineSheet 'Main', {root: true},
popout: ['Center']
ComponentRegistry.register ComposerWithWindowProps,
location: WorkspaceStore.Location.Center
deactivate: ->
atom.unregisterHotWindow('composer')
ComponentRegistry.unregister(ComposerView)
ComponentRegistry.unregister(ComposeButton)
ComponentRegistry.unregister(ComposerWithWindowProps)
serialize: -> @state