-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from AndrewGable/tgolen-report-port
Some initial fixes and code style updates
- Loading branch information
Showing
21 changed files
with
625 additions
and
583 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# EditorConfig is awesome: http://EditorConfig.org | ||
|
||
# Howto with your editor: | ||
# Sublime: https://github.com/sindresorhus/editorconfig-sublime | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
# Unix-style newlines with a newline ending every file | ||
[**] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
# Standard at: https://github.com/felixge/node-style-guide | ||
[**.js, **.json] | ||
trim_trailing_whitespace = true | ||
quote_type = single | ||
curly_bracket_next_line = false | ||
spaces_around_operators = true | ||
space_after_control_statements = true | ||
space_after_anonymous_functions = false | ||
spaces_in_brackets = false | ||
|
||
# No Standard. Please document a standard if different from .js | ||
[**.yml, **.html, **.css] | ||
trim_trailing_whitespace = true | ||
|
||
# No standard. Please document a standard if different from .js | ||
[**.md] | ||
|
||
# Standard at: | ||
[Makefile] | ||
|
||
[package*] | ||
indent_style = space | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,64 @@ | ||
import {init as StoreInit} from './store/Store.js'; | ||
import { init as StoreInit } from './store/Store.js'; | ||
import SignInPage from './page/SignInPage.js'; | ||
import HomePage from './page/HomePage/HomePage.js'; | ||
import * as Store from './store/Store.js'; | ||
import * as ActiveClientManager from './lib/ActiveClientManager.js'; | ||
import {verifyAuthToken} from './store/actions/SessionActions.js'; | ||
import { verifyAuthToken } from './store/actions/SessionActions.js'; | ||
import STOREKEYS from './store/STOREKEYS.js'; | ||
import React, {Component} from 'react'; | ||
import {Route, Router, Redirect, Switch} from './lib/Router'; | ||
import React, { Component } from 'react'; | ||
import { Route, Router, Redirect, Switch } from './lib/Router'; | ||
|
||
// Initialize the store when the app loads for the first time | ||
StoreInit(); | ||
|
||
export default class Expensify extends Component { | ||
constructor(props) { | ||
super(props); | ||
constructor(props) { | ||
super(props); | ||
|
||
this.sessionChanged = this.sessionChanged.bind(this); | ||
this.sessionChanged = this.sessionChanged.bind(this); | ||
|
||
this.state = { | ||
redirectTo: null, | ||
}; | ||
} | ||
this.state = { | ||
redirectTo: null, | ||
}; | ||
} | ||
|
||
async componentDidMount() { | ||
// Listen for when the app wants to redirect to a specific URL | ||
Store.subscribe(STOREKEYS.APP_REDIRECT_TO, (redirectTo) => { | ||
this.setState({redirectTo}); | ||
}); | ||
async componentDidMount() { | ||
// Listen for when the app wants to redirect to a specific URL | ||
Store.subscribe(STOREKEYS.APP_REDIRECT_TO, (redirectTo) => { | ||
this.setState({ redirectTo }); | ||
}); | ||
|
||
// Verify that our authToken is OK to use | ||
verifyAuthToken(); | ||
// Verify that our authToken is OK to use | ||
verifyAuthToken(); | ||
|
||
// Initialize this client as being an active client | ||
await ActiveClientManager.init(); | ||
//TODO: Refactor window events | ||
// window.addEventListener('beforeunload', () => { | ||
// ActiveClientManager.removeClient(); | ||
// }); | ||
} | ||
// Initialize this client as being an active client | ||
await ActiveClientManager.init(); | ||
//TODO: Refactor window events | ||
// window.addEventListener('beforeunload', () => { | ||
// ActiveClientManager.removeClient(); | ||
// }); | ||
} | ||
|
||
/** | ||
* When the session changes, change which page the user sees | ||
* | ||
* @param {object} newSession | ||
*/ | ||
sessionChanged(newSession) { | ||
this.setState({isAuthTokenValid: newSession && newSession.authToken}); | ||
} | ||
/** | ||
* When the session changes, change which page the user sees | ||
* | ||
* @param {object} newSession | ||
*/ | ||
sessionChanged(newSession) { | ||
this.setState({ isAuthTokenValid: newSession && newSession.authToken }); | ||
} | ||
|
||
render() { | ||
return ( | ||
<Router> | ||
{/* If there is ever a property for redirecting, we do the redirect here */} | ||
{this.state.redirectTo && <Redirect to={this.state.redirectTo} />} | ||
render() { | ||
return ( | ||
<Router> | ||
{/* If there is ever a property for redirecting, we do the redirect here */} | ||
{this.state.redirectTo && <Redirect to={this.state.redirectTo} />} | ||
|
||
<Switch> | ||
<Route path="/signin" component={SignInPage} /> | ||
<Route path="/" component={HomePage} /> | ||
</Switch> | ||
</Router> | ||
); | ||
} | ||
<Switch> | ||
<Route path="/signin" component={SignInPage} /> | ||
<Route path="/" component={HomePage} /> | ||
</Switch> | ||
</Router> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
const CONFIG = { | ||
PUSHER: { | ||
APP_KEY: '829fd8fd2a6036568469', | ||
CLUSTER: 'us3', | ||
}, | ||
PUSHER: { | ||
APP_KEY: '829fd8fd2a6036568469', | ||
CLUSTER: 'us3', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.