Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ROHITKUMARMODI
Copy link
Contributor

@ROHITKUMARMODI ROHITKUMARMODI commented Dec 20, 2024

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:

  • Add a new profile page that displays user information, including their avatar, email, and a list of books they are reading, have completed, or want to read.

take image from cloud in place of local of user avtaar
Copy link

sourcery-ai bot commented Dec 20, 2024

Reviewer's Guide by Sourcery

This PR introduces a new profile page (finalProfilepage.html) which fetches and displays the user's avatar from the cloud. It also includes CSS improvements for better styling.

Sequence diagram for book completion toggle interaction

sequenceDiagram
    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
Loading

Class diagram for profile page structure

classDiagram
    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"
Loading

File-Level Changes

Change Details Files
Created finalProfilepage.html with user profile information, book management section, and close button functionality.
  • Displays user's avatar image from a cloud source.
  • Implements a close button that redirects to Management.html.
  • Includes a book management section with checkboxes to mark books as completed.
  • Applies CSS for styling the profile page elements, such as background color, font, and layout.
  • Uses JavaScript to dynamically show/hide book list items based on checkbox status and pre-selects completed books.
finalProfilepage.html

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

netlify bot commented Dec 20, 2024

Deploy Preview for vrkpzs ready!

Name Link
🔨 Latest commit a7e2764
🔍 Latest deploy log https://app.netlify.com/sites/vrkpzs/deploys/676547f4aca6400008927ed8
😎 Deploy Preview https://deploy-preview-24--vrkpzs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

@sourcery-ai sourcery-ai bot left a 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

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +52 to +57
.book-management li {
background-color: #f9f9f9;
margin: 5px 0;
padding: 10px;
border-radius: 5px;
display: none;
Copy link

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:

  1. Toggle the 'completed' class instead of directly setting display:none
  2. Use classList.add('completed') or classList.remove('completed') to change visibility states

background-color:#e5e5f3;
margin: 0;
padding: 0;
}
Copy link

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")) {
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant