mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-11 18:32:20 +08:00
2b324c4533
Summary: Update a few more packages to deactivate properly Miscelaneous fixes Initial commit of new settings package WIP WIP - can load and unload and install / uninstall Click to create new boilerplate package, package updating Test Plan: Run tests Reviewers: evan Reviewed By: evan Differential Revision: https://phab.nylas.com/D1582
69 lines
2 KiB
CoffeeScript
69 lines
2 KiB
CoffeeScript
React = require 'react'
|
|
_ = require "underscore"
|
|
PackageSet = require './package-set'
|
|
SettingsPackagesStore = require './settings-packages-store'
|
|
SettingsActions = require './settings-actions'
|
|
{Spinner, EventedIFrame, Flexbox} = require 'nylas-component-kit'
|
|
classNames = require 'classnames'
|
|
|
|
class TabExplore extends React.Component
|
|
@displayName: 'TabExplore'
|
|
|
|
constructor: (@props) ->
|
|
@state = @_getStateFromStores()
|
|
|
|
render: =>
|
|
if @state.search.length
|
|
collectionPrefix = "Matching "
|
|
if @state.searchResults
|
|
collection = @state.searchResults
|
|
emptyText = "No results found."
|
|
else
|
|
collection = {packages: [], themes: []}
|
|
emptyText = "Loading results..."
|
|
else
|
|
collection = @state.featured
|
|
collectionPrefix = "Featured "
|
|
emptyText = null
|
|
|
|
<div className="explore">
|
|
<div className="inner">
|
|
<input
|
|
type="search"
|
|
value={@state.search}
|
|
onChange={@_onSearchChange }
|
|
placeholder="Search Packages and Themes"/>
|
|
<PackageSet
|
|
title="#{collectionPrefix} Themes"
|
|
emptyText={emptyText ? "There are no featured themes yet."}
|
|
packages={collection.themes} />
|
|
<PackageSet
|
|
title="#{collectionPrefix} Packages"
|
|
emptyText={emptyText ? "There are no featured packages yet."}
|
|
packages={collection.packages} />
|
|
</div>
|
|
</div>
|
|
|
|
componentDidMount: =>
|
|
@_unsubscribers = []
|
|
@_unsubscribers.push SettingsPackagesStore.listen(@_onChange)
|
|
|
|
# Trigger a refresh of the featured packages
|
|
SettingsActions.refreshFeaturedPackages()
|
|
|
|
componentWillUnmount: =>
|
|
unsubscribe() for unsubscribe in @_unsubscribers
|
|
|
|
_getStateFromStores: =>
|
|
featured: SettingsPackagesStore.featured()
|
|
search: SettingsPackagesStore.globalSearchValue()
|
|
searchResults: SettingsPackagesStore.searchResults()
|
|
|
|
_onChange: =>
|
|
@setState(@_getStateFromStores())
|
|
|
|
_onSearchChange: (event) =>
|
|
SettingsActions.setGlobalSearchValue(event.target.value)
|
|
|
|
|
|
module.exports = TabExplore
|