diff --git a/src/app/components/modules/SidePanel/index.jsx b/src/app/components/modules/SidePanel/index.jsx index 5de40992e9624c5751f09a7828b1532238e68389..4d45faed217d9227b01bf64392f9f394218c314a 100644 --- a/src/app/components/modules/SidePanel/index.jsx +++ b/src/app/components/modules/SidePanel/index.jsx @@ -61,16 +61,6 @@ const SidePanel = ({ alignment, visible, hideSidePanel, username }) => { }, ], wallet: [ - { - value: 'recover_account_step_1', - label: tt('navigation.stolen_account_recovery'), - link: `/recover_account_step_1`, - }, - { - value: 'change_password', - label: tt('navigation.change_account_password'), - link: `/change_password`, - }, { value: 'vote_for_witnesses', label: tt('navigation.vote_for_witnesses'), @@ -171,6 +161,9 @@ const SidePanel = ({ alignment, visible, hideSidePanel, username }) => { <ul className="vertical menu"> {sidePanelLinks.internal.map(makeInternalLink)} </ul> + <ul className="vertical menu"> + {sidePanelLinks.wallet.map(makeInternalLink)} + </ul> <ul className="vertical menu"> <li> <a className="menu-section"> diff --git a/src/app/components/modules/UserWallet.jsx b/src/app/components/modules/UserWallet.jsx index 71a45975432b9a8fe7aab00c71af5180bf2b481c..5ef97889c99ee55d544f7a2253d5ed4d2aaca177 100644 --- a/src/app/components/modules/UserWallet.jsx +++ b/src/app/components/modules/UserWallet.jsx @@ -27,7 +27,7 @@ import { import * as transactionActions from 'app/redux/TransactionReducer'; import * as globalActions from 'app/redux/GlobalReducer'; import DropdownMenu from 'app/components/elements/DropdownMenu'; -import { getAllTransferHistory } from 'app/utils/steemApi'; +import { getAllTransferHistory } from 'app/utils/hiveApi'; const assetPrecision = 1000; diff --git a/src/app/redux/AppReducer.js b/src/app/redux/AppReducer.js index 9ba65734cafc965fdac2d9d79fae02a1fb501c26..9cd2b73060c4770153e088113dd8e40886d816bc 100644 --- a/src/app/redux/AppReducer.js +++ b/src/app/redux/AppReducer.js @@ -45,12 +45,12 @@ export default function reducer(state = defaultState, action = {}) { dismissAfter: 10000, ...action.payload, }; - return state.update('notifications', s => { + return state.update('notifications', (s) => { return s ? s.set(n.key, n) : OrderedMap({ [n.key]: n }); }); } case REMOVE_NOTIFICATION: - return state.update('notifications', s => + return state.update('notifications', (s) => s.delete(action.payload.key) ); case SET_USER_PREFERENCES: @@ -70,7 +70,7 @@ export default function reducer(state = defaultState, action = {}) { } } -export const steemApiError = error => ({ +export const hiveApiError = (error) => ({ type: HIVE_API_ERROR, error, }); @@ -83,17 +83,17 @@ export const fetchDataEnd = () => ({ type: FETCH_DATA_END, }); -export const addNotification = payload => ({ +export const addNotification = (payload) => ({ type: ADD_NOTIFICATION, payload, }); -export const removeNotification = payload => ({ +export const removeNotification = (payload) => ({ type: REMOVE_NOTIFICATION, payload, }); -export const setUserPreferences = payload => ({ +export const setUserPreferences = (payload) => ({ type: SET_USER_PREFERENCES, payload, }); @@ -102,7 +102,7 @@ export const toggleNightmode = () => ({ type: TOGGLE_NIGHTMODE, }); -export const receiveFeatureFlags = flags => ({ +export const receiveFeatureFlags = (flags) => ({ type: RECEIVE_FEATURE_FLAGS, flags, }); diff --git a/src/app/redux/AppReducer.test.js b/src/app/redux/AppReducer.test.js index f3a317297829c477236680eb328aa94f6b64be0a..cb6cd65d59bd038b37b3f2c815d0ad23b05a7ee1 100644 --- a/src/app/redux/AppReducer.test.js +++ b/src/app/redux/AppReducer.test.js @@ -2,7 +2,7 @@ import { Map, OrderedMap, getIn } from 'immutable'; import reducer, { defaultState, - steemApiError, + hiveApiError, fetchDataBegin, fetchDataEnd, addNotification, @@ -62,7 +62,7 @@ describe('App reducer', () => { }); it('should return correct state for a HIVE_API_ERROR action', () => { const initial = reducer(); - const out = reducer(initial, steemApiError()); + const out = reducer(initial, hiveApiError()); expect(out).toEqual(initial); }); it('should return correct state for a FETCH_DATA_BEGIN action', () => { diff --git a/src/app/redux/FetchDataSaga.js b/src/app/redux/FetchDataSaga.js index f3c9392dafb2d5e39038735dbc8c7e37f17991a8..a312438ad7dd32b2657a31217c4840d4f64382fd 100644 --- a/src/app/redux/FetchDataSaga.js +++ b/src/app/redux/FetchDataSaga.js @@ -12,7 +12,7 @@ import * as globalActions from './GlobalReducer'; import * as appActions from './AppReducer'; import constants from './constants'; import { fromJS, Map, Set } from 'immutable'; -import { getStateAsync } from 'app/utils/steemApi'; +import { getStateAsync } from 'app/utils/hiveApi'; const REQUEST_DATA = 'fetchDataSaga/REQUEST_DATA'; const GET_CONTENT = 'fetchDataSaga/GET_CONTENT'; @@ -71,7 +71,7 @@ export function* fetchState(location_change_action) { //yield call(getTransferUsers, pathname); } catch (error) { console.error('~~ Saga fetchState error ~~>', url, error); - yield put(appActions.steemApiError(error.message)); + yield put(appActions.hiveApiError(error.message)); } yield put(appActions.fetchDataEnd()); diff --git a/src/app/redux/MarketSaga.js b/src/app/redux/MarketSaga.js index 4f560146ad08d60e245fcd2cbf8783b754cd11f0..10697636852f722d702f27a022f66d8f45f2a522 100644 --- a/src/app/redux/MarketSaga.js +++ b/src/app/redux/MarketSaga.js @@ -12,8 +12,8 @@ export const marketWatches = [ takeLatest(marketActions.UPDATE_MARKET, reloadMarket), ]; -export const wait = ms => - new Promise(resolve => { +export const wait = (ms) => + new Promise((resolve) => { setTimeout(() => resolve(), ms); }); @@ -61,7 +61,7 @@ export function* fetchMarket(location_change_action) { yield put(marketActions.receiveTicker(state3)); } catch (error) { console.error('~~ Saga fetchMarket error ~~>', error); - yield put(appActions.steemApiError(error.message)); + yield put(appActions.hiveApiError(error.message)); } yield call(wait, 3000); @@ -77,7 +77,7 @@ export function* fetchOpenOrders(set_user_action) { yield call(getAccount, username); } catch (error) { console.error('~~ Saga fetchOpenOrders error ~~>', error); - yield put(appActions.steemApiError(error.message)); + yield put(appActions.hiveApiError(error.message)); } } diff --git a/src/app/redux/SagaShared.js b/src/app/redux/SagaShared.js index 0b5d482ccee47bd02c577118ce754e3a91b284cb..b6ff32e958a1fb1f25824173d55bed0f38de277b 100644 --- a/src/app/redux/SagaShared.js +++ b/src/app/redux/SagaShared.js @@ -6,7 +6,7 @@ import * as globalActions from './GlobalReducer'; import * as appActions from './AppReducer'; import * as transactionActions from './TransactionReducer'; import { setUserPreferences } from 'app/utils/ServerApiClient'; -import { getStateAsync } from 'app/utils/steemApi'; +import { getStateAsync } from 'app/utils/hiveApi'; const wait = (ms) => new Promise((resolve) => { @@ -62,7 +62,7 @@ export function* getState({ payload: { url } }) { yield put(globalActions.receiveState(state)); } catch (error) { console.error('~~ Saga getState error ~~>', url, error); - yield put(appActions.steemApiError(error.message)); + yield put(appActions.hiveApiError(error.message)); } } diff --git a/src/app/utils/steemApi.js b/src/app/utils/hiveApi.js similarity index 90% rename from src/app/utils/steemApi.js rename to src/app/utils/hiveApi.js index 6234d5475710ff405618e2d77e662547dc514939..93fdfe8bb17f79b60e18ff1e987f86f64217136c 100644 --- a/src/app/utils/steemApi.js +++ b/src/app/utils/hiveApi.js @@ -34,13 +34,12 @@ async function getStateForTrending() { return result; } -async function getStateForWitnesses() { +async function getStateForWitnessesAndProposals() { let schedule = await api.getWitnessScheduleAsync(); let witnesses = await api.getWitnessesByVoteAsync('', 200); let global_properties = await api.getDynamicGlobalPropertiesAsync(); let result = {}; - result.current_route = '/~witnesses'; result.props = global_properties; result.tag_idx = {}; result.tag_idx.trending = []; @@ -174,18 +173,13 @@ async function getTransferHistory(account) { } export async function getStateAsync(url) { - // strip off query string if (url === 'trending') { - // [JES] For now, just fake a response. The front page for an unlogged in user doesn't need any of these properties to function - let trending_state = await getStateForTrending(); - return stateCleaner(trending_state); - } else if (url.includes('witness')) { - let witness_state = await getStateForWitnesses(); - return stateCleaner(witness_state); - } else if (url.includes('proposals')) { - let proposals_state = await getStateForWitnesses(); - return stateCleaner(proposals_state); + return stateCleaner(await getStateForTrending()); + } + if (url === '/~witnesses' || url === '/proposals') { + return stateCleaner(await getStateForWitnessesAndProposals()); } + // strip off query string let path = url.split('?')[0]; let fetch_transfers = false; if (path.includes('transfers')) { @@ -199,6 +193,7 @@ export async function getStateAsync(url) { } } } + let raw = await getGenericState(path); if (fetch_transfers) { diff --git a/src/shared/UniversalRender.jsx b/src/shared/UniversalRender.jsx index 84249e7b8d8602e6339806bce41195b68740843a..16bb5eef28f9b11f15c60172478b0dfb9e4f44e7 100644 --- a/src/shared/UniversalRender.jsx +++ b/src/shared/UniversalRender.jsx @@ -30,7 +30,7 @@ import Translator from 'app/Translator'; import { routeRegex } from 'app/ResolveRoute'; import { contentStats } from 'app/utils/StateFunctions'; import ScrollBehavior from 'scroll-behavior'; -import { getStateAsync } from 'app/utils/steemApi'; +import { getStateAsync } from 'app/utils/hiveApi'; let get_state_perf, get_content_perf = false;