diff --git a/css/style.css b/css/style.css index 644074d..52281dd 100644 --- a/css/style.css +++ b/css/style.css @@ -272,6 +272,7 @@ html, body { .edit .profile-tree { padding: 0 5px; width: 100%; + height: 100%; } .edit .profile-tree ul { diff --git a/src/components/common/app-icon.js b/src/components/common/app-icon.js index f67770e..2476ae9 100644 --- a/src/components/common/app-icon.js +++ b/src/components/common/app-icon.js @@ -11,7 +11,7 @@ module.exports = React.createClass({ mixins: [LazyLoad], getInitialState: function() { - return { icon: DEFAULT_ICON, currentTheme: '' }; + return { icon: DEFAULT_ICON, iconPath: DEFAULT_ICON, currentTheme: '' }; }, onInViewport: function() { @@ -20,16 +20,20 @@ module.exports = React.createClass({ updateIconIfInViewport: function() { + var currentIcon = this.state.icon; + var newIcon = this.props.icon; var currentTheme = this.state.currentTheme; var newTheme = this.props.theme; - if( !this.isInViewport() || newTheme === currentTheme ) return; + var shouldUpdate = this.isInViewport() && + ( (newTheme && newTheme !== currentTheme) || (newIcon && newIcon !== currentIcon) ) + ; - this.setState({ icon: LOADING_ICON, currentTheme: newTheme }); + if( !shouldUpdate ) return; - var desktopEntry = this.props.desktopEntry; + this.setState({ icon: newIcon, iconPath: LOADING_ICON, currentTheme: newTheme }); - this._findIcon(this.props.icon, newTheme); + this._findIcon(newIcon, newTheme); }, @@ -39,7 +43,7 @@ module.exports = React.createClass({ render: function() { - var icon = this.state.icon; + var icon = this.state.iconPath; var style = { backgroundImage: 'url('+icon+')' @@ -59,12 +63,7 @@ module.exports = React.createClass({ Util.DesktopApps.findIcon(iconPath || DEFAULT_ICON, theme) .then(function(iconPath) { - if( !iconPath || /\.xpm$/.test(iconPath) ) { - return Util.DesktopApps.findIcon(DEFAULT_ICON, theme); - } - return iconPath; - }) - .then(function(iconPath) { + if(!iconPath) return DEFAULT_ICON; return Util.System.exists(iconPath) .then(function(exists) { return exists ? iconPath : DEFAULT_ICON; @@ -72,7 +71,8 @@ module.exports = React.createClass({ ; }) .then(function(iconPath) { - self.setState({ icon: iconPath }); + debug('Found icon %s', iconPath); + self.setState({ iconPath: iconPath }); }) ; diff --git a/src/components/edit/item-form.js b/src/components/edit/item-form.js index 874b38e..6888680 100644 --- a/src/components/edit/item-form.js +++ b/src/components/edit/item-form.js @@ -1,4 +1,5 @@ var React = require('react'); +var _ = require('lodash'); var ItemForm = React.createClass({ diff --git a/src/components/edit/profile-tree.js b/src/components/edit/profile-tree.js index 98f867e..17f7c47 100644 --- a/src/components/edit/profile-tree.js +++ b/src/components/edit/profile-tree.js @@ -2,6 +2,8 @@ var React = require('react'); var connect = require('react-redux').connect; var actions = require('../../store/actions'); var TreeItem = require('./tree-item.js'); +var DropTarget = require('react-dnd').DropTarget; +var _ = require('lodash'); var TreeNode = React.createClass({ @@ -53,7 +55,9 @@ var ProfileTree = React.createClass({ render: function() { - return ( + var connectDropTarget = this.props.connectDropTarget; + + return connectDropTarget(