Skip to content

Commit

Permalink
/changes --> /recent. Part of #50.
Browse files Browse the repository at this point in the history
  • Loading branch information
jkomoros committed Dec 27, 2018
1 parent 7087d40 commit 017692f
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/actions/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const navigatePathTo = (path, silent) => (dispatch, getState) => {

export const navigateToChangesNumDays = (numDays) => (dispatch) => {
if (!numDays) numDays = 1;
dispatch(navigatePathTo('/changes/' + numDays + '/days'));
dispatch(navigatePathTo('/recent/' + numDays + '/days'));
}

export const navigateToNextCard = () => (dispatch, getState) => {
Expand Down Expand Up @@ -102,7 +102,7 @@ const loadPage = (pathname) => (dispatch) => {
// navigating to view1 after my-view1.js is loaded.
});
break;
case 'changes':
case 'recent':
import('../components/recent-changes-view.js');
break;
case 'maintenance':
Expand Down
8 changes: 4 additions & 4 deletions src/actions/changes.js → src/actions/recent.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const UPDATE_CHANGES_CARDS= 'UPDATE_CHANGES_CARDS';
export const CHANGES_FETCHING='CHANGES_FETCHING';
export const UPDATE_RECENT_CARDS= 'UPDATE_RECENT_CARDS';
export const RECENT_FETCHING='RECENT_FETCHING';

import {
db,
Expand All @@ -8,7 +8,7 @@ import {

const fetching = (isFetching) => {
return {
type: CHANGES_FETCHING,
type: RECENT_FETCHING,
isFetching
}
}
Expand Down Expand Up @@ -45,7 +45,7 @@ export const fetchRecentChanges = (numDays) => (dispatch, getState) => {

const updateChangesCards = (cardsBySection) => {
return {
type: UPDATE_CHANGES_CARDS,
type: UPDATE_RECENT_CARDS,
cardsBySection
}
}
4 changes: 2 additions & 2 deletions src/components/compendium-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ class CompendiumApp extends connect(store)(LitElement) {
`)}` :
html`<a ?selected="${this._page === 'c'}" href="/c"><em>Loading...</em></a>`
}
<a ?selected="${this._page === 'changes'}" href="/changes">Recent Changes</a>
<a ?selected="${this._page === 'recent'}" href="/recent">Recent</a>
</nav>
<div class='spacer dev'>
${this._devMode ? html`DEVMODE` : ""}
Expand All @@ -195,7 +195,7 @@ class CompendiumApp extends connect(store)(LitElement) {
<!-- Main content -->
<main role="main" class="main-content">
<card-view class="page" ?active="${this._page === 'c'}"></card-view>
<recent-changes-view class="page" ?active="${this._page === 'changes'}"></recent-changes-view>
<recent-changes-view class="page" ?active="${this._page === 'recent'}"></recent-changes-view>
<my-view404 class="page" ?active="${this._page === 'view404'}"></my-view404>
<maintenance-view class='page' ?active="${this._page === 'maintenance'}"></maintenance-view>
</main>
Expand Down
10 changes: 5 additions & 5 deletions src/components/recent-changes-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import { connect } from 'pwa-helpers/connect-mixin.js';
// This element is connected to the Redux store.
import { store } from '../store.js';

import changes from '../reducers/changes.js';
import recent from '../reducers/recent.js';
store.addReducers({
changes
recent
});

import {
fetchRecentChanges
} from '../actions/changes.js';
} from '../actions/recent.js';

import {
navigateToChangesNumDays,
Expand Down Expand Up @@ -188,9 +188,9 @@ class RecentChangesView extends connect(store)(PageViewElement) {

stateChanged(state) {
this._numDays = this.extractPageExtra(state.app.pageExtra);
this._cardsBySection = state.changes.cardsBySection;
this._cardsBySection = state.recent.cardsBySection;
this._sections = state.data.sections;
this._fetching = state.changes.fetching;
this._fetching = state.recent.fetching;
}

updated(changedProps) {
Expand Down
10 changes: 5 additions & 5 deletions src/reducers/changes.js → src/reducers/recent.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
UPDATE_CHANGES_CARDS,
CHANGES_FETCHING
} from '../actions/changes.js';
UPDATE_RECENT_CARDS,
RECENT_FETCHING
} from '../actions/recent.js';

const INITIAL_STATE = {
cardsBySection: {},
Expand All @@ -10,13 +10,13 @@ const INITIAL_STATE = {

const app = (state = INITIAL_STATE, action) => {
switch (action.type) {
case UPDATE_CHANGES_CARDS:
case UPDATE_RECENT_CARDS:
return {
...state,
cardsBySection: action.cardsBySection,
fetching: false
}
case CHANGES_FETCHING:
case RECENT_FETCHING:
return {
...state,
fetching: action.isFetching
Expand Down

0 comments on commit 017692f

Please sign in to comment.