fixed a lot of lint and work on utils
This commit is contained in:
parent
4881a38c32
commit
42bc2966df
17 changed files with 183 additions and 93 deletions
|
|
@ -19,7 +19,7 @@ export function formatPercentage(value: number): string {
|
|||
}
|
||||
|
||||
export function getValueColor(value: number): string {
|
||||
if (value > 0) return 'text-success';
|
||||
if (value < 0) return 'text-danger';
|
||||
if (value > 0) {return 'text-success';}
|
||||
if (value < 0) {return 'text-danger';}
|
||||
return 'text-text-secondary';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,9 +23,9 @@ export function formatPercentage(value: number, decimals = 2): string {
|
|||
* Format large numbers with K, M, B suffixes
|
||||
*/
|
||||
export function formatNumber(num: number): string {
|
||||
if (num >= 1e9) return (num / 1e9).toFixed(1) + 'B';
|
||||
if (num >= 1e6) return (num / 1e6).toFixed(1) + 'M';
|
||||
if (num >= 1e3) return (num / 1e3).toFixed(1) + 'K';
|
||||
if (num >= 1e9) {return (num / 1e9).toFixed(1) + 'B';}
|
||||
if (num >= 1e6) {return (num / 1e6).toFixed(1) + 'M';}
|
||||
if (num >= 1e3) {return (num / 1e3).toFixed(1) + 'K';}
|
||||
return num.toString();
|
||||
}
|
||||
|
||||
|
|
@ -33,8 +33,8 @@ export function formatNumber(num: number): string {
|
|||
* Get color class based on numeric value (profit/loss)
|
||||
*/
|
||||
export function getValueColor(value: number): string {
|
||||
if (value > 0) return 'text-success';
|
||||
if (value < 0) return 'text-danger';
|
||||
if (value > 0) {return 'text-success';}
|
||||
if (value < 0) {return 'text-danger';}
|
||||
return 'text-text-secondary';
|
||||
}
|
||||
|
||||
|
|
@ -42,6 +42,6 @@ export function getValueColor(value: number): string {
|
|||
* Truncate text to specified length
|
||||
*/
|
||||
export function truncateText(text: string, length: number): string {
|
||||
if (text.length <= length) return text;
|
||||
if (text.length <= length) {return text;}
|
||||
return text.slice(0, length) + '...';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue