Commit graph

132 commits

Author SHA1 Message Date
Juan Tejada 78665c5fec fix(sidebar): Handle edge cases for sidebar shortcuts
Summary:
- Update menus and shortcuts correclt when accounts change or focused
  accounts change
- Move menu logic into SidebarCommands to remove duplicated logic
- Make `Window` menu also contain checkboxes

Test Plan: - Manual

Reviewers: evan, bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2534
2016-02-05 14:25:07 -08:00
Juan Tejada c4749f592e fix(sidebar): Display correct keyboard shortcuts in account switcher
- Fixes #1203
2016-02-05 09:55:27 -08:00
Juan Tejada 182f6abb25 update(sidebar): Update sidebar design + context menus
Summary:
- Removes account switcher almost entirely
- Update context menu to edit and delete sidebar items
- Gross hardcoded position and size for the switcher icon -- will likely update with later redesign

Test Plan: - Visual

Reviewers: evan, bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2527
2016-02-04 14:58:47 -08:00
Ben Gotow 8b3f7f0578 feat(outbox): Sending status now appears beside drafts
Summary:
This diff adds an "OutboxStore" which reflects the TaskQueue and
adds a progress bar / cancel button to drafts which are currently sending.

- Sending state is different from things like Send later because drafts
  which are sending shouldn't be editable. You should have to stop them
  from sending before editing. I think we can implement "Send Later"
  indicators, etc. with a simple InjectedComponentSet on the draft list
  rows, but the OutboxStore is woven into the DraftList query subscription
  so every draft has a `uploadTaskId`.

- The TaskQueue now saves periodically (every one second) when there are
  "Processing" tasks. This is not really necessary, but makes it super
  easy for tasks to expose "progress", because they're essentially
  serialized and propagated to all windows every one second with the
  current progress value. Kind of questionable, but super convenient.

- I also cleaned up ListTabular and MultiselectList a bit because they
  applied the className prop to an inner element and not the top one.

- If a DestroyDraft task is created for a draft without a server id, it
  ends with Task.Status.Continue and not Failed.

- The SendDraftTask doesn't delete uploads until the send actually goes
  through, in case the app crashes and it forgets the file IDs it created.

Test Plan: Tests coming soon

Reviewers: juan, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D2524
2016-02-04 14:14:24 -08:00
Juan Tejada 4fc9c74362 fix(sidebar):Correctly update sidebar by listening to FocusedPerspective
-  Clean up AccountSwitcher a bit
2016-02-02 10:59:44 -08:00
Juan Tejada ae039a6752 Revert "fix(sidebar): Correctly update sidebar when a notif is selected"
This reverts commit 0828badb921c81a9779b2e52ab4829bf0db07410.
2016-02-02 10:58:24 -08:00
Juan Tejada cd2d8f0629 fix(sidebar): Correctly update sidebar when a notif is selected
- Clean up AccountSwitcher a bit
2016-02-02 10:44:18 -08:00
Juan Tejada 2955ce7dee fix(styles): Cleanup less files for account sidebar and switcher 2016-01-29 11:03:52 -08:00
Juan Tejada 223f7fdde4 fix(sidebar): Update sidebar correctly when an account added or removed 2016-01-29 10:21:49 -08:00
Ben Gotow 179626dc20 fix(config): observe fires immediately, causing re-renders 2016-01-29 00:31:10 -08:00
Juan Tejada e7a70d9bf7 fix(account-switcher): Don't display "All Accounts" when only 1 account 2016-01-28 19:53:12 -08:00
Ben Gotow db06df0902 fix(account-sidebar): onToggleCollapsed => onCollapseToggled 2016-01-28 16:57:24 -08:00
Juan Tejada 0c3ca4b6e4 fix(sidebar): Prevent editing items in OutlineView when not allowed
- Fix check in OutlineViewItem
2016-01-28 16:21:21 -08:00
Ben Gotow de489368e6 fix(unified): Add a unified icon. designer gets back tues. 2016-01-28 16:01:22 -08:00
Juan Tejada 10a6b76fb7 add(docs): Add docs for OutlineView and OutlineViewItem
- Renames some stuff
2016-01-28 15:28:15 -08:00
Ben Gotow 09a2096690 fix(linter): Switching between Coffee + ES6 is hard... 2016-01-28 14:59:17 -08:00
Juan Tejada 89f431edec add(specs): Add specs for MailboxPerspective
- Renames canApplyToThreads -> canReceiveThreads and applyToThreads ->
  receiveThreads
