diff --git a/src/actions/index.js b/src/actions/index.js index 99f65e0..311f4d3 100644 --- a/src/actions/index.js +++ b/src/actions/index.js @@ -118,7 +118,6 @@ export function updateDomain(domain) { export function fetchSelected(selected) { if (!selected || !selected.length || selected.length === 0) { - console.log('hitting base') return updateSelected([]) } return dispatch => { @@ -127,6 +126,7 @@ export function fetchSelected(selected) { dispatch(fetchSourceError('No source extension specified.')) } else { dispatch(toggleFetchingSources()) + // TODO: fetching logic } } diff --git a/src/components/Card.jsx b/src/components/Card.jsx index 9c65c2a..60be91f 100644 --- a/src/components/Card.jsx +++ b/src/components/Card.jsx @@ -91,7 +91,10 @@ class Card extends React.Component { ) } @@ -137,11 +140,6 @@ class Card extends React.Component { } renderContent() { - // if (!this.state.isHighlighted) { - // return ( - //
- // ); - // } else { return (
{this.renderTags()} @@ -149,7 +147,6 @@ class Card extends React.Component { {this.renderNarrative()}
); - // } } renderCaret() { diff --git a/src/components/CardStack.jsx b/src/components/CardStack.jsx index 3178342..98185be 100644 --- a/src/components/CardStack.jsx +++ b/src/components/CardStack.jsx @@ -20,6 +20,7 @@ class CardStack extends React.Component { return ( { +const CardSource = ({ source, language, isLoading, error }) => { const source_lang = copy[language].cardstack.source - if (!source) source = copy[language].cardstack.unknown_source - const content = isLoading ? ( - - ) : ( -
{source}
- ) + if (isLoading) { + return + } + + function renderSource() { + return ( +

TODO: display source properly.

+ ) + } return (

{source_lang}:

- {content} + {source.error ? ( +
{source.error}
+ ) : ( + renderSource() + )}
) } diff --git a/src/reducers/app.js b/src/reducers/app.js index c8f243b..7fe01be 100644 --- a/src/reducers/app.js +++ b/src/reducers/app.js @@ -16,6 +16,7 @@ import { TOGGLE_INFOPOPUP, TOGGLE_NOTIFICATIONS, FETCH_ERROR, + FETCH_SOURCE_ERROR, } from '../actions'; function updateHighlighted(appState, action) { @@ -156,6 +157,16 @@ function toggleNotifications(appState, action) { }); } +function fetchSourceError(appState, action) { + return { + ...appState, + errors: { + ...appState.errors, + source: action.msg + } + } +} + function app(appState = initial.app, action) { @@ -186,6 +197,8 @@ function app(appState = initial.app, action) { return toggleInfoPopup(appState, action); case TOGGLE_NOTIFICATIONS: return toggleNotifications(appState, action); + case FETCH_SOURCE_ERROR: + return fetchSourceError(appState, action); default: return appState; } diff --git a/src/store/initial.js b/src/store/initial.js index d487022..dbe0dd7 100644 --- a/src/store/initial.js +++ b/src/store/initial.js @@ -25,7 +25,9 @@ const initial = { * or by the characteristics of the client, browser, etc. */ app: { - error: null, + errors: { + source: null, + }, highlighted: null, selected: [], narrative: null,