-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create finalProfilepage.html #24
base: main
Are you sure you want to change the base?
Conversation
take image from cloud in place of local of user avtaar
Reviewer's Guide by SourceryThis PR introduces a new profile page ( Sequence diagram for book completion toggle interactionsequenceDiagram
actor User
participant UI as Profile Page UI
participant BM as Book Management
User->>UI: Clicks book checkbox
UI->>BM: Toggle book completion status
BM->>UI: Update book display
alt Book is checked
UI->>UI: Show book item
else Book is unchecked
UI->>UI: Hide book item
end
Class diagram for profile page structureclassDiagram
class ProfileContainer {
+profileHeader
+profileInfo
+bookManagement
+closeProfile()
}
class ProfileInfo {
+avatar: Image
+userName: String
+email: String
}
class BookManagement {
+bookList: List
+toggleBookCompletion()
+initializeCompletedBooks()
}
ProfileContainer --> ProfileInfo
ProfileContainer --> BookManagement
note for ProfileInfo "Avatar now loaded from cloud URL"
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
✅ Deploy Preview for vrkpzs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @ROHITKUMARMODI - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider moving hardcoded user data (name, email, books) to a configuration file or loading it dynamically from an API to improve maintainability
- The JavaScript contains duplicate loops over bookCompletedCheckboxes - consider consolidating this logic to reduce code duplication
- Add error handling for the close button navigation and book status updates to gracefully handle potential failures
Here's what I looked at during the review
- 🟡 General issues: 3 issues found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
.book-management li { | ||
background-color: #f9f9f9; | ||
margin: 5px 0; | ||
padding: 10px; | ||
border-radius: 5px; | ||
display: none; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (performance): Consider showing list items by default and using CSS to handle completed state
Setting display:none by default can cause content flashing before JavaScript loads. Consider showing items by default and using CSS classes to handle visibility states.
Suggested implementation:
.book-management li {
background-color: #f9f9f9;
margin: 5px 0;
padding: 10px;
border-radius: 5px;
display: block;
}
.book-management li.completed {
display: none;
}
The JavaScript code will need to be updated to:
- Toggle the 'completed' class instead of directly setting display:none
- Use classList.add('completed') or classList.remove('completed') to change visibility states
background-color:#e5e5f3; | ||
margin: 0; | ||
padding: 0; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Consolidate duplicate loops over bookCompletedCheckboxes
The two loops over bookCompletedCheckboxes can be combined into a single loop that handles both initialization and click handling setup.
Suggested implementation:
var closeProfile = document.getElementById("close-profile");
var bookCompletedCheckboxes = document.getElementsByClassName("book-completed");
Array.from(bookCompletedCheckboxes).forEach(function(checkbox) {
// Set initial state if needed
checkbox.parentElement.style.display = checkbox.checked ? "list-item" : "none";
// Set up click handler
checkbox.onclick = function() {
this.parentElement.style.display = this.checked ? "list-item" : "none";
};
});
If there are other loops over bookCompletedCheckboxes elsewhere in the file that we can't see, those should also be consolidated into this single loop if they're performing related operations.
|
||
|
||
for (var i = 0; i < bookCompletedCheckboxes.length; i++) { | ||
if (bookCompletedCheckboxes[i].nextSibling.nodeValue.includes("Status: Completed")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Use data attributes instead of text content for state management
Parsing text content is fragile. Consider using data-status attributes to manage book states.
Suggested implementation:
for (var i = 0; i < bookCompletedCheckboxes.length; i++) {
if (bookCompletedCheckboxes[i].parentElement.dataset.status === 'completed') {
bookCompletedCheckboxes[i].checked = true;
bookCompletedCheckboxes[i].parentElement.style.display = "list-item";
}
}
You'll also need to update the HTML elements where the book status is displayed to include the data-status attribute. For example, where you currently have text content showing the status, you should add the attribute to the parent element like this:
<li data-status="completed">
<input type="checkbox" class="book-completed"> Status: Completed
</li>
This change will need to be made wherever book status is displayed in the HTML structure.
take image from cloud in place of local of user avtaar and make css better than previous one by me
Summary by Sourcery
New Features: