Skip to content

feat: few style changes#87

Merged
antoncoding merged 9 commits intomasterfrom
feat/slogan
Nov 25, 2024
Merged

feat: few style changes#87
antoncoding merged 9 commits intomasterfrom
feat/slogan

Conversation

@antoncoding
Copy link
Copy Markdown
Owner

@antoncoding antoncoding commented Nov 25, 2024

  • Align styling
  • Color, font size changes

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced a new FAQ page to provide users with quick answers to common questions.
  • Improvements

    • Updated the application branding and description to reflect a focus on customized lending strategies.
    • Enhanced the interactivity and visual presentation of the HomePage component with dynamic content updates.
    • Improved the AccountDropdown component for better user experience with enhanced visibility and information display.
    • Added animations to dropdowns and table rows for smoother transitions and improved user experience.
    • Enhanced the FromAndToMarkets component for clearer button conditions and pagination logic.
    • Streamlined the Navbar and NavbarMobile components for a more straightforward navigation experience.
  • Bug Fixes

    • Clarified button conditions and pagination logic in the market selection component.
  • Style

    • Updated styling for various components to ensure consistency across the application, including changes in button colors and header presentations.
    • Enhanced scrollbar handling and table row interactions for better usability.

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Nov 25, 2024

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

Name Status Preview Comments Updated (UTC)
monarch ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 25, 2024 9:43am

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Nov 25, 2024

📝 Walkthrough
📝 Walkthrough

Walkthrough

This pull request introduces several modifications across multiple files in the Monarch project. Key updates include a rebranding in the README.md, significant changes to the HomePage component for enhanced interactivity, and the introduction of a new FAQ page. Several components, such as HomeHeader and WhyUseIt, have been deleted, while others like AccountDropdown have been restructured for improved functionality. CSS styles have been adjusted for consistency, and the overall user interface has been refined to better reflect the new focus on customized lending strategies.

Changes

File Path Change Summary
README.md Updated description and branding to reflect a focus on customized lending strategies.
app/home/HomePage.tsx Removed isMorphoBlue state; added showCustomized, riskYieldIndex, and secondCounter; modified rendering logic.
app/home/_components/Home.module.css Deleted file containing styles for home page layout.
app/home/_components/HomeHeader.tsx Deleted HomeHeader component.
app/home/_components/WhyUseIt.tsx Deleted HomeMain component, which rendered an empty <div />.
app/page.tsx Updated description in generateMetadata function.
app/positions/components/FromAndToMarkets.tsx Updated pagination and rendering logic for market data.
app/positions/components/PositionsContent.tsx Altered header styling; maintained existing state management and rendering logic.
app/positions/components/PositionsSummaryTable.tsx Changed header text styling; no impact on functionality.
app/positions/components/RebalanceActionInput.tsx Updated CSS class names for styling elements.
app/positions/components/RebalanceModal.tsx Updated button class for "Execute Rebalance" action; maintained existing logic.
app/settings/faq/page.tsx Introduced new FAQPage component to display FAQs with links to resources.
src/components/common/PrimaryButton.tsx Changed button opacity from opacity-80 to opacity-90.
src/components/layout/header/AccountConnect.tsx Removed AccountInfoPanel from rendered output when user is connected.
src/components/layout/header/AccountDropdown.tsx Enhanced dropdown functionality with new state management and layout.
src/components/layout/header/AccountInfoPanel.tsx Deleted file containing user account information panel.
src/components/layout/header/Navbar.tsx Simplified navigation structure; removed mobile menu handling.
src/components/layout/header/NavbarMobile.tsx Updated NavbarLink components to include matchKey prop for improved routing.

Possibly related PRs

"In the realm of lending, a shift we see,
With customized paths, as clear as can be.
From headers to buttons, a fresh look in sight,
FAQs now guide, making knowledge feel right.
Monarch's new chapter, with style and with grace,
Personalized lending, a bright, welcoming space!" 🌟


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 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
Copy Markdown

@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: 8

🧹 Outside diff range and nitpick comments (7)
app/settings/faq/page.tsx (1)

6-39: Move FAQ data to a separate file

Extract FAQ data to app/settings/faq/data.ts for better maintainability.

README.md (1)

19-19: Consider adding a quick example

