From e8937a285c2f52823920455d4c2ba75ebd49a878 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sat, 30 Apr 2022 16:53:30 +1200 Subject: [PATCH 01/27] Add UI route for testing --- client/homebrew/homebrew.jsx | 2 ++ server/app.js | 12 ++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/client/homebrew/homebrew.jsx b/client/homebrew/homebrew.jsx index b41c7c59d..7c4862373 100644 --- a/client/homebrew/homebrew.jsx +++ b/client/homebrew/homebrew.jsx @@ -11,6 +11,7 @@ const SharePage = require('./pages/sharePage/sharePage.jsx'); const NewPage = require('./pages/newPage/newPage.jsx'); //const ErrorPage = require('./pages/errorPage/errorPage.jsx'); const PrintPage = require('./pages/printPage/printPage.jsx'); +const UIPage = require('./pages/basePages/uiPage/uiPage.jsx'); const Homebrew = createClass({ displayName : 'Homebrewery', @@ -56,6 +57,7 @@ const Homebrew = createClass({ }/> }/> }/> + }/> }/> }/> diff --git a/server/app.js b/server/app.js index c04e9b370..fa3e3bbf7 100644 --- a/server/app.js +++ b/server/app.js @@ -272,6 +272,16 @@ app.get('/print/:id', asyncHandler(async (req, res, next)=>{ return next(); })); +//UI Page +app.get('/ui', asyncHandler(async (req, res, next)=>{ + const brew = { + title : 'UI PAGE' + }; + req.brew = brew; + return next(); +})); + + const nodeEnv = config.get('node_env'); const isLocalEnvironment = config.get('local_environments').includes(nodeEnv); // Local only @@ -286,8 +296,6 @@ if(isLocalEnvironment){ }); } - - //Render the page const templateFn = require('./../client/template.js'); app.use((req, res)=>{ From fe536bc9df3459c4820b20c3b30e46149b2ea696 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sat, 30 Apr 2022 16:54:11 +1200 Subject: [PATCH 02/27] Initial pass at UI page and styling --- .../pages/basePages/uiPage/uiPage.jsx | 46 +++++++++++++++++++ .../pages/basePages/uiPage/uiPage.less | 30 ++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 client/homebrew/pages/basePages/uiPage/uiPage.jsx create mode 100644 client/homebrew/pages/basePages/uiPage/uiPage.less diff --git a/client/homebrew/pages/basePages/uiPage/uiPage.jsx b/client/homebrew/pages/basePages/uiPage/uiPage.jsx new file mode 100644 index 000000000..50eafa3c3 --- /dev/null +++ b/client/homebrew/pages/basePages/uiPage/uiPage.jsx @@ -0,0 +1,46 @@ +require('./uiPage.less'); +const React = require('react'); +const createClass = require('create-react-class'); + +const Nav = require('naturalcrit/nav/nav.jsx'); +const Navbar = require('../../../navbar/navbar.jsx'); +const RecentNavItem = require('../../../navbar/recent.navitem.jsx').both; +const Account = require('../../../navbar/account.navitem.jsx'); + + +const UIPage = createClass({ + displayName : 'UIPage', + + getDefaultProps : function(){ + return { + uiItems : <> +

H1 Header

+

H2 Header

+

H3 Header

+

H4 Header

+

This is some test text.

