aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/redux
diff options
context:
space:
mode:
authorFrancesco Agosti <francesco.agosti93@gmail.com>2018-05-31 02:49:04 +0800
committerGitHub <noreply@github.com>2018-05-31 02:49:04 +0800
commite18d61b31a22519cd7d85ecffa62925ef7adc63d (patch)
tree166746953c94bdfd62cca909553f30d96d682bd8 /packages/website/ts/redux
parentb20e40dd6fd9964876a0006efe8b879a9a1d2118 (diff)
parent61cd1ae5259c03e3ae1d1711d585e2222d8cfc34 (diff)
downloaddexon-sol-tools-e18d61b31a22519cd7d85ecffa62925ef7adc63d.tar
dexon-sol-tools-e18d61b31a22519cd7d85ecffa62925ef7adc63d.tar.gz
dexon-sol-tools-e18d61b31a22519cd7d85ecffa62925ef7adc63d.tar.bz2
dexon-sol-tools-e18d61b31a22519cd7d85ecffa62925ef7adc63d.tar.lz
dexon-sol-tools-e18d61b31a22519cd7d85ecffa62925ef7adc63d.tar.xz
dexon-sol-tools-e18d61b31a22519cd7d85ecffa62925ef7adc63d.tar.zst
dexon-sol-tools-e18d61b31a22519cd7d85ecffa62925ef7adc63d.zip
Merge pull request #635 from 0xProject/feature/website/custom-onboarding-tooltip
Remove react-joyride and some more refactoring
Diffstat (limited to 'packages/website/ts/redux')
-rw-r--r--packages/website/ts/redux/reducer.ts5
-rw-r--r--packages/website/ts/redux/store.ts21
2 files changed, 25 insertions, 1 deletions
diff --git a/packages/website/ts/redux/reducer.ts b/packages/website/ts/redux/reducer.ts
index e61345c87..5c57792f7 100644
--- a/packages/website/ts/redux/reducer.ts
+++ b/packages/website/ts/redux/reducer.ts
@@ -42,6 +42,7 @@ export interface State {
userEtherBalanceInWei: BigNumber;
portalOnboardingStep: number;
isPortalOnboardingShowing: boolean;
+ hasPortalOnboardingBeenSeen: boolean;
// Note: cache of supplied orderJSON in fill order step. Do not use for anything else.
userSuppliedOrderCache: Order;
@@ -56,7 +57,7 @@ export interface State {
translate: Translate;
}
-const INITIAL_STATE: State = {
+export const INITIAL_STATE: State = {
// Portal
blockchainErr: BlockchainErrs.NoError,
blockchainIsLoaded: false,
@@ -84,6 +85,7 @@ const INITIAL_STATE: State = {
userSuppliedOrderCache: undefined,
portalOnboardingStep: 0,
isPortalOnboardingShowing: false,
+ hasPortalOnboardingBeenSeen: false,
// Docs
docsVersion: DEFAULT_DOCS_VERSION,
availableDocVersions: [DEFAULT_DOCS_VERSION],
@@ -309,6 +311,7 @@ export function reducer(state: State = INITIAL_STATE, action: Action): State {
return {
...state,
isPortalOnboardingShowing,
+ hasPortalOnboardingBeenSeen: true,
};
}
diff --git a/packages/website/ts/redux/store.ts b/packages/website/ts/redux/store.ts
new file mode 100644
index 000000000..203f068a1
--- /dev/null
+++ b/packages/website/ts/redux/store.ts
@@ -0,0 +1,21 @@
+import * as _ from 'lodash';
+import { createStore, Store as ReduxStore } from 'redux';
+import { devToolsEnhancer } from 'redux-devtools-extension/developmentOnly';
+import { stateStorage } from 'ts/local_storage/state_storage';
+import { reducer, State } from 'ts/redux/reducer';
+
+const ONE_SECOND = 1000;
+
+export const store: ReduxStore<State> = createStore(
+ reducer,
+ stateStorage.getPersistedDefaultState(),
+ devToolsEnhancer({ name: '0x Website Redux Store' }),
+);
+store.subscribe(
+ _.throttle(() => {
+ // Persisted state
+ stateStorage.saveState({
+ hasPortalOnboardingBeenSeen: store.getState().hasPortalOnboardingBeenSeen,
+ });
+ }, ONE_SECOND),
+);