0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-06 18:42:40 +00:00

Shift renderUiItems to function

This commit is contained in:
G.Ambatte
2022-09-26 00:35:12 +13:00
parent be25e90009
commit ed5bef27e0
2 changed files with 16 additions and 14 deletions

View File

@@ -18,7 +18,7 @@ const AccountPage = createClass({
getDefaultProps : function() { getDefaultProps : function() {
return { return {
brew : {}, brew : {},
uiItems : [] uiItems : {}
}; };
}, },
getInitialState : function() { getInitialState : function() {
@@ -39,14 +39,14 @@ const AccountPage = createClass({
}, },
renderUiItems : function() { renderUiItems : function() {
// console.log(JSON.stringify(this.props.uiItems)); // console.log(this.props.uiItems);
return <> return <>
<h1>Account Information <i className='fas fa-user'></i></h1> <h1>Account Information <i className='fas fa-user'></i></h1>
<p><strong>Username: </strong> {this.props.uiItems.username || 'No user currently logged in'}</p> <p><strong>Username: </strong> {this.props.uiItems.username || 'No user currently logged in'}</p>
<p><strong>Last Login: </strong> {this.props.uiItems.issued || '-'}</p> <p><strong>Last Login: </strong> {this.props.uiItems.issued.toString() || '-'}</p>
<p></p> <p></p>
<h3>MongoDB Information</h3> <h3>Homebrewery Information</h3>
<p><strong>Brews on MongoDB: </strong> {this.props.uiItems.mongoCount || '-'}</p> <p><strong>Brews on Homebrewery: </strong> {this.props.uiItems.mongoCount || '-'}</p>
<p></p> <p></p>
<h3>Google Information <i className='fa-brands fa-google-drive'></i></h3> <h3>Google Information <i className='fa-brands fa-google-drive'></i></h3>
<p><strong>Linked to Google: </strong> {this.props.uiItems.googleId ? 'YES' : 'NO'}</p> <p><strong>Linked to Google: </strong> {this.props.uiItems.googleId ? 'YES' : 'NO'}</p>
@@ -55,7 +55,7 @@ const AccountPage = createClass({
}, },
render : function(){ render : function(){
return <UIPage brew={this.props.brew} uiItems={this.renderUiItems()} ></UIPage>; return <UIPage brew={this.props.brew} renderUiItems={this.renderUiItems} ></UIPage>;
} }
}); });

View File

@@ -13,13 +13,15 @@ const UIPage = createClass({
getDefaultProps : function(){ getDefaultProps : function(){
return { return {
uiItems : <> renderUiItems : ()=>{
<h1>H1 Header</h1> return <>
<h2>H2 Header</h2> <h1>H1 Header</h1>
<h3>H3 Header</h3> <h2>H2 Header</h2>
<h4>H4 Header</h4> <h3>H3 Header</h3>
<p>This is some test text.</p> <h4>H4 Header</h4>
</> <p>This is some test text.</p>
</>;
}
}; };
}, },
@@ -37,7 +39,7 @@ const UIPage = createClass({
</Navbar> </Navbar>
<div className='content'> <div className='content'>
{this.props.uiItems} {this.props.renderUiItems()}
</div> </div>
</div>; </div>;
} }