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

Fix #969 #1082

Merged
merged 14 commits into from
Feb 27, 2025
Merged

Fix #969 #1082

merged 14 commits into from
Feb 27, 2025

Conversation

Emmanex01
Copy link
Contributor

@Emmanex01 Emmanex01 commented Feb 23, 2025

Close: #969

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features
    • Updated the profile picture gallery prompt to "Choose your NFT Profile picture."
    • Introduced "CONFIRM PROFILE PICTURE" and "CANCEL" buttons for user profile picture selection, enhancing user interaction.
  • Style
    • Enhanced button styling with new classes for confirmation and cancellation buttons.
    • Adjusted button margins to improve layout.
    • Increased padding for the NFT section for better spacing.

Copy link

vercel bot commented Feb 23, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
app-starknet-id ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 27, 2025 10:14pm

Copy link

vercel bot commented Feb 23, 2025

@Emmanex01 is attempting to deploy a commit to the LFG Labs Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

coderabbitai bot commented Feb 23, 2025

Walkthrough

The pull request modifies the UpdateProfilePic component to enhance profile picture selection functionality. The selectPfp function's parameter type is changed to accept null, and the title of the PfpGallery is updated to "Choose your NFT Profile picture." New CSS classes for the confirmation and cancellation buttons are introduced, while the margin of the .nq-button class is adjusted to refine button spacing. The overall structure and functionality of the components remain intact.

Changes

File Change Summary
components/identities/updateProfilePic.tsx Updated selectPfp function to accept null; changed PfpGallery title; added imports for useAccount and Button.
styles/components/profilePic.module.css Added .confirmPpButton and .cancelButton CSS classes with shared styling attributes; increased padding of .nftSection from 10px to 35px.
styles/components/button.module.css Modified .nq-button margin from 10px to 0 10px to adjust vertical spacing.

Possibly related PRs

  • fix: Refont domain registration step 2 #993: The changes in the main PR are related to the modifications in the .nftSection class of the retrieved PR, as both involve updates to the CSS styles affecting the profile picture component.
  • Fix column categories for profile picture categories #1060: The changes in the main PR are related to the UpdateProfilePic component, specifically the modifications to the selectPfp function's parameter type, which may interact with the new navigation system introduced in the retrieved PR.
  • Fix: Added No NFTs FOUND state in your NFTs category #1058: The changes in the main PR are related to those in the retrieved PR as both involve modifications to the UpdateProfilePic and PfpGallery components, specifically in how they handle the presence or absence of NFTs, including updates to titles and conditional rendering logic.

Suggested reviewers

  • Marchand-Nicolas

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e59370e and 273ee89.

