Commit graph

368 commits

Author SHA1 Message Date
Juan Tejada 072490ebcc fix(send-later): Check if draft is valid before scheduling send later 2016-05-19 13:28:28 -07:00
Evan Morikawa 0db70868a8 fix(composer): reduction in composer bootup time 2016-05-17 15:03:49 -07:00
Evan Morikawa 517a9cdd47 feat(perf): add perf monitoring to composer open time
Summary:
Add basic globally accessible performance monitoring.

Allows us to measure load times for composer windows (or whatever else we
want) and view the data as a Histogram on Mixpanel

Test Plan: manual

Reviewers: bengotow, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D2965
2016-05-17 14:23:14 -07:00
Evan Morikawa 6f355093e0 feat(composer): speed up composer loading & fix deactivate error 2016-05-17 12:37:46 -07:00
Juan Tejada 99f8a81e96 fix(mail-merge): Pass session to injected subject 2016-05-13 16:01:12 -07:00
Ben Gotow 26d4361bfb bump(electron): Fix remaining deprecated requires, move to 1.0.1 2016-05-12 13:59:23 -07:00
Juan Tejada 51d51fb47e feat(mail-merge): Add ability to drop tokens in subject
Summary:
Adds ability to drop tokens in subject via a custom rendered subject field which
renders a contenteditable instead of an input.
Decided to completely replace the subject field via injected components for a
few resons:
  - That's the way we are currently extending the functionality of the participant fields, so it keeps the plugin code consistent (at the cost of potentially more code)
  - Completely replacing the subject for a contenteditable means we hace to do extra work to clean up the html before sending.
  - Reusing our Contenteditable.cjsx class for the subject is overkill, but using a vanilla contenteditable meant duplicating a bunch of the code in that class if we want to add

Test Plan: Unit tests

Reviewers: bengotow, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D2949
2016-05-12 10:47:41 -07:00
Juan Tejada ab55bc68ea fix(build): Fix lint issues and specs 2016-05-11 15:33:52 -07:00
Juan Tejada eb79ce9d44 specs(table): Add specs for table components
Summary:
- Add some docs to Table components
- Updates Table components to use a TableDataSource instead of accessing arrays, cleans up code a bit
- Add enzyme lib to have a cleaner and simpler api to write tests for React Components
- Updates decorators to extend from the BaseComponent instead of vanilla Component, this way instance methods are still available on composed components

Test Plan: - Unit tests

Reviewers: evan, bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2941
2016-05-11 14:36:59 -07:00
Evan Morikawa 1498bcfac6 fix(lint): final linter fixes
fix(lint): final set of linter fixes
2016-05-06 16:32:34 -07:00
Ben Gotow 41ae914b9d fix(lint): Various linter fixes 2016-05-06 16:23:48 -07:00
Ben Gotow 42ef0e98a4 fix(lint): Various linter issues 2016-05-06 16:06:16 -07:00
Evan Morikawa 837627aa39 feat(babel6): 1,774 linter errors 2016-05-06 11:55:46 -07:00
Evan Morikawa e717a44581 feat(babel6): Fix spread operator 2016-05-06 11:55:29 -07:00
Evan Morikawa 50f301e845 feat(babel6): fix es6 describe function syntax 2016-05-06 11:55:20 -07:00
Evan Morikawa 7f50074c0d feat(babel6): Convert to use new es6 require syntax 2016-05-06 11:54:55 -07:00
Ben Gotow f0be73cdc4 fix(focus): Always set selection range into editor on focus 2016-05-05 11:53:58 -07:00
Juan Tejada 2c986f2cd0 fix(composer): Properly setup editing action listeners on update
- This prevented emoji selection via the popover from working on a new
window because the plugin is loaded after the contenteditable sets up
the action listeners, so we need to re set them on update
2016-05-04 16:25:42 -07:00
Juan Tejada 6e0e70ddf7 fix(composer-editor): Remove dead code 2016-05-04 15:02:38 -07:00
Ben Gotow 2bd2965acf fix(keymaps): "Delete" => "Del" to fix keycode 46 2016-05-04 09:29:42 -07:00
Ben Gotow e9a898c869 fix(undo): Don't create separate commands, since they bubble separately 2016-04-29 17:10:17 -07:00
Evan Morikawa 444101a74b fix(specs): fix composer-header specs 2016-04-29 16:54:37 -07:00
Ben Gotow 871383d0b1 fix(lint): Errors in ActionBarPlugins 2016-04-29 16:19:52 -07:00
Evan Morikawa 909226fcf4 feat(composer): better composer plugin loading 2016-04-29 15:58:17 -07:00
Evan Morikawa 99a8143a9d fix(composer): fix flashing and focus losing in the composer 2016-04-29 15:58:17 -07:00
Ben Gotow 105e33c9c4 fix(mail-merge): Fix drag and drop for files vs. chips 2016-04-29 11:57:43 -07:00
Evan Morikawa b226dfb5b1 perf(composer): tweak tooltip animation timing & composer loading 2016-04-28 13:42:30 -07:00
Juan Tejada ea9538f444 feat(mail-merge): Add CSV imports, styling, and several fixes
Summary: Adds CSV imports, proper styles to mail merge plugin and fixes a handful of bugs

