Skip to content

Commit

Permalink
v0.4.1: Переходы между папками
Browse files Browse the repository at this point in the history
  • Loading branch information
RubaXa committed Jun 16, 2016
1 parent a216a02 commit fe02c07
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "redux-octavius",
"version": "0.4.0",
"version": "0.4.1",
"private": true,
"description": "Боль и унижение!",
"main": "index.js",
Expand Down
23 changes: 20 additions & 3 deletions src/components/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import Letters from './Letters';
({auth, folders, threads}, {params}) => ({
auth,
folders,
threads: threads.current[params.folder|0] || []
threads: threads.current[params.folder|0]
}),
(dispatch) => ({
actions: bindActionCreators({fetchStatus}, dispatch),
Expand All @@ -31,6 +31,12 @@ import Letters from './Letters';
({email, folder}, actions) => email && actions.fetchStatus(folder)
)
export default class App extends Component {
constructor(...args) {
super(...args);
this.activeFolderId = null;
this.activeThreads = [];
}

handleGlobalClick(evt) {
if (!evt.defaultPrevented) {
let el = evt.target;
Expand All @@ -48,10 +54,21 @@ export default class App extends Component {
}

render() {
const {auth, folders, threads, params} = this.props;
const folderId = params.folder|0;
const {auth} = this.props;

if (auth.state) {
let {folders, threads, params} = this.props;
let folderId = params.folder|0;

if (threads == null) {
// Not loaded
folderId = this.activeFolderId == null ? folderId : this.activeFolderId;
threads = this.activeThreads;
} else {
this.activeFolderId = folderId;
this.activeThreads = threads;
}

const sidebar = <Folders models={folders} active={folderId}/>;
const main = <Letters models={threads}/>;

Expand Down

0 comments on commit fe02c07

Please sign in to comment.