From 928edee90f4a35eea20d581e093b002be04e9b47 Mon Sep 17 00:00:00 2001 From: Noah Loomans Date: Sat, 6 Jan 2018 13:16:31 +0100 Subject: Move LandingPage.js to component/page/Index.js --- src/client/react/components/page/Index.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/client/react/components/page/Index.js (limited to 'src/client/react/components/page') diff --git a/src/client/react/components/page/Index.js b/src/client/react/components/page/Index.js new file mode 100644 index 0000000..dcc521d --- /dev/null +++ b/src/client/react/components/page/Index.js @@ -0,0 +1,16 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import Search from '../container/Search'; + +const App = ({ location }) => ( +
+ +
+); + +App.propTypes = { + // eslint-disable-next-line react/forbid-prop-types + location: PropTypes.object.isRequired, +}; + +export default App; -- cgit v1.1 From c0aa588bc8f85b13b5a55ccd6cdf11bf99048a1c Mon Sep 17 00:00:00 2001 From: Noah Loomans Date: Sat, 6 Jan 2018 15:42:04 +0100 Subject: Add user page --- src/client/react/components/page/Index.js | 10 ++-------- src/client/react/components/page/User.js | 31 +++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 8 deletions(-) create mode 100644 src/client/react/components/page/User.js (limited to 'src/client/react/components/page') diff --git a/src/client/react/components/page/Index.js b/src/client/react/components/page/Index.js index dcc521d..a91d7a9 100644 --- a/src/client/react/components/page/Index.js +++ b/src/client/react/components/page/Index.js @@ -1,16 +1,10 @@ import React from 'react'; -import PropTypes from 'prop-types'; import Search from '../container/Search'; -const App = ({ location }) => ( +const App = () => (
- +
); -App.propTypes = { - // eslint-disable-next-line react/forbid-prop-types - location: PropTypes.object.isRequired, -}; - export default App; diff --git a/src/client/react/components/page/User.js b/src/client/react/components/page/User.js new file mode 100644 index 0000000..2ad65a6 --- /dev/null +++ b/src/client/react/components/page/User.js @@ -0,0 +1,31 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { Redirect } from 'react-router-dom'; +import Search from '../container/Search'; +import users from '../../users'; + +const App = ({ match }) => { + const user = `${match.params.type}/${match.params.value}`; + + if (!users.allIds.includes(user)) { + // Invalid user, redirect to index. + return ; + } + + return ( +
+ +
+ ); +}; + +App.propTypes = { + match: PropTypes.shape({ + params: PropTypes.shape({ + type: PropTypes.string.isRequired, + value: PropTypes.string.isRequired, + }).isRequired, + }).isRequired, +}; + +export default App; -- cgit v1.1 From 1b3f4ea79f947558573fbce5a2e2d0c2c5dd6a8d Mon Sep 17 00:00:00 2001 From: Noah Loomans Date: Wed, 17 Jan 2018 16:26:04 +0100 Subject: Add view code --- src/client/react/components/page/User.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/client/react/components/page') diff --git a/src/client/react/components/page/User.js b/src/client/react/components/page/User.js index 2ad65a6..ea8cd10 100644 --- a/src/client/react/components/page/User.js +++ b/src/client/react/components/page/User.js @@ -2,6 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { Redirect } from 'react-router-dom'; import Search from '../container/Search'; +import View from '../container/View'; import users from '../../users'; const App = ({ match }) => { @@ -15,6 +16,7 @@ const App = ({ match }) => { return (
+
); }; -- cgit v1.1 From 2232877ed5b3c0b60789940d2a367726ee8919c5 Mon Sep 17 00:00:00 2001 From: Noah Loomans Date: Wed, 17 Jan 2018 16:45:17 +0100 Subject: Add some basic styling --- src/client/react/components/page/Index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/client/react/components/page') diff --git a/src/client/react/components/page/Index.js b/src/client/react/components/page/Index.js index a91d7a9..9b8dbd7 100644 --- a/src/client/react/components/page/Index.js +++ b/src/client/react/components/page/Index.js @@ -2,7 +2,8 @@ import React from 'react'; import Search from '../container/Search'; const App = () => ( -
+
+ Metis
); -- cgit v1.1 From 3f228d0d84868e4a02aa7a62b09dde8092f2cc4c Mon Sep 17 00:00:00 2001 From: Noah Loomans Date: Fri, 19 Jan 2018 14:58:49 +0100 Subject: Add helpbox --- src/client/react/components/page/Index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/client/react/components/page') diff --git a/src/client/react/components/page/Index.js b/src/client/react/components/page/Index.js index 9b8dbd7..c2994c9 100644 --- a/src/client/react/components/page/Index.js +++ b/src/client/react/components/page/Index.js @@ -1,10 +1,14 @@ import React from 'react'; import Search from '../container/Search'; +import HelpBox from '../container/HelpBox'; const App = () => (
- Metis - +
+ Metis + + +
); -- cgit v1.1 From 16723546de81e29fa8a31acc4070df5acb182b24 Mon Sep 17 00:00:00 2001 From: Noah Loomans Date: Wed, 24 Jan 2018 16:08:49 +0100 Subject: Add basic styling to user page --- src/client/react/components/page/User.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/client/react/components/page') diff --git a/src/client/react/components/page/User.js b/src/client/react/components/page/User.js index ea8cd10..ff304c0 100644 --- a/src/client/react/components/page/User.js +++ b/src/client/react/components/page/User.js @@ -14,8 +14,12 @@ const App = ({ match }) => { } return ( -
- +
+
+
+ +
+
); -- cgit v1.1 From 19534b4770b4f4097b02f5fa021a24822b12d907 Mon Sep 17 00:00:00 2001 From: Noah Loomans Date: Fri, 26 Jan 2018 20:30:34 +0100 Subject: Add week selector --- src/client/react/components/page/User.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/client/react/components/page') diff --git a/src/client/react/components/page/User.js b/src/client/react/components/page/User.js index ff304c0..980070f 100644 --- a/src/client/react/components/page/User.js +++ b/src/client/react/components/page/User.js @@ -1,12 +1,17 @@ import React from 'react'; import PropTypes from 'prop-types'; import { Redirect } from 'react-router-dom'; +import queryString from 'query-string'; +import moment from 'moment'; import Search from '../container/Search'; import View from '../container/View'; import users from '../../users'; +import WeekSelector from '../container/WeekSelector'; -const App = ({ match }) => { +const App = ({ match, location }) => { const user = `${match.params.type}/${match.params.value}`; + const weekStr = queryString.parse(location.search).week; + const week = weekStr ? moment().week(weekStr) : moment(); if (!users.allIds.includes(user)) { // Invalid user, redirect to index. @@ -18,6 +23,7 @@ const App = ({ match }) => {
+
@@ -32,6 +38,9 @@ App.propTypes = { value: PropTypes.string.isRequired, }).isRequired, }).isRequired, + location: PropTypes.shape({ + search: PropTypes.string.isRequired, + }).isRequired, }; export default App; -- cgit v1.1 From 8670ada517bc8beb69d152c82f282322b9ea8d64 Mon Sep 17 00:00:00 2001 From: Noah Loomans Date: Sun, 28 Jan 2018 15:43:11 +0100 Subject: Implement week selector in the view --- src/client/react/components/page/User.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/client/react/components/page') diff --git a/src/client/react/components/page/User.js b/src/client/react/components/page/User.js index 980070f..72e92c2 100644 --- a/src/client/react/components/page/User.js +++ b/src/client/react/components/page/User.js @@ -26,7 +26,8 @@ const App = ({ match, location }) => {
- + {/* The View object just wants the week number. */} + ); }; -- cgit v1.1 From 3b98d4c4f13424c89a10580065075998d37ae857 Mon Sep 17 00:00:00 2001 From: Noah Loomans Date: Sun, 28 Jan 2018 16:06:56 +0100 Subject: Improve week logic --- src/client/react/components/page/User.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/client/react/components/page') diff --git a/src/client/react/components/page/User.js b/src/client/react/components/page/User.js index 72e92c2..10d608d 100644 --- a/src/client/react/components/page/User.js +++ b/src/client/react/components/page/User.js @@ -3,6 +3,7 @@ import PropTypes from 'prop-types'; import { Redirect } from 'react-router-dom'; import queryString from 'query-string'; import moment from 'moment'; +import purifyWeek from '../../lib/purifyWeek'; import Search from '../container/Search'; import View from '../container/View'; import users from '../../users'; @@ -11,7 +12,7 @@ import WeekSelector from '../container/WeekSelector'; const App = ({ match, location }) => { const user = `${match.params.type}/${match.params.value}`; const weekStr = queryString.parse(location.search).week; - const week = weekStr ? moment().week(weekStr) : moment(); + const week = purifyWeek(weekStr ? parseInt(weekStr, 10) : moment().week()); if (!users.allIds.includes(user)) { // Invalid user, redirect to index. @@ -26,8 +27,7 @@ const App = ({ match, location }) => { - {/* The View object just wants the week number. */} - + ); }; -- cgit v1.1 From 9a9edd1865d619caada787231c8bb34be25af3af Mon Sep 17 00:00:00 2001 From: Noah Loomans Date: Sun, 28 Jan 2018 20:00:44 +0100 Subject: Give IndexPage and UserPage the correct name --- src/client/react/components/page/Index.js | 4 ++-- src/client/react/components/page/User.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/client/react/components/page') diff --git a/src/client/react/components/page/Index.js b/src/client/react/components/page/Index.js index c2994c9..e5e47c5 100644 --- a/src/client/react/components/page/Index.js +++ b/src/client/react/components/page/Index.js @@ -2,7 +2,7 @@ import React from 'react'; import Search from '../container/Search'; import HelpBox from '../container/HelpBox'; -const App = () => ( +const IndexPage = () => (
Metis @@ -12,4 +12,4 @@ const App = () => (
); -export default App; +export default IndexPage; diff --git a/src/client/react/components/page/User.js b/src/client/react/components/page/User.js index 10d608d..215a6e0 100644 --- a/src/client/react/components/page/User.js +++ b/src/client/react/components/page/User.js @@ -9,7 +9,7 @@ import View from '../container/View'; import users from '../../users'; import WeekSelector from '../container/WeekSelector'; -const App = ({ match, location }) => { +const UserPage = ({ match, location }) => { const user = `${match.params.type}/${match.params.value}`; const weekStr = queryString.parse(location.search).week; const week = purifyWeek(weekStr ? parseInt(weekStr, 10) : moment().week()); @@ -32,7 +32,7 @@ const App = ({ match, location }) => { ); }; -App.propTypes = { +UserPage.propTypes = { match: PropTypes.shape({ params: PropTypes.shape({ type: PropTypes.string.isRequired, @@ -44,4 +44,4 @@ App.propTypes = { }).isRequired, }; -export default App; +export default UserPage; -- cgit v1.1