Test Plan: TODO

Reviewers: bengotow, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D2925
2016-04-27 18:22:32 -07:00
Ben Gotow 2bae0d5885 fix(composer): Wait frames not msec on focus out #2033 2016-04-26 13:14:06 -07:00
Evan Morikawa 3ac94a4402 fix(win): draft popout windows always send draftJSON 2016-04-26 13:02:05 -07:00
Ben Gotow a48ddd51f8 refactor(menus): Major prune of keymaps/commands, real conditional menus
Summary:
Keymaps & menus CSON => JSON, remove AtomKeymaps, CommandRegistry use of CSS selectors, use Mousetrap instead

Important Notes:

- The `application:` prefix is reserved for commands which are handled in the application process. Don't use it for other things. You will not receive the events in the window.

- Maintaining dynamic menus seems to come with quite an overhead, because Electron updates the entire menu every time. In the future, we'll need https://github.com/electron/electron/issues/528 to really make things nice. I will be tracking this upstream.

- The format for keyboard shortcuts has changed. `cmd-X` is now `command+shift+x`

Test Plan: Run tests

Reviewers: juan, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D2917
2016-04-24 12:16:25 -05:00
Juan Tejada 2dccde2e58 feat(mail-merge): Add mail merge plugin
Summary:
Adds Mail Merge Plugin
- Adds new table components to component kit
- Adds new extension points to allow dragging and dropping into composer contenteditable and participant fields and customizing participant fields
- Adds new decorators and other misc updates
- #1608

Test Plan: TODO

Reviewers: bengotow, evan

Reviewed By: bengotow, evan

Differential Revision: https://phab.nylas.com/D2895
2016-04-22 18:29:07 -07:00
Evan Morikawa 1920d5db8a fix(win): speed up composer launching 2016-04-22 17:41:22 -07:00
Evan Morikawa 78112563a6 feat(win): faster popout windows
Summary:
This diff is designed to dramatically speed up new window load time for
all window types and reduce memory consumption of our hot windows.

Before this diff, windows loaded in ~3 seconds. They now boot in a couple
hundred milliseconds without requiring to keep hot windows around for
each and every type of popout window we want to load quickly.

One of the largest bottlenecks was the `require`ing and initializing of
everything in `NylasExports`.

I changed `NylasExports` to be entirely lazily-loaded. Drafts and tasks
now register their constructors with a `StoreRegistry` and the
`TaskRegistry`. This lets us explicitly choose a time to activate these
stores in the window initalization instead of whenever nylas-exports
happens to be required first.

Before, NylasExports was required first when components were first
rendering. This made initial render extremely slow and made the proposed
time picker popout slow.

By moving require into the very initial window boot, we can create a new
scheme of hot windows that are "half loaded". All of the expensive
require-ing and store initialization is done. All we need to do is
activate the packages for just the one window.