- Add initial specs and better documentation for
  MailboxPerspective.canReceiveThreads.
2016-01-28 14:11:50 -08:00
Juan Tejada 8237e3742c fix(perspective): Update MailboxPerspective.canApplyToThreads
- Checks if the account ids of the threads that want to be applied are
  contained inside the perspectives account ids. E.g.:
  - I can move thread from account A to unified inbox or inbox A, but
    not to inbox B.
  - I can move threads from account A to a folder in account A but not a
    folder in account B
- Update data transferred in drag + other minor updates
2016-01-28 13:30:08 -08:00
Juan Tejada 19edb34599 Increment max width for sidebar 2016-01-28 01:29:18 -08:00
Juan Tejada 8bd387e8b2 Update OutlineViewItem to focus end of input when editing 2016-01-28 00:02:55 -08:00
Juan Tejada aa4de82625 Add folder/label renames
- Updates OutlineView to reuse OutlineViewItem for creating new items
- Adds ability to edit outline view items via double click or right
  click
- Cleans up css and code and sidebar item
- Updates SyncbackCategoryTask to update categories as well
- Adds 405 to permanent api error codes
2016-01-27 23:16:17 -08:00
Ben Gotow 53390fbd5c Basic fixes for drag and drop 2016-01-27 11:45:02 -08:00
Ben Gotow 470fbae6a3 Fix sidebar when an account doesn't have a standard category 2016-01-27 11:14:11 -08:00
Ben Gotow 3bcbec4118 Fix for bad @props 2016-01-25 19:07:28 -08:00
Ben Gotow 68d55fb662 Clean up action bars, random exceptions 2016-01-25 17:08:38 -08:00
Ben Gotow 22121f9f18 Fix drafts 2016-01-25 16:37:34 -08:00
Juan Tejada 901ce1bcbd Show window when switching accounts if it isnt visible 2016-01-22 11:58:24 -08:00
Juan Tejada 2380e1eefa Update sidebar to hold state for selected account
- Ensures that it displays the correct set of sidebar items even when
  the perspective changes
- Also sets up hotkeys to switch currently focused accounts
2016-01-21 14:13:48 -08:00
Juan Tejada e8583abb01 Update default collapsed value for sidebar items in unified inbox view 2016-01-20 19:22:33 -08:00
Juan Tejada 6c559ddb7e Add collapse capabilities to OutlineView
- Make user category sections collapsible when in unified view
- Get rid of dumb CategoryHelpers class
2016-01-20 17:09:05 -08:00
Ben Gotow 1d55f1ac11 Change the sidebar to use Flexbox for container 2016-01-20 13:04:06 -08:00
Juan Tejada b538ec050c Add account switcher back to sidebar:
- Account switcher can now switch between all accounts and each account
- Updates FocusedPerspectiveStore and Actions.focusDefaultMailboxPerspectiveForAccounts
  to focus a perspective for accountIds instead of for a single account,
  and updates methods
  - Adds helpers to CategoryStore and MailboxPerspective
  - Updates key commands to allow switch to unified inbox
2016-01-19 23:42:50 -08:00
Juan Tejada 38590139bc Fix collapsing behavior for non perspective sidebar items
- Assign unique id for sheet and draft sidebar items
2016-01-19 10:51:52 -08:00
Juan Tejada 866805f835 More account sidebar refactor + sections for unified inbox
- Refactors some of the old code which was 💩
  - Makes SidbarSection a factory for different types of items for the
    OutlineView
  - Decided not to create a OutlineViewItem.Model class since the only
    purpose it would serve would be to validate getters for props or for
    documentation, both of which are already done via React.PropTypes.
