gbowne1 / codebooker

This is a book recommendation app created with React 18.2 and MUI for coders/programmers looking for reccomendations to books on programming/coding to read
MIT License
31 stars 57 forks source link

[Todo] Add to Library button #63 #216

Closed dev-george-nikolaidis closed 8 months ago

dev-george-nikolaidis commented 8 months ago

Hi @gbwne1, I've successfully added the 'Add to Library' button and connected it to the database as per our project requirements. Could you please take a moment to review the changes? Let me know if there are any adjustments needed. Thanks! CodeBooker (2)

dev-george-nikolaidis commented 8 months ago

@BlackBond06

When you log into the app, the books you see are considered part of the global library ? If is that the case I did the totally opposite. Currently, clicking the 'add to library' button checks if the book exists in the database model globalLibraryBooksModel.js ; if not, it's saved, indicating successful addition to the user's global library. If the book is already added, you're informed it exists in the global library.

Let me know what you think before I start working on the correction.

BlackBond06 commented 8 months ago

@dev-george-nikolaidis

Yes the books you see when you log into the app are in the global library, which is why clicking the 'Add To Library' button on any of the books returns with the book already exist message. Because it is checking the title of the book in the existing global book model in the database, which it will find.

The UI is fine; it's the functionality that requires correction. Clicking the 'Add To Library' button on any book should add that book to the user's personal library. So, when the user opens their personal library from the left-hand drawer menu of the app, the book should appear there.

dev-george-nikolaidis commented 8 months ago

@BlackBond06 Thank you very much for your information. I will work on the corrections and write back to you.

dev-george-nikolaidis commented 8 months ago

@BlackBond06 @gbowne1 I've made the necessary code changes. Now, when the user presses the 'Add to Library' button, we check if that user already has the book in the database. If not, we add it. Regarding how we will display the user's books when we press the library from sitenav, please consider opening a new ticker to discuss how you want to implement this.

dev-george-nikolaidis commented 8 months ago

@BlackBond06 Thank you for the suggestion. I've implemented the changes.

dev-george-nikolaidis commented 8 months ago

I am suggesting that we should add a global link at the navigation sidebar, which the user sees when they log in. When the user clicks on the library link, they should navigate to a new screen, for example, PersonalLibrary.jsx. Regarding the design, it can be similar to the global one, and afterward, we can add features and customize it depending on the needs.

gbowne1 commented 8 months ago

@BlackBond06 @dev-george-nikolaidis @LOGESH-B

Can this be merged as is? It's fine as is. I agree with the need for a separate view which would house the users library separately from the global library because they are two separate things.

BlackBond06 commented 8 months ago

Yes it can be merged as it is, but I suggest @dev-george-nikolaidis should go ahead and implement the UI for this feature so we can at least have something to iterate upon.

For the design, I agree with the suggestion for a separate view. But, the link to access the user's library should be connected to the library icon in the sidebar. That is, clicking the library icon should redirect the user to their personal library page.

The user's library page should also feature the navbar. I believe it's time to ensure that every new page from now on includes the navbar.

gbowne1 commented 8 months ago

@BlackBond06 @dev-george-nikolaidis @LOGESH-B

At some point in the future as I have mentioned before I want to suggest a large refactoring of the UI and especially the very large Library.jsx.

There are indeed 2 scopes, a global library and a users library.

The current UI I have never been happy with but it was the best I could come up with at the time.

There is also no "add book to favorites" button either.

I would suggest that the new UI could use cards to display books instead of a table.

I will entertain ideas for a new UI.

I would at some point also refactoring away from using Create React App.

Let me know what you think about this.

BlackBond06 commented 8 months ago

I totally agree, the new UI should use cards instead of tables. This is standard for most book sharing web apps.

We can create a custom card which will contain not only all the properties of the current Library.jsx table like book title, author, publisher etc. but also an image.

gbowne1 commented 8 months ago

How would we then distinguish between the users library and the global library?