- {this.props.folders.map((f, i) =>
+ {this.props.account.folders.map((f, i) =>
0 ? ' with-unread' : '')+
- (this.state.selected == i ? ' selected' : '')} onClick={this.selectFolder}>
+ (this.props.selected == i ? ' selected' : '')} onClick={this.selectFolder}>
{f.icon ?
: null}
{' '}
{f.name}
@@ -37,7 +37,6 @@ var AccountFolders = module.exports = React.createClass({
if (t && t != this.refs.vis)
{
var i = t.getAttribute('data-i');
- this.setState({ selected: i });
this.props.onSelect(this.props.accountIndex, i);
}
// FIXME: send select event + switch focus to message list if folder changed
@@ -46,7 +45,7 @@ var AccountFolders = module.exports = React.createClass({
{
var self = this;
var i = DropDownBase.instances.account.state.items;
- i[0].text = 'Read '+(this.props.email||this.props.name);
+ i[0].text = 'Read '+(this.props.account.email||this.props.account.name);
DropDownBase.instances.account.setState({ items: i });
DropDownBase.instances.account.showAt(ev.target, function()
{
@@ -57,7 +56,7 @@ var AccountFolders = module.exports = React.createClass({
},
getInitialState: function()
{
- return { collapsed: this.props.collapsed, animating: false, h: null, cfgPressed: false, selected: -1 };
+ return { collapsed: this.props.collapsed, animating: false, h: null, cfgPressed: false };
},
onClick: function()
{
diff --git a/FolderList.js b/FolderList.js
index a273114..dc4f441 100644
--- a/FolderList.js
+++ b/FolderList.js
@@ -7,7 +7,7 @@ var FolderList = module.exports = React.createClass({
render: function()
{
var self = this;
- return
+ return
@@ -16,14 +16,15 @@ var FolderList = module.exports = React.createClass({
// TODO: keyboard navigation
- {this.props.accounts.map(function(account, i) {
- return
+ {self.props.accounts.map(function(account, i) {
+ return
})}
-
Loading database ({this.props.progress||0}%)
-
-
Loading database ({this.props.progress||0}%)
+
Loading database ({self.props.progress||0}%)
+
+
Loading database ({self.props.progress||0}%)
@@ -34,13 +35,11 @@ var FolderList = module.exports = React.createClass({
var folder = this.props.accounts[accIndex].folders[folderIndex];
if (folder.folderId)
Store.loadFolder(folder.folderId);
- if (this.prevSelected && this.prevSelected != accIndex)
- this.prevSelected.setState({ selected: -1 });
- this.prevSelected = accIndex;
+ this.setState({ selectedAccount: accIndex, selectedFolder: folderIndex });
},
getInitialState: function()
{
- return { pbarWidth: '' };
+ return { pbarWidth: '', selectedAccount: -1, selectedFolder: -1 };
},
onResize: function()
{