-
Notifications
You must be signed in to change notification settings - Fork 429
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
add favorites to portfolio #3853
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
4 Skipped Deployments
|
WalkthroughThe changes introduce functionality for managing a user watchlist and a favorites list within the Changes
Possibly related PRs
Suggested reviewers
Recent review detailsConfiguration used: CodeRabbit UI Files selected for processing (1)
Files skipped from review as they are similar to previous changes (1)
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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 (4)
packages/web/components/table/cells/asset.tsx (1)
43-43
: LGTM! Consider a minor optimization.The conditional
id
for the star icon is correctly implemented, aligning with the PR objective of adding favorites functionality. This change allows for different icon representations based on the watchlist status, which is great.For a minor optimization, consider moving the condition outside the JSX:
+ const starIconId = isInUserWatchlist ? "star" : "star-outlined"; <Icon onClick={(e) => { e.stopPropagation(); e.preventDefault(); onClickWatchlist(); }} className={classNames( "cursor-pointer transition-colors duration-150 ease-out hover:text-wosmongton-300", isInUserWatchlist ? "text-wosmongton-400" : "text-osmoverse-600" )} - id={isInUserWatchlist ? "star" : "star-outlined"} + id={starIconId} />This change would slightly improve readability and prevent the condition from being re-evaluated on each render.
packages/web/components/table/asset-balances.tsx (3)
173-176
: Consider initializingfavoritesList
with an empty arrayInitializing
favoritesList
with default values["OSMO", "ATOM", "TIA"]
may not align with user expectations. It might be better to start with an empty list and allow users to add their own favorites.
174-175
: Namespace the localStorage key to avoid conflictsUsing a generic key like
"favoritesList"
in localStorage may lead to potential conflicts with other applications or components. Consider namespacing the key, for example,"osmosisFavoritesList"
, to prevent collisions.
244-252
: Review dependency array inuseMemo
hookIncluding
onSetFavoritesList
in the dependency array may not be necessary. Setter functions from state hooks are generally stable and can be excluded to prevent unnecessary re-renders.
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
packages/web/public/icons/sprite.svg
is excluded by!**/*.svg
,!**/*.svg
Files selected for processing (2)
- packages/web/components/table/asset-balances.tsx (4 hunks)
- packages/web/components/table/cells/asset.tsx (1 hunks)
Additional comments not posted (2)
packages/web/components/table/cells/asset.tsx (1)
Line range hint
1-89
: Excellent component structure and implementation!The
AssetCell
component is well-designed and follows React best practices. Here are some notable points:
- Proper TypeScript typing for enhanced type safety.
- Flexible prop structure allowing partial props.
- Responsive design with different styles for mobile and desktop.
- Use of Next.js Image component for optimized image loading.
- Internationalization support via the
useTranslation
hook.- Proper handling of accessibility concerns (e.g., alt text for images).
- Efficient use of classNames for conditional styling.
The component effectively implements the favorites functionality while maintaining a clean and maintainable structure. Great job!
packages/web/components/table/asset-balances.tsx (1)
189-198
: EnsurecoinDenom
uniquely identifies assetsUsing
coinDenom
to identify assets infavoritesList
may lead to issues if multiple assets share the samecoinDenom
. Verify thatcoinDenom
uniquely identifies each asset, or consider using a more unique identifier likecoinMinimalDenom
or an asset ID.
* Amplitude: prevent outlier value usd logs (#3825) * prevent outlier value usd logs * usd const * forgot one * format * Mattupham/fe 726 porfolio v3 alloyed convert button deposit withdraw dropdown (#3841) * Add convert button * Add convert button * Clean up * Handle feature via flag * Update icons * Clean up * Clean up * i18n * Extract functionality * Extract type * Clean up comments * Refactor icon * Clean up styles * Update types * fix: amino signing for withdraw position message (#3852) * add favorites to portfolio (#3853) * Update sprite * Clean up * Update to useUserWatchlist --------- Co-authored-by: Jon Ator <jonathanator0@gmail.com> Co-authored-by: Matt Upham <30577966+mattupham@users.noreply.github.com> Co-authored-by: PaddyMc <paddymchale@hotmail.com>
What is the purpose of the change:
Linear Task
https://linear.app/osmosis/issue/FE-1045/portfolio-v3-favorites
Brief Changelog
Testing and Verifying
Screen.Recording.2024-09-24.at.10.49.25.AM.mov