+ + }; + }, + + render : function(){ + return
+ + + {this.props.brew.title} + + + + + + + + +
+ {this.props.uiItems} +
+
; + } +}); + +module.exports = UIPage; diff --git a/client/homebrew/pages/basePages/uiPage/uiPage.less b/client/homebrew/pages/basePages/uiPage/uiPage.less new file mode 100644 index 000000000..a26e3fed4 --- /dev/null +++ b/client/homebrew/pages/basePages/uiPage/uiPage.less @@ -0,0 +1,30 @@ +.uiPage{ + .content{ + overflow-y : hidden; + width : 90vw; + background-color: #f0f0f0; + font-family: 'Open Sans'; + margin-left: auto; + margin-right: auto; + margin-top: 25px; + padding: 2% 4%; + font-size: 0.8em; + h1, h2, h3, h4{ + font-weight: 900; + text-transform: uppercase; + padding-bottom: 0.25em; + } + h1 { + font-size: 2em; + } + h2 { + font-size: 1.75em; + } + h3 { + font-size: 1.5em; + } + h4 { + font-size: 1.25em; + } + } +} From 0923c502183755cad664c5eb2d61d971b24ee113 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sun, 1 May 2022 12:38:20 +1200 Subject: [PATCH 03/27] Update UI page styling --- client/homebrew/pages/basePages/uiPage/uiPage.less | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/homebrew/pages/basePages/uiPage/uiPage.less b/client/homebrew/pages/basePages/uiPage/uiPage.less index a26e3fed4..23b8ec889 100644 --- a/client/homebrew/pages/basePages/uiPage/uiPage.less +++ b/client/homebrew/pages/basePages/uiPage/uiPage.less @@ -9,13 +9,15 @@ margin-top: 25px; padding: 2% 4%; font-size: 0.8em; + line-height: 1.8em; h1, h2, h3, h4{ font-weight: 900; text-transform: uppercase; - padding-bottom: 0.25em; } h1 { font-size: 2em; + border-bottom: 2px solid darkslategrey; + margin-bottom: 0.5em; } h2 { font-size: 1.75em; @@ -26,5 +28,8 @@ h4 { font-size: 1.25em; } + strong { + font-weight: bold; + } } } From 00412a70e90eba420910f342531b955ad2addeb7 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sun, 1 May 2022 12:39:19 +1200 Subject: [PATCH 04/27] Remove test UI page, add initial Account page --- client/homebrew/homebrew.jsx | 3 +- .../pages/accountPage/accountPage.jsx | 56 +++++++++++++++++++ server/app.js | 42 ++++++++++++-- 3 files changed, 95 insertions(+), 6 deletions(-) create mode 100644 client/homebrew/pages/accountPage/accountPage.jsx diff --git a/client/homebrew/homebrew.jsx b/client/homebrew/homebrew.jsx index 7c4862373..bf2068798 100644 --- a/client/homebrew/homebrew.jsx +++ b/client/homebrew/homebrew.jsx @@ -11,6 +11,7 @@ const SharePage = require('./pages/sharePage/sharePage.jsx'); const NewPage = require('./pages/newPage/newPage.jsx'); //const ErrorPage = require('./pages/errorPage/errorPage.jsx'); const PrintPage = require('./pages/printPage/printPage.jsx'); +const AccountPage = require('./pages/accountPage/accountPage.jsx'); const UIPage = require('./pages/basePages/uiPage/uiPage.jsx'); const Homebrew = createClass({ @@ -57,8 +58,8 @@ const Homebrew = createClass({ }/> }/> }/> - }/> }/> + }/> }/> diff --git a/client/homebrew/pages/accountPage/accountPage.jsx b/client/homebrew/pages/accountPage/accountPage.jsx new file mode 100644 index 000000000..72925ac70 --- /dev/null +++ b/client/homebrew/pages/accountPage/accountPage.jsx @@ -0,0 +1,56 @@ +const React = require('react'); +const createClass = require('create-react-class'); +const _ = require('lodash'); +const cx = require('classnames'); + +const UIPage = require('../basePages/uiPage/uiPage.jsx'); + +const Nav = require('naturalcrit/nav/nav.jsx'); +const Navbar = require('../../navbar/navbar.jsx'); + +const RecentNavItem = require('../../navbar/recent.navitem.jsx').both; +const Account = require('../../navbar/account.navitem.jsx'); +const NewBrew = require('../../navbar/newbrew.navitem.jsx'); +const HelpNavItem = require('../../navbar/help.navitem.jsx'); + +const AccountPage = createClass({ + displayName : 'AccountPage', + getDefaultProps : function() { + return { + brew : {}, + uiItems : [] + }; + }, + getInitialState : function() { + return { + uiItems : this.props.uiItems + }; + }, + + navItems : function() { + return + + + + + + + ; + }, + + uiItems : function() { + const result = <> +

Account Information

+

Username: {this.props.uiItems.username}

+

Issued: {this.props.uiItems.issued}

+ ; + + return result; + }, + + render : function(){ + return ; + } +}); + +module.exports = AccountPage; diff --git a/server/app.js b/server/app.js index fa3e3bbf7..a623af1bc 100644 --- a/server/app.js +++ b/server/app.js @@ -272,11 +272,42 @@ app.get('/print/:id', asyncHandler(async (req, res, next)=>{ return next(); })); -//UI Page -app.get('/ui', asyncHandler(async (req, res, next)=>{ - const brew = { - title : 'UI PAGE' - }; +//Account Page +app.get('/ui/account', asyncHandler(async (req, res, next)=>{ + const brew = {}; + brew.title = 'ACCOUNT'; + + let auth; + let files; + if(req.account) { + if(req.account.googleId) { + try { + auth = await GoogleActions.authCheck(req.account, res); + } catch (e) { + auth = undefined; + console.log('Google auth check failed!'); + console.log(e); + } + if(auth.credentials.access_token) { + try { + files = await GoogleActions.listGoogleBrews(auth); + } catch (e) { + files = undefined; + console.log('List Google files failed!'); + console.log(e); + } + } + } + + brew.uiItems = { + username : req.account.username, + issued : req.account.issued, + googleId : Boolean(req.account.googleId), + authCheck : Boolean(req.account.googleId && auth.credentials.access_token), + fileCount : files?.length + }; + } + req.brew = brew; return next(); })); @@ -298,6 +329,7 @@ if(isLocalEnvironment){ //Render the page const templateFn = require('./../client/template.js'); + app.use((req, res)=>{ // Create configuration object const configuration = { From c925e04f3cf1f953febb7e846ce09522270f77ac Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sun, 1 May 2022 12:41:10 +1200 Subject: [PATCH 05/27] Remove unused require --- client/homebrew/homebrew.jsx | 1 - 1 file changed, 1 deletion(-) diff --git a/client/homebrew/homebrew.jsx b/client/homebrew/homebrew.jsx index bf2068798..23047d9da 100644 --- a/client/homebrew/homebrew.jsx +++ b/client/homebrew/homebrew.jsx @@ -12,7 +12,6 @@ const NewPage = require('./pages/newPage/newPage.jsx'); //const ErrorPage = require('./pages/errorPage/errorPage.jsx'); const PrintPage = require('./pages/printPage/printPage.jsx'); const AccountPage = require('./pages/accountPage/accountPage.jsx'); -const UIPage = require('./pages/basePages/uiPage/uiPage.jsx'); const Homebrew = createClass({ displayName : 'Homebrewery', From 61f4456842dec0d7a96aab6e3c12ecdad1d3621e Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sun, 1 May 2022 12:58:10 +1200 Subject: [PATCH 06/27] Styling updates. --- client/homebrew/pages/basePages/uiPage/uiPage.less | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client/homebrew/pages/basePages/uiPage/uiPage.less b/client/homebrew/pages/basePages/uiPage/uiPage.less index 23b8ec889..350154fc5 100644 --- a/client/homebrew/pages/basePages/uiPage/uiPage.less +++ b/client/homebrew/pages/basePages/uiPage/uiPage.less @@ -13,11 +13,14 @@ h1, h2, h3, h4{ font-weight: 900; text-transform: uppercase; + margin: 0.5em 30% 0.25em 0; + border-bottom: 2px solid slategrey; } h1 { font-size: 2em; border-bottom: 2px solid darkslategrey; margin-bottom: 0.5em; + margin-right: 0; } h2 { font-size: 1.75em; From 1d85eede43ae56c2a7e1c7eb371ccd90fb959553 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Tue, 3 May 2022 11:38:24 +1200 Subject: [PATCH 07/27] Account information added --- .../homebrew/pages/accountPage/accountPage.jsx | 12 ++++++++++-- server/app.js | 18 ++++++++++++------ 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/client/homebrew/pages/accountPage/accountPage.jsx b/client/homebrew/pages/accountPage/accountPage.jsx index 72925ac70..034f9ae05 100644 --- a/client/homebrew/pages/accountPage/accountPage.jsx +++ b/client/homebrew/pages/accountPage/accountPage.jsx @@ -39,10 +39,18 @@ const AccountPage = createClass({ }, uiItems : function() { + // console.log(JSON.stringify(this.props.uiItems)); const result = <>