The overview explains the concept well. Adding a simple example of a lending strategy would make it more concrete.

src/components/layout/header/Navbar.tsx (2)

33-36: Extract common styles to a constant

The styling is clean but repeated across components. Consider extracting base styles to a constant.

+const baseNavLinkStyles = 'px-2 py-1 text-center font-zen text-base font-normal text-primary no-underline';
+const navLinkAnimationStyles = 'relative after:absolute after:bottom-[-4px] after:left-0 after:h-[2px] after:w-full after:bg-primary transition-all duration-200 hover:-translate-y-[2px]';

 className={clsx(
-  'px-2 py-1 text-center font-zen text-base font-normal text-primary no-underline',
-  'relative after:absolute after:bottom-[-4px] after:left-0 after:h-[2px] after:w-full after:bg-primary',
-  'transition-all duration-200 hover:-translate-y-[2px]',
+  baseNavLinkStyles,
+  navLinkAnimationStyles,
   isActive ? 'after:opacity-100' : 'after:opacity-0',
)}

77-77: Remove or implement FAQ link

Commented code should be either removed or implemented.

src/components/layout/header/AccountDropdown.tsx (2)

24-26: Consider removing useCallback

The useCallback here might be unnecessary since disconnect is likely stable.

-  const handleDisconnectWallet = useCallback(() => {
-    disconnect();
-  }, [disconnect]);
+  const handleDisconnectWallet = () => disconnect();

14-17: Avoid hardcoded margin for positioning

Using fixed negative margin for dropdown positioning could break on different screen sizes.

Consider using Radix UI's built-in positioning system:

-const DropdownMenuContentStyle = {
-  marginTop: '-22px',
-};

// Then remove style={DropdownMenuContentStyle} from DropdownMenu.Content
app/home/HomePage.tsx (1)

111-114: Handle undefined 'address' in 'Get Started' button

If address is undefined, the href becomes /positions/. Consider disabling the button or prompting the user to connect.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 08842c3 and 5760611.

📒 Files selected for processing (17)
  • README.md (2 hunks)
  • app/home/HomePage.tsx (1 hunks)
  • app/home/_components/Home.module.css (0 hunks)
  • app/home/_components/HomeHeader.tsx (0 hunks)
  • app/home/_components/WhyUseIt.tsx (0 hunks)
  • app/page.tsx (1 hunks)
  • app/positions/components/FromAndToMarkets.tsx (2 hunks)
  • app/positions/components/PositionsContent.tsx (1 hunks)
  • app/positions/components/PositionsSummaryTable.tsx (1 hunks)
  • app/positions/components/RebalanceActionInput.tsx (2 hunks)
  • app/positions/components/RebalanceModal.tsx (1 hunks)
  • app/settings/faq/page.tsx (1 hunks)
  • src/components/common/PrimaryButton.tsx (1 hunks)
  • src/components/layout/header/AccountConnect.tsx (1 hunks)
  • src/components/layout/header/AccountDropdown.tsx (1 hunks)
  • src/components/layout/header/AccountInfoPanel.tsx (0 hunks)
  • src/components/layout/header/Navbar.tsx (2 hunks)
💤 Files with no reviewable changes (4)
  • app/home/_components/Home.module.css
  • app/home/_components/HomeHeader.tsx
  • app/home/_components/WhyUseIt.tsx
  • src/components/layout/header/AccountInfoPanel.tsx
✅ Files skipped from review due to trivial changes (4)
  • app/page.tsx
  • app/positions/components/PositionsSummaryTable.tsx
  • app/positions/components/RebalanceModal.tsx
  • src/components/common/PrimaryButton.tsx
🔇 Additional comments (8)
src/components/layout/header/AccountConnect.tsx (1)

48-50: Clean consolidation of account UI

Good move merging account info into the dropdown. Simpler code, same features.

README.md (1)

4-4: LGTM: Clear tagline

The new tagline accurately reflects the product focus.

app/positions/components/RebalanceActionInput.tsx (2)

31-31: Container styling looks good

Changed from orange-specific to primary color scheme. Matches the new branding.


62-62: Nice button animation

Added scale and opacity transitions. Makes the UI more engaging.

src/components/layout/header/AccountDropdown.tsx (2)

1-12: LGTM!

