Skip to content

Conversation

@PetarStoev02
Copy link
Contributor

Summary

  • Migrate AssetPortfolio component to shadcn registry format
  • Extract types and utilities to separate files for better maintainability
  • Replace next/image with native img for framework-agnostic portability
  • Remove dependency on internal @/config/tokens - token config is now part of the Asset interface

Changes

File Description
registry/w3-kit/asset-portfolio/asset-portfolio.tsx Main component with PriceChart, AssetItem, TimeframeSelector, and PortfolioDistributionChart
registry/w3-kit/asset-portfolio/types.ts TypeScript interfaces (Asset, TokenConfig, CandleData, AssetPortfolioProps)
registry/w3-kit/asset-portfolio/utils.ts Utility functions (formatCurrency, formatPercent, getChainName, getExplorerUrl)
registry.json shadcn registry manifest
components.json shadcn configuration

Installation

npx shadcn@latest add @w3-kit/asset-portfolio

Test plan

  • Verify component renders correctly with sample asset data
  • Test price chart displays with different timeframes (24h, 7d, 30d)
  • Test portfolio distribution chart interaction (hover/click)
  • Test compact variant rendering
  • Verify multi-chain explorer URLs work correctly

Closes #2

- Create registry structure for @w3-kit/asset-portfolio component
- Extract types to separate file (Asset, TokenConfig, CandleData, AssetPortfolioProps)
- Extract utilities to separate file (formatCurrency, formatPercent, getChainName, getExplorerUrl)
- Replace next/image with native img for portability
- Remove dependency on internal @/config/tokens
- Add chart.js and react-chartjs-2 as component dependencies
- Add registry.json and components.json for shadcn configuration

Component can be installed via: npx shadcn@latest add @w3-kit/asset-portfolio
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.

[Migration] Migrate AssetPortfolio to shadcn registry

2 participants