Account Information

-

Username: {this.props.uiItems.username}

-

Issued: {this.props.uiItems.issued}

+

Username: {this.props.uiItems.username || 'No user currently logged in'}

+

Issued: {this.props.uiItems.issued || '-'}

+

+

MongoDB Information

+

Brews on MongoDB: {this.props.uiItems.mongoCount || '-'}

+

+

Google Information

+

Linked to Google: {this.props.uiItems.googleId ? 'YES' : 'NO'}

+ {this.props.uiItems.googleId ?

Brews on Google: {this.props.uiItems.fileCount || '-'}

: '' } ; return result; diff --git a/server/app.js b/server/app.js index a623af1bc..aa0439ab6 100644 --- a/server/app.js +++ b/server/app.js @@ -275,7 +275,7 @@ app.get('/print/:id', asyncHandler(async (req, res, next)=>{ //Account Page app.get('/ui/account', asyncHandler(async (req, res, next)=>{ const brew = {}; - brew.title = 'ACCOUNT'; + brew.title = 'ACCOUNT INFORMATION PAGE'; let auth; let files; @@ -299,12 +299,18 @@ app.get('/ui/account', asyncHandler(async (req, res, next)=>{ } } + const brews = await HomebrewModel.getByUser(req.account.username, true, 'id') + .catch((err)=>{ + console.log(err); + }); + brew.uiItems = { - username : req.account.username, - issued : req.account.issued, - googleId : Boolean(req.account.googleId), - authCheck : Boolean(req.account.googleId && auth.credentials.access_token), - fileCount : files?.length + username : req.account.username, + issued : req.account.issued, + mongoCount : brews.length, + googleId : Boolean(req.account.googleId), + authCheck : Boolean(req.account.googleId && auth.credentials.access_token), + fileCount : files?.length || '-' }; } From 03402e43426190f2be861e62d1ba194be8609526 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Tue, 3 May 2022 22:29:33 +1200 Subject: [PATCH 08/27] Add Google icon Co-authored-by: Trevor Buckner --- client/homebrew/pages/accountPage/accountPage.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/homebrew/pages/accountPage/accountPage.jsx b/client/homebrew/pages/accountPage/accountPage.jsx index 034f9ae05..d2bd2f444 100644 --- a/client/homebrew/pages/accountPage/accountPage.jsx +++ b/client/homebrew/pages/accountPage/accountPage.jsx @@ -48,9 +48,9 @@ const AccountPage = createClass({

MongoDB Information

Brews on MongoDB: {this.props.uiItems.mongoCount || '-'}

-

Google Information

+

Google Information

Linked to Google: {this.props.uiItems.googleId ? 'YES' : 'NO'}

- {this.props.uiItems.googleId ?

Brews on Google: {this.props.uiItems.fileCount || '-'}

: '' } + {this.props.uiItems.googleId ?

Brews on Google Drive: {this.props.uiItems.fileCount || '-'}

: '' } ; return result; From 2b1fe5d3fe7bed6de724493d22cef476a02332a3 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Tue, 3 May 2022 22:29:53 +1200 Subject: [PATCH 09/27] Update client/homebrew/pages/accountPage/accountPage.jsx Co-authored-by: Trevor Buckner --- client/homebrew/pages/accountPage/accountPage.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/homebrew/pages/accountPage/accountPage.jsx b/client/homebrew/pages/accountPage/accountPage.jsx index d2bd2f444..66c5f585a 100644 --- a/client/homebrew/pages/accountPage/accountPage.jsx +++ b/client/homebrew/pages/accountPage/accountPage.jsx @@ -41,7 +41,7 @@ const AccountPage = createClass({ uiItems : function() { // console.log(JSON.stringify(this.props.uiItems)); const result = <> -

Account Information

+

Account Information

Username: {this.props.uiItems.username || 'No user currently logged in'}

Issued: {this.props.uiItems.issued || '-'}

From 4f154922c03cadeae1476c21766cc705bed5b12b Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Tue, 3 May 2022 22:30:08 +1200 Subject: [PATCH 10/27] Update client/homebrew/pages/accountPage/accountPage.jsx Co-authored-by: Trevor Buckner --- client/homebrew/pages/accountPage/accountPage.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/homebrew/pages/accountPage/accountPage.jsx b/client/homebrew/pages/accountPage/accountPage.jsx index 66c5f585a..2f13ee48b 100644 --- a/client/homebrew/pages/accountPage/accountPage.jsx +++ b/client/homebrew/pages/accountPage/accountPage.jsx @@ -43,7 +43,7 @@ const AccountPage = createClass({ const result = <>

Account Information

Username: {this.props.uiItems.username || 'No user currently logged in'}

-

Issued: {this.props.uiItems.issued || '-'}

+

Last Login: {this.props.uiItems.issued || '-'}

MongoDB Information

Brews on MongoDB: {this.props.uiItems.mongoCount || '-'}

From 9135ca1e439fb498fa327fc86e35b4b2c649f234 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sun, 25 Sep 2022 23:20:03 +1300 Subject: [PATCH 11/27] Fix `class` => `className` --- client/homebrew/pages/accountPage/accountPage.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/homebrew/pages/accountPage/accountPage.jsx b/client/homebrew/pages/accountPage/accountPage.jsx index 2f13ee48b..5a19ce195 100644 --- a/client/homebrew/pages/accountPage/accountPage.jsx +++ b/client/homebrew/pages/accountPage/accountPage.jsx @@ -41,14 +41,14 @@ const AccountPage = createClass({ uiItems : function() { // console.log(JSON.stringify(this.props.uiItems)); const result = <> -

Account Information

+

Account Information

Username: {this.props.uiItems.username || 'No user currently logged in'}

Last Login: {this.props.uiItems.issued || '-'}

MongoDB Information

Brews on MongoDB: {this.props.uiItems.mongoCount || '-'}

-

Google Information

+

Google Information

Linked to Google: {this.props.uiItems.googleId ? 'YES' : 'NO'}

{this.props.uiItems.googleId ?

Brews on Google Drive: {this.props.uiItems.fileCount || '-'}

: '' } ; From 0ac50017c44feb93f66980ae665643290516e1ad Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sun, 25 Sep 2022 23:20:45 +1300 Subject: [PATCH 12/27] Change path to `/account` --- client/homebrew/homebrew.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/homebrew/homebrew.jsx b/client/homebrew/homebrew.jsx index 23047d9da..6182456ab 100644 --- a/client/homebrew/homebrew.jsx +++ b/client/homebrew/homebrew.jsx @@ -58,7 +58,7 @@ const Homebrew = createClass({ }/> }/> }/> - }/> + }/> }/> From 57b0af54dfccdfa99c7421570738a58940f0c8da Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sun, 25 Sep 2022 23:29:45 +1300 Subject: [PATCH 13/27] Renamed functions, eliminate unnecessary variable --- client/homebrew/pages/accountPage/accountPage.jsx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/client/homebrew/pages/accountPage/accountPage.jsx b/client/homebrew/pages/accountPage/accountPage.jsx index 5a19ce195..2154956e9 100644 --- a/client/homebrew/pages/accountPage/accountPage.jsx +++ b/client/homebrew/pages/accountPage/accountPage.jsx @@ -27,7 +27,7 @@ const AccountPage = createClass({ }; }, - navItems : function() { + renderNavItems : function() { return @@ -38,9 +38,9 @@ const AccountPage = createClass({ ; }, - uiItems : function() { + renderUiItems : function() { // console.log(JSON.stringify(this.props.uiItems)); - const result = <> + return <>

Account Information

Username: {this.props.uiItems.username || 'No user currently logged in'}

Last Login: {this.props.uiItems.issued || '-'}

@@ -52,12 +52,10 @@ const AccountPage = createClass({

Linked to Google: {this.props.uiItems.googleId ? 'YES' : 'NO'}

{this.props.uiItems.googleId ?

Brews on Google Drive: {this.props.uiItems.fileCount || '-'}

: '' } ; - - return result; }, render : function(){ - return ; + return ; } }); From ab98bf5d6cd80446ddb95624fa97a5a381b3aa13 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Mon, 26 Sep 2022 00:05:53 +1300 Subject: [PATCH 14/27] Fix Routes --- client/homebrew/homebrew.jsx | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/client/homebrew/homebrew.jsx b/client/homebrew/homebrew.jsx index df08e3af1..5fa225945 100644 --- a/client/homebrew/homebrew.jsx +++ b/client/homebrew/homebrew.jsx @@ -65,22 +65,21 @@ const Homebrew = createClass({ return (
- - }/> - }/> - }/> - }/> - }/> - }/> - }/> - }/> - }/> - }/> - }/> + + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> } /> } /> } /> - +
); From be25e900097fc68dcccdc46c0744957d4a54296f Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Mon, 26 Sep 2022 00:34:54 +1300 Subject: [PATCH 15/27] Change variable name --- server/app.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/server/app.js b/server/app.js index d310aafd4..d95b48474 100644 --- a/server/app.js +++ b/server/app.js @@ -1,4 +1,4 @@ -/*eslint max-lines: ["warn", {"max": 300, "skipBlankLines": true, "skipComments": true}]*/ +/*eslint max-lines: ["warn", {"max": 400, "skipBlankLines": true, "skipComments": true}]*/ // Set working directory to project root process.chdir(`${__dirname}/..`); @@ -263,9 +263,9 @@ app.get('/print/:id', asyncHandler(getBrew('share')), (req, res, next)=>{ }); //Account Page -app.get('/ui/account', asyncHandler(async (req, res, next)=>{ - const brew = {}; - brew.title = 'ACCOUNT INFORMATION PAGE'; +app.get('/account', asyncHandler(async (req, res, next)=>{ + const data = {}; + data.title = 'ACCOUNT INFORMATION PAGE'; let auth; let files; @@ -294,7 +294,7 @@ app.get('/ui/account', asyncHandler(async (req, res, next)=>{ console.log(err); }); - brew.uiItems = { + data.uiItems = { username : req.account.username, issued : req.account.issued, mongoCount : brews.length, @@ -304,7 +304,7 @@ app.get('/ui/account', asyncHandler(async (req, res, next)=>{ }; } - req.brew = brew; + req.brew = data; return next(); })); From ed5bef27e0bcd61b7f432324b424440896da4079 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Mon, 26 Sep 2022 00:35:12 +1300 Subject: [PATCH 16/27] Shift renderUiItems to function --- .../homebrew/pages/accountPage/accountPage.jsx | 12 ++++++------ .../homebrew/pages/basePages/uiPage/uiPage.jsx | 18 ++++++++++-------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/client/homebrew/pages/accountPage/accountPage.jsx b/client/homebrew/pages/accountPage/accountPage.jsx index 2154956e9..f4aecae49 100644 --- a/client/homebrew/pages/accountPage/accountPage.jsx +++ b/client/homebrew/pages/accountPage/accountPage.jsx @@ -18,7 +18,7 @@ const AccountPage = createClass({ getDefaultProps : function() { return { brew : {}, - uiItems : [] + uiItems : {} }; }, getInitialState : function() { @@ -39,14 +39,14 @@ const AccountPage = createClass({ }, renderUiItems : function() { - // console.log(JSON.stringify(this.props.uiItems)); + // console.log(this.props.uiItems); return <>