Imports are well-organized and all dependencies are used.


61-63: 🛠️ Refactor suggestion

Handle undefined chainId case

The fallback to chainId 1 might not be ideal if the network isn't Ethereum mainnet.

-            <Link href={getExplorerURL(address, chainId ?? 1)} target="_blank">
+            <Link href={chainId ? getExplorerURL(address, chainId) : '#'} target="_blank">
✅ Verification successful

Fallback to chainId 1 is correct

The current implementation is safe. The getExplorerURL function handles only Mainnet (1) and Base (8453), defaulting to Etherscan for any other chain. The fallback to chainId ?? 1 aligns with this design.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if getExplorerURL is used elsewhere with similar pattern
rg "getExplorerURL.*\?\?" --type typescript

Length of output: 80


Script:

#!/bin/bash
# Search for getExplorerURL usage
rg "getExplorerURL" -A 2

# Find the implementation of getExplorerURL
ast-grep --pattern 'function getExplorerURL'

Length of output: 4111


Script:

#!/bin/bash
# Find the type definition of SupportedNetworks
rg "enum SupportedNetworks" -A 5

# Find getExplorerURL implementation with export
ast-grep --pattern 'export const getExplorerURL'

Length of output: 794

app/positions/components/PositionsContent.tsx (1)

32-32: Check alignment after flex removal

The h1 element lost its flex alignment properties. This might affect its positioning relative to the buttons.

Consider this alternative that maintains alignment:

-<h1 className="py-8 font-zen"> Portfolio </h1>
+<h1 className="flex items-center py-8 font-zen"> Portfolio </h1>
app/positions/components/FromAndToMarkets.tsx (1)

183-184: LGTM: Proper BigInt handling

Good use of BigInt for comparing large numbers.

Comment thread app/settings/faq/page.tsx
Comment thread app/settings/faq/page.tsx
Comment on lines +48 to +50
<div className="flex hidden md:block">
<AccountDropdown />
</div>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codebase verification

Mobile account access needs attention

The Connect button is visible on all screens, but the account dropdown only shows on desktop (md:block). No alternative mobile UI was found for logged-in users.

  • Add mobile-friendly account access or document why it's desktop-only
🔗 Analysis chain

Check mobile account access

The dropdown is hidden on mobile screens. Make sure users can access account functions through another way on small screens.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if there's a mobile-specific account component
rg -g '*.tsx' -g '*.jsx' 'md:hidden.*Account'

Length of output: 47


Script:

#!/bin/bash
# Let's check for any mobile-specific account UI patterns
rg -g '*.tsx' -g '*.jsx' 'block md:hidden.*Account|md:hidden.*Account|Account.*block md:hidden|Account.*md:hidden'

# Also check the AccountConnect component for any mobile handling
rg -g 'AccountConnect.tsx' 'md:'

Length of output: 250


Script:

#!/bin/bash
# Let's check the entire AccountConnect component to understand mobile handling
rg -g 'AccountConnect.tsx' . -A 5 -B 5

Length of output: 4717

Comment thread src/components/layout/header/Navbar.tsx
Comment on lines +72 to +73
<NavbarLink href="/markets">Markets</NavbarLink>
<NavbarLink href={`/positions/${address ?? ''}`}>Portfolio</NavbarLink>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codebase verification

Add address check before showing portfolio link

The positions pages have no guard for undefined addresses. Either:

  • Hide the portfolio link when address is undefined
  • Redirect to connect wallet when clicked without address
🔗 Analysis chain

Consider a better fallback for missing address

Empty string fallback might cause routing issues. Consider redirecting or disabling links when address is undefined.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if there's handling for undefined address in route handlers
rg -A 5 "positions/\[\[...params\]\]" 

Length of output: 39


Script:

#!/bin/bash
# Check route handling for positions pages
rg -A 5 "positions/\[.*\]" 

# Check if there's any handling for undefined address in positions related files
fd "positions" --type f --exec rg -A 5 "undefined.*address|!address|address\s+===\s+undefined"

Length of output: 123


Script:

#!/bin/bash
# Look for positions page components and routing
fd -e tsx -e ts positions

# Check for any address validation or guards in the app
rg -A 5 "router.push|router.replace|redirect" 

Length of output: 5292

