diff --git a/client/src/app/components/login-select.jsx b/client/src/app/components/login-select.jsx index 9d3ea4f..68c513e 100644 --- a/client/src/app/components/login-select.jsx +++ b/client/src/app/components/login-select.jsx @@ -26,7 +26,7 @@ var LoginSel = React.createClass({ width: '100%', height: '45px', float: 'left', - marginTop: '5px', + marginTop: '10px', }, kakaoText: { color: "#3c1e1e", diff --git a/client/src/app/components/master.jsx b/client/src/app/components/master.jsx index a60eadf..ab524f9 100644 --- a/client/src/app/components/master.jsx +++ b/client/src/app/components/master.jsx @@ -117,11 +117,16 @@ var Master = React.createClass({ }.bind(this); setTabsState(); window.onresize = setTabsState; + window.lastTabIndex = '1'; }, componentWillReceiveProps: function() { console.log("master componentWillReceiveProps"); - this.setState({tabIndex: this._getSelectedIndex()}); + if (!this.context.router.isActive('new-asks')) { + this.setState({tabIndex: '0'}); + } else { + this.setState({tabIndex: window.lastTabIndex}); + } }, _getSelectedIndex: function() { @@ -129,13 +134,13 @@ var Master = React.createClass({ }, _handleTabChange: function(value, e, tab) { + console.log("master _handleTabChange value : " + value); + if (!this.context.router.isActive('new-asks')) { + this.context.router.transitionTo('new-asks'); + } + this.setState({tabIndex: value}); - var event = new CustomEvent("tabChanged", { - detail: { - value: value - } - }); - document.dispatchEvent(event); + window.lastTabIndex = value; window.scrollTo(0,0); }, diff --git a/client/src/app/components/new-asks.jsx b/client/src/app/components/new-asks.jsx index f51c736..8436ed5 100644 --- a/client/src/app/components/new-asks.jsx +++ b/client/src/app/components/new-asks.jsx @@ -18,7 +18,6 @@ var NewAsks = React.createClass({ componentWillMount: function () { console.log('New asks componentWillMount called'); console.log('window.newAsksState is ', window.newAsksState); - this.tabIndex = '1'; if (window.newAsksState === undefined || window.newAsksState === "UpdateNeeded") { var query = {}; @@ -67,18 +66,13 @@ var NewAsks = React.createClass({ }); window.hotAsksState = "Updated"; } else if (window.hotAsksState === "Updated"){ - this.setState({hotAsksData: hotAsks}); + this.setState({hotAsksData: hotAsks.slice(0, 5)}); } }, componentDidMount: function () { console.log('New asks componentDidMount called'); console.log('window.newAsksState is ', window.newAsksState); - document.addEventListener("tabChanged", - function statusChangeCallback(e) { - this.tabIndex = e.detail.value; - }.bind(this) - ); }, componentWillUpdate: function(nextProps, nextState) { @@ -154,7 +148,6 @@ var NewAsks = React.createClass({ }.bind(this), 1000); } setTimeout( function() { - console.log("jungo"); this.refs.newAsksMoreButton.showButton(); }.bind(this), 1000); }.bind(this), @@ -166,7 +159,7 @@ var NewAsks = React.createClass({ }, render: function() { - console.log("new Asks rendering : " + this.tabIndex); + console.log("New Asks rendering : " + window.lastTabIndex); var root = { backgroundColor : Colors.grey100, }; @@ -179,7 +172,7 @@ var NewAsks = React.createClass({ backgroundColor : Colors.grey100, }; - var newTabStyle = this.tabIndex === "1" ? + var newTabStyle = window.lastTabIndex === "1" ? { position: "absolute", top: document.body.clientWidth <= 647 ? Spacing.desktopKeylineIncrement+48: Spacing.desktopKeylineIncrement, @@ -195,7 +188,7 @@ var NewAsks = React.createClass({ maxWidth : 650, }; - var hotTabStyle = this.tabIndex === "2" ? + var hotTabStyle = window.lastTabIndex === "2" ? { position: "absolute", top: document.body.clientWidth <= 647 ? Spacing.desktopKeylineIncrement+48: Spacing.desktopKeylineIncrement,