Account Information

Username: {this.props.uiItems.username || 'No user currently logged in'}

-

Last Login: {this.props.uiItems.issued || '-'}

+

Last Login: {this.props.uiItems.issued.toString() || '-'}

-

MongoDB Information

-

Brews on MongoDB: {this.props.uiItems.mongoCount || '-'}

+

Homebrewery Information

+

Brews on Homebrewery: {this.props.uiItems.mongoCount || '-'}

Google Information

Linked to Google: {this.props.uiItems.googleId ? 'YES' : 'NO'}

@@ -55,7 +55,7 @@ const AccountPage = createClass({ }, render : function(){ - return ; + return ; } }); diff --git a/client/homebrew/pages/basePages/uiPage/uiPage.jsx b/client/homebrew/pages/basePages/uiPage/uiPage.jsx index 50eafa3c3..3e15ba932 100644 --- a/client/homebrew/pages/basePages/uiPage/uiPage.jsx +++ b/client/homebrew/pages/basePages/uiPage/uiPage.jsx @@ -13,13 +13,15 @@ const UIPage = createClass({ getDefaultProps : function(){ return { - uiItems : <> -

H1 Header

-

H2 Header

-

H3 Header

-

H4 Header

-

This is some test text.

- + renderUiItems : ()=>{ + return <> +

H1 Header

+

H2 Header

+

H3 Header

+

H4 Header

+

This is some test text.

+ ; + } }; }, @@ -37,7 +39,7 @@ const UIPage = createClass({
- {this.props.uiItems} + {this.props.renderUiItems()}
; } From 5193271796885dba1eea3cdd7496d9fccc1ffe11 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Mon, 26 Sep 2022 00:41:17 +1300 Subject: [PATCH 17/27] Fix Google Drive icon --- client/homebrew/pages/accountPage/accountPage.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/homebrew/pages/accountPage/accountPage.jsx b/client/homebrew/pages/accountPage/accountPage.jsx index f4aecae49..e0f82ba14 100644 --- a/client/homebrew/pages/accountPage/accountPage.jsx +++ b/client/homebrew/pages/accountPage/accountPage.jsx @@ -48,7 +48,7 @@ const AccountPage = createClass({

Homebrewery Information

Brews on Homebrewery: {this.props.uiItems.mongoCount || '-'}

-

Google Information

+

Google Information

Linked to Google: {this.props.uiItems.googleId ? 'YES' : 'NO'}

{this.props.uiItems.googleId ?

Brews on Google Drive: {this.props.uiItems.fileCount || '-'}

: '' } ; From 9a844dae39fffcf2ffc5611df6388d35629edd64 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Mon, 26 Sep 2022 00:41:49 +1300 Subject: [PATCH 18/27] Fix class=>className --- client/homebrew/pages/accountPage/accountPage.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/homebrew/pages/accountPage/accountPage.jsx b/client/homebrew/pages/accountPage/accountPage.jsx index e0f82ba14..1aea1c8f3 100644 --- a/client/homebrew/pages/accountPage/accountPage.jsx +++ b/client/homebrew/pages/accountPage/accountPage.jsx @@ -48,7 +48,7 @@ const AccountPage = createClass({

Homebrewery Information

Brews on Homebrewery: {this.props.uiItems.mongoCount || '-'}

-

Google Information

+

Google Information

Linked to Google: {this.props.uiItems.googleId ? 'YES' : 'NO'}

{this.props.uiItems.googleId ?

Brews on Google Drive: {this.props.uiItems.fileCount || '-'}

: '' } ; From d7b1f89152b96c45523a39a1e77b6b815dda78b4 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Mon, 26 Sep 2022 11:30:45 +1300 Subject: [PATCH 19/27] Change data items to a list --- .../pages/accountPage/accountPage.jsx | 28 +++++++++++-------- .../pages/basePages/uiPage/uiPage.jsx | 6 +++- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/client/homebrew/pages/accountPage/accountPage.jsx b/client/homebrew/pages/accountPage/accountPage.jsx index 1aea1c8f3..22bb84dca 100644 --- a/client/homebrew/pages/accountPage/accountPage.jsx +++ b/client/homebrew/pages/accountPage/accountPage.jsx @@ -40,18 +40,22 @@ const AccountPage = createClass({ renderUiItems : function() { // console.log(this.props.uiItems); - return <> -

Account Information

-

Username: {this.props.uiItems.username || 'No user currently logged in'}

-

Last Login: {this.props.uiItems.issued.toString() || '-'}

-

-

Homebrewery Information

-

Brews on Homebrewery: {this.props.uiItems.mongoCount || '-'}

-

-

Google Information

-

Linked to Google: {this.props.uiItems.googleId ? 'YES' : 'NO'}

- {this.props.uiItems.googleId ?

Brews on Google Drive: {this.props.uiItems.fileCount || '-'}

: '' } - ; + return [ + <> +

Account Information

+

Username: {this.props.uiItems.username || 'No user currently logged in'}

+

Last Login: {this.props.uiItems.issued.toString() || '-'}

+ , + <> +

Homebrewery Information

+

Brews on Homebrewery: {this.props.uiItems.mongoCount || '-'}

+ , + <> +

Google Information

+

Linked to Google: {this.props.uiItems.googleId ? 'YES' : 'NO'}

+ {this.props.uiItems.googleId ?

Brews on Google Drive: {this.props.uiItems.fileCount || '-'}

: '' } + + ]; }, render : function(){ diff --git a/client/homebrew/pages/basePages/uiPage/uiPage.jsx b/client/homebrew/pages/basePages/uiPage/uiPage.jsx index 3e15ba932..e05303665 100644 --- a/client/homebrew/pages/basePages/uiPage/uiPage.jsx +++ b/client/homebrew/pages/basePages/uiPage/uiPage.jsx @@ -39,7 +39,11 @@ const UIPage = createClass({
- {this.props.renderUiItems()} + {this.props.renderUiItems().map((item, index)=>{ + return
+ {item} +
; + })}
; } From 248687684a7ef8184f79e7c2bc9fe5076ffc4e06 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Mon, 26 Sep 2022 11:31:00 +1300 Subject: [PATCH 20/27] Add group styling --- client/homebrew/pages/basePages/uiPage/uiPage.less | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/client/homebrew/pages/basePages/uiPage/uiPage.less b/client/homebrew/pages/basePages/uiPage/uiPage.less index 350154fc5..960cf3fc1 100644 --- a/client/homebrew/pages/basePages/uiPage/uiPage.less +++ b/client/homebrew/pages/basePages/uiPage/uiPage.less @@ -10,6 +10,12 @@ padding: 2% 4%; font-size: 0.8em; line-height: 1.8em; + .dataGroup{ + padding: 6px 20px 15px; + border: 2px solid black; + border-radius: 5px; + margin: 5px 0px; + } h1, h2, h3, h4{ font-weight: 900; text-transform: uppercase; From 764621f7624a030b455ed16054c6a9aa350f381a Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Mon, 26 Sep 2022 12:12:21 +1300 Subject: [PATCH 21/27] Add Homebrewery Icon --- client/homebrew/pages/accountPage/accountPage.jsx | 4 +++- client/homebrew/pages/basePages/uiPage/uiPage.less | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/client/homebrew/pages/accountPage/accountPage.jsx b/client/homebrew/pages/accountPage/accountPage.jsx index 22bb84dca..b65377aa5 100644 --- a/client/homebrew/pages/accountPage/accountPage.jsx +++ b/client/homebrew/pages/accountPage/accountPage.jsx @@ -13,6 +13,8 @@ const Account = require('../../navbar/account.navitem.jsx'); const NewBrew = require('../../navbar/newbrew.navitem.jsx'); const HelpNavItem = require('../../navbar/help.navitem.jsx'); +const NaturalCritIcon = require('naturalcrit/svg/naturalcrit.svg.jsx'); + const AccountPage = createClass({ displayName : 'AccountPage', getDefaultProps : function() { @@ -47,7 +49,7 @@ const AccountPage = createClass({

Last Login: {this.props.uiItems.issued.toString() || '-'}

, <> -

Homebrewery Information

+

Homebrewery Information

Brews on Homebrewery: {this.props.uiItems.mongoCount || '-'}

, <> diff --git a/client/homebrew/pages/basePages/uiPage/uiPage.less b/client/homebrew/pages/basePages/uiPage/uiPage.less index 960cf3fc1..868334322 100644 --- a/client/homebrew/pages/basePages/uiPage/uiPage.less +++ b/client/homebrew/pages/basePages/uiPage/uiPage.less @@ -33,6 +33,9 @@ } h3 { font-size: 1.5em; + svg { + width: 16px; + } } h4 { font-size: 1.25em; From 5469ec6683cd354947bdebefd5eeef1af3e147d8 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Mon, 26 Sep 2022 13:28:50 +1300 Subject: [PATCH 22/27] Format Issued datetime --- client/homebrew/pages/accountPage/accountPage.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/homebrew/pages/accountPage/accountPage.jsx b/client/homebrew/pages/accountPage/accountPage.jsx index b65377aa5..9a9512527 100644 --- a/client/homebrew/pages/accountPage/accountPage.jsx +++ b/client/homebrew/pages/accountPage/accountPage.jsx @@ -2,6 +2,7 @@ const React = require('react'); const createClass = require('create-react-class'); const _ = require('lodash'); const cx = require('classnames'); +const moment = require('moment'); const UIPage = require('../basePages/uiPage/uiPage.jsx'); @@ -46,7 +47,7 @@ const AccountPage = createClass({ <>

Account Information

Username: {this.props.uiItems.username || 'No user currently logged in'}

-

Last Login: {this.props.uiItems.issued.toString() || '-'}

+

Last Login: {moment(this.props.uiItems.issued).format('dddd, MMMM Do YYYY, h:mm:ss a ZZ') || '-'}

, <>

Homebrewery Information

From d9228b8c4b9400bd9cae4dd095d86425f080c4b1 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Mon, 26 Sep 2022 18:43:47 +1300 Subject: [PATCH 23/27] Add Account menu item --- client/homebrew/navbar/account.navitem.jsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/client/homebrew/navbar/account.navitem.jsx b/client/homebrew/navbar/account.navitem.jsx index 7ac687a41..061bc8e00 100644 --- a/client/homebrew/navbar/account.navitem.jsx +++ b/client/homebrew/navbar/account.navitem.jsx @@ -76,6 +76,14 @@ const Account = createClass({ > brews + + account + Date: Mon, 26 Sep 2022 19:07:46 +1300 Subject: [PATCH 24/27] Add Nav bar items --- client/homebrew/pages/basePages/uiPage/uiPage.jsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/homebrew/pages/basePages/uiPage/uiPage.jsx b/client/homebrew/pages/basePages/uiPage/uiPage.jsx index e05303665..6ba8b4a09 100644 --- a/client/homebrew/pages/basePages/uiPage/uiPage.jsx +++ b/client/homebrew/pages/basePages/uiPage/uiPage.jsx @@ -4,6 +4,8 @@ const createClass = require('create-react-class'); const Nav = require('naturalcrit/nav/nav.jsx'); const Navbar = require('../../../navbar/navbar.jsx'); +const NewBrewItem = require('../../../navbar/newbrew.navitem.jsx'); +const HelpNavItem = require('../../../navbar/help.navitem.jsx'); const RecentNavItem = require('../../../navbar/recent.navitem.jsx').both; const Account = require('../../../navbar/account.navitem.jsx'); @@ -33,6 +35,8 @@ const UIPage = createClass({ + + From 91b2911bb021e3f3018e065144b2647f43fc566d Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Mon, 26 Sep 2022 20:17:52 +1300 Subject: [PATCH 25/27] Change capitalization of page title --- server/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/app.js b/server/app.js index d95b48474..4586c7220 100644 --- a/server/app.js +++ b/server/app.js @@ -265,7 +265,7 @@ app.get('/print/:id', asyncHandler(getBrew('share')), (req, res, next)=>{ //Account Page app.get('/account', asyncHandler(async (req, res, next)=>{ const data = {}; - data.title = 'ACCOUNT INFORMATION PAGE'; + data.title = 'Account Information Page'; let auth; let files; From 93918bc26c71c0275e014bc97900eaaf62f7134d Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sun, 2 Oct 2022 11:06:57 +1300 Subject: [PATCH 26/27] Nudge SVG size --- client/homebrew/pages/basePages/uiPage/uiPage.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/homebrew/pages/basePages/uiPage/uiPage.less b/client/homebrew/pages/basePages/uiPage/uiPage.less index 868334322..9780b84ff 100644 --- a/client/homebrew/pages/basePages/uiPage/uiPage.less +++ b/client/homebrew/pages/basePages/uiPage/uiPage.less @@ -34,7 +34,7 @@ h3 { font-size: 1.5em; svg { - width: 16px; + width: 19px; } } h4 { From 1d8781da900974e5485298d6282d397a8e464d7d Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Mon, 3 Oct 2022 20:27:34 +1300 Subject: [PATCH 27/27] Modify how data is passed to UIPage --- .../pages/accountPage/accountPage.jsx | 20 ++++++++++--------- .../pages/basePages/uiPage/uiPage.jsx | 20 +------------------ 2 files changed, 12 insertions(+), 28 deletions(-) diff --git a/client/homebrew/pages/accountPage/accountPage.jsx b/client/homebrew/pages/accountPage/accountPage.jsx index 9a9512527..644ab13d8 100644 --- a/client/homebrew/pages/accountPage/accountPage.jsx +++ b/client/homebrew/pages/accountPage/accountPage.jsx @@ -43,26 +43,28 @@ const AccountPage = createClass({ renderUiItems : function() { // console.log(this.props.uiItems); - return [ - <> + return <> +

Account Information

Username: {this.props.uiItems.username || 'No user currently logged in'}

Last Login: {moment(this.props.uiItems.issued).format('dddd, MMMM Do YYYY, h:mm:ss a ZZ') || '-'}

- , - <> +
+

Homebrewery Information

Brews on Homebrewery: {this.props.uiItems.mongoCount || '-'}

- , - <> +
+

Google Information

Linked to Google: {this.props.uiItems.googleId ? 'YES' : 'NO'}

{this.props.uiItems.googleId ?

Brews on Google Drive: {this.props.uiItems.fileCount || '-'}

: '' } - - ]; +
+ ; }, render : function(){ - return ; + return + {this.renderUiItems()} + ; } }); diff --git a/client/homebrew/pages/basePages/uiPage/uiPage.jsx b/client/homebrew/pages/basePages/uiPage/uiPage.jsx index 6ba8b4a09..20dc6b26b 100644 --- a/client/homebrew/pages/basePages/uiPage/uiPage.jsx +++ b/client/homebrew/pages/basePages/uiPage/uiPage.jsx @@ -13,20 +13,6 @@ const Account = require('../../../navbar/account.navitem.jsx'); const UIPage = createClass({ displayName : 'UIPage', - getDefaultProps : function(){ - return { - renderUiItems : ()=>{ - return <> -

H1 Header

-

H2 Header

-

H3 Header

-

H4 Header

-

This is some test text.

- ; - } - }; - }, - render : function(){ return
@@ -43,11 +29,7 @@ const UIPage = createClass({
- {this.props.renderUiItems().map((item, index)=>{ - return
- {item} -
; - })} + {this.props.children}
; }