Comment thread app/positions/components/FromAndToMarkets.tsx
Comment thread app/home/HomePage.tsx
Comment thread app/home/HomePage.tsx
Copy link
Copy Markdown

@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: 5

🧹 Outside diff range and nitpick comments (8)
app/global.css (2)

127-129: Avoid !important

The transparent border trick is good, but let's avoid !important. Consider increasing selector specificity instead.

-.table-body-focused {
+.table-body tr.table-body-focused {
   background-color: var(--palette-bg-hovered);
-  border-left: 2px solid var(--palette-orange) !important;
+  border-left: 2px solid var(--palette-orange);
 }

Also applies to: 138-138


Line range hint 13-13: Move shared color to single definition

Orange color is defined twice with same value. Move it to root level only.

 :root {
   --quick-nav-display: none;
   --component-highlights-item-width: calc(100vw - 100px);
   --developer-experience-code-window-background: var(--slate-12);
   --palette-orange: #f45f2d;
 }
 
 .dark {
   --quick-nav-display: none;
-  --palette-orange: #f45f2d;
   --palette-bg-black: #16181a;

Also applies to: 28-28

app/markets/components/AssetFilter.tsx (2)

6-6: Fix import order

Move framer-motion import before next/image to match project conventions.

import { ChevronDownIcon, TrashIcon } from '@radix-ui/react-icons';
+import { motion, AnimatePresence } from 'framer-motion';
import Image from 'next/image';
-import { motion, AnimatePresence } from 'framer-motion';
🧰 Tools
🪛 eslint (1.23.1)

[error] 6-6: framer-motion import should occur before import of next/image

(import/order)


119-127: Add layout prop for better performance

Add layout prop to motion.div to optimize list animations.

 <motion.div
+  layout
   initial={{ opacity: 0, y: -10 }}
   animate={{ opacity: 1, y: 0 }}
   exit={{ opacity: 0, y: -10 }}
   transition={{ duration: 0.15 }}
   className="bg-surface absolute z-10 mt-1 w-full rounded-sm shadow-lg"
 >
app/markets/components/MarketTableBody.tsx (1)

1-1: Fix import order

Move framer-motion import before next/image.

import React, { useState, useEffect } from 'react';
+import { motion, AnimatePresence } from 'framer-motion';
import { Tooltip } from '@nextui-org/tooltip';
import Image from 'next/image';
-import { motion, AnimatePresence } from 'framer-motion';

Also applies to: 14-14

app/positions/components/SuppliedMarketsDetail.tsx (2)

10-10: Fix import issues

  1. Move framer-motion import before next/link
  2. Remove unused AnimatePresence import
-import { motion, AnimatePresence } from 'framer-motion';
+import { motion } from 'framer-motion';
🧰 Tools
🪛 eslint (1.23.1)

[error] 10-10: framer-motion import should occur before import of next/link

(import/order)


[error] 10-10: 'AnimatePresence' is defined but never used.

(@typescript-eslint/no-unused-vars)


61-67: Consider smoother animation

Animation feels abrupt at 0.1s. Try:

  • Increase duration to 0.2-0.3s
  • Add easing function
 <motion.div
   initial={{ height: 0 }}
   animate={{ height: 'auto' }}
   exit={{ height: 0 }}
-  transition={{ duration: 0.1 }}
+  transition={{ duration: 0.3, ease: 'easeInOut' }}
   className="overflow-hidden"
 >
app/positions/components/PositionsSummaryTable.tsx (1)

237-242: Add tooltip for collateral tokens

Users might not recognize token icons by image alone.

 <TokenIcon
   key={`${collateral.address}-${index}`}
   address={collateral.address}
   chainId={groupedPosition.chainId}
   width={20}
   height={20}
+  title={collateral.symbol}
 />
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 5760611 and 09afb3a.

📒 Files selected for processing (8)
  • app/global.css (3 hunks)
  • app/markets/components/AssetFilter.tsx (2 hunks)
  • app/markets/components/MarketTableBody.tsx (4 hunks)
  • app/positions/components/PositionsContent.tsx (1 hunks)
  • app/positions/components/PositionsSummaryTable.tsx (8 hunks)
  • app/positions/components/SuppliedMarketsDetail.tsx (2 hunks)
  • src/components/layout/header/Navbar.tsx (2 hunks)
  • src/components/layout/header/NavbarMobile.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • app/positions/components/PositionsContent.tsx
  • src/components/layout/header/Navbar.tsx
🧰 Additional context used
🪛 eslint (1.23.1)
app/markets/components/AssetFilter.tsx

[error] 6-6: framer-motion import should occur before import of next/image

(import/order)

app/markets/components/MarketTableBody.tsx

[error] 14-14: framer-motion import should occur before import of next/image

(import/order)


[error] 41-41: 'visibleRowId' is assigned a value but never used.

(@typescript-eslint/no-unused-vars)

app/positions/components/PositionsSummaryTable.tsx

[error] 18-18: framer-motion import should occur before import of next/image

(import/order)

app/positions/components/SuppliedMarketsDetail.tsx

[error] 10-10: framer-motion import should occur before import of next/link

(import/order)


[error] 10-10: 'AnimatePresence' is defined but never used.

(@typescript-eslint/no-unused-vars)

🔇 Additional comments (6)
src/components/layout/header/NavbarMobile.tsx (1)

40-52: Verify route matching behavior

The matchKey values match their href paths. Double check that:

  1. '/' correctly highlights only the home page
  2. '/markets' doesn't conflict with deeper market routes
  3. '/positions' works with dynamic addresses
app/markets/components/AssetFilter.tsx (1)

154-156: ⚠️ Potential issue

Fix aria-selected syntax and improve keyboard nav

The aria-selected attribute is missing a closing quote. Also consider adding arrow key navigation.

 aria-selected={selectedAssets.includes(
   token.networks.map((n) => infoToKey(n.address, n.chain.id)).join('|'),
-)}
+)}