This means that the hot window scheme needs to fundamentally change from
have fully pre-loaded windows, to having half-loaded empty hot windows
that can get their window props overridden again.

This led to a major refactor of the WindowManager to support this new
window scheme.

Along the way the API of WindowManager was significantly simplifed.
Instead of a bunch of special-cased windows, there are now consistent
interfaces to get and `ensure` windows are created and displayed. This
DRYed up a lot of repeated logic around showing or creating core windows.

This also allowed the consolidation of the core window configurations into
one place for much easier reasoning about what's getting booted up.

When a hot window goes "live" and gets populated, we simply change the
`windowType`. This now re-triggers the loading of all of the packages for
the window. All of the loading time is now just for the packages that
window requires since core Nylas is there thanks to the hot window
mechanism.

Unfortunately loading all of the packages for the composer was still
unnaceptably slow. The major issue was that all of the composer plugins
were taking a long time to process and initialize. The solution was to
have the main composer load first, then trigger another window load
settings change to change the `windowType` that loads in all of the
plugins.

Another major bottleneck was the `RetinaImg` name lookup on disk. This
requires traversing the entire static folder synchronously on boot. This
is now done once when the main window loads and saved in a cache in the
browser process. Any secondary windows simply ask the backend for this
cache and save the filesystem access time.

The Paper Doc below is the current set of manual tests I'm doing to make
sure no window interactions (there are a lot of them!) regressed.

Test Plan: https://paper.dropbox.com/doc/Window-Refactor-UYsgvjgdXgVlTw8nXTr9h

Reviewers: juan, bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2916
2016-04-22 13:30:42 -07:00
Ben Gotow 33225f56b0 rename(drafts) DraftStoreProxy => DraftEditingSession 2016-04-19 16:08:58 -07:00
Ben Gotow 7452705c31 refactor(composer): Make session, draft available everywhere
Summary:
Up until now, we've been requiring that every plugin control in the composer take the draftClientId, retreive the session, listen to it, build state from the draft, etc. This is a huge pain and is hard to explain to newcomers becaus it frankly makes no sense.

In 0.3.45 we made it so that the ComposerView always has a non-null draft and session. (It isn't rendered until they're available). In this diff, I just pass those through to all the plugins and remove all the session retrieval cruft.

Almost none of the buttons have state of their own, which I think is appropriate.

They do render on every keystroke, but they were already running code (to recompute their state) on each keystroke and profiling suggests this has no impact.

Prepare for immutable

In preparation for Immutable models, make the draft store proxy returns a !== draft if any changes have been made. This means you can safely know that a draft has changed if `props.draft !== nextProps.draft`

Test Plan: Run tests

Reviewers: juan, evan

Reviewed By: juan, evan

