diff --git a/bfrontend/src/APIRequest.js b/bfrontend/src/API/APIRequest.js similarity index 95% rename from bfrontend/src/APIRequest.js rename to bfrontend/src/API/APIRequest.js index 3b25afa..f386491 100644 --- a/bfrontend/src/APIRequest.js +++ b/bfrontend/src/API/APIRequest.js @@ -1,4 +1,4 @@ -import config from './Config'; +import config from '../Config'; async function APIRequest(endpoint, options) { let res; diff --git a/bfrontend/src/Authenticator.js b/bfrontend/src/API/Authenticator.js similarity index 79% rename from bfrontend/src/Authenticator.js rename to bfrontend/src/API/Authenticator.js index b638b0e..893d09d 100644 --- a/bfrontend/src/Authenticator.js +++ b/bfrontend/src/API/Authenticator.js @@ -1,6 +1,6 @@ import APIRequest from './APIRequest'; -import gatewayConnection from './Gateway/globalGatewayConnection'; -import Logger from './Logger'; +import gatewayConnection from '../API/Gateway/globalGatewayConnection'; +import Logger from '../Util/Logger'; const { log: authLog, error: authError } = Logger([ 'Authenticator' ]); @@ -9,7 +9,7 @@ const Authenticator = { authLog('Fetching current logged in user status...'); const { json, isOK, err } = await APIRequest.authenticated('/api/v1/users/current/info'); if (!isOK && err) { - authLog('Exeption while fetching current logged in user status', err); + authLog('Exception while fetching current logged in user status', err); throw new Error(err); } if (!isOK && !err) { @@ -21,7 +21,7 @@ const Authenticator = { return undefined; } - authLog(`Logged in as "${json.user.username || '[undefined user]'}"`); + authLog(`Logged in as "${json.user.username || '[undefined username]'}"`); // NOTE(hippoz): this function has a stupid side-effect but this will have to do for now... gatewayConnection.connect(json.user.token); diff --git a/bfrontend/src/Gateway/GatewayConnection.js b/bfrontend/src/API/Gateway/GatewayConnection.js similarity index 97% rename from bfrontend/src/Gateway/GatewayConnection.js rename to bfrontend/src/API/Gateway/GatewayConnection.js index 4c6fe96..330423f 100644 --- a/bfrontend/src/Gateway/GatewayConnection.js +++ b/bfrontend/src/API/Gateway/GatewayConnection.js @@ -1,6 +1,6 @@ import io from 'socket.io-client'; -import Logger from '../Logger'; +import Logger from '../../Util/Logger'; const { log: gatewayLog } = Logger([ 'Gateway' ]); const { log: gatewayHandshakeLog } = Logger([ 'Gateway', 'Handshake' ]); diff --git a/bfrontend/src/Gateway/globalGatewayConnection.js b/bfrontend/src/API/Gateway/globalGatewayConnection.js similarity index 91% rename from bfrontend/src/Gateway/globalGatewayConnection.js rename to bfrontend/src/API/Gateway/globalGatewayConnection.js index c577294..0d60f55 100644 --- a/bfrontend/src/Gateway/globalGatewayConnection.js +++ b/bfrontend/src/API/Gateway/globalGatewayConnection.js @@ -1,6 +1,6 @@ import GatewayConnection from './GatewayConnection'; -import config from '../Config'; -import store from '../store'; +import config from '../../Config'; +import store from '../../Global/store'; const globalGatewayConnection = new GatewayConnection(config.gatewayUrl); diff --git a/bfrontend/src/Components/Auth/Login.js b/bfrontend/src/Components/Auth/Login.js index ee83395..27819e1 100644 --- a/bfrontend/src/Components/Auth/Login.js +++ b/bfrontend/src/Components/Auth/Login.js @@ -2,10 +2,10 @@ import { useState } from 'react'; import { useHistory } from 'react-router-dom'; import { useDispatch } from 'react-redux'; -import Notification from '../Notification'; -import APIRequest from '../../APIRequest'; -import Authenticator from './../../Authenticator'; -import { getLoginMessageFromError } from '../../Errors' +import Notification from '../UI/Notification'; +import APIRequest from '../../API/APIRequest'; +import Authenticator from '../../API/Authenticator'; +import { getLoginMessageFromError } from '../../Util/Errors' export default function Login() { const history = useHistory(); diff --git a/bfrontend/src/Components/Categories/CategoryButton.js b/bfrontend/src/Components/Categories/CategoryButton.js index e1dd245..c26a996 100644 --- a/bfrontend/src/Components/Categories/CategoryButton.js +++ b/bfrontend/src/Components/Categories/CategoryButton.js @@ -1,5 +1,5 @@ import CategoryProfile from './CategoryProfileLink'; -import gatewayConnection from '../../Gateway/globalGatewayConnection'; +import gatewayConnection from '../../API/Gateway/globalGatewayConnection'; import { useHistory } from 'react-router-dom'; diff --git a/bfrontend/src/Components/Categories/CategoryList.js b/bfrontend/src/Components/Categories/CategoryList.js index 75f523a..0c3dd12 100644 --- a/bfrontend/src/Components/Categories/CategoryList.js +++ b/bfrontend/src/Components/Categories/CategoryList.js @@ -1,12 +1,12 @@ import CategoryListLoader from './CategoryListLoader'; import CategoryButton from './CategoryButton'; -import APIRequest from '../../APIRequest'; -import { couldNotReach } from '../../Errors'; +import APIRequest from '../../API/APIRequest'; +import { couldNotReach } from '../../Util/Errors'; import { connect, useDispatch } from 'react-redux' import { useState, useEffect } from 'react'; -import Logger from '../../Logger'; -import gatewayConnection from '../../Gateway/globalGatewayConnection'; +import Logger from '../../Util/Logger'; +import gatewayConnection from '../../API/Gateway/globalGatewayConnection'; const { log: loaderLog } = Logger([ 'CategoryList', 'Loader' ]); diff --git a/bfrontend/src/Components/Categories/CategoryView.js b/bfrontend/src/Components/Categories/CategoryView.js index f499a5f..c76ee22 100644 --- a/bfrontend/src/Components/Categories/CategoryView.js +++ b/bfrontend/src/Components/Categories/CategoryView.js @@ -1,7 +1,7 @@ import CategoryViewLoader from './CategoryViewLoader'; import CategoryProfile from './CategoryProfileLink'; import Message from '../Messages/Message'; -import gatewayConnection from '../../Gateway/globalGatewayConnection'; +import gatewayConnection from '../../API/Gateway/globalGatewayConnection'; import { useParams } from 'react-router-dom'; import { connect, useDispatch } from 'react-redux'; diff --git a/bfrontend/src/Components/Root.js b/bfrontend/src/Components/Home/Root.js similarity index 100% rename from bfrontend/src/Components/Root.js rename to bfrontend/src/Components/Home/Root.js diff --git a/bfrontend/src/Components/App.js b/bfrontend/src/Components/Main/App.js similarity index 82% rename from bfrontend/src/Components/App.js rename to bfrontend/src/Components/Main/App.js index a1e8fd4..3723720 100644 --- a/bfrontend/src/Components/App.js +++ b/bfrontend/src/Components/Main/App.js @@ -1,11 +1,11 @@ -import Login from './Auth/Login'; -import Root from './Root'; -import Authenticator from './../Authenticator'; -import Notification from './Notification'; -import './../Styles/App.scss'; -import { couldNotReach } from '../Errors'; -import CategoryView from './Categories/CategoryView'; -import Sidebar from './UI/Sidebar'; +import Login from '../Auth/Login'; +import Root from '../Home/Root'; +import Authenticator from '../../API/Authenticator'; +import Notification from '../UI/Notification'; +import './../../Styles/App.scss'; +import { couldNotReach } from '../../Util/Errors'; +import CategoryView from '../Categories/CategoryView'; +import Sidebar from '../UI/Sidebar'; import { useEffect, useState } from 'react'; import { useDispatch, connect } from 'react-redux' diff --git a/bfrontend/src/Components/Notification.js b/bfrontend/src/Components/UI/Notification.js similarity index 100% rename from bfrontend/src/Components/Notification.js rename to bfrontend/src/Components/UI/Notification.js diff --git a/bfrontend/src/Components/UI/ProfileLink.js b/bfrontend/src/Components/UI/ProfileLink.js index 1f0e90a..c048d52 100644 --- a/bfrontend/src/Components/UI/ProfileLink.js +++ b/bfrontend/src/Components/UI/ProfileLink.js @@ -1,4 +1,4 @@ -import defaultProfile from '../../Images/defaultprofile_256px-256px.png' +import defaultProfile from '../../Content/Images/defaultprofile_256px-256px.png' export default function ProfileLink({ object, size=32, type, offset=true, children=null }) { let picture; diff --git a/bfrontend/src/Images/defaultprofile_256px-256px.png b/bfrontend/src/Content/Images/defaultprofile_256px-256px.png similarity index 100% rename from bfrontend/src/Images/defaultprofile_256px-256px.png rename to bfrontend/src/Content/Images/defaultprofile_256px-256px.png diff --git a/bfrontend/src/store.js b/bfrontend/src/Global/store.js similarity index 100% rename from bfrontend/src/store.js rename to bfrontend/src/Global/store.js diff --git a/bfrontend/src/Errors.js b/bfrontend/src/Util/Errors.js similarity index 100% rename from bfrontend/src/Errors.js rename to bfrontend/src/Util/Errors.js diff --git a/bfrontend/src/Logger.js b/bfrontend/src/Util/Logger.js similarity index 100% rename from bfrontend/src/Logger.js rename to bfrontend/src/Util/Logger.js diff --git a/bfrontend/src/index.js b/bfrontend/src/index.js index 1cdcfcc..a46406b 100644 --- a/bfrontend/src/index.js +++ b/bfrontend/src/index.js @@ -1,5 +1,5 @@ -import store from './store'; -import App from './Components/App'; +import store from './Global/store'; +import App from './Components/Main/App'; import React from 'react'; import ReactDOM from 'react-dom';