- Adds sections when looking at unified inbox and integrates with new
  mailbox perspecitve interface
- Updates OutlineViewItem a bit + styles
- Tests missing
2016-01-18 23:22:46 -08:00
Juan Tejada 81bd78fb09 Fix merge errors 2016-01-18 11:56:52 -08:00
Juan Tejada e1084708b8 Minor fixes and style updates 2016-01-18 11:48:34 -08:00
Ben Gotow 00ff8269da Make a few changes to AccountSidebar - needs to use accountIds? 2016-01-18 01:31:54 -08:00
Ben Gotow f1b4a23897 Merge branch 'unified-inbox-bg' into unified-inbox
# Conflicts:
#	internal_packages/account-sidebar/lib/account-sidebar-store.coffee
#	internal_packages/account-sidebar/lib/main.coffee
#	internal_packages/category-picker/lib/category-picker.cjsx
#	spec/stores/focused-perspective-store-spec.coffee
#	src/flux/stores/focused-perspective-store.coffee
#	src/mailbox-perspective.coffee
2016-01-18 00:53:03 -08:00
Ben Gotow 96f429ff39 Unified inbox mailbox perspectives working (sidebar disabled atm) 2016-01-18 00:47:04 -08:00
Juan Tejada ebb9c9735f AccountSidebar package refactor:
- Creates OutlineView generic component and uses that instead of custom
  code
- Refactors AccountSidebarStore:
  - Split the generation of the state tree into smaller functions
  - Adds different types of account sidebar items and sections, which contain
    logic and props necessary to be rendered as OutlineViewItems, and
    removes that logic from the store
- Removes WorkspaceStore.SidebarItem and removes the ability to register
  new sidebar items. If people want to add something to the sidebar they
  can just register a Component via the component registry and use the
  OutlineView component
- Removes the DraftListSidebarItem, which was basically duplicated code
  for an item but with a different data source. This is now handled
  generically by the account sidebar by rendering OutlineViewItems with
  different props and handlers
- Clean ups here and there:

- TODO
  - Add AccountSwitcher
  - Revisit calculation and generation of the state tree. Should the
    parent store contain and update the entire state all the time.
    Should separate items inside the tree have their own data sources?
  - This would avoid having the AccountSidebarStore listen to a bunch of
    different other stores, and the specific logic wold be contained
    inside each item type.
2016-01-15 16:55:21 -08:00
Juan Tejada 8db220cbb9 Fix issues in AccountSidebarStore and MailboxPerpective#isEqual 2016-01-11 17:54:40 -08:00
Juan Tejada a1a5cd7fb9 Fix tests for AccountSidebarStore
- Switches to using CategoryStore to reduce complexity
- Update CategoryStore.categories to retun all categories when account
  is null
- Inits AccountSidebarStore._account based on the currently focused
  MailboxPerspective
2016-01-11 15:16:50 -08:00
Ben Gotow 7b6f122119 AccountStore no longer tracks index, Actions.selectAccount gone 2016-01-11 14:11:48 -08:00
Juan Tejada b5fa97bc7a fix(category-store): Fix issue with observables in CategoryStore
- Removes use of observables from category store and keeps a big cache
  of categories per account
- Upates Category Observables with new helper observables
- Updates CategoryPicker and AccountSidebarStore to use observables
- Misc fixes
2016-01-08 18:03:18 -08:00
Ben Gotow 14d6cec669 Rename MailViewFilter => MailboxPerspective 2016-01-08 14:58:31 -08:00
Juan Tejada 34f68dcc0d refactor(rip-current-account): Rips out AccountStore.current
Summary:
- WIP: Need to fix tests and some errors!
- Refactors Category class to hold information about its type
- Refactors CategoryStore to rely on observables instead of local caches
- Adds and updates Observables and helpers
- Refactors ContactStore to hold entire cache of contacts instead of per
  current account
  - Same for ContactRankingStore and other stores
- Refactors method names for AccountStore + some helpers
- Updates MailViewFilter to hold an account
  - Adds basic Unified filter
