Mailspring/internal_packages/preferences/lib/main.cjsx
Ben Gotow 6a4613b4a1 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

52 lines
1.4 KiB
CoffeeScript

{PreferencesUIStore,
Actions,
WorkspaceStore,
ComponentRegistry} = require 'nylas-exports'
{ipcRenderer} = require 'electron'
module.exports =
activate: ->
React = require 'react'
Cfg = PreferencesUIStore.TabItem
PreferencesUIStore.registerPreferencesTab(new Cfg {
tabId: 'General'
displayName: 'General'
component: require './tabs/preferences-general'
order: 1
})
PreferencesUIStore.registerPreferencesTab(new Cfg {
tabId: 'Accounts'
displayName: 'Accounts'
component: require './tabs/preferences-accounts'
order: 2
})
PreferencesUIStore.registerPreferencesTab(new Cfg {
tabId: 'Shortcuts'
displayName: 'Shortcuts'
component: require './tabs/preferences-keymaps'
order: 3
})
WorkspaceStore.defineSheet 'Preferences', {},
split: ['Preferences']
list: ['Preferences']
PreferencesRoot = require('./preferences-root')
ComponentRegistry.register PreferencesRoot,
location: WorkspaceStore.Location.Preferences
Actions.openPreferences.listen(@_openPreferences)
ipcRenderer.on 'open-preferences', => @_openPreferences()
_openPreferences: ->
ipcRenderer.send 'command', 'application:show-main-window'
if WorkspaceStore.topSheet() isnt WorkspaceStore.Sheet.Preferences
Actions.pushSheet(WorkspaceStore.Sheet.Preferences)
deactivate: ->
serialize: -> @state