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

Feat(layout): add migration banner to layout for Initia #1258

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

Poafs1
Copy link
Collaborator

@Poafs1 Poafs1 commented Mar 6, 2025

Summary by CodeRabbit

  • New Features
    • Introduced a new on-screen notice informing users about the deprecation of the legacy wallet extension.
    • Added a migration button for users to update their wallets.
    • Seamlessly integrated the new notification into the existing layout without altering overall design elements.
    • Enhanced date formatting functionality for displaying migration deadlines.

Copy link

vercel bot commented Mar 6, 2025

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

Name Status Preview Comments Updated (UTC)
celatone-frontend-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 6, 2025 11:19am
7 Skipped Deployments
Name Status Preview Comments Updated (UTC)
celatone-frontend-main ⬜️ Ignored (Inspect) Visit Preview Mar 6, 2025 11:19am
initia-celatone-frontend ⬜️ Ignored (Inspect) Visit Preview Mar 6, 2025 11:19am
initia-celatone-rehearsal ⬜️ Ignored (Inspect) Visit Preview Mar 6, 2025 11:19am
neutron-celatone-frontend ⬜️ Ignored (Inspect) Visit Preview Mar 6, 2025 11:19am
osmosis-celatone-frontend ⬜️ Ignored (Inspect) Visit Preview Mar 6, 2025 11:19am
sei-celatone-frontend ⬜️ Ignored (Inspect) Visit Preview Mar 6, 2025 11:19am
terra-celatone-frontend ⬜️ Ignored (Inspect) Visit Preview Mar 6, 2025 11:19am

Copy link

coderabbitai bot commented Mar 6, 2025

Walkthrough

The update in the layout file introduces a new conditional rendering block. When the useInitia hook indicates an Initia Wallet, a deprecation notice is displayed along with a migration button. The block consists of a Flex component containing Text and a Button wrapped in a Link. The existing Grid layout remains intact but is now enclosed within a Box component. Additional imports have been added to support these UI changes.

Changes

File(s) Change Summary
src/lib/layout/index.tsx - Added new conditional block using isInitia from useInitia to render a deprecation notice with a Flex container, Text, and a Button wrapped in a Link.
- Wrapped the existing Grid layout in a Box.
- Updated imports to include Chakra UI components and others.

Sequence Diagram(s)

sequenceDiagram
    participant L as Layout Component
    participant H as useInitia Hook
    participant UI as Deprecation UI Block
    participant G as Grid Layout

    L ->> H: Call useInitia hook
    H -->> L: Return isInitia state
    alt isInitia is true
        L ->> UI: Render deprecation notice (Flex, Text, Button, Link)
    else isInitia is false
        L ->> UI: Skip deprecation block
    end
    L ->> G: Render existing Grid layout within Box
Loading

Poem

I hopped into the code with delight,
Found deprecation warnings shining bright.
A migration button hops into view,
Guiding wallets old to paths anew.
My rabbit heart sings with every change so true! 🐰
Cheers to updates both playful and new!

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

src/lib/layout/index.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-import".

