Code Monkey home page Code Monkey logo

crwn-clothing-v2's Introduction

How to fork and clone

One quick note about cloning this project. If you wish to make commits and push your own code, you'll need to fork the project first. Forking allows you to have your own copy of this repository by adding a duplicate version in your own profile!

You can see the fork button in the top right corner of every GitHub project; click it and a copy of the project will be added to your GitHub profile under the same name as the original project.

github fork

After forking the project, simply clone it the way you would from the new forked project in your own GitHub repository and you can commit and push to it freely!

After you fork and clone:

Install dependencies

In your terminal after you clone your project down, remember to run either yarn or npm install to build all the dependencies in the project.

Set your firebase config

Remember to replace the config variable in your firebase.utils.js with your own config object from the firebase dashboard! Navigate to the project settings gear icon > project settings and scroll down to the config code. Copy the object in the code and replace the variable in your cloned code.

Screen Shot 2022-03-11 at 8 51 22 PM

Branching strategy

After forking this repository and cloning it down, you will have access to all the lesson branches with code at different checkpoints throughout the course. If for some reason you need to work from the codebase at one of these lesson branch checkpoints, follow these steps:

  1. Checkout to the lesson-# (let's use lesson-15 as an example) branch
git checkout lesson-15
  1. Branch off from lesson-15. This will create a new branch where the code of lesson-15 is the basis for your new branch. You can name your new branch whatever you want! Let's say we use my-main-branch as the name.
git checkout -b my-main-branch
  1. Now you can just code on this branch, push code from this branch up to your forked repo etc. The main thing to remember is that you want to be on this branch for your own code, so remember what you named this branch!

crwn-clothing-v2's People

Contributors

zhangmyihua avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

crwn-clothing-v2's Issues

user.context.jsx lesson 26

dispatch({ type: USER_ACTION_TYPES.SET_CURRENT_USER, currentUser: user });

should been
dispatch({ type: USER_ACTION_TYPES.SET_CURRENT_USER, payload: user });

Nothing displays after I Login and press Shop

I'm having problems with the Complete React Developer in 2023 (w/ Redux, Hooks, GraphQL): Zero to Mastery course.
I've been working in the [Firebase Database Storage] section for sometime now.
Just to save some questions to come at me, I've downloaded the scripts from the git site up to Branch Lesson 21 and yes I put my login info for firebase utility.
The users and the collections are there on the firebase site .

The app starts up okay.
After I sign in and click shop nothing appears except the Crown Icon and navigation
For some strange reason it has been working that way for quite through a bunch of videos.
Originally I thought it was the way I might have typed something, so I been pulling the code from the git site

I get the same issue no matter if its Chrome or Firefox
but in addition to my main problem If I try using Firefox, when the initial page displays, everything is crunched down

Please help if you can as this is certainly frustrating

Mike
[email protected]
here's a snap shot of my console
console
network

lecture 145 user.context.jsx line 36

line 36 dispatch({ type: USER_ACTION_TYPES.SET_CURRENT_USER, currentUser: user });
should be
dispatch({ type: USER_ACTION_TYPES.SET_CURRENT_USER, payload: user });

Reducer Section - Bugs with cart and checkout [branch lesson 28 & 29] (with solution)

Reducer section (lesson 28 to 29)

Hello everyone ๐Ÿ‘‹

I thought I might save someone some time with problem solving the issue with the source code here. If you are following and coding along with this repo and the videos and you get to the end of the section you will be left with a couple bugs.

You will find a bug that will affect the cart, as a quick QA example

If you add an item to the cart ;

  • the cart icon will remain at 0
  • proceed to checkout and you will see the item there however the cart total will be 0

If you add a second item to the cart ;

  • the cart icon will update to 1
  • proceed to checkout and you will see the two items in your cart

Further there will be issues with calculating the total amount, increasing/decreasing on checkout page etc.

Source Code (according to the video and GitHub repo)


Click to expand export const CartProvider = ({ children }) => { const [isCartOpen, setIsCartOpen] = useState(false); const [{ cartCount, cartTotal, cartItems }, dispatch] = useReducer( cartReducer, INITIAL_STATE ); const updateCartItemsReducer = (cartItems) => { const newCartCount = cartItems.reduce( (total, cartItem) => total + cartItem.quantity, 0 ); const newCartTotal = cartItems.reduce( (total, cartItem) => total + cartItem.quantity * cartItem.price, 0 ); const payload = { cartItems, cartCount: newCartCount, cartTotal: newCartTotal, }; dispatch(createAction(CART_ACTION_TYPES.SET_CART_ITEMS, payload)); };

Solution Bug Fix


Click to expand export const CartProvider = ({ children }) => { const [ { cartItems, isCartOpen, cartCount, cartTotal }, dispatch] = useReducer( cartReducer, INITIAL_STATE ); const updateCartItemsReducer = (newCartItems) => { const newCartCount = newCartItems.reduce( (total, cartItem) => total + cartItem.quantity, 0 ); const newCartTotal = newCartItems.reduce((total, cartItem) => total + cartItem.quantity * cartItem.price, 0); const payload = { cartItems: newCartItems, cartTotal: newCartTotal, cartCount: newCartCount, }; //importing from createAction from utils -> reducer dispatch( createAction(CART_ACTION_TYPES.SET_CART_ITEMS, payload)); };

FInal Note

The issue is the wrong object is passed in as props and then reduce is run on the wrong props. Further a mistake in the payload causing issues.

I leave this here as an issue as I see that Pull Requests are rarely merged.
I hope this helps anyone who is getting stuck here

โœŒ๏ธ

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.