feat: Add Copy Strategy button to Insights signal cards#494
Conversation
📝 WalkthroughWalkthroughThis pull request enhances the trading signals interface by adding clipboard copy functionality to the SignalCard component, improving logging in the signal fetching hook, and applying minor formatting adjustments across the insights module. Changes
Estimated Code Review Effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Deploying pillarx-debug with
|
| Latest commit: |
f73c58c
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://276b7883.pillarx-debug.pages.dev |
| Branch Preview URL: | https://copy-strategy.pillarx-debug.pages.dev |
Deploying x with
|
| Latest commit: |
f73c58c
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://2db4ed60.x-e62.pages.dev |
| Branch Preview URL: | https://copy-strategy.x-e62.pages.dev |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @src/apps/insights/components/SignalCard/SignalCard.tsx:
- Around line 42-61: The copyStrategy function currently hardcodes the exchange
as "BINANCE"; update it to use dynamic data by reading the exchange from the
signal object (e.g., signal.exchange or signal.exchange_name) and fall back to a
module-level default constant (e.g., EXCHANGE_DEFAULT) or a config value if the
signal exchange is missing; ensure the identifier copyStrategy is changed to
reference that dynamic value when building the strategy object and keep the same
fallback behavior to avoid breaking copies for older signals.
🧹 Nitpick comments (1)
src/apps/insights/hooks/useTradingSignals.ts (1)
30-70: Review the dependency array inclusion ofisInitialLoad.Adding
isInitialLoadto theuseCallbackdependency array (line 70) will causefetchSignalsto be recreated whenisInitialLoadtransitions fromtruetofalse. However,isInitialLoadis only written inside the callback (lines 60-62) and not used for any conditional logic within it.This creates an unnecessary dependency that triggers callback recreation. Consider whether this behavior is intentional:
- If you only need to track initial load completion,
isInitialLoadcan be safely removed from the dependency array- The state update inside the callback will work correctly without this dependency
The verbose logging additions (lines 32-54) are helpful for debugging and provide good visibility into the signal fetching process.
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/apps/insights/components/SignalCard/SignalCard.tsxsrc/apps/insights/hooks/useTradingSignals.tssrc/apps/insights/index.tsx
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-12-03T10:01:15.801Z
Learnt from: aldin4u
Repo: pillarwallet/x PR: 471
File: src/apps/pillarx-app/components/AlgoInsightsTile/AlgoInsightsTile.tsx:36-48
Timestamp: 2025-12-03T10:01:15.801Z
Learning: In the AlgoInsightsTile component (src/apps/pillarx-app/components/AlgoInsightsTile/AlgoInsightsTile.tsx), the data is always hardcoded and guaranteed to be present with complete history arrays for all timeframes, so edge case handling for empty or sparse history data is not required.
Applied to files:
src/apps/insights/index.tsx
📚 Learning: 2025-11-21T13:10:33.422Z
Learnt from: aldin4u
Repo: pillarwallet/x PR: 461
File: src/apps/pulse/components/Search/MarketList.tsx:10-15
Timestamp: 2025-11-21T13:10:33.422Z
Learning: In the Pulse app's MarketList component (src/apps/pulse/components/Search/MarketList.tsx), markets should display liquidity (not price) in the right-hand column. This is per the design specification.
Applied to files:
src/apps/insights/components/SignalCard/SignalCard.tsx
🧬 Code graph analysis (2)
src/apps/insights/index.tsx (1)
src/apps/insights/components/FeedEventCard/FeedEventCard.tsx (1)
FeedEventCard(16-100)
src/apps/insights/hooks/useTradingSignals.ts (2)
src/apps/insights/api/insightsApi.ts (1)
getTradingSignals(46-65)src/apps/insights/types/index.ts (1)
TradingSignal(5-35)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: unit-tests
- GitHub Check: lint
- GitHub Check: build
- GitHub Check: Cloudflare Pages: pillarx-debug
🔇 Additional comments (2)
src/apps/insights/index.tsx (1)
127-127: LGTM! Formatting improvements with safe error handling.The changes consist primarily of spacing improvements for readability. The empty catch blocks on lines 309 and 328 appropriately suppress errors during subscription refresh operations, preventing UI disruption when background checks fail.
Also applies to: 165-165, 191-191, 197-197, 201-201, 206-206, 262-262, 270-270, 309-309, 328-328, 646-651
src/apps/insights/components/SignalCard/SignalCard.tsx (1)
136-159: LGTM! Well-implemented copy functionality.The Copy Strategy button provides good UX with:
- Visual feedback via state toggle (Check icon + "Copied!" text)
- Appropriate 2-second timeout for feedback reset
- Error handling with console logging
- Conditional rendering only for open signals
Description
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Summary by CodeRabbit
New Features
Style
Chores
✏️ Tip: You can customize this high-level summary in your review settings.