diff --git a/src/components/ErrorBoundary/index.jsx b/src/components/ErrorBoundary/index.jsx
new file mode 100644
index 0000000..e461680
--- /dev/null
+++ b/src/components/ErrorBoundary/index.jsx
@@ -0,0 +1,34 @@
+import React from 'react';
+/**
+ * Generic ErrorBoundary handler. Will catch error and return a basic respons message
+ * TODO:
+ * * Extend the plesantry of the error message and perhaps direct to help page etc
+ * * improve verbosity of logging
+ *
+ *
+ *
+ *
+ */
+class ErrorBoundary extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = { hasError: false };
+ }
+
+ componentDidCatch(error, info) {
+ // Display fallback UI
+ this.setState({ hasError: true });
+ // You can also log the error to an error reporting service
+ console.log(error, info);
+ }
+
+ render() {
+ if (this.state.hasError) {
+ // You can render any custom fallback UI
+ return
Ooops. Something went wrong.
;
+ }
+ return this.props.children;
+ }
+ }
+
+ export default ErrorBoundary;
\ No newline at end of file
diff --git a/src/components/UnAuthorized/index.jsx b/src/components/UnAuthorized/index.jsx
new file mode 100644
index 0000000..3350562
--- /dev/null
+++ b/src/components/UnAuthorized/index.jsx
@@ -0,0 +1,12 @@
+import React from 'react';
+import { Wrapper, Message, Button } from './style';
+
+const UnAuthorized = props => (
+
+ You Must be Logged in to view this page
+
+
+);
+
+export default UnAuthorized;
diff --git a/src/components/UnAuthorized/style.js b/src/components/UnAuthorized/style.js
new file mode 100644
index 0000000..e7dcf93
--- /dev/null
+++ b/src/components/UnAuthorized/style.js
@@ -0,0 +1,23 @@
+import styled from 'styled-components';
+
+export const Wrapper = styled.div`
+ width: 100%;
+ height: 300px;
+ background: white;
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-content: center;
+ vertical-align: middle;
+`;
+
+export const Message = styled.div`
+ color: black;
+ align-self: center;
+`
+export const Button = styled.button`
+ color: black;
+ width: 100px;
+ align-self: center;
+
+`
diff --git a/src/services/sapi/client.js b/src/services/sapi/client.js
index 48bcbff..a57a09f 100644
--- a/src/services/sapi/client.js
+++ b/src/services/sapi/client.js
@@ -43,8 +43,27 @@ import StockLogo from './fixtures/images/stockLogo.png';
*
*/
class ShortedAPI {
- constructor() {
+ constructor(credentials = false) {
console.log('constructing stub client');
+ this.credentials = credentials
+ this.authenticated = false
+ }
+ /**
+ * login
+ * generate authentication token for client side requests
+ */
+ login() {
+ if (this.credentials) {
+ this.authenticated = this.authenticate(this.credentials);
+ return this.authenticated
+ }
+ }
+ authenticate(credentials) {
+ if (credentials) {
+ return true
+ } else {
+ return false
+ }
}
/**
* getTopShorts
@@ -157,6 +176,20 @@ class ShortedAPI {
getTopAlerts(total = 5) {
return topAlerts.alerts.slice(0, total);
}
+ /**
+ * getUserAlerts()
+ *
+ *
+ *
+ *
+ */
+ getUserAlerts() {
+ if (this.authenticated) {
+ // get user list here
+ } else {
+ return false
+ }
+ }
/**
* getAlerts
* get the latest alerts for a specific stock
diff --git a/src/components/AboutHeader/index.jsx b/src/views/aboutpage/components/AboutHeader/index.jsx
similarity index 97%
rename from src/components/AboutHeader/index.jsx
rename to src/views/aboutpage/components/AboutHeader/index.jsx
index 895401b..b59ef60 100644
--- a/src/components/AboutHeader/index.jsx
+++ b/src/views/aboutpage/components/AboutHeader/index.jsx
@@ -1,6 +1,6 @@
import React from 'react';
import Transition from 'react-transition-group/Transition';
-import AboutHeaderHero from '../../assets/images/about-main.svg';
+import AboutHeaderHero from '../../../../assets/images/about-main.svg';
import {
HeroWrapper,
HeroButtonWrapper,
diff --git a/src/components/AboutHeader/style.js b/src/views/aboutpage/components/AboutHeader/style.js
similarity index 100%
rename from src/components/AboutHeader/style.js
rename to src/views/aboutpage/components/AboutHeader/style.js
diff --git a/src/views/aboutpage/index.jsx b/src/views/aboutpage/index.jsx
index c5e5301..e09e415 100644
--- a/src/views/aboutpage/index.jsx
+++ b/src/views/aboutpage/index.jsx
@@ -1,7 +1,7 @@
import React from 'react';
import Transition from 'react-transition-group/Transition';
import AppViewWrapper from '../../components/AppViewWrapper';
-import AboutHeader from '../../components/AboutHeader';
+import AboutHeader from './components/AboutHeader';
import {duration, transitionStyles} from './style';
class AboutPage extends React.Component {
diff --git a/src/views/alerts/components/List/index.jsx b/src/views/alerts/components/List/index.jsx
index e41c9b0..cd495be 100644
--- a/src/views/alerts/components/List/index.jsx
+++ b/src/views/alerts/components/List/index.jsx
@@ -1,13 +1,13 @@
import React from 'react';
import {Wrapper} from './style';
-
import Row from '../Row';
+import UnAuthorized from '../../../../components/UnAuthorized';
const List = props => (
- {props.data.map(row => (
+ {props.data ? props.data.map(row => (
- ))}
+ )) : }
);
diff --git a/src/views/alerts/index.jsx b/src/views/alerts/index.jsx
index 775f296..5107ee3 100644
--- a/src/views/alerts/index.jsx
+++ b/src/views/alerts/index.jsx
@@ -2,7 +2,7 @@ import React from 'react';
import Transition from 'react-transition-group/Transition';
import ShortedAPI from '../../services/sapi/client';
import List from './components/List';
-import {DashboardWrapper, duration, transitionStyles} from './style';
+import {DashboardWrapper, duration, transitionStyles, Header} from './style';
/**
* View:Alerts
@@ -39,11 +39,20 @@ class Alerts extends React.Component {
{state => {
return (
- this.handleHover(row)}
- onSelect={row => this.handleClick(row)}
- data={this.apiClient.getTopAlerts()}
- />
+
+ this.handleHover(row)}
+ onSelect={row => this.handleClick(row)}
+ data={this.apiClient.getTopAlerts()}
+ />
+
+
+ this.handleHover(row)}
+ onSelect={row => this.handleClick(row)}
+ data={this.apiClient.getUserAlerts()}
+ />
+
);
}}
diff --git a/src/views/alerts/style.js b/src/views/alerts/style.js
index b542fb5..1031219 100644
--- a/src/views/alerts/style.js
+++ b/src/views/alerts/style.js
@@ -16,6 +16,11 @@ export const DashboardWrapper = styled.div`
'top-list top-alerts top-alerts top-movers';
}
`;
+export const Header = styled.div`
+ font-family: Avenir Next, sans-serif;
+ font-size: 40px;
+ font-weight: bold;
+`
export const duration = 300;
diff --git a/src/views/dashboard/index.jsx b/src/views/dashboard/index.jsx
index 96f7188..a2e38ff 100644
--- a/src/views/dashboard/index.jsx
+++ b/src/views/dashboard/index.jsx
@@ -3,6 +3,7 @@ import Transition from 'react-transition-group/Transition';
import {Menu, Icon, Switch, Button} from 'antd';
import 'antd/dist/antd.css';
import Logo from '../../components/Logo';
+import ErrorBoundary from '../../components/ErrorBoundary';
import ThemeSwitch from '../../components/ThemeSwitch';
import Sectors from '../../views/sectors';
import Alerts from '../../views/alerts';
@@ -48,17 +49,17 @@ class Dashboard extends React.Component {
getView(selection, theme) {
switch (selection) {
case 'SECTORS':
- return ;
+ return ;
case 'MOVERS':
- return ;
+ return ;
case 'ALERTS':
- return ;
+ return ;
case 'SEASONALITY':
- return ;
+ return ;
case 'SUMMARY':
- return ;
+ return ;
default:
- return ;
+ return ;
}
}
diff --git a/src/views/dashboard/style.js b/src/views/dashboard/style.js
index 7625eaa..9ab2bbd 100644
--- a/src/views/dashboard/style.js
+++ b/src/views/dashboard/style.js
@@ -60,4 +60,5 @@ export const ContentWrapper = styled.div`
padding-right: 20px;
padding-bottom: 20px;
background: ${props => props.background};
+ height: 100vh;
`;
diff --git a/src/components/ProfileAlerts/index.jsx b/src/views/stockprofile/components/ProfileAlerts/index.jsx
similarity index 100%
rename from src/components/ProfileAlerts/index.jsx
rename to src/views/stockprofile/components/ProfileAlerts/index.jsx
diff --git a/src/components/ProfileAlerts/style.js b/src/views/stockprofile/components/ProfileAlerts/style.js
similarity index 100%
rename from src/components/ProfileAlerts/style.js
rename to src/views/stockprofile/components/ProfileAlerts/style.js
diff --git a/src/components/ProfileChart/index.jsx b/src/views/stockprofile/components/ProfileChart/index.jsx
similarity index 100%
rename from src/components/ProfileChart/index.jsx
rename to src/views/stockprofile/components/ProfileChart/index.jsx
diff --git a/src/components/ProfileChart/style.js b/src/views/stockprofile/components/ProfileChart/style.js
similarity index 100%
rename from src/components/ProfileChart/style.js
rename to src/views/stockprofile/components/ProfileChart/style.js
diff --git a/src/components/ProfileHeader/index.jsx b/src/views/stockprofile/components/ProfileHeader/index.jsx
similarity index 100%
rename from src/components/ProfileHeader/index.jsx
rename to src/views/stockprofile/components/ProfileHeader/index.jsx
diff --git a/src/components/ProfileHeader/style.js b/src/views/stockprofile/components/ProfileHeader/style.js
similarity index 100%
rename from src/components/ProfileHeader/style.js
rename to src/views/stockprofile/components/ProfileHeader/style.js
diff --git a/src/components/ProfileSidePanel/index.jsx b/src/views/stockprofile/components/ProfileSidePanel/index.jsx
similarity index 100%
rename from src/components/ProfileSidePanel/index.jsx
rename to src/views/stockprofile/components/ProfileSidePanel/index.jsx
diff --git a/src/components/ProfileSidePanel/style.js b/src/views/stockprofile/components/ProfileSidePanel/style.js
similarity index 100%
rename from src/components/ProfileSidePanel/style.js
rename to src/views/stockprofile/components/ProfileSidePanel/style.js
diff --git a/src/views/stockprofile/index.jsx b/src/views/stockprofile/index.jsx
index a3c179f..ac1fdb1 100644
--- a/src/views/stockprofile/index.jsx
+++ b/src/views/stockprofile/index.jsx
@@ -6,11 +6,11 @@ import ShortedAPI from '../../services/sapi/client';
import headerBackground from '../../assets/images/header-background.svg';
import AppViewWrapper from '../../components/AppViewWrapper';
-import ProfileChart from '../../components/ProfileChart';
-import ProfileSidePanel from '../../components/ProfileSidePanel';
-import ProfileHeader from '../../components/ProfileHeader';
-import ProfileAlerts from '../../components/ProfileAlerts';
-import icon32 from '../../../static/favicon-32x32.png';
+import ProfileChart from './components/ProfileChart';
+import ProfileSidePanel from './components/ProfileSidePanel';
+import ProfileHeader from './components/ProfileHeader';
+import ProfileAlerts from './components/ProfileAlerts';
+import icon32 from './../../../static/favicon-32x32.png';
import {StockProfileWrapper, duration, transitionStyles} from './style';
/**
diff --git a/src/components/AlertRow/index.jsx b/src/views/summary/components/AlertRow/index.jsx
similarity index 100%
rename from src/components/AlertRow/index.jsx
rename to src/views/summary/components/AlertRow/index.jsx
diff --git a/src/components/AlertRow/style.js b/src/views/summary/components/AlertRow/style.js
similarity index 100%
rename from src/components/AlertRow/style.js
rename to src/views/summary/components/AlertRow/style.js
diff --git a/src/components/AlertRowGraph/index.jsx b/src/views/summary/components/AlertRowGraph/index.jsx
similarity index 100%
rename from src/components/AlertRowGraph/index.jsx
rename to src/views/summary/components/AlertRowGraph/index.jsx
diff --git a/src/components/AlertRowGraph/style.js b/src/views/summary/components/AlertRowGraph/style.js
similarity index 100%
rename from src/components/AlertRowGraph/style.js
rename to src/views/summary/components/AlertRowGraph/style.js
diff --git a/src/components/Alerts/index.jsx b/src/views/summary/components/Alerts/index.jsx
similarity index 92%
rename from src/components/Alerts/index.jsx
rename to src/views/summary/components/Alerts/index.jsx
index 04c44be..83e3129 100644
--- a/src/components/Alerts/index.jsx
+++ b/src/views/summary/components/Alerts/index.jsx
@@ -1,7 +1,6 @@
import React from 'react';
import Transition from 'react-transition-group/Transition';
-import ShortedAPI from '../../services/sapi/client';
-import AlertRow from '../../components/AlertRow';
+import AlertRow from '../AlertRow';
import {duration, transitionStyles, Wrapper, Header, More, Rows} from './style';
/**
* Responsible for the rendering/display of "alerts" which represent anomalous changes in short positions for a given stock.
diff --git a/src/components/Alerts/style.js b/src/views/summary/components/Alerts/style.js
similarity index 100%
rename from src/components/Alerts/style.js
rename to src/views/summary/components/Alerts/style.js
diff --git a/src/components/ChartOptions/index.jsx b/src/views/summary/components/ChartOptions/index.jsx
similarity index 100%
rename from src/components/ChartOptions/index.jsx
rename to src/views/summary/components/ChartOptions/index.jsx
diff --git a/src/components/ChartOptions/style.js b/src/views/summary/components/ChartOptions/style.js
similarity index 100%
rename from src/components/ChartOptions/style.js
rename to src/views/summary/components/ChartOptions/style.js
diff --git a/src/components/Legend/index.jsx b/src/views/summary/components/Legend/index.jsx
similarity index 88%
rename from src/components/Legend/index.jsx
rename to src/views/summary/components/Legend/index.jsx
index a59d8fd..c12648d 100644
--- a/src/components/Legend/index.jsx
+++ b/src/views/summary/components/Legend/index.jsx
@@ -1,9 +1,9 @@
import React from 'react';
import Transition from 'react-transition-group/Transition';
-import LegendCompanyCode from '../../components/LegendCompanyCode';
-import LegendCompanyLogo from '../../components/LegendCompanyLogo';
-import LegendCompanyPE from '../../components/LegendCompanyPE';
-import LegendCompanyMarketCap from '../../components/LegendCompanyMarketCap';
+import LegendCompanyCode from '../LegendCompanyCode';
+import LegendCompanyLogo from '../LegendCompanyLogo';
+import LegendCompanyPE from '../LegendCompanyPE';
+import LegendCompanyMarketCap from '../LegendCompanyMarketCap';
import {
Wrapper,
duration,
@@ -12,7 +12,7 @@ import {
CompanyName,
CompanySector,
} from './style';
-import ShortedAPI from '../../services/sapi/client';
+import ShortedAPI from '../../../../services/sapi/client';
/**
* Renders a shorted.com.au logo
* TODO: add data fetch here, async or prefetch based of top-short positions
diff --git a/src/components/Legend/style.js b/src/views/summary/components/Legend/style.js
similarity index 100%
rename from src/components/Legend/style.js
rename to src/views/summary/components/Legend/style.js
diff --git a/src/components/LegendCompanyCode/index.jsx b/src/views/summary/components/LegendCompanyCode/index.jsx
similarity index 100%
rename from src/components/LegendCompanyCode/index.jsx
rename to src/views/summary/components/LegendCompanyCode/index.jsx
diff --git a/src/components/LegendCompanyCode/style.js b/src/views/summary/components/LegendCompanyCode/style.js
similarity index 100%
rename from src/components/LegendCompanyCode/style.js
rename to src/views/summary/components/LegendCompanyCode/style.js
diff --git a/src/components/LegendCompanyLogo/index.jsx b/src/views/summary/components/LegendCompanyLogo/index.jsx
similarity index 100%
rename from src/components/LegendCompanyLogo/index.jsx
rename to src/views/summary/components/LegendCompanyLogo/index.jsx
diff --git a/src/components/LegendCompanyLogo/style.js b/src/views/summary/components/LegendCompanyLogo/style.js
similarity index 100%
rename from src/components/LegendCompanyLogo/style.js
rename to src/views/summary/components/LegendCompanyLogo/style.js
diff --git a/src/components/LegendCompanyMarketCap/index.jsx b/src/views/summary/components/LegendCompanyMarketCap/index.jsx
similarity index 100%
rename from src/components/LegendCompanyMarketCap/index.jsx
rename to src/views/summary/components/LegendCompanyMarketCap/index.jsx
diff --git a/src/components/LegendCompanyMarketCap/style.js b/src/views/summary/components/LegendCompanyMarketCap/style.js
similarity index 100%
rename from src/components/LegendCompanyMarketCap/style.js
rename to src/views/summary/components/LegendCompanyMarketCap/style.js
diff --git a/src/components/LegendCompanyPE/index.jsx b/src/views/summary/components/LegendCompanyPE/index.jsx
similarity index 100%
rename from src/components/LegendCompanyPE/index.jsx
rename to src/views/summary/components/LegendCompanyPE/index.jsx
diff --git a/src/components/LegendCompanyPE/style.js b/src/views/summary/components/LegendCompanyPE/style.js
similarity index 100%
rename from src/components/LegendCompanyPE/style.js
rename to src/views/summary/components/LegendCompanyPE/style.js
diff --git a/src/components/MoversList/index.jsx b/src/views/summary/components/MoversList/index.jsx
similarity index 93%
rename from src/components/MoversList/index.jsx
rename to src/views/summary/components/MoversList/index.jsx
index a1ab6bd..3f586f4 100644
--- a/src/components/MoversList/index.jsx
+++ b/src/views/summary/components/MoversList/index.jsx
@@ -1,7 +1,6 @@
import React from 'react';
import Transition from 'react-transition-group/Transition';
-import ShortedAPI from '../../services/sapi/client';
-import MoversListRow from '../../components/MoversListRow';
+import MoversListRow from '../MoversListRow';
import {Wrapper, Header, More, duration, transitionStyles} from './style';
/**
* Renders a list of TopShortsListRow components. These rows will display the stock code, stock name, and percentage shorted
diff --git a/src/components/MoversList/style.js b/src/views/summary/components/MoversList/style.js
similarity index 100%
rename from src/components/MoversList/style.js
rename to src/views/summary/components/MoversList/style.js
diff --git a/src/components/MoversListRow/index.jsx b/src/views/summary/components/MoversListRow/index.jsx
similarity index 100%
rename from src/components/MoversListRow/index.jsx
rename to src/views/summary/components/MoversListRow/index.jsx
diff --git a/src/components/MoversListRow/style.js b/src/views/summary/components/MoversListRow/style.js
similarity index 100%
rename from src/components/MoversListRow/style.js
rename to src/views/summary/components/MoversListRow/style.js
diff --git a/src/components/TopChartVictory/components.jsx b/src/views/summary/components/TopChartVictory/components.jsx
similarity index 100%
rename from src/components/TopChartVictory/components.jsx
rename to src/views/summary/components/TopChartVictory/components.jsx
diff --git a/src/components/TopChartVictory/index.jsx b/src/views/summary/components/TopChartVictory/index.jsx
similarity index 100%
rename from src/components/TopChartVictory/index.jsx
rename to src/views/summary/components/TopChartVictory/index.jsx
diff --git a/src/components/TopChartVictory/style.js b/src/views/summary/components/TopChartVictory/style.js
similarity index 100%
rename from src/components/TopChartVictory/style.js
rename to src/views/summary/components/TopChartVictory/style.js
diff --git a/src/components/TopShortsList/index.jsx b/src/views/summary/components/TopShortsList/index.jsx
similarity index 100%
rename from src/components/TopShortsList/index.jsx
rename to src/views/summary/components/TopShortsList/index.jsx
diff --git a/src/components/TopShortsList/style.js b/src/views/summary/components/TopShortsList/style.js
similarity index 100%
rename from src/components/TopShortsList/style.js
rename to src/views/summary/components/TopShortsList/style.js
diff --git a/src/components/TopShortsListRow/index.jsx b/src/views/summary/components/TopShortsListRow/index.jsx
similarity index 100%
rename from src/components/TopShortsListRow/index.jsx
rename to src/views/summary/components/TopShortsListRow/index.jsx
diff --git a/src/components/TopShortsListRow/style.js b/src/views/summary/components/TopShortsListRow/style.js
similarity index 100%
rename from src/components/TopShortsListRow/style.js
rename to src/views/summary/components/TopShortsListRow/style.js
diff --git a/src/components/WindowPicker/index.jsx b/src/views/summary/components/WindowPicker/index.jsx
similarity index 94%
rename from src/components/WindowPicker/index.jsx
rename to src/views/summary/components/WindowPicker/index.jsx
index 41741af..2582dac 100644
--- a/src/components/WindowPicker/index.jsx
+++ b/src/views/summary/components/WindowPicker/index.jsx
@@ -1,6 +1,6 @@
import React from 'react';
import {Wrapper} from './style';
-import Button from '../Button';
+import Button from '../../../../components/Button';
/**
* WindowPicker
diff --git a/src/components/WindowPicker/style.js b/src/views/summary/components/WindowPicker/style.js
similarity index 100%
rename from src/components/WindowPicker/style.js
rename to src/views/summary/components/WindowPicker/style.js
diff --git a/src/views/summary/index.jsx b/src/views/summary/index.jsx
index 21076a0..a44e3b0 100644
--- a/src/views/summary/index.jsx
+++ b/src/views/summary/index.jsx
@@ -1,18 +1,14 @@
import React from 'react';
import Transition from 'react-transition-group/Transition';
-import headerBackground from '../../assets/images/header-background.svg';
import ShortedAPI from '../../services/sapi/client';
-import AppViewWrapper from '../../components/AppViewWrapper';
-import TopChartVictory from '../../components/TopChartVictory';
-import MoversList from '../../components/MoversList';
-import TopShortsList from '../../components/TopShortsList';
-import Legend from '../../components/Legend';
-import Alerts from '../../components/Alerts';
-import ThemePicker from '../../components/ThemePicker';
-import WindowPicker from './../../components/WindowPicker';
-import ChartOptions from '../../components/ChartOptions';
+import TopChartVictory from './components/TopChartVictory';
+import MoversList from './components/MoversList';
+import TopShortsList from './components/TopShortsList';
+import Legend from './components/Legend';
+import Alerts from './components/Alerts';
+import WindowPicker from '././components/WindowPicker';
+import ChartOptions from './components/ChartOptions';
import {DashboardWrapper, themes, duration, transitionStyles} from './style';
-import {runInThisContext} from 'vm';
/**
* View:TopShorts