Mailspring/internal_packages/today/lib/today-view.cjsx
Ben Gotow 0bd303865e fix(friday): Bugs and initial pass at the Today view without content (see summary)
Summary:
Load unread counts from database again, not tags

fix(multiselect-list): Clear selection on esc

fix(onboarding): Make target=_blank links work in onboarding pages

fix(workspace): Items in header and footer regions are in a single column

fix(layout): Critical issue for things not 100% height

fix(activity-bar): Show in dev mode so you know you're in dev mode

fix(quoted-text): Support for #divRplyFwdMsg quoted text marker

Test Plan: Run specs

Reviewers: evan

Reviewed By: evan

Differential Revision: https://review.inboxapp.com/D1484
2015-05-08 16:36:48 -07:00

83 lines
1.8 KiB
CoffeeScript

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