(The package "eslint-plugin-import" was not found when loaded as a Node module from the directory "".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-import@latest --save-dev

The plugin "eslint-plugin-import" was referenced from the config file in ".eslintrc.json".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.


📜 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 2f49bc9 and d6f8905.

📒 Files selected for processing (1)
  • src/lib/layout/index.tsx (4 hunks)
🔇 Additional comments (5)
src/lib/layout/index.tsx (5)

1-4: Import organization looks good.

The necessary imports have been properly added to support the new migration banner functionality. The dayjs setup with UTC plugin is correctly implemented.

Also applies to: 9-10, 19-20


29-29: Good use of custom hook.

The useInitia hook provides a clean way to detect if a user is using the Initia wallet, allowing for conditional rendering of the migration banner.


63-101: Migration banner implementation is well done.

The banner effectively communicates the deprecation notice and provides a clear path for users to migrate. The responsive styling ensures good visibility on both mobile and desktop devices.

A few observations:

  • The banner uses appropriate styling with the primary.darker background
  • The text clearly explains the situation and deadline
  • The migrate button includes an icon for better UX
  • The link now points to a proper migration URL (https://migration.initia.xyz)

102-144: Layout structure preserved correctly.

The existing Grid component structure has been maintained while being wrapped in a Box component, ensuring the new banner doesn't disrupt the existing layout.


57-61:

❓ Verification inconclusive

Verify the migration deadline date.

The code specifies March 18, 2025 as the migration deadline. Please confirm this is the correct date for Initia wallet deprecation.


🏁 Script executed:

#!/bin/bash
# Check if there are other references to this deadline date in the codebase
rg -i "2025-03-18" --type tsx --type ts

Length of output: 67


Below is a new shell script that uses file globs to search for the deadline date reference in both .tsx and .ts files. This should avoid the "unrecognized file type" error and help us verify whether "2025-03-18" appears elsewhere in the codebase.

Please run this script and share its output so we can confirm if the migration deadline date is consistently referenced as March 18, 2025.


🏁 Script executed:

#!/bin/bash
# Use file globs to search for migration deadline date "2025-03-18" in all .tsx and .ts files
echo "Searching for '2025-03-18' references in .tsx and .ts files..."
rg -i "2025-03-18" -g "*.tsx" -g "*.ts"

Length of output: 370


Migration Deadline Date Verification

  • The only occurrence of "2025-03-18" is in src/lib/layout/index.tsx, where the UTC date is converted to a local format.
  • Ensure that the March 18, 2025 deadline is indeed the correct deprecation date for Initia wallet as intended.
  • If there’s any discrepancy with the planned timeline, please update the deadline accordingly.
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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

@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)
src/lib/layout/index.tsx (1)

54-54: Consider adding a data-testid attribute.

For better testability, consider adding a data-testid attribute to the Box component containing the migration banner.

-    <Box>
+    <Box data-testid="layout-container">
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 73e36e0 and 778b3d8.

📒 Files selected for processing (1)
  • src/lib/layout/index.tsx (3 hunks)
🔇 Additional comments (3)
src/lib/layout/index.tsx (3)

53-87: Good implementation of a responsive migration banner.

The banner implementation uses responsive design principles with appropriate Chakra UI components. The conditional rendering based on isInitia ensures the banner is only shown to relevant users.


1-8: Well-organized imports.

The additions to the import statements are properly organized and necessary for the new UI components.


25-25:

❓ Verification inconclusive

Verify the useInitia hook implementation.

Ensure that the useInitia hook correctly identifies Initia wallet users. This is critical as the banner will only display for users where this hook returns true.


🏁 Script executed:

#!/bin/bash
# Check the implementation of useInitia hook
rg -A 10 "export function useInitia" --glob "*.{ts,tsx}"

Length of output: 58


Action Required: Manual Verification of the useInitia Hook Implementation

The previous grep search did not reveal the hook’s implementation. Please manually verify if the useInitia hook is defined elsewhere—potentially as a constant or under an alternative declaration—in the codebase. In particular, confirm the following:

  • The hook is implemented (either via a function declaration or as a constant) and correctly exported.
  • It reliably returns true for Initia wallet users to ensure the banner displays as intended.

Copy link

@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 (1)
src/lib/layout/index.tsx (1)

55-92: The migration banner looks good, with some potential improvements.

The migration banner is well-implemented with:

  • Clear warning message with specific deadline
  • Proper action button for immediate migration
  • Responsive design for different screen sizes
  • Good accessibility with proper contrast

Consider these enhancements:

  1. Add a way for users to dismiss the banner after they've seen it:
 <Box>
   {isInitia && (
+    <Box position="relative">
       <Flex
         py={{
           base: 3,
           md: 2,
         }}
         px={3}
         bg="primary.darker"
         justifyContent="center"
         flexDirection={{ base: "column", md: "row" }}
         gap={{
           base: 2,
           md: 6,
         }}
         alignItems={{
           base: "flex-end",
           md: "center",
         }}
       >
         <Text variant="body2">
           Initia Wallet extension is being deprecated. Existing extension
           users must migrate before March 18, 2025 22:00 EST to be eligible
           for future incentives.
         </Text>
         <Link
           href="https://migration.initia.xyz"
           target="_blank"
           rel="noopener noreferrer"
         >
           <Button
             size="sm"
             rightIcon={<CustomIcon name="launch" boxSize={2.5} />}
           >
             Migrate Wallet
           </Button>
         </Link>
+        <Button
+          position="absolute"
+          right={2}
+          top={2}
+          size="xs"
+          variant="ghost"
+          onClick={() => {
+            // Set state or localStorage to remember user dismissed the banner
+            localStorage.setItem('initiaMigrationBannerDismissed', 'true');
+            // Update state to hide banner
+            setShowInitiaBanner(false);
+          }}
+        >
+          <CustomIcon name="close" boxSize={3} />
+        </Button>
       </Flex>
+    </Box>
   )}
  1. Consider tracking migration clicks for analytics:
 <Link
   href="https://migration.initia.xyz"
   target="_blank"
   rel="noopener noreferrer"
+  onClick={() => {
+    // Track migration click event
+    if (typeof window !== 'undefined' && window.analytics) {
+      window.analytics.track('Initia Migration Click');
+    }
+  }}
 >
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 778b3d8 and d0ae950.

📒 Files selected for processing (1)
  • src/lib/layout/index.tsx (3 hunks)
🔇 Additional comments (4)
src/lib/layout/index.tsx (4)

1-2: Good addition of required imports.

The imports are correctly added to support the new UI components and functionality.

Also applies to: 7-8


25-25: LGTM on the Initia detection.

Clean implementation of the useInitia hook to detect if the user is using an Initia wallet.


54-54: Appropriate structure change to accommodate the migration banner.

Wrapping the Grid in a Box component is a clean approach to add the banner without disrupting the existing layout structure.

Also applies to: 93-135


79-83: Correct implementation of the migration URL.

The link now points to a proper migration URL instead of a placeholder, addressing the past review comment.

Copy link

@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)
src/lib/layout/index.tsx (3)