Likely invalid or redundant comment.

app/markets/components/MarketTableBody.tsx (1)

181-200: Nice animation implementation

Clean implementation of expand/collapse animation with framer-motion.

app/positions/components/SuppliedMarketsDetail.tsx (1)

107-225: Table implementation looks good

Clean structure with good accessibility and error handling.

app/positions/components/PositionsSummaryTable.tsx (2)

199-202: LGTM: Position mapping looks good

The mapping logic correctly handles grouped positions and calculates average APY.


283-304: Good use of Framer Motion

The animation implementation provides smooth transitions for expanded rows.

Comment thread src/components/layout/header/NavbarMobile.tsx Outdated
Comment thread app/global.css
Comment thread app/markets/components/MarketTableBody.tsx Outdated
} from 'app/markets/components/RiskIndicator';
import { RebalanceModal } from './RebalanceModal';
import { SuppliedMarketsDetail } from './SuppliedMarketsDetail';
import { motion, AnimatePresence } from 'framer-motion';
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix import order

Move framer-motion import before next/image.

-import { motion, AnimatePresence } from 'framer-motion';
import Image from 'next/image';
+import { motion, AnimatePresence } from 'framer-motion';

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 eslint (1.23.1)

[error] 18-18: framer-motion import should occur before import of next/image

(import/order)

Comment on lines +213 to +214
src={getNetworkImg(groupedPosition.chainId) ?? ''}
alt={`Chain ${groupedPosition.chainId}`}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codebase verification

Add error handling for network images

The getNetworkImg function can return undefined, and there's no fallback handling in the Image components. Add onError handlers to prevent broken image displays.

  • app/positions/components/PositionsSummaryTable.tsx:213-214
  • app/rewards/components/UniformProgram.tsx
  • app/rewards/components/MarketProgram.tsx
  • Other instances using network images
🔗 Analysis chain

Consider error handling for network images

Add fallback for missing network images and token icons.

Also applies to: 222-226

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for image fallbacks in the codebase
rg -A 2 "getNetworkImg.*\?\?" .

Length of output: 972


Script:

#!/bin/bash
# Check for the implementation of getNetworkImg function
ast-grep --pattern 'function getNetworkImg($_) { $$$ }'

# Also check for any error handling or fallback components for images
rg -A 3 'onError.*Image|fallback.*Image' .

Length of output: 102


Script:

#!/bin/bash
# Let's try a different pattern to find getNetworkImg
rg -A 5 "getNetworkImg" .

