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
|
|
@ -10,7 +10,7 @@ export function Layout() {
|
|||
// Determine title from current route
|
||||
const getTitle = () => {
|
||||
const path = location.pathname.replace('/', '');
|
||||
if (!path || path === 'dashboard') return 'Dashboard';
|
||||
if (!path || path === 'dashboard') {return 'Dashboard';}
|
||||
return path.charAt(0).toUpperCase() + path.slice(1);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import React from 'react';
|
||||
import { XMarkIcon } from '@heroicons/react/24/outline';
|
||||
|
||||
interface DialogProps {
|
||||
open: boolean;
|
||||
|
|
@ -8,7 +7,7 @@ interface DialogProps {
|
|||
}
|
||||
|
||||
export function Dialog({ open, onOpenChange, children }: DialogProps) {
|
||||
if (!open) return null;
|
||||
if (!open) {return null;}
|
||||
|
||||
return (
|
||||
<div className="fixed inset-0 z-50 flex items-center justify-center">
|
||||
|
|
|
|||
|
|
@ -278,9 +278,9 @@ export function PortfolioTable() {
|
|||
size: 120,
|
||||
cell: ({ getValue }) => {
|
||||
const value = getValue() as number;
|
||||
if (value >= 1e12) return <span className="font-mono">${(value / 1e12).toFixed(2)}T</span>;
|
||||
if (value >= 1e9) return <span className="font-mono">${(value / 1e9).toFixed(2)}B</span>;
|
||||
if (value >= 1e6) return <span className="font-mono">${(value / 1e6).toFixed(2)}M</span>;
|
||||
if (value >= 1e12) {return <span className="font-mono">${(value / 1e12).toFixed(2)}T</span>;}
|
||||
if (value >= 1e9) {return <span className="font-mono">${(value / 1e9).toFixed(2)}B</span>;}
|
||||
if (value >= 1e6) {return <span className="font-mono">${(value / 1e6).toFixed(2)}M</span>;}
|
||||
return <span className="font-mono">${value.toLocaleString()}</span>;
|
||||
},
|
||||
},
|
||||
|
|
@ -327,8 +327,8 @@ export function PortfolioTable() {
|
|||
size: 120,
|
||||
cell: ({ getValue }) => {
|
||||
const value = getValue() as number;
|
||||
if (value >= 1e9) return <span className="font-mono">${(value / 1e9).toFixed(2)}B</span>;
|
||||
if (value >= 1e6) return <span className="font-mono">${(value / 1e6).toFixed(2)}M</span>;
|
||||
if (value >= 1e9) {return <span className="font-mono">${(value / 1e9).toFixed(2)}B</span>;}
|
||||
if (value >= 1e6) {return <span className="font-mono">${(value / 1e6).toFixed(2)}M</span>;}
|
||||
return <span className="font-mono">${value.toLocaleString()}</span>;
|
||||
},
|
||||
},
|
||||
|
|
@ -339,8 +339,8 @@ export function PortfolioTable() {
|
|||
size: 120,
|
||||
cell: ({ getValue }) => {
|
||||
const value = getValue() as number;
|
||||
if (value >= 1e9) return <span className="font-mono">${(value / 1e9).toFixed(2)}B</span>;
|
||||
if (value >= 1e6) return <span className="font-mono">${(value / 1e6).toFixed(2)}M</span>;
|
||||
if (value >= 1e9) {return <span className="font-mono">${(value / 1e9).toFixed(2)}B</span>;}
|
||||
if (value >= 1e6) {return <span className="font-mono">${(value / 1e6).toFixed(2)}M</span>;}
|
||||
return <span className="font-mono">${value.toLocaleString()}</span>;
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ export function AddProviderMappingDialog({
|
|||
const exchange = unmappedExchanges.find(
|
||||
ex => ex.provider_exchange_code === selectedProviderExchange
|
||||
);
|
||||
if (!exchange) return null;
|
||||
if (!exchange) {return null;}
|
||||
|
||||
return (
|
||||
<div className="space-y-1 text-xs">
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ export function AddSourceDialog({
|
|||
|
||||
const handleSubmit = async (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
if (!source || !sourceCode || !id || !name || !code) return;
|
||||
if (!source || !sourceCode || !id || !name || !code) {return;}
|
||||
|
||||
setLoading(true);
|
||||
try {
|
||||
|
|
@ -52,8 +52,8 @@ export function AddSourceDialog({
|
|||
setName('');
|
||||
setCode('');
|
||||
setAliases('');
|
||||
} catch (error) {
|
||||
console.error('Error adding source:', error);
|
||||
} catch (_error) {
|
||||
console.error('Error adding source:', _error);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ export function useFormValidation<T>(
|
|||
onSuccess?: () => void,
|
||||
onError?: (error: unknown) => void
|
||||
) => {
|
||||
if (!validate()) return;
|
||||
if (!validate()) {return;}
|
||||
|
||||
setIsSubmitting(true);
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -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