Commit graph

375 commits

Author SHA1 Message Date
Juan Tejada e103809b34 fix(mail-merge): Switch to using new overlaid components api
Summary:
- Fixes several selection and focus issues along the way
- Can now preview what tokens will look like when not editing
- Adds decorator to listen to mail merge session changes and removes a bunch of duplicated code
- Gets rid of all imperative code (and specs) that had to imperatively
reach into the dom to update the tokens

Test Plan: - Unit tests

Reviewers: bengotow, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D2989
2016-05-27 11:02:44 -07:00
Juan Tejada 6e57cbaee4 fix(build): Fix remaining specs (composer-view, send-draft-task) 2016-05-25 10:25:36 -07:00
Juan Tejada 39611f8962 fix(specs): Fix merge conflicts and some specs 2016-05-24 19:04:20 -07:00
Juan Tejada db868740c8 fix(build): Fix lint error 2016-05-24 17:53:15 -07:00
Juan Tejada a4ee61eadc fix(mail-merge): Refactor mass sending procedure
Summary:
This diff introduces several updates to mail merge to improve the procedure for sending a list of drafts.
Specifically, sending mass email will now:

- Clear mail merge metadata on the drafts that will actually be sent
- Upload attached files only /once/, and reuse those files on the drafts that will actually be sent
- Minimize database writes for new drafts being created
- Will queue a SendManyDraftsTask that will subsequently queue the necessary SendDraftTasks and keep track of them, and notify of any failed tasks

TODO:
- Add state to MailMerge plugin for failed sends and ability to attempt to re send them

Test Plan: - TODO

Reviewers: evan, bengotow, jackie

Reviewed By: bengotow, jackie

Subscribers: jackie

Differential Revision: https://phab.nylas.com/D2973
2016-05-24 17:22:09 -07:00
Evan Morikawa c9ea5b6483 feat(scheduler): Add Overlaid Components
Summary:
SEE ASSOCIATED SUBMODULE DIFF

This enables rich React components (like the Scheduler's `NewEventCard`)
to be used in contenteditables.

We introduce the concept of an "Overlaid Component". These are rendered
React components that are absolutely positioned on top of an equivalent
"Anchor" in a contenteditable.

Inside the contenteditable are special `<img />` tags that have an
id corresponding to a particular rich overlaid component. This way, even
if those img tags are cut and pasted or moved, they'll have a mapping to a
  particular component stored in the `OverlaidComponentStore`. Img tags
  are fairly well handled natively by contenteditable and allow you to
  maniuplate these overlaid components as normal text elements.

The `OverlaidComponentStore` is responsible for listening to and managing
the state of the Anchors and their equivalent OverlaidComponents.

We use a decorator called `ListenToChanges` that allows us to wrap
components to update their corresponding anchor. Since we need to know
about ALL changes that could affect rendered height and width, we need to
use a `MuatationListener` instead of the React render cycle.

This is only the initial diff. There are several TODOs here:
https://paper.dropbox.com/doc/Composer-Overlaid-Components-FoZrF0cFggzSUZirZ9MNo

Test Plan: TODO. Manual

Reviewers: juan, bengotow

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D2946
2016-05-24 15:47:49 -07:00
Ben Gotow 77733253eb fix(undo): Move undo/redo to session, properly undo all changes
Summary:
- Simplify undoManager to just maintain the undo/redo history items
- DraftEditingSession manages snapshotting state of draft, hack allows it to also save selection (still hoping to eventually put selection in body HTML as markers)
- Switch from `debounce` to `throttle` style behavior so typing for along time followed by undo doesn't undo away your entire block.

This resolves two issues:
+ Changes to participant fields are no longer undoable because they go straight to the session.
+ Changes to metadata weren't undoable.

Test Plan: Tests WIP

Reviewers: evan, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D2956
2016-05-24 11:48:33 -07:00
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