- Replaces AccountStore.current calls with either:
  - The account of the currently focused MailViewFilter
  - The account associated with a thread, message, file, etc...
  - A parameter to be passed in
  - Arbitrarily, the first account in the AccountsStore

Test Plan: - Unit tests

Reviewers: evan, bengotow

Differential Revision: https://phab.nylas.com/D2423
2016-01-08 14:22:13 -08:00
Ben Gotow af67597f0b feat(mail-rules): Per-account mail rules filter incoming, existing mail
Summary:
Originally, this was going to be a totally independent package, but
I wasn't able to isolate the functionality and get it tied in to
the delta-stream consumption. Here's how it currently works:

- The preferences package has a new tab which allows you to edit
  mail filters. Filters are saved in a new core store, and a new
  stock component (ScenarioEditor) renders the editor. The editor
  takes a set of templates that define a value space, and outputs
  a valid set of values.

- A new MailFilterProcessor takes messages and creates tasks to
  apply the actions from the MailFiltersStore.

- The worker-sync package now uses the MailFilterProcessor to
  apply filters /before/ it calls didPassivelyReceiveNewModels,
  so filtrs are applied before any notifications are created.

- A new task, ReprocessMailFiltersTask allows you to run filters
  on all of your existing mail. It leverages the existing TaskQueue
  architecture to: a) resume where it left off if you quit midway,
  b) be queryable (for status) from all windows and c) cancelable.
  The TaskQueue is a bit strange because it runs performLocal and
  performRemote very differently, and I had to use `performRemote`.
  (todo refactor soon.)

This diff also changes the EditableList a bit to behave like a
controlled component and render focused / unfocused states.

Test Plan: Run tests, only for actual filter processing atm.

Reviewers: juan, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D2379
2015-12-23 02:19:32 -05:00
Juan Tejada b68a8d6bc9 fix(warning): Remove implicit return from event handler to remove react
warning
2015-12-10 18:19:13 -08:00
Juan Tejada 415d612458 feat(account-prefs): Adds new page for Account in preferences
Summary:
Adds the new Account preferences page. This consists of two major React components,
PreferencesAccountList and PreferencesAccountDetails, both of which use EditableList.

I added a bunch of fixes and updated the API for EditableList, plus a bit of
refactoring for PreferencesAccount component, and a bunch of CSS so its a big diff.

The detailed changelog:

Updates to EditableList:
  - Fix bug updating selection state when arrows pressed to move selection
  - Add new props:
    - allowEmptySelection to allow the list to have no selection
    - createInputProps to pass aditional props to the createInput
  - Add scroll region for list items
  - Update styles and refactor render methods

Other Updates:
- Updates Account model to hold aliases and a label
  - Adds getter for label to default to email
- Update accountswitcher to display label, update styles and spec

- Refactor PreferencesAccounts component:
  - Splits it into smaller components,
  - Removes unused code
- Splits preferences styelsheets into smaller separate stylesheet for
  account page. Adds some updates and fixes (scroll-region padding)
- Update AccountStore to be able to perform updates on an account.
- Adds new Action to update account, and an action to remove account to
  be consistent with Action usage
- Adds components for Account list and Aliases list using EditableList

Test Plan: - All specs pass, but need to write new tests!

Reviewers: bengotow, evan

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2332
2015-12-10 15:27:29 -08:00
Ben Gotow d7d5ed2832 feat(prefs): Allow tabs with an accounts submenu
Summary:
This diff:
- Improves the styling of the tabs in the preferences sidebar.
- Adds an optional param to section cofnig that puts an "account" submenu beneath the tab item.
- Renames preferences "sections" => "tabs", and renames the PreferencesSectionStore to PreferencesUIStore. I think we should include "UI" in more of our stores, and I think "tabs" is a good idea because it's unambigious—there's no way you could confuse it for a "section" of the NylasEnv.config tree or think it deals with actually saving prefs.

Test Plan: Inspect visually

Reviewers: evan, juan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D2296
2015-11-30 11:43:49 -08:00