📒 Files selected for processing (1)
  • components/identities/updateProfilePic.tsx (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • components/identities/updateProfilePic.tsx

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
components/identities/updateProfilePic.tsx (1)

55-68: Improve button group structure.

The buttons share the same conditional logic and could be grouped in a single container for better maintainability.

Apply this diff to improve the structure:

-          <div className={`hidden justify-center mt-4 ${userNfts.length > 0 ? "flex" : ""}`}>
-            <button 
-              className={styles.confirmPpButton}
-              onClick={() => selectPfp(selectedPfp)}
-            >
-              CONFIRM PROFILE PICTURE
-            </button>
-          </div>
-          <div className={`hidden justify-center mt-4 ${userNfts.length > 0 ? "flex" : ""}`}>
-            <button 
-              className={styles.cancelButton}
-              onClick={back}
-            >
-              CANCEL
-            </button>
-          </div>
+          <div className={`hidden flex-col gap-4 mt-4 ${userNfts.length > 0 ? "flex" : ""}`}>
+            <button 
+              className={styles.confirmPpButton}
+              onClick={() => selectPfp(selectedPfp)}
+              disabled={!selectedPfp}
+            >
+              CONFIRM PROFILE PICTURE
+            </button>
+            <button 
+              className={styles.cancelButton}
+              onClick={back}
+            >
+              CANCEL
+            </button>
+          </div>
styles/components/profilePic.module.css (1)

25-37: Improve button styles for better accessibility and user experience.

The button styles have the following issues:

  1. The confirm button's background color (rgb(192, 175, 175)) has low contrast with text color (#454545)
  2. The cancel button lacks specific styles
  3. Missing hover and disabled states

Apply this diff to improve the styles:

 .confirmPpButton,
 .cancelButton{
   padding: 1rem;
   font-size: 14px;
   font-style: normal;
   font-weight: 900;
   border-radius: 10px;
+  transition: opacity 0.3s ease;
+  cursor: pointer;
 }

 .confirmPpButton{
-  background:rgb(192, 175, 175);
-  color: #454545;
+  background: #6d696a;
+  color: #ffffff;
+}
+
+.confirmPpButton:hover:not(:disabled) {
+  opacity: 0.8;
+}
+
+.confirmPpButton:disabled {
+  opacity: 0.5;
+  cursor: not-allowed;
+}
+
+.cancelButton {
+  background: transparent;
+  color: #454545;
+  border: 1px solid #454545;
+}
+
+.cancelButton:hover {
+  opacity: 0.8;
 }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a00ae6e and 2d2650a.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (2)
  • components/identities/updateProfilePic.tsx (1 hunks)
  • styles/components/profilePic.module.css (1 hunks)

Comment on lines 62 to 68
<div className={`hidden justify-center mt-4 ${userNfts && "flex"}`}>
<button
className={styles.cancelButton}
>
CANCEL
</button>
</div>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix conditional rendering and add onClick handler for cancel button.

The cancel button has the same issues as the confirm button.

Apply this diff to fix the issues:

-          <div className={`hidden justify-center mt-4 ${userNfts && "flex"}`}>
+          <div className={`hidden justify-center mt-4 ${userNfts.length > 0 ? "flex" : ""}`}>
             <button 
               className={styles.cancelButton}
+              onClick={back}
             >
               CANCEL
             </button>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<div className={`hidden justify-center mt-4 ${userNfts && "flex"}`}>
<button
className={styles.cancelButton}
>
CANCEL
</button>
</div>
<div className={`hidden justify-center mt-4 ${userNfts.length > 0 ? "flex" : ""}`}>
<button
className={styles.cancelButton}
onClick={back}
>
CANCEL
</button>
</div>

Comment on lines 55 to 61
<div className={`hidden justify-center mt-4 ${userNfts && "flex"}`}>
<button
className={styles.confirmPpButton}
>
CONFIRM PROFILE PICTURE
</button>
</div>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix conditional rendering and add onClick handler for confirm button.

The conditional rendering has the following issues:

  1. userNfts && "flex" will evaluate to "flex" when userNfts is a non-empty array, but the intention seems to be checking for presence of NFTs
  2. The confirm button lacks an onClick handler

Apply this diff to fix the issues:

-          <div className={`hidden justify-center mt-4 ${userNfts && "flex"}`}>
+          <div className={`hidden justify-center mt-4 ${userNfts.length > 0 ? "flex" : ""}`}>
             <button 
               className={styles.confirmPpButton}
+              onClick={() => selectPfp(selectedPfp)}
             >
               CONFIRM PROFILE PICTURE
             </button>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<div className={`hidden justify-center mt-4 ${userNfts && "flex"}`}>
<button
className={styles.confirmPpButton}
>
CONFIRM PROFILE PICTURE
</button>
</div>
<div className={`hidden justify-center mt-4 ${userNfts.length > 0 ? "flex" : ""}`}>
<button
className={styles.confirmPpButton}
onClick={() => selectPfp(selectedPfp)}
>
CONFIRM PROFILE PICTURE
</button>
</div>

Copy link
Collaborator

@Marchand-Nicolas Marchand-Nicolas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see the confirm button. You can reuse the code from https://sepolia.app.starknet.id/register/qsd.stark, there it works.

Also, please check the comments made by the ai.

/>
<div className={`hidden justify-center mt-4 ${userNfts && "flex"}`}>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bad practice to use css to render dynamically in react.
Instead use React conditional rendering.
e.g.:

{
userNfts ?
 <div>
... 
</div>
: null
}

@Marchand-Nicolas Marchand-Nicolas added the ❌ Change request Change requested from reviewer label Feb 23, 2025
Copy link
Collaborator

@Marchand-Nicolas Marchand-Nicolas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image This is not like on figma. You can reuse the code from components/domains/steps/selectPfp.tsx, it litterally does that

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
components/identities/updateProfilePic.tsx (1)

59-61: Add null check for selectedPfp.

The onClick handler passes selectedPfp directly to selectPfp, but selectedPfp could be null. Consider adding a validation check.

-onClick={() => selectPfp(selectedPfp)}
+onClick={() => {
+  if (!selectedPfp) {
+    // Consider showing a user-friendly message
+    return;
+  }
+  selectPfp(selectedPfp);
+}}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7a9ede5 and 77760e2.

📒 Files selected for processing (1)
  • components/identities/updateProfilePic.tsx (2 hunks)
🔇 Additional comments (3)
components/identities/updateProfilePic.tsx (3)

29-29: LGTM! Type safety improvement.

The function signature now correctly matches the state type, allowing for proper type checking.


53-53: LGTM! Improved user guidance.

The new title provides clearer instructions to users.


55-74: LGTM! Proper React conditional rendering.

The implementation follows React best practices for conditional rendering and includes proper event handlers.

</div>
<div className="flex justify-center mt-4">
<button
className={styles.cancelBtn}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Verify CSS class name consistency.

The CSS class name cancelBtn seems inconsistent with the style mentioned in past comments (cancelButton).

Run this script to check the available class names in the CSS module:


🏁 Script executed:

#!/bin/bash
# Check available class names in the CSS module
cat styles/components/profilePic.module.css

Length of output: 6865


Action Required: Rename the class for consistency

At line 67 in components/identities/updateProfilePic.tsx, the code currently uses:

className={styles.cancelBtn}

However, the CSS module (styles/components/profilePic.module.css) defines two cancel-related classes – .cancelBtn and .cancelButton. The .cancelButton class is grouped with .confirmPpButton and provides a styling convention (e.g., padding, bold font weight, border-radius) that aligns with our standardized button styles per past review comments.

Recommendation:

  • Update the component to use styles.cancelButton if the intent is to adopt the consistent button styling used elsewhere.
  • Alternatively, if a different style is required for this cancel action, please clarify the distinction between .cancelBtn and .cancelButton in the codebase.

Please verify and adjust accordingly.

Copy link
Collaborator

@Marchand-Nicolas Marchand-Nicolas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cancel button doesn't look like expected.
You can reuse this one:
Screenshot 2025-02-24 at 9 35 17 AM

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9335cd3 and 13a1ab9.

📒 Files selected for processing (1)
  • components/identities/updateProfilePic.tsx (3 hunks)
🔇 Additional comments (4)
components/identities/updateProfilePic.tsx (4)

8-8: LGTM!

The Button import follows the correct path convention and aligns with the UI changes.


30-33: LGTM!

The updated function signature correctly handles both NFT selection and deselection cases.


54-54: LGTM!

The updated title provides clearer guidance to users.


68-68: Update CSS class name for consistency.

The class name btnWrapperCancelBtn differs from the established convention (cancelButton) mentioned in past review comments.

Copy link
Collaborator

@Marchand-Nicolas Marchand-Nicolas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Too much margin. You can see it is not like on figma.

Please check everything before pushing, because everytime I make a review, it reduces your reward

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
components/identities/updateProfilePic.tsx (1)

67-72: 🛠️ Refactor suggestion

Use consistent button implementation.

The code mixes the custom Button component for confirmation and native button for cancellation. This creates inconsistency in styling and behavior.

Apply this diff to maintain consistency:

-                  <button 
-                    className={styles.btnWrapperCancelBtn}
-                    onClick={back}
-                  >
-                    CANCEL
-                  </button>
+                  <Button 
+                    onClick={back}
+                    variant="secondary"
+                  >
+                    CANCEL
+                  </Button>
🧹 Nitpick comments (1)
components/identities/updateProfilePic.tsx (1)

56-75: Replace hardcoded conditional with proper React conditional rendering.

Following previous review comments, replace CSS-based conditional rendering with proper React conditional rendering.

-          {true && 
-              <>
+          {userNfts.length > 0 && (
+              <>
                 <div className="flex justify-center mt-1">
                   <Button 
                     onClick={() => selectPfp(selectedPfp)} 
                     disabled={selectedPfp === null}
                   >
                     CONFIRM PROFILE PICTURE
                   </Button>
                 </div>
                 <div className="flex justify-center">
                   <Button 
                     onClick={back}
                     variant="secondary"
                   >
                     CANCEL
                   </Button>
                 </div>
-              </>  
-          }
+              </>
+          )}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 13a1ab9 and 2f790de.

📒 Files selected for processing (1)
  • components/identities/updateProfilePic.tsx (4 hunks)
🔇 Additional comments (3)
components/identities/updateProfilePic.tsx (3)

30-30: Function type update looks good.

The update to accommodate null as a possible parameter type is a good change that matches the state declaration on line 26.


43-43: Verify the condition for hasNoNfts.

The condition userNfts.length === 1 for determining if there are no NFTs seems counterintuitive. Typically, "no NFTs" would be represented by userNfts.length === 0. Please verify if there's a specific reason for this (e.g., array always includes a default/null item).


54-54: Title update for better clarity.

The updated title "Choose your NFT Profile picture" provides clearer guidance to users.

/>
{true &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Remove unnecessary conditional rendering.

The {true && conditional is redundant since it always evaluates to true.

-          {true && 
+          <>

And update line 75 accordingly:

-          }
+          </>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{true &&
<>
{/* ... existing child components or elements ... */}
</>

@Marchand-Nicolas
Copy link
Collaborator

@Emmanex01 please always check the comments made by the ai. It is right

Copy link
Collaborator

@Marchand-Nicolas Marchand-Nicolas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see a small harsh shadow here. Please fix it so that it doesn't instantly stops
Screenshot 2025-02-25 at 6 15 12 PM

@Marchand-Nicolas
Copy link
Collaborator

@Emmanex01 can you fix the conflicts and remove the mock nft from the PR ?

Copy link
Collaborator

@Marchand-Nicolas Marchand-Nicolas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, very good job! LGTM

@Marchand-Nicolas Marchand-Nicolas merged commit 7a1c750 into lfglabs-dev:testnet Feb 27, 2025
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
❌ Change request Change requested from reviewer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refont of "Your NFTs" category
2 participants