gbenavid / bag-it-up Goto Github PK
View Code? Open in Web Editor NEWShopping's never been easier with bag-it-up ๐ ๐ Keep it simple and track what you on the go. It's that simple.
Shopping's never been easier with bag-it-up ๐ ๐ Keep it simple and track what you on the go. It's that simple.
src/firebase.js line 18: githubAuthProvider is invalid
Calls for two parameters
ShoppingLists.js
toggleItems(key, marketClicked){ //line 26
const properties = [];
this.itemsListedRef.on("value", function(snapshot) {
var marketObj = snapshot.val();
var keysInMarketObj = Object.keys(marketObj);
for(var i in keysInMarketObj){
for(var j in marketObj[keysInMarketObj[i]]){
if (marketObj[keysInMarketObj[i]].name === marketClicked ){
properties.push(marketObj[keysInMarketObj[i]][j].itemName);
// this.setState({listedItems: properties} );
}
}
}
}, function (errorObject) {
console.log("The read failed: " + errorObject.code);
});
this.setState({listedItems: properties} );
}
Being called in ShoppingList on line 14 with no params:
onClick(key, marketName){
this.setState({childVisible: !this.state.childVisible});
this.props.toggleItems();
// this.setState({itemsToggled: !this.state.itemsToggled});
}
Please add them so your application will know which market/shopping list you are referring to
class ShoppingList extends Component {
constructor(props){
super(props);
this.state = {
childVisible: false
}
}
/* Add conditional for listed items that also belong to the correct store to prevent unwanted items appearing under the wrong merchant */
onClick(key, marketName){
this.setState({childVisible: !this.state.childVisible});
this.props.toggleItems();
}
render () {
const { name, user, handleDelete, appendTo } = this.props;
return (
<article>
<h3>{ name }</h3>
<button onClick={ handleDelete }> Delete </button>
<button onClick={()=> this.onClick()}> Select </button>
{
this.state.childVisible ?
<ShowItems user={this.props.user}
appendTo={appendTo}
content={this.props.content}
/>
: <span></span>
}
</article>
);
}
}
toggleItems(key, marketClicked){
const properties = [];
this.itemsListedRef.on("value", function(snapshot) {
var marketObj = snapshot.val();
var keysInMarketObj = Object.keys(marketObj);
for (var i in keysInMarketObj){
for (var j in marketObj[keysInMarketObj[i]]){
if (marketObj[keysInMarketObj[i]].name === marketClicked){
// add a conditional or something.
properties.push(marketObj[keysInMarketObj[i]][j].itemName);
// this.setState({listedItems: properties} );
}
}
}
}, function (errorObject) {
console.log("The read failed: " + errorObject.code);
});
this.setState({listedItems: properties} );
}
Why are you pushing an undefined element into properties?
Please fix this...
render () {
const { shoppingListsRef, user } = this.props;
return (
<section>
{ map(shoppingListsRef, (shoppingList, key) => (
<ShoppingList key={key} name={shoppingList.name} user={user} {...shoppingList}
handleDelete={ () => this.handleDelete(key)}
/>
)) }
</section>
);
}
Why is name undefined?
line 46 in ShoppingList.js
<section>
{map(shoppingLists, (shoppingList, key) => (
<ShoppingList key={key}
appendTo={key}
user={user}
content={this.state.listedItems}
toggleItems={ () => this.toggleItems(key,shoppingList.name)}
handleDelete={ () => this.handleDelete(key)}
{...shoppingList}
/>
))}
</section>
Each time we press the button that triggers clicked()
as seen in ShoppingList.js
on line 26:
render () {
const { name, user, handleDelete, appendTo } = this.props;
return (
<article>
<h3>{ name }</h3>
<button onClick={ handleDelete }> Delete </button>
<button onClick={()=> this.clicked(appendTo, name)}> Select </button>
{
this.state.childVisible ?
<ShowItems user={this.props.user}
appendTo={appendTo}
content={this.props.content}
/>
: <span></span>
}
</article>
);
}
The function toggles the show/hide state of the element.
And I'm not 100% sure of the toggleItems method.... let's look deeper into this...
clicked(key, marketName){
this.setState({childVisible: !this.state.childVisible}); /* We need to only toggle for the specific element with the same id as the item being clicked. */
this.props.toggleItems(key, marketName);
// this.setState({itemsToggled: !this.state.itemsToggled});
}
The end functionality is a bug in the UI that manipulates the previous lists that are opened if multiple lists are selected.
We need to display the proper list. Should we render the proper list through the CSS?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.