mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-12 12:40:08 +08:00
84 lines
1.8 KiB
Text
84 lines
1.8 KiB
Text
|
React = require 'react'
|
||
|
_ = require "underscore-plus"
|
||
|
{Utils, Actions} = require 'inbox-exports'
|
||
|
{Spinner, EventedIFrame} = require 'ui-components'
|
||
|
moment = require 'moment'
|
||
|
|
||
|
class TodayViewDateTime extends React.Component
|
||
|
@displayName: 'TodayViewDateTime'
|
||
|
|
||
|
constructor: (@props) ->
|
||
|
@state =
|
||
|
moment: moment()
|
||
|
|
||
|
componentDidMount: =>
|
||
|
@_setTimeState()
|
||
|
|
||
|
componentWillUnmount: =>
|
||
|
clearInterval(@_timer)
|
||
|
|
||
|
render: =>
|
||
|
<div className="centered">
|
||
|
<div className="time">{@state.moment.format('h:mm')}</div>
|
||
|
<div className="date">{@state.moment.format('dddd, MMM Do')}</div>
|
||
|
</div>
|
||
|
|
||
|
_setTimeState: =>
|
||
|
timeTillNextSecond = (60 - (new Date).getSeconds()) * 1000
|
||
|
@_timer = setTimeout(@_setTimeState, timeTillNextSecond)
|
||
|
|
||
|
@setState(moment: moment())
|
||
|
|
||
|
|
||
|
class TodayViewBox extends React.Component
|
||
|
@displayName: 'TodayViewBox'
|
||
|
|
||
|
@propTypes:
|
||
|
name: React.PropTypes.string.isRequired
|
||
|
|
||
|
constructor: (@props) ->
|
||
|
|
||
|
render: =>
|
||
|
<div className="box">
|
||
|
<h2>{@props.name}</h2>
|
||
|
</div>
|
||
|
|
||
|
class TodayView extends React.Component
|
||
|
@displayName: 'TodayView'
|
||
|
|
||
|
constructor: (@props) ->
|
||
|
@state = @_getStateFromStores()
|
||
|
|
||
|
render: =>
|
||
|
<div className="today">
|
||
|
<div className="inner">
|
||
|
<TodayViewDateTime />
|
||
|
<div className="boxes">
|
||
|
<TodayViewBox name="Conversations">
|
||
|
</TodayViewBox>
|
||
|
<TodayViewBox name="Events">
|
||
|
</TodayViewBox>
|
||
|
<TodayViewBox name="Drafts">
|
||
|
</TodayViewBox>
|
||
|
</div>
|
||
|
<div className="to-the-inbox">
|
||
|
Inbox
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
componentDidMount: =>
|
||
|
@_unsubscribers = []
|
||
|
|
||
|
componentWillUnmount: =>
|
||
|
unsubscribe() for unsubscribe in @_unsubscribers
|
||
|
|
||
|
_getStateFromStores: =>
|
||
|
{}
|
||
|
|
||
|
_onChange: =>
|
||
|
@setState(@_getStateFromStores())
|
||
|
|
||
|
|
||
|
module.exports = TodayView
|