# Also check for any image-related utilities or helpers
fd "image|img" --type f

Length of output: 9854


Script:

#!/bin/bash
# Check NextImage component for any built-in error handling
cat src/components/NextImage/NextImage.tsx

Length of output: 498

Copy link
Copy Markdown

@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: 3

🧹 Outside diff range and nitpick comments (2)
app/positions/components/SuppliedMarketsDetail.tsx (2)

61-67: Height animation might cause layout shifts

The auto height animation can be janky. Consider using a fixed height or transform instead.

 <motion.div
-  initial={{ height: 0 }}
-  animate={{ height: 'auto' }}
-  exit={{ height: 0 }}
+  initial={{ transform: 'translateY(-20px)', opacity: 0 }}
+  animate={{ transform: 'translateY(0)', opacity: 1 }}
+  exit={{ transform: 'translateY(-20px)', opacity: 0 }}
   transition={{ duration: 0.1 }}
   className="overflow-hidden"
 >

149-156: Remove commented tooltip code

Clean up the commented tooltip code around the market link.

-      {/* <Tooltip content="View on Explorer" placement="top"> */}
       <Link
         className="group flex items-center justify-center no-underline hover:underline"
         href={`/market/${position.market.morphoBlue.chain.id}/${position.market.uniqueKey}`}
       >
         {position.market.uniqueKey.slice(2, 8)}
       </Link>
-      {/* </Tooltip> */}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 09afb3a and e8df592.

📒 Files selected for processing (7)
  • app/markets/components/AssetFilter.tsx (2 hunks)
  • app/markets/components/MarketTableBody.tsx (2 hunks)
  • app/positions/components/PositionsContent.tsx (1 hunks)
  • app/positions/components/PositionsSummaryTable.tsx (8 hunks)
  • app/positions/components/SuppliedMarketsDetail.tsx (2 hunks)
  • src/components/layout/header/AccountConnect.tsx (1 hunks)
  • src/components/layout/header/NavbarMobile.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
  • app/markets/components/AssetFilter.tsx
  • app/positions/components/PositionsContent.tsx
  • app/positions/components/PositionsSummaryTable.tsx
  • src/components/layout/header/AccountConnect.tsx
  • src/components/layout/header/NavbarMobile.tsx
🧰 Additional context used
🪛 eslint (1.23.1)
app/markets/components/MarketTableBody.tsx

[error] 1-1: 'useState' is defined but never used.

(@typescript-eslint/no-unused-vars)


[error] 1-1: 'useEffect' is defined but never used.

(@typescript-eslint/no-unused-vars)

🔇 Additional comments (1)
app/markets/components/MarketTableBody.tsx (1)

173-192: Nice animation implementation

Clean implementation of expandable rows using framer-motion. The height animation provides smooth transitions.

@@ -1,5 +1,6 @@
import React from 'react';
import React, { useState, useEffect } from 'react';
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue

Remove unused imports

-import React, { useState, useEffect } from 'react';
+import React from 'react';
📝 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
import React, { useState, useEffect } from 'react';
import React from 'react';
🧰 Tools
🪛 eslint (1.23.1)

[error] 1-1: 'useState' is defined but never used.

(@typescript-eslint/no-unused-vars)


[error] 1-1: 'useEffect' is defined but never used.

(@typescript-eslint/no-unused-vars)

Comment on lines +202 to +221
<button
type="button"
className="bg-hovered rounded-sm p-1 text-xs duration-300 ease-in-out hover:bg-orange-500"
onClick={() => {
setSelectedPosition(position);
setShowWithdrawModal(true);
}}
>
Withdraw
</button>
<button
type="button"
className="bg-hovered rounded-sm p-1 text-xs duration-300 ease-in-out hover:bg-orange-500"
onClick={() => {
setSelectedPosition(position);
setShowSupplyModal(true);
}}
>
Supply
</button>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Improve button accessibility and feedback

Add focus styles and loading states to action buttons.

 <button
   type="button"
-  className="bg-hovered rounded-sm p-1 text-xs duration-300 ease-in-out hover:bg-orange-500"
+  className="bg-hovered rounded-sm p-1 text-xs duration-300 ease-in-out hover:bg-orange-500 focus:ring-2 focus:ring-orange-500 focus:outline-none disabled:opacity-50"
+  disabled={isLoading}
   onClick={() => {
     setSelectedPosition(position);
     setShowWithdrawModal(true);
   }}
 >
