Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/src/app/components/login-select.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var LoginSel = React.createClass({
width: '100%',
height: '45px',
float: 'left',
marginTop: '5px',
marginTop: '10px',
},
kakaoText: {
color: "#3c1e1e",
Expand Down
19 changes: 12 additions & 7 deletions client/src/app/components/master.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,25 +117,30 @@ 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() {
return this.context.router.isActive('new-asks') ? '1' : '0';
},

_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);
},

Expand Down
15 changes: 4 additions & 11 deletions client/src/app/components/new-asks.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {};
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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),
Expand All @@ -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,
};
Expand All @@ -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,
Expand All @@ -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,
Expand Down