Differential Revision: https://phab.nylas.com/D2902
2016-04-19 16:05:15 -07:00
Dakota Nelson ccaa03e944 Expose ParticipantsTextField through component kit (#1994) 2016-04-18 16:39:08 -07:00
Ben Gotow f85f447141 fix(require): Move more requires to new electron format 2016-04-13 15:35:01 -07:00
Ben Gotow 3cd94e8957 fix(cc/bcc): Make targets bigger, wait longer before declaring focus left 2016-04-06 13:54:39 -07:00
Ben Gotow 34201ff644 fix(collapsed-participants): Resize in correct scenarios 2016-04-05 14:16:24 -07:00
Ben Gotow 646ac9589c fix(composer): Show when rendered, send draft JSON to composer windows 2016-04-04 18:30:50 -07:00
Ben Gotow 2688881ff3 fix(lint): Missing const breaking build 2016-04-04 17:12:59 -07:00
Evan Morikawa db1f651a3e fix(scheduler): add timezone & fix tabbing 2016-04-04 16:06:48 -07:00
Ben Gotow b4434f6617 fix(focus): Remove focusedField in favor of imperative focus, break apart ComposerView
Summary:
- Removes controlled focus in the composer!
  - No React components ever perfom focus in lifecycle methods. Never again.
  - A new `Utils.schedule({action, after, timeout})` helper makes it easy to say "setState or load draft, etc. and then focus"
  - The DraftStore issues a focusDraft action after creating a draft, which causes the MessageList to focus and scroll to the desired composer, which itself decides which field to focus.
  - The MessageList never focuses anything automatically.
- Refactors ComposerView apart — ComposerHeader handles all top fields, DraftSessionContainer handles draft session initialization and exposes props to ComposerView
  - ComposerHeader now uses a KeyCommandRegion (with focusIn and focusOut) to do the expanding and collapsing of the participants fields. May rename that container very soon.
- Removes all CommandRegistry handling of tab and shift-tab. Unless you preventDefault, the browser does it's thing.
- Removes all tabIndexes greater than 1. This is an anti-pattern—assigning everything a tabIndex of 0 tells the browser to move between them based on their order in the DOM, and is almost always what you want.
- Adds "TabGroupRegion" which allows you to create a tab/shift-tabbing group, (so tabbing does not leave the active composer). Can't believe this isn't a browser feature.

Todos:
- Occasionally, clicking out of the composer contenteditable requires two clicks. This is because atomicEdit is restoring selection within the contenteditable and breaking blur.
- Because the ComposerView does not render until it has a draft, we're back to it being white in popout composers for a brief moment. We will fix this another way - all the "return unless draft" statements were untenable.
- Clicking a row in the thread list no longer shifts focus to the message list and focuses the last draft. This will be restored soon.

Test Plan: Broken

Reviewers: juan, evan

Reviewed By: juan, evan

Differential Revision: https://phab.nylas.com/D2814
2016-04-04 15:22:01 -07:00
Evan Morikawa 15ff969e73 feat(calendar): add week view for quick scheduler
Summary: New Calendar

Test Plan: TODO

Reviewers: drew, juan, bengotow

Reviewed By: bengotow

Subscribers: jackie

Differential Revision: https://phab.nylas.com/D2767
2016-04-04 15:05:48 -07:00
Ben Gotow 39768fd9d4 bump(react): 0.13.2 => 0.14.7
Great breakdown of React changes here:
https://github.com/facebook/react/blob/master/CHANGELOG.md#0140-october-7-2015

Due to deprecation warnings, I don't think this will break third-party extensions unless they were doing really bad things.
2016-03-29 01:43:12 -07:00
Ben Gotow 3fa93c2730 fix(composer): Sentry 9688 2016-03-24 17:18:50 -07:00
Juan Tejada 9413459311 fix(styles): Fix styles for attachment and upload items 2016-03-23 17:16:25 -07:00
Dakota Nelson f3250e5395 Add extensibility in composer recipient chips
Summary:
Allow for injection into the composer's list of recipients to indicate
something about each recipient (i.e. for the PGP plugin, allow an
indicator as to whether or not each recipient has a PGP key
available)

Test Plan: Tested locally

Reviewers: juan

Reviewed By: juan

Subscribers: bengotow

Differential Revision: https://phab.nylas.com/D2761
2016-03-22 17:08:54 -07:00
Ben Gotow 92bff6ca5a fix(drafts): Formalize draft factory, add reply "behaviors" #1722
Summary:
This diff implements a behavior change described in https://github.com/nylas/N1/issues/1722.

Reply buttons should prefer to focus an existing draft in reply to the same message, if one is pristine, altering it as necessary to switch between reply / reply-all. If no pristine reply is already there, it creates one.

Reply keyboard shortcuts should do the same, but more strictly - the shortcuts should switch between reply / reply-all for an existing draft regardless of whether it's pristine.

This diff also cleans up the DraftStore and moves all the draft creation itself to a new DraftFactory object. This makes it much easier to see what's going on in the DraftStore, and I also refactored away the "newMessageWithContext" method, which was breaking the logic for Reply vs Forward between a bunch of different helper methods and was hard to follow.

Test Plan: They're all wrecked. Will fix after concept is greenlighted

Reviewers: evan, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D2776
2016-03-22 15:47:51 -07:00