refactor: replace formatPrice with formatNumber#4
Conversation
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
There was a problem hiding this comment.
Pull request overview
This PR refactors the frontend formatting utilities by removing the formatPrice compatibility wrapper and standardizing on formatNumber, with follow-up updates to UI usage and generated type declarations. It also addresses PrimeVue tab typing issues in the AI trade reasoning view.
Changes:
- Removed
formatPricefrom the number formatter module and replaced call sites withformatNumber. - Updated UI components and utilities to use
formatNumberconsistently (while retainingformatPriceCurrency). - Updated generated typing files and added missing
valueprops to<TabPanel>entries to resolve TypeScript errors.
Reviewed changes
Copilot reviewed 14 out of 16 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| frequi/src/utils/formatters/numberformat.ts | Removes the formatPrice wrapper and routes currency formatting through formatNumber. |
| frequi/src/utils/backtestMetrics.ts | Switches stake formatting from formatPrice to formatNumber. |
| frequi/src/components/general/ProfitPill.vue | Updates profit display formatting to use formatNumber. |
| frequi/src/components/ftbot/TradeList.vue | Updates trade list numeric formatting to use formatNumber. |
| frequi/src/components/ftbot/TradeDetail.vue | Updates trade detail numeric formatting to use formatNumber. |
| frequi/src/components/ftbot/PeriodBreakdown.vue | Replaces formatting calls with formatNumber in period breakdown table. |
| frequi/src/components/ftbot/CustomTradeListEntry.vue | Updates trade entry formatting to use formatNumber. |
| frequi/src/components/ftbot/BotPerformance.vue | Updates performance table formatter to use formatNumber. |
| frequi/src/components/ftbot/BotComparisonList.vue | Updates balance formatting to use formatNumber. |
| frequi/src/components/ftbot/BotBalance.vue | Updates balance formatting helper to use formatNumber. |
| frequi/src/components/ftbot/BacktestResultTablePer.vue | Replaces backtest result number formatting with formatNumber. |
| frequi/src/components/ftbot/BacktestResultPeriodBreakdown.vue | Updates period breakdown formatting to use formatNumber. |
| frequi/src/components/charts/CumProfitChart.vue | Updates tooltip profit formatting to use formatNumber. |
| frequi/src/components/ai/TradeReasoning.vue | Adds missing value props to TabPanel elements to satisfy TS typing. |
| frequi/src/components.d.ts | Updates generated global component typings (new AI components included). |
| frequi/src/auto-imports.d.ts | Removes formatPrice from Vue component custom properties typings. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| function useFormatPriceStake(stake_currency_decimals: number, stake_currency: string) { | ||
| const formatPriceStake = (price) => { | ||
| return `${formatPrice(price, stake_currency_decimals)} ${stake_currency}`; | ||
| return `${formatNumber(price, stake_currency_decimals)} ${stake_currency}`; | ||
| }; | ||
| return formatPriceStake; | ||
| } |
| const confirmExitValue = ref<ModalReasons | null>(null); | ||
|
|
||
| const increasePosition = ref({ visible: false, trade: {} as Trade }); | ||
| function formatPriceWithDecimals(price: number) { |
| } else if (props.profitAbs !== undefined) { | ||
| if (props.stakeCurrency !== undefined) { | ||
| return `${formatPriceCurrency(props.profitAbs, props.stakeCurrency, 3)}`; | ||
| } else { | ||
| return `${formatPrice(props.profitAbs, 3)}`; | ||
| return `${formatNumber(props.profitAbs, 3)}`; | ||
| } |
Replace
formatPricecompatibility wrapper function call usage or implementation withformatNumber.formatPriceusage insrc/utils/formatters/numberformat.tsand many places around the codebase.formatPricewithformatNumbereverywhere in the codebase.formatPriceimplementation fromsrc/utils/formatters/numberformat.ts.src/components/ai/TradeReasoning.vueto add the missingvalueproperties to the<TabPanel>elements to resolve the TypeScript errors.pnpm typecheckandpnpm test:unitto ensure everything works properly.PR created automatically by Jules for task 3511230033843476217 started by @ymcbzrgn