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

Update the Domain Expiration feature - Remove buttons #1089

Merged
merged 3 commits into from
Feb 27, 2025

Conversation

tali-creator
Copy link
Contributor

@tali-creator tali-creator commented Feb 27, 2025

close: #1028

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • The renewal icon now supports dynamic color customization, allowing its appearance to be easily adjusted.
    • Domain management actions have been enhanced with a visually distinct renewal button for expired domains and streamlined interaction options for updating domain settings.
    • New styling options have been added for critical actions, improving visual cues for users.
  • Bug Fixes

    • Navigation behavior for various components has been adjusted to allow users to return to the previous page instead of a fixed route.

Copy link

vercel bot commented Feb 27, 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 9:31pm

Copy link

vercel bot commented Feb 27, 2025

@tali-creator 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 27, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This pull request introduces several updates across multiple components. The RenewalIcon component now accepts a dynamic color prop for the fill color of its SVG elements, replacing a hardcoded value. The IdentityActions component has been refactored to improve rendering logic for domain renewal actions based on expiration status. Additionally, the ClickableAction component has been updated to include a new severe prop for conditional styling. Other components, such as CheckoutCard, SelectPfp, and UserInfoForm, have modified navigation behaviors to utilize router.back() instead of a fixed route.

Changes

File(s) Change Summary
components/UI/iconsComponents/icons/renewalIcon.tsx Replaced hardcoded fill="#0C8654" in SVG <ellipse> and <path> elements with a dynamic color prop, enabling external control of the icon's color.
components/identities/actions/identityActions.tsx Refactored conditional rendering for domain renewal actions: renders a ClickableAction with a "RENEW YOUR DOMAIN" title when the domain is expired; otherwise, it shows a different ClickableAction for soon-to-expire domains and updates the title for changing the domain target.
components/UI/iconsComponents/clickableAction.tsx Added a new optional severe property to ClickableActionProps, affecting the class name for styling based on this property.
components/domains/steps/checkoutCard.tsx Adjusted rendering logic for ReduceDuration component and modified navigation behavior to use router.back() instead of router.push("/").
components/domains/steps/selectPfp.tsx Changed the close button's event handler to use router.back() for navigation instead of router.push("/").
components/domains/steps/userInfoForm.tsx Modified the handleClose function to navigate back using router.back() instead of redirecting to the home page.
styles/components/identityMenu.module.css Introduced new CSS classes .clickableActionSevere and .clickableActionSevere .clickableIconPrimary for styling severe actions.
styles/globals.css Updated CSS variable --background from #FCFFFE to #fcfffe (case change).

Possibly related PRs

Suggested labels

❌ Change request


📜 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 6159b6c and cf273e7.

