mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-22 17:47:53 +00:00
Normalise trailing whitespace and line endings everywhere
This commit is contained in:
@@ -21,7 +21,7 @@ export default function (params: any): Promise<{ html: string }> {
|
||||
const app = (
|
||||
<Provider store={ store }>
|
||||
<RouterContext {...renderProps} />
|
||||
</Provider>
|
||||
</Provider>
|
||||
);
|
||||
|
||||
// Perform an initial render that will cause any async tasks (e.g., data access) to begin
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from 'react';
|
||||
import * as React from 'react';
|
||||
import { Navbar, Nav, NavItem, NavDropdown, MenuItem } from 'react-bootstrap';
|
||||
import { Link } from 'react-router';
|
||||
import { LinkContainer } from 'react-router-bootstrap';
|
||||
@@ -25,7 +25,7 @@ class NavMenu extends React.Component<NavMenuProps, void> {
|
||||
{genres.map(genre =>
|
||||
<LinkContainer key={ genre.GenreId } to={ `/genre/${ genre.GenreId }` }>
|
||||
<MenuItem>{ genre.Name }</MenuItem>
|
||||
</LinkContainer>
|
||||
</LinkContainer>
|
||||
)}
|
||||
<MenuItem divider />
|
||||
<LinkContainer to={ '/genres' }><MenuItem>More…</MenuItem></LinkContainer>
|
||||
@@ -43,7 +43,7 @@ class NavMenu extends React.Component<NavMenuProps, void> {
|
||||
// Selects which part of global state maps to this component, and defines a type for the resulting props
|
||||
const provider = provide(
|
||||
(state: ApplicationState) => state.genreList,
|
||||
GenreList.actionCreators
|
||||
GenreList.actionCreators
|
||||
);
|
||||
type NavMenuProps = typeof provider.allProps;
|
||||
export default provider.connect(NavMenu);
|
||||
|
||||
@@ -22,9 +22,9 @@ class AlbumDetails extends React.Component<AlbumDetailsProps, void> {
|
||||
const albumData = this.props.album;
|
||||
return <div>
|
||||
<h2>{ albumData.Title }</h2>
|
||||
|
||||
|
||||
<p><img alt={ albumData.Title } src={ albumData.AlbumArtUrl } /></p>
|
||||
|
||||
|
||||
<div id="album-details">
|
||||
<p>
|
||||
<em>Genre:</em>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from 'react';
|
||||
import * as React from 'react';
|
||||
import { Link } from 'react-router';
|
||||
import { Album } from '../../store/FeaturedAlbums';
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ class GenreDetails extends React.Component<GenreDetailsProps, void> {
|
||||
componentWillMount() {
|
||||
this.props.requestGenreDetails(parseInt(this.props.params.genreId));
|
||||
}
|
||||
|
||||
|
||||
componentWillReceiveProps(nextProps: GenreDetailsProps) {
|
||||
this.props.requestGenreDetails(parseInt(nextProps.params.genreId));
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ export default function configureStore(history: HistoryModule.History, initialSt
|
||||
const reduxRouterMiddleware = syncHistory(history);
|
||||
const middlewares = [thunk, reduxRouterMiddleware, typedToPlain];
|
||||
const devToolsExtension = null;//(window as any).devToolsExtension; // If devTools is installed, connect to it
|
||||
|
||||
|
||||
const finalCreateStore = compose(
|
||||
applyMiddleware(...middlewares),
|
||||
devToolsExtension ? devToolsExtension() : f => f
|
||||
@@ -20,10 +20,10 @@ export default function configureStore(history: HistoryModule.History, initialSt
|
||||
const allReducers = buildRootReducer(Store.reducers);
|
||||
|
||||
const store = finalCreateStore(allReducers, initialState) as Redux.Store;
|
||||
|
||||
|
||||
// Required for replaying actions from devtools to work
|
||||
reduxRouterMiddleware.listenForReplays(store);
|
||||
|
||||
|
||||
// Enable Webpack hot module replacement for reducers
|
||||
if (module.hot) {
|
||||
module.hot.accept('./store', () => {
|
||||
|
||||
@@ -47,7 +47,7 @@ class ReceiveAlbumDetails extends Action {
|
||||
// ACTION CREATORS - These are functions exposed to UI components that will trigger a state transition.
|
||||
// They don't directly mutate state, but they can have external side-effects (such as loading data).
|
||||
|
||||
export const actionCreators = {
|
||||
export const actionCreators = {
|
||||
requestAlbumDetails: (albumId: number): ActionCreator => (dispatch, getState) => {
|
||||
// Only load if it's not already loaded (or currently being loaded)
|
||||
if (albumId !== getState().albumDetails.requestedAlbumId) {
|
||||
@@ -59,7 +59,7 @@ export const actionCreators = {
|
||||
dispatch(new ReceiveAlbumDetails(album));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
dispatch(new RequestAlbumDetails(albumId));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ export const actionCreators = {
|
||||
fetch('/api/albums/mostPopular')
|
||||
.then(results => results.json())
|
||||
.then(albums => dispatch(new ReceiveFeaturedAlbums(albums)));
|
||||
|
||||
|
||||
return dispatch(new RequestFeaturedAlbums());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ class ReceiveGenreDetails extends Action {
|
||||
// ACTION CREATORS - These are functions exposed to UI components that will trigger a state transition.
|
||||
// They don't directly mutate state, but they can have external side-effects (such as loading data).
|
||||
|
||||
export const actionCreators = {
|
||||
export const actionCreators = {
|
||||
requestGenreDetails: (genreId: number): ActionCreator => (dispatch, getState) => {
|
||||
// Only load if it's not already loaded (or currently being loaded)
|
||||
if (genreId !== getState().genreDetails.requestedGenreId) {
|
||||
@@ -44,10 +44,10 @@ export const actionCreators = {
|
||||
.then(albums => {
|
||||
// Only replace state if it's still the most recent request
|
||||
if (genreId === getState().genreDetails.requestedGenreId) {
|
||||
dispatch(new ReceiveGenreDetails(genreId, albums));
|
||||
dispatch(new ReceiveGenreDetails(genreId, albums));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
dispatch(new RequestGenreDetails(genreId));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ class ReceiveGenresList extends Action {
|
||||
// ACTION CREATORS - These are functions exposed to UI components that will trigger a state transition.
|
||||
// They don't directly mutate state, but they can have external side-effects (such as loading data).
|
||||
|
||||
export const actionCreators = {
|
||||
export const actionCreators = {
|
||||
requestGenresList: (): ActionCreator => (dispatch, getState) => {
|
||||
if (!getState().genreList.isLoaded) {
|
||||
fetch('/api/genres')
|
||||
|
||||
@@ -23,5 +23,5 @@ export const reducers = {
|
||||
};
|
||||
|
||||
// This type can be used as a hint on action creators so that its 'dispatch' and 'getState' params are
|
||||
// correctly typed to match your store.
|
||||
// correctly typed to match your store.
|
||||
export type ActionCreator = ActionCreatorGeneric<ApplicationState>;
|
||||
|
||||
Reference in New Issue
Block a user