-  Withdraw
+  {isLoading ? 'Loading...' : 'Withdraw'}
 </button>

Committable suggestion skipped: line range outside the PR's diff.

Comment on lines +72 to +86
<div className="flex h-3 w-full overflow-hidden rounded-full bg-gray-200">
{groupedPosition.processedCollaterals.map((collateral, colIndex) => (
<div
key={`${collateral.address}-${colIndex}`}
className="h-full opacity-70"
style={{
color:
width: `${collateral.percentage}%`,
backgroundColor:
collateral.symbol === 'Others'
? '#A0AEC0'
: getCollateralColor(collateral.address),
}}
>
</span>{' '}
{collateral.symbol}: {formatReadable(collateral.percentage)}%
</span>
))}
title={`${collateral.symbol}: ${collateral.percentage.toFixed(2)}%`}
/>
))}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add accessibility attributes to chart

The collateral exposure bar chart needs aria labels for screen readers.

 <div 
   key={`${collateral.address}-${colIndex}`}
   className="h-full opacity-70"
+  role="progressbar"
+  aria-valuenow={collateral.percentage}
+  aria-valuemin="0"
+  aria-valuemax="100"
+  aria-label={`${collateral.symbol} collateral: ${collateral.percentage.toFixed(2)}%`}
   style={{
     width: `${collateral.percentage}%`,
     backgroundColor: collateral.symbol === 'Others' ? '#A0AEC0' : getCollateralColor(collateral.address),
   }}
-  title={`${collateral.symbol}: ${collateral.percentage.toFixed(2)}%`}
 />
📝 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="flex h-3 w-full overflow-hidden rounded-full bg-gray-200">
{groupedPosition.processedCollaterals.map((collateral, colIndex) => (
<div
key={`${collateral.address}-${colIndex}`}
className="h-full opacity-70"
style={{
color:
width: `${collateral.percentage}%`,
backgroundColor:
collateral.symbol === 'Others'
? '#A0AEC0'
: getCollateralColor(collateral.address),
}}
>
</span>{' '}
{collateral.symbol}: {formatReadable(collateral.percentage)}%
</span>
))}
title={`${collateral.symbol}: ${collateral.percentage.toFixed(2)}%`}
/>
))}
<div className="flex h-3 w-full overflow-hidden rounded-full bg-gray-200">
{groupedPosition.processedCollaterals.map((collateral, colIndex) => (
<div
key={`${collateral.address}-${colIndex}`}
className="h-full opacity-70"
role="progressbar"
aria-valuenow={collateral.percentage}
aria-valuemin="0"
aria-valuemax="100"
aria-label={`${collateral.symbol} collateral: ${collateral.percentage.toFixed(2)}%`}
style={{
width: `${collateral.percentage}%`,
backgroundColor:
collateral.symbol === 'Others'
? '#A0AEC0'
: getCollateralColor(collateral.address),
}}
/>
))}

Copy link
Copy Markdown

@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

🧹 Outside diff range and nitpick comments (1)
app/markets/components/MarketTableBody.tsx (1)

173-192: Consider slightly longer transition

0.1s might feel abrupt. Try 0.2s for smoother expand/collapse.

-      transition={{ duration: 0.1 }}
+      transition={{ duration: 0.2 }}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between e8df592 and 64a4bbc.

📒 Files selected for processing (2)
  • app/markets/components/MarketTableBody.tsx (2 hunks)
  • src/components/layout/header/NavbarMobile.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/layout/header/NavbarMobile.tsx
🔇 Additional comments (1)
app/markets/components/MarketTableBody.tsx (1)

3-3: LGTM!

Clean import of framer-motion for animations.

@antoncoding antoncoding merged commit 7262843 into master Nov 25, 2024
@antoncoding antoncoding deleted the feat/slogan branch November 25, 2024 09:56
@coderabbitai coderabbitai Bot mentioned this pull request Aug 18, 2025
@coderabbitai coderabbitai Bot mentioned this pull request Nov 2, 2025
@coderabbitai coderabbitai Bot mentioned this pull request Nov 30, 2025
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