📒 Files selected for processing (7)
  • components/UI/iconsComponents/clickableAction.tsx (3 hunks)
  • components/domains/steps/checkoutCard.tsx (3 hunks)
  • components/domains/steps/selectPfp.tsx (1 hunks)
  • components/domains/steps/userInfoForm.tsx (1 hunks)
  • components/identities/actions/identityActions.tsx (1 hunks)
  • styles/components/identityMenu.module.css (1 hunks)
  • styles/globals.css (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings

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: 0

🧹 Nitpick comments (3)
components/UI/iconsComponents/icons/renewalIcon.tsx (1)

3-3: Consider adding a default color value.

While the component works correctly, consider adding a default value for the color prop to ensure the icon renders properly even if the color prop is omitted.

-const RenewalIcon: FunctionComponent<IconProps> = ({ color, width }) => {
+const RenewalIcon: FunctionComponent<IconProps> = ({ color = "#0C8654", width }) => {
components/identities/actions/identityActions.tsx (2)

250-251: Consider extracting Tailwind classes to a named class.

The inline Tailwind classes make the JSX harder to read. Consider extracting these to a named class in your CSS module or a component to improve readability and maintainability.

-<button
-  className="flex items-center bg-white hover:opacity-80 transition-all duration-300  w-[280px] h-[60px] rounded-[12px] border-t-[1px] border-r-[4px] border-b-[4px] border-[#D32F2F] border-l-[1px] p-[8px] gap-[12px]"
-  onClick={() => router.push("/renewal")}>
+<button
+  className={styles.expiredDomainButton}
+  onClick={() => router.push("/renewal")}>

Then define the class in your module CSS file:

.expiredDomainButton {
  display: flex;
  align-items: center;
  background-color: white;
  width: 280px;
  height: 60px;
  border-radius: 12px;
  border-top: 1px solid #D32F2F;
  border-right: 4px solid #D32F2F;
  border-bottom: 4px solid #D32F2F;
  border-left: 1px solid #D32F2F;
  padding: 8px;
  gap: 12px;
  transition: opacity 300ms;
}

.expiredDomainButton:hover {
  opacity: 0.8;
}

260-263: Use proper date formatting for expired domains.

The current implementation shows "Expired on [date]". Consider expressing this in terms of how long ago it expired for better user context.

-<span className="text-[12px] text-[#8C8989]">
-  {`Expired on ${timestampToReadableDate(
-    identity?.domainExpiry ?? 0
-  )}`}
-</span>
+<span className="text-[12px] text-[#8C8989]">
+  {`Expired ${getTimeSinceExpiry(identity?.domainExpiry ?? 0)} ago`}
+</span>

You would need to implement a helper function like:

function getTimeSinceExpiry(timestamp: number): string {
  const now = Math.floor(Date.now() / 1000);
  const secondsSinceExpiry = now - timestamp;
  
  if (secondsSinceExpiry < 60 * 60 * 24) {
    return "today";
  } else if (secondsSinceExpiry < 60 * 60 * 24 * 7) {
    return `${Math.floor(secondsSinceExpiry / (60 * 60 * 24))} days`;
  } else if (secondsSinceExpiry < 60 * 60 * 24 * 30) {
    return `${Math.floor(secondsSinceExpiry / (60 * 60 * 24 * 7))} weeks`;
  } else {
    return `${Math.floor(secondsSinceExpiry / (60 * 60 * 24 * 30))} months`;
  }
}
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0a34f84 and 6159b6c.

📒 Files selected for processing (2)
  • components/UI/iconsComponents/icons/renewalIcon.tsx (1 hunks)
  • components/identities/actions/identityActions.tsx (2 hunks)
🔇 Additional comments (7)
components/UI/iconsComponents/icons/renewalIcon.tsx (2)

17-17: Good refactoring to use dynamic color prop.

Making the icon's color configurable improves component reusability. This change allows the icon to be styled contextually based on the domain's status (e.g., expired vs. active).


21-21: Consistent implementation of dynamic color prop.

The color prop is correctly applied to all relevant SVG elements while maintaining the white highlight at line 33, which appears to be intentional.

Also applies to: 25-25, 29-29

components/identities/actions/identityActions.tsx (5)

248-265: Improved UI for expired domains.

The new button for expired domains effectively communicates urgency with its red styling and clear messaging. The design nicely separates this critical action from regular domain management actions.


269-282: Consistent usage of RenewalIcon with color prop.

The RenewalIcon now correctly uses the color prop, allowing it to adapt to different states and styles. Good job maintaining consistency between the expired and non-expired states.


285-295: Improved organization of domain management actions.

Moving the "CHANGE DOMAIN TARGET" action outside of the conditional rendering makes it consistently available, which is a good UX improvement.


297-370: Well-structured "View more" section.

The reorganization of actions with the "View more/less" toggle improves the UI by reducing clutter while keeping all functionality accessible. The conditional rendering logic is clear and effective.


336-356:

❓ Verification inconclusive

Verify subscription-related functionality.

The subscription actions appear correctly implemented, but since they involve transaction functionality, it's important to ensure they work as expected.


🏁 Script executed:

#!/bin/bash
# Check if there are any references to the subscription functionality elsewhere 
# to ensure there are no inconsistencies

# Search for subscription-related components or functions
echo "Searching for subscription-related components or functions:"
rg -A 2 -B 2 "subscription" --type tsx --type ts

Length of output: 205


Review Verification: Subscription Actions Integration

The subscription actions in components/identities/actions/identityActions.tsx (lines 336–356) appear to be conditionally rendering based on the auto-renewal state. The code correctly provides separate UI elements for enabling and disabling subscription functionality. However, our initial automated search for subscription-related references was hindered by a file type recognition issue.

Please ensure the following manually:

  • Confirm that subscription transaction handling (triggered via the "ENABLE SUBSCRIPTION" and "DISABLE SUBSCRIPTION" actions) integrates correctly with the broader subscription logic.
  • Verify that the disableRenewal function and related routing (using router.push("/subscription")) are properly connected elsewhere in the codebase.
  • Double-check that any subscription-related configurations and UI elements (like the renewal icons) are consistent and reliable.

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.

You did a really good job, lgtm!

@Marchand-Nicolas Marchand-Nicolas merged commit 3063031 into lfglabs-dev:testnet Feb 27, 2025
2 of 4 checks passed
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.

Update the Domain Expiration feature - Remove buttons
2 participants