From 740ae09aad84ec421e35eb10d7c0095fc5b32ed2 Mon Sep 17 00:00:00 2001 From: Apostolof Date: Sat, 21 Nov 2020 17:21:18 +0200 Subject: [PATCH] Refactor configuration, move all configs to env vars files and provide default values --- .../concordia-app/.env.development.example | 12 +++++++++ .../components/InitializationScreen/index.jsx | 2 +- .../src/components/PostCreate/index.jsx | 10 +++---- .../components/PostList/PostListRow/index.jsx | 8 +++--- .../src/components/PostList/index.jsx | 2 +- .../TopicList/TopicListRow/index.jsx | 8 +++--- .../src/components/TopicList/index.jsx | 2 +- .../src/constants/PlaceholderTypes.js | 2 -- .../src/constants/configuration/defaults.js | 7 +++++ .../{ => contracts}/ContractNames.js | 0 .../events}/ForumContractEvents.js | 0 .../src/constants/contracts/events/index.js | 8 ++++++ .../constants/{ => orbit}/OrbitDatabases.js | 0 .../{ => orbit}/PostsDatabaseKeys.js | 0 .../{ => orbit}/TopicsDatabaseKeys.js | 0 .../constants/{ => orbit}/UserDatabaseKeys.js | 0 .../src/options/breezeOptions.js | 11 ++++++-- .../src/options/drizzleOptions.js | 13 +++------ .../concordia-app/src/options/web3Options.js | 27 ++++++++++++++----- .../src/redux/actions/contractEventActions.js | 2 +- .../src/redux/sagas/peerDbReplicationSaga.js | 8 +++--- .../concordia-app/src/redux/sagas/userSaga.js | 2 +- .../concordia-app/src/views/Home/index.jsx | 2 +- .../src/views/Profile/GeneralTab/index.jsx | 4 +-- .../concordia-app/src/views/Profile/index.jsx | 2 +- .../PersonalInformationStep/index.jsx | 4 +-- .../src/views/Register/SignUpStep/index.jsx | 2 +- .../src/views/Topic/TopicCreate/index.jsx | 10 +++---- .../src/views/Topic/TopicView/index.jsx | 8 +++--- 29 files changed, 99 insertions(+), 57 deletions(-) create mode 100644 packages/concordia-app/.env.development.example delete mode 100644 packages/concordia-app/src/constants/PlaceholderTypes.js create mode 100644 packages/concordia-app/src/constants/configuration/defaults.js rename packages/concordia-app/src/constants/{ => contracts}/ContractNames.js (100%) rename packages/concordia-app/src/constants/{ => contracts/events}/ForumContractEvents.js (100%) create mode 100644 packages/concordia-app/src/constants/contracts/events/index.js rename packages/concordia-app/src/constants/{ => orbit}/OrbitDatabases.js (100%) rename packages/concordia-app/src/constants/{ => orbit}/PostsDatabaseKeys.js (100%) rename packages/concordia-app/src/constants/{ => orbit}/TopicsDatabaseKeys.js (100%) rename packages/concordia-app/src/constants/{ => orbit}/UserDatabaseKeys.js (100%) diff --git a/packages/concordia-app/.env.development.example b/packages/concordia-app/.env.development.example new file mode 100644 index 0000000..7a5643c --- /dev/null +++ b/packages/concordia-app/.env.development.example @@ -0,0 +1,12 @@ +# This is an example development configuration for the app +# To create your own configuration, copy this one and ommit the ".example" from the filename, then change the +# environment cariables to the prefered values. + +# Node dev-server host & port +HOST=localhost +PORT=7000 + +# Variables needed in runtime (in browser) +# Carefull, IPFS won't accept localhost as a valid hostname +REACT_APP_RENDEZVOUS_HOST=localhost +REACT_APP_RENDEZVOUS_PORT=9090 diff --git a/packages/concordia-app/src/components/InitializationScreen/index.jsx b/packages/concordia-app/src/components/InitializationScreen/index.jsx index 82d61ce..0e46ac3 100644 --- a/packages/concordia-app/src/components/InitializationScreen/index.jsx +++ b/packages/concordia-app/src/components/InitializationScreen/index.jsx @@ -5,7 +5,7 @@ import CustomLoader from './CustomLoader'; // CSS import '../../assets/css/loading-component.css'; -import { FORUM_CONTRACT } from '../../constants/ContractNames'; +import { FORUM_CONTRACT } from '../../constants/contracts/ContractNames'; const InitializationLoader = ({ children }) => { const initializing = useSelector((state) => state.drizzleStatus.initializing); diff --git a/packages/concordia-app/src/components/PostCreate/index.jsx b/packages/concordia-app/src/components/PostCreate/index.jsx index fcaec71..0bbabf7 100644 --- a/packages/concordia-app/src/components/PostCreate/index.jsx +++ b/packages/concordia-app/src/components/PostCreate/index.jsx @@ -8,15 +8,15 @@ import PropTypes from 'prop-types'; import { useTranslation } from 'react-i18next'; import { useDispatch, useSelector } from 'react-redux'; import determineKVAddress from '../../utils/orbitUtils'; -import { POSTS_DATABASE, USER_DATABASE } from '../../constants/OrbitDatabases'; +import { POSTS_DATABASE, USER_DATABASE } from '../../constants/orbit/OrbitDatabases'; import { FETCH_USER_DATABASE } from '../../redux/actions/peerDbReplicationActions'; -import { USER_PROFILE_PICTURE } from '../../constants/UserDatabaseKeys'; +import { USER_PROFILE_PICTURE } from '../../constants/orbit/UserDatabaseKeys'; import { breeze, drizzle } from '../../redux/store'; import './styles.css'; import { TRANSACTION_ERROR, TRANSACTION_SUCCESS } from '../../constants/TransactionStatus'; -import { POST_CONTENT, POST_SUBJECT } from '../../constants/PostsDatabaseKeys'; -import { FORUM_CONTRACT } from '../../constants/ContractNames'; -import { POST_CREATED_EVENT } from '../../constants/ForumContractEvents'; +import { POST_CONTENT, POST_SUBJECT } from '../../constants/orbit/PostsDatabaseKeys'; +import { FORUM_CONTRACT } from '../../constants/contracts/ContractNames'; +import { POST_CREATED_EVENT } from '../../constants/contracts/events/ForumContractEvents'; const { contracts: { [FORUM_CONTRACT]: { methods: { createPost } } } } = drizzle; const { orbit } = breeze; diff --git a/packages/concordia-app/src/components/PostList/PostListRow/index.jsx b/packages/concordia-app/src/components/PostList/PostListRow/index.jsx index 085c217..34ed09f 100644 --- a/packages/concordia-app/src/components/PostList/PostListRow/index.jsx +++ b/packages/concordia-app/src/components/PostList/PostListRow/index.jsx @@ -12,11 +12,11 @@ import { Link } from 'react-router-dom'; import { FETCH_USER_DATABASE } from '../../../redux/actions/peerDbReplicationActions'; import { breeze } from '../../../redux/store'; import './styles.css'; -import { POSTS_DATABASE, USER_DATABASE } from '../../../constants/OrbitDatabases'; +import { POSTS_DATABASE, USER_DATABASE } from '../../../constants/orbit/OrbitDatabases'; import determineKVAddress from '../../../utils/orbitUtils'; -import { USER_PROFILE_PICTURE } from '../../../constants/UserDatabaseKeys'; -import { POST_CONTENT, POST_SUBJECT } from '../../../constants/PostsDatabaseKeys'; -import { FORUM_CONTRACT } from '../../../constants/ContractNames'; +import { USER_PROFILE_PICTURE } from '../../../constants/orbit/UserDatabaseKeys'; +import { POST_CONTENT, POST_SUBJECT } from '../../../constants/orbit/PostsDatabaseKeys'; +import { FORUM_CONTRACT } from '../../../constants/contracts/ContractNames'; const { orbit } = breeze; diff --git a/packages/concordia-app/src/components/PostList/index.jsx b/packages/concordia-app/src/components/PostList/index.jsx index 68759b2..fda4102 100644 --- a/packages/concordia-app/src/components/PostList/index.jsx +++ b/packages/concordia-app/src/components/PostList/index.jsx @@ -6,7 +6,7 @@ import { useSelector } from 'react-redux'; import { Dimmer, Feed, Loader } from 'semantic-ui-react'; import PostListRow from './PostListRow'; import { drizzle } from '../../redux/store'; -import { FORUM_CONTRACT } from '../../constants/ContractNames'; +import { FORUM_CONTRACT } from '../../constants/contracts/ContractNames'; const { contracts: { [FORUM_CONTRACT]: { methods: { getPost: { cacheCall: getPostChainData } } } } } = drizzle; diff --git a/packages/concordia-app/src/components/TopicList/TopicListRow/index.jsx b/packages/concordia-app/src/components/TopicList/TopicListRow/index.jsx index 4d25f91..9f16ecf 100644 --- a/packages/concordia-app/src/components/TopicList/TopicListRow/index.jsx +++ b/packages/concordia-app/src/components/TopicList/TopicListRow/index.jsx @@ -13,11 +13,11 @@ import { Link } from 'react-router-dom'; import { FETCH_USER_DATABASE } from '../../../redux/actions/peerDbReplicationActions'; import { breeze } from '../../../redux/store'; import './styles.css'; -import { TOPICS_DATABASE, USER_DATABASE } from '../../../constants/OrbitDatabases'; +import { TOPICS_DATABASE, USER_DATABASE } from '../../../constants/orbit/OrbitDatabases'; import determineKVAddress from '../../../utils/orbitUtils'; -import { USER_PROFILE_PICTURE } from '../../../constants/UserDatabaseKeys'; -import { TOPIC_SUBJECT } from '../../../constants/TopicsDatabaseKeys'; -import { FORUM_CONTRACT } from '../../../constants/ContractNames'; +import { USER_PROFILE_PICTURE } from '../../../constants/orbit/UserDatabaseKeys'; +import { TOPIC_SUBJECT } from '../../../constants/orbit/TopicsDatabaseKeys'; +import { FORUM_CONTRACT } from '../../../constants/contracts/ContractNames'; const { orbit } = breeze; diff --git a/packages/concordia-app/src/components/TopicList/index.jsx b/packages/concordia-app/src/components/TopicList/index.jsx index e171caf..8a85f4e 100644 --- a/packages/concordia-app/src/components/TopicList/index.jsx +++ b/packages/concordia-app/src/components/TopicList/index.jsx @@ -6,7 +6,7 @@ import { useSelector } from 'react-redux'; import { List } from 'semantic-ui-react'; import TopicListRow from './TopicListRow'; import { drizzle } from '../../redux/store'; -import { FORUM_CONTRACT } from '../../constants/ContractNames'; +import { FORUM_CONTRACT } from '../../constants/contracts/ContractNames'; const { contracts: { [FORUM_CONTRACT]: { methods: { getTopic: { cacheCall: getTopicChainData } } } } } = drizzle; diff --git a/packages/concordia-app/src/constants/PlaceholderTypes.js b/packages/concordia-app/src/constants/PlaceholderTypes.js deleted file mode 100644 index c529cb7..0000000 --- a/packages/concordia-app/src/constants/PlaceholderTypes.js +++ /dev/null @@ -1,2 +0,0 @@ -export const PLACEHOLDER_TYPE_TOPIC = 'PLACEHOLDER_TYPE_TOPIC'; -export const PLACEHOLDER_TYPE_POST = 'PLACEHOLDER_TYPE_POST'; diff --git a/packages/concordia-app/src/constants/configuration/defaults.js b/packages/concordia-app/src/constants/configuration/defaults.js new file mode 100644 index 0000000..74c67a2 --- /dev/null +++ b/packages/concordia-app/src/constants/configuration/defaults.js @@ -0,0 +1,7 @@ +export const WEB3_HOST_DEFAULT = '127.0.0.1'; +export const WEB3_PORT_DEFAULT = '8545'; +export const WEB3_PORT_SOCKET_TIMEOUT_DEFAULT = 30000; +export const WEB3_PORT_SOCKET_CONNECT_MAX_ATTEMPTS_DEFAULT = 3; + +export const REACT_APP_RENDEZVOUS_HOST_DEFAULT = '127.0.0.1'; +export const REACT_APP_RENDEZVOUS_PORT_DEFAULT = '9090'; diff --git a/packages/concordia-app/src/constants/ContractNames.js b/packages/concordia-app/src/constants/contracts/ContractNames.js similarity index 100% rename from packages/concordia-app/src/constants/ContractNames.js rename to packages/concordia-app/src/constants/contracts/ContractNames.js diff --git a/packages/concordia-app/src/constants/ForumContractEvents.js b/packages/concordia-app/src/constants/contracts/events/ForumContractEvents.js similarity index 100% rename from packages/concordia-app/src/constants/ForumContractEvents.js rename to packages/concordia-app/src/constants/contracts/events/ForumContractEvents.js diff --git a/packages/concordia-app/src/constants/contracts/events/index.js b/packages/concordia-app/src/constants/contracts/events/index.js new file mode 100644 index 0000000..870bd36 --- /dev/null +++ b/packages/concordia-app/src/constants/contracts/events/index.js @@ -0,0 +1,8 @@ +import { FORUM_CONTRACT } from '../ContractNames'; +import forumContractEvents from './ForumContractEvents'; + +const appEvents = { + [FORUM_CONTRACT]: forumContractEvents, +}; + +export default appEvents; diff --git a/packages/concordia-app/src/constants/OrbitDatabases.js b/packages/concordia-app/src/constants/orbit/OrbitDatabases.js similarity index 100% rename from packages/concordia-app/src/constants/OrbitDatabases.js rename to packages/concordia-app/src/constants/orbit/OrbitDatabases.js diff --git a/packages/concordia-app/src/constants/PostsDatabaseKeys.js b/packages/concordia-app/src/constants/orbit/PostsDatabaseKeys.js similarity index 100% rename from packages/concordia-app/src/constants/PostsDatabaseKeys.js rename to packages/concordia-app/src/constants/orbit/PostsDatabaseKeys.js diff --git a/packages/concordia-app/src/constants/TopicsDatabaseKeys.js b/packages/concordia-app/src/constants/orbit/TopicsDatabaseKeys.js similarity index 100% rename from packages/concordia-app/src/constants/TopicsDatabaseKeys.js rename to packages/concordia-app/src/constants/orbit/TopicsDatabaseKeys.js diff --git a/packages/concordia-app/src/constants/UserDatabaseKeys.js b/packages/concordia-app/src/constants/orbit/UserDatabaseKeys.js similarity index 100% rename from packages/concordia-app/src/constants/UserDatabaseKeys.js rename to packages/concordia-app/src/constants/orbit/UserDatabaseKeys.js diff --git a/packages/concordia-app/src/options/breezeOptions.js b/packages/concordia-app/src/options/breezeOptions.js index b04ff33..41984c0 100644 --- a/packages/concordia-app/src/options/breezeOptions.js +++ b/packages/concordia-app/src/options/breezeOptions.js @@ -1,5 +1,12 @@ import { EthereumContractIdentityProvider } from '@ezerous/eth-identity-provider'; -import databases from '../constants/OrbitDatabases'; +import databases from '../constants/orbit/OrbitDatabases'; +import { + REACT_APP_RENDEZVOUS_HOST_DEFAULT, + REACT_APP_RENDEZVOUS_PORT_DEFAULT, +} from '../constants/configuration/defaults'; + +const REACT_APP_RENDEZVOUS_HOST = process.env.REACT_APP_RENDEZVOUS_HOST || REACT_APP_RENDEZVOUS_HOST_DEFAULT; +const REACT_APP_RENDEZVOUS_PORT = process.env.REACT_APP_RENDEZVOUS_PORT || REACT_APP_RENDEZVOUS_PORT_DEFAULT; const breezeOptions = { ipfs: { @@ -8,7 +15,7 @@ const breezeOptions = { Swarm: [ // Use local signaling server (see also rendezvous script in package.json) // For more information: https://github.com/libp2p/js-libp2p-webrtc-star - '/ip4/127.0.0.1/tcp/9090/wss/p2p-webrtc-star', + `/ip4/${REACT_APP_RENDEZVOUS_HOST}/tcp/${REACT_APP_RENDEZVOUS_PORT}/wss/p2p-webrtc-star`, // Use the following public servers if needed // '/dns4/wrtc-star1.par.dwebops.pub/tcp/443/wss/p2p-webrtc-star', diff --git a/packages/concordia-app/src/options/drizzleOptions.js b/packages/concordia-app/src/options/drizzleOptions.js index 80dd30c..7d689ee 100644 --- a/packages/concordia-app/src/options/drizzleOptions.js +++ b/packages/concordia-app/src/options/drizzleOptions.js @@ -1,17 +1,12 @@ -// See also: https://truffleframework.com/docs/drizzle/reference/drizzle-options +// Check out the documentation: https://truffleframework.com/docs/drizzle/reference/drizzle-options import { contracts } from 'concordia-contracts'; import web3Options from './web3Options'; -import forumContractEvents from '../constants/ForumContractEvents'; -import { FORUM_CONTRACT } from '../constants/ContractNames'; +import appEvents from '../constants/contracts/events'; const drizzleOptions = { - web3: { - customProvider: web3Options.web3, - }, + web3: web3Options, contracts, - events: { - [FORUM_CONTRACT]: forumContractEvents, - }, + events: { ...appEvents }, reloadWindowOnNetworkChange: true, reloadWindowOnAccountChange: true, // We need it to reinitialize breeze and create new Orbit databases }; diff --git a/packages/concordia-app/src/options/web3Options.js b/packages/concordia-app/src/options/web3Options.js index 1957de8..36fac71 100644 --- a/packages/concordia-app/src/options/web3Options.js +++ b/packages/concordia-app/src/options/web3Options.js @@ -1,14 +1,29 @@ import Web3 from 'web3'; +import { + WEB3_HOST_DEFAULT, + WEB3_PORT_DEFAULT, + WEB3_PORT_SOCKET_CONNECT_MAX_ATTEMPTS_DEFAULT, + WEB3_PORT_SOCKET_TIMEOUT_DEFAULT, +} from '../constants/configuration/defaults'; -const { WEB3_URL, WEB3_PORT } = process.env; +const { WEB3_HOST, WEB3_PORT, WEBSOCKET_TIMEOUT } = process.env; -// We need fallback ws://127.0.0.1:8545 because drizzle has not the patched web3 we use here -const web3 = (WEB3_URL && WEB3_PORT) - ? `ws://${WEB3_URL}:${WEB3_PORT}` - : new Web3(Web3.givenProvider || new Web3.providers.WebsocketProvider('ws://127.0.0.1:8545')); +const web3WebsocketOptions = { + keepAlive: true, + timeout: WEBSOCKET_TIMEOUT !== undefined ? WEBSOCKET_TIMEOUT : WEB3_PORT_SOCKET_TIMEOUT_DEFAULT, + reconnect: { + maxAttempts: WEB3_PORT_SOCKET_CONNECT_MAX_ATTEMPTS_DEFAULT, + }, +}; + +const web3 = (WEB3_HOST !== undefined && WEB3_PORT !== undefined) + ? `ws://${WEB3_HOST}:${WEB3_PORT}` + : new Web3(Web3.givenProvider || new Web3.providers.WebsocketProvider( + `ws://${WEB3_HOST_DEFAULT}:${WEB3_PORT_DEFAULT}`, web3WebsocketOptions, + )); const web3Options = { - web3, + customProvider: web3, }; export default web3Options; diff --git a/packages/concordia-app/src/redux/actions/contractEventActions.js b/packages/concordia-app/src/redux/actions/contractEventActions.js index 1dd5be1..a7b250e 100644 --- a/packages/concordia-app/src/redux/actions/contractEventActions.js +++ b/packages/concordia-app/src/redux/actions/contractEventActions.js @@ -3,7 +3,7 @@ import { TOPIC_CREATED_EVENT, USER_SIGNED_UP_EVENT, USERNAME_UPDATED_EVENT, -} from '../../constants/ForumContractEvents'; +} from '../../constants/contracts/events/ForumContractEvents'; export const FORUM_EVENT_USER_SIGNED_UP = 'FORUM_EVENT_USER_SIGNED_UP'; export const FORUM_EVENT_USERNAME_UPDATED = 'FORUM_EVENT_USERNAME_UPDATED'; diff --git a/packages/concordia-app/src/redux/sagas/peerDbReplicationSaga.js b/packages/concordia-app/src/redux/sagas/peerDbReplicationSaga.js index 5e30042..6bbb981 100644 --- a/packages/concordia-app/src/redux/sagas/peerDbReplicationSaga.js +++ b/packages/concordia-app/src/redux/sagas/peerDbReplicationSaga.js @@ -9,10 +9,10 @@ import { } from '@ezerous/breeze/src/orbit/orbitActions'; import determineKVAddress from '../../utils/orbitUtils'; import { FETCH_USER_DATABASE, UPDATE_ORBIT_DATA } from '../actions/peerDbReplicationActions'; -import { POSTS_DATABASE, TOPICS_DATABASE, USER_DATABASE } from '../../constants/OrbitDatabases'; -import userDatabaseKeys from '../../constants/UserDatabaseKeys'; -import { TOPIC_SUBJECT } from '../../constants/TopicsDatabaseKeys'; -import { POST_CONTENT, POST_SUBJECT } from '../../constants/PostsDatabaseKeys'; +import { POSTS_DATABASE, TOPICS_DATABASE, USER_DATABASE } from '../../constants/orbit/OrbitDatabases'; +import userDatabaseKeys from '../../constants/orbit/UserDatabaseKeys'; +import { TOPIC_SUBJECT } from '../../constants/orbit/TopicsDatabaseKeys'; +import { POST_CONTENT, POST_SUBJECT } from '../../constants/orbit/PostsDatabaseKeys'; function* fetchUserDb({ orbit, userAddress, dbName }) { const peerDbAddress = yield call(determineKVAddress, { diff --git a/packages/concordia-app/src/redux/sagas/userSaga.js b/packages/concordia-app/src/redux/sagas/userSaga.js index f436914..ac06fd2 100644 --- a/packages/concordia-app/src/redux/sagas/userSaga.js +++ b/packages/concordia-app/src/redux/sagas/userSaga.js @@ -5,7 +5,7 @@ import { import { drizzleActions } from '@ezerous/drizzle'; import { USER_DATA_UPDATED, USER_DATA_ERROR } from '../actions/userActions'; import { FORUM_EVENT_USER_SIGNED_UP } from '../actions/contractEventActions'; -import { FORUM_CONTRACT } from '../../constants/ContractNames'; +import { FORUM_CONTRACT } from '../../constants/contracts/ContractNames'; function* fetchUserData({ drizzle, account }) { const contract = drizzle.contracts[FORUM_CONTRACT]; diff --git a/packages/concordia-app/src/views/Home/index.jsx b/packages/concordia-app/src/views/Home/index.jsx index 3272cfd..69305ba 100644 --- a/packages/concordia-app/src/views/Home/index.jsx +++ b/packages/concordia-app/src/views/Home/index.jsx @@ -6,7 +6,7 @@ import { useSelector } from 'react-redux'; import Board from './Board'; import './styles.css'; import { drizzle } from '../../redux/store'; -import { FORUM_CONTRACT } from '../../constants/ContractNames'; +import { FORUM_CONTRACT } from '../../constants/contracts/ContractNames'; const { contracts: { [FORUM_CONTRACT]: { methods: { getNumberOfTopics } } } } = drizzle; diff --git a/packages/concordia-app/src/views/Profile/GeneralTab/index.jsx b/packages/concordia-app/src/views/Profile/GeneralTab/index.jsx index 0b1193b..c98ce60 100644 --- a/packages/concordia-app/src/views/Profile/GeneralTab/index.jsx +++ b/packages/concordia-app/src/views/Profile/GeneralTab/index.jsx @@ -7,10 +7,10 @@ import moment from 'moment'; import { useDispatch, useSelector } from 'react-redux'; import { useTranslation } from 'react-i18next'; import determineKVAddress from '../../../utils/orbitUtils'; -import databases, { USER_DATABASE } from '../../../constants/OrbitDatabases'; +import databases, { USER_DATABASE } from '../../../constants/orbit/OrbitDatabases'; import { FETCH_USER_DATABASE } from '../../../redux/actions/peerDbReplicationActions'; import { breeze } from '../../../redux/store'; -import { USER_LOCATION, USER_PROFILE_PICTURE } from '../../../constants/UserDatabaseKeys'; +import { USER_LOCATION, USER_PROFILE_PICTURE } from '../../../constants/orbit/UserDatabaseKeys'; import './styles.css'; const { orbit } = breeze; diff --git a/packages/concordia-app/src/views/Profile/index.jsx b/packages/concordia-app/src/views/Profile/index.jsx index 69ed6cd..4d3e1bd 100644 --- a/packages/concordia-app/src/views/Profile/index.jsx +++ b/packages/concordia-app/src/views/Profile/index.jsx @@ -6,7 +6,7 @@ import { useSelector } from 'react-redux'; import { useHistory, useRouteMatch } from 'react-router'; import { useTranslation } from 'react-i18next'; import { drizzle } from '../../redux/store'; -import { FORUM_CONTRACT } from '../../constants/ContractNames'; +import { FORUM_CONTRACT } from '../../constants/contracts/ContractNames'; import CustomLoadingTabPane from '../../components/CustomLoadingTabPane'; import TopicList from '../../components/TopicList'; import PostList from '../../components/PostList'; diff --git a/packages/concordia-app/src/views/Register/PersonalInformationStep/index.jsx b/packages/concordia-app/src/views/Register/PersonalInformationStep/index.jsx index 2f9b155..1ac1cdb 100644 --- a/packages/concordia-app/src/views/Register/PersonalInformationStep/index.jsx +++ b/packages/concordia-app/src/views/Register/PersonalInformationStep/index.jsx @@ -10,8 +10,8 @@ import { useHistory } from 'react-router'; import checkUrlValid from '../../../utils/urlUtils'; import { breeze } from '../../../redux/store'; import './styles.css'; -import { USER_DATABASE } from '../../../constants/OrbitDatabases'; -import { USER_LOCATION, USER_PROFILE_PICTURE } from '../../../constants/UserDatabaseKeys'; +import { USER_DATABASE } from '../../../constants/orbit/OrbitDatabases'; +import { USER_LOCATION, USER_PROFILE_PICTURE } from '../../../constants/orbit/UserDatabaseKeys'; const { orbit: { stores } } = breeze; diff --git a/packages/concordia-app/src/views/Register/SignUpStep/index.jsx b/packages/concordia-app/src/views/Register/SignUpStep/index.jsx index 948b3ae..6d2da68 100644 --- a/packages/concordia-app/src/views/Register/SignUpStep/index.jsx +++ b/packages/concordia-app/src/views/Register/SignUpStep/index.jsx @@ -11,7 +11,7 @@ import { useHistory } from 'react-router'; import PropTypes from 'prop-types'; import { drizzle } from '../../../redux/store'; import { TRANSACTION_ERROR, TRANSACTION_SUCCESS } from '../../../constants/TransactionStatus'; -import { FORUM_CONTRACT } from '../../../constants/ContractNames'; +import { FORUM_CONTRACT } from '../../../constants/contracts/ContractNames'; const { contracts: { [FORUM_CONTRACT]: { methods: { isUserNameTaken, signUp } } } } = drizzle; diff --git a/packages/concordia-app/src/views/Topic/TopicCreate/index.jsx b/packages/concordia-app/src/views/Topic/TopicCreate/index.jsx index a801b5a..29673eb 100644 --- a/packages/concordia-app/src/views/Topic/TopicCreate/index.jsx +++ b/packages/concordia-app/src/views/Topic/TopicCreate/index.jsx @@ -10,11 +10,11 @@ import { useSelector } from 'react-redux'; import './styles.css'; import { drizzle, breeze } from '../../../redux/store'; import { TRANSACTION_ERROR, TRANSACTION_SUCCESS } from '../../../constants/TransactionStatus'; -import { POSTS_DATABASE, TOPICS_DATABASE } from '../../../constants/OrbitDatabases'; -import { TOPIC_SUBJECT } from '../../../constants/TopicsDatabaseKeys'; -import { POST_CONTENT, POST_SUBJECT } from '../../../constants/PostsDatabaseKeys'; -import { FORUM_CONTRACT } from '../../../constants/ContractNames'; -import { TOPIC_CREATED_EVENT } from '../../../constants/ForumContractEvents'; +import { POSTS_DATABASE, TOPICS_DATABASE } from '../../../constants/orbit/OrbitDatabases'; +import { TOPIC_SUBJECT } from '../../../constants/orbit/TopicsDatabaseKeys'; +import { POST_CONTENT, POST_SUBJECT } from '../../../constants/orbit/PostsDatabaseKeys'; +import { FORUM_CONTRACT } from '../../../constants/contracts/ContractNames'; +import { TOPIC_CREATED_EVENT } from '../../../constants/contracts/events/ForumContractEvents'; const { contracts: { [FORUM_CONTRACT]: { methods: { createTopic } } } } = drizzle; const { orbit: { stores } } = breeze; diff --git a/packages/concordia-app/src/views/Topic/TopicView/index.jsx b/packages/concordia-app/src/views/Topic/TopicView/index.jsx index c3fa8cf..e6a84e4 100644 --- a/packages/concordia-app/src/views/Topic/TopicView/index.jsx +++ b/packages/concordia-app/src/views/Topic/TopicView/index.jsx @@ -11,12 +11,12 @@ import { breeze, drizzle } from '../../../redux/store'; import { FETCH_USER_DATABASE } from '../../../redux/actions/peerDbReplicationActions'; import './styles.css'; import PostList from '../../../components/PostList'; -import { TOPICS_DATABASE, USER_DATABASE } from '../../../constants/OrbitDatabases'; +import { TOPICS_DATABASE, USER_DATABASE } from '../../../constants/orbit/OrbitDatabases'; import determineKVAddress from '../../../utils/orbitUtils'; -import { USER_PROFILE_PICTURE } from '../../../constants/UserDatabaseKeys'; -import { TOPIC_SUBJECT } from '../../../constants/TopicsDatabaseKeys'; +import { USER_PROFILE_PICTURE } from '../../../constants/orbit/UserDatabaseKeys'; +import { TOPIC_SUBJECT } from '../../../constants/orbit/TopicsDatabaseKeys'; import PostCreate from '../../../components/PostCreate'; -import { FORUM_CONTRACT } from '../../../constants/ContractNames'; +import { FORUM_CONTRACT } from '../../../constants/contracts/ContractNames'; const { contracts: { [FORUM_CONTRACT]: { methods: { getTopic: { cacheCall: getTopicChainData } } } } } = drizzle; const { orbit } = breeze;