29-29: Consider adding fallback handling for useInitia hook.

The code assumes the useInitia hook will always return a valid boolean value. Consider adding error handling in case the hook fails or returns an unexpected value.

-  const isInitia = useInitia();
+  const isInitia = useInitia() || false; // Ensure we always get a boolean value

84-88: Consider improving text readability with emphasis.

For important notifications like this, you might want to emphasize key information like the deadline date to make it more noticeable to users.

-          <Text variant="body2">
-            Initia Wallet extension is being deprecated. Existing extension
-            users must migrate before {date} to be eligible for future
-            incentives.
-          </Text>
+          <Text variant="body2">
+            Initia Wallet extension is being deprecated. Existing extension
+            users must migrate before <strong>{date}</strong> to be eligible for future
+            incentives.
+          </Text>

138-138: Consider using Chakra's styling props instead of inline styles.

For consistency with the rest of the codebase that uses Chakra UI, consider using Chakra's styling props instead of inline styles.

-          <div
-            style={{ minHeight: "calc(100vh - 129px)", position: "relative" }}
-          >
+          <Box
+            minHeight="calc(100vh - 129px)"
+            position="relative"
+          >
-          </div>
+          </Box>
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c4270c2 and 9fafe80.

📒 Files selected for processing (1)
  • src/lib/layout/index.tsx (4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (3)
src/lib/layout/index.tsx (3)

90-93: Good implementation of the migration URL.

The migration link has been properly implemented with the actual URL to the migration site, addressing the previous review comment.


66-82: Well-designed responsive banner implementation.

The banner uses responsive design with different layouts for mobile and desktop views. The use of Flex with appropriate breakpoints ensures good user experience across device sizes.


57-61:

✅ Verification successful

Verify the UTC time conversion for the migration deadline.

The comment indicates this is for "March 18th, 2025 12:00 KST", but the UTC time is set to "2025-03-18T03:00:00Z". Please verify this conversion is correct - KST is UTC+9, so 12:00 KST should convert to 03:00 UTC on the same day.


🏁 Script executed:

#!/bin/bash
# Check the time difference between KST and UTC
echo "Verifying KST to UTC conversion:"
echo "March 18th, 2025 12:00 KST should be March 18th, 2025 03:00 UTC"

# Use date command to verify (this works on most Unix-like systems)
if [[ "$(uname)" == "Darwin" ]]; then
  # macOS date command syntax
  echo "KST: March 18th, 2025 12:00 = $(TZ=Asia/Seoul date -j -f "%Y-%m-%d %H:%M" "2025-03-18 12:00" "+%Y-%m-%d %H:%M")"
  echo "UTC: March 18th, 2025 03:00 = $(date -u -j -f "%Y-%m-%d %H:%M" "2025-03-18 03:00" "+%Y-%m-%d %H:%M")"
else
  # Linux date command syntax
  echo "KST: March 18th, 2025 12:00 = $(TZ=Asia/Seoul date -d "2025-03-18 12:00" "+%Y-%m-%d %H:%M")"
  echo "UTC: March 18th, 2025 03:00 = $(TZ=UTC date -d "2025-03-18 03:00" "+%Y-%m-%d %H:%M")"
fi

Length of output: 579


UTC Conversion Verified
The verification confirms that the timestamp conversion is accurate. March 18th, 2025 at 12:00 KST correctly converts to 03:00 UTC, consistent with KST being UTC+9. No further changes are required in the code.

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.

2 participants