Mailspring/examples/N1-Send-Availability/lib/calendar-button.cjsx
Drew Regitsky 92820fc3d2 fix(examples): revamp/fix Send-Availability, change URL to live Heroku link
Summary:
Several fixes and updates the the Send Availability example package. Switches from
using `electron-safe-ipc` to using `protocol.RegisterStringProtocol` to communicate
with the child window. Changes the URLs in the package from localhost to our live
demo backend.

Test Plan: manual

Reviewers: bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2271
2015-11-19 18:16:38 -08:00

31 lines
819 B
CoffeeScript

{Utils, DraftStore, React} = require 'nylas-exports'
{RetinaImg} = require 'nylas-component-kit'
class CalendarButton extends React.Component
@displayName: 'CalendarButton'
render: =>
<button className="btn btn-toolbar" onClick={@_onClick}>
Add Availability
</button>
_onClick: =>
BrowserWindow = require('remote').require('browser-window')
w = new BrowserWindow
'node-integration': false,
'web-preferences': {'web-security':false},
'width': 700,
'height': 600
# Here, we load an arbitrary html file into the Composer!
path = require 'path'
url = path.join __dirname, '..', 'calendar.html'
w.loadUrl "file://#{url}?draftClientId=#{@props.draftClientId}"
_getDialog: =>
require('remote').require('dialog')
module.exports = CalendarButton