mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-09 17:55:35 +08:00
35 lines
808 B
Text
35 lines
808 B
Text
|
|
||
|
_ = require 'underscore'
|
||
|
_str = require 'underscore.string'
|
||
|
React = require 'react'
|
||
|
{Actions, FocusedTagStore} = require 'nylas-exports'
|
||
|
|
||
|
class MessageNavTitle extends React.Component
|
||
|
@displayName: 'MessageNavTitle'
|
||
|
|
||
|
constructor: (@props) ->
|
||
|
@state = @_getStateFromStores()
|
||
|
|
||
|
componentDidMount: =>
|
||
|
@_unsubscriber = FocusedTagStore.listen @_onChange
|
||
|
|
||
|
componentWillUnmount: =>
|
||
|
@_unsubscriber() if @_unsubscriber
|
||
|
|
||
|
render: =>
|
||
|
if @state.tagId
|
||
|
title = "Back to #{_str.titleize(@state.tagId)}"
|
||
|
else
|
||
|
title = "Back"
|
||
|
|
||
|
<div onClick={ -> Actions.popSheet() }
|
||
|
className="message-nav-title">{title}</div>
|
||
|
|
||
|
_onChange: => _.defer =>
|
||
|
@setState(@_getStateFromStores())
|
||
|
|
||
|
_getStateFromStores: =>
|
||
|
tagId: FocusedTagStore.tagId()
|
||
|
|
||
|
module.exports = MessageNavTitle
|