fixed lint issues

This commit is contained in:
Boki 2025-06-23 17:07:30 -04:00
parent b67fe48f72
commit 519d24722e
12 changed files with 54 additions and 46 deletions

View file

@ -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';}
// Handle nested routes
if (path.includes('/')) {

View file

@ -1,4 +1,5 @@
import { navigation } from '@/lib/constants';
import type { NavigationItem } from '@/lib/constants';
import { cn } from '@/lib/utils';
import { Dialog, Transition } from '@headlessui/react';
import { XMarkIcon, ChevronDownIcon, ChevronRightIcon } from '@heroicons/react/24/outline';
@ -101,7 +102,7 @@ function SidebarContent() {
setExpandedItems(newExpanded);
};
const isChildActive = (children: any[]) => {
const isChildActive = (children: NavigationItem[]) => {
return children.some(child => location.pathname === child.href);
};
@ -148,7 +149,7 @@ function SidebarContent() {
{item.children.map(child => (
<li key={child.name}>
<NavLink
to={child.href!}
to={child.href || ''}
className={({ isActive }) =>
cn(
isActive
@ -180,7 +181,7 @@ function SidebarContent() {
</>
) : (
<NavLink
to={item.href!}
to={item.href || ''}
className={({ isActive }) =>
cn(
isActive

View file

@ -8,7 +8,15 @@ interface AddProviderMappingDialogProps {
exchangeId: string;
exchangeName: string;
onClose: () => void;
onCreateMapping: (request: CreateProviderMappingRequest) => Promise<any>;
onCreateMapping: (request: CreateProviderMappingRequest) => Promise<boolean | void>;
}
interface UnmappedExchange {
provider_exchange_code: string;
provider_exchange_name: string;
country_code?: string;
currency?: string;
symbol_count?: number;
}
export function AddProviderMappingDialog({
@ -21,29 +29,12 @@ export function AddProviderMappingDialog({
const { fetchProviders, fetchUnmappedProviderExchanges } = useExchanges();
const [providers, setProviders] = useState<string[]>([]);
const [selectedProvider, setSelectedProvider] = useState('');
const [unmappedExchanges, setUnmappedExchanges] = useState<any[]>([]);
const [unmappedExchanges, setUnmappedExchanges] = useState<UnmappedExchange[]>([]);
const [selectedProviderExchange, setSelectedProviderExchange] = useState('');
const [loading, setLoading] = useState(false);
const [providersLoading, setProvidersLoading] = useState(false);
const [exchangesLoading, setExchangesLoading] = useState(false);
// Load providers on mount
useEffect(() => {
if (isOpen) {
loadProviders();
}
}, [isOpen, loadProviders]);
// Load unmapped exchanges when provider changes
useEffect(() => {
if (selectedProvider) {
loadUnmappedExchanges(selectedProvider);
} else {
setUnmappedExchanges([]);
setSelectedProviderExchange('');
}
}, [selectedProvider, loadUnmappedExchanges]);
const loadProviders = useCallback(async () => {
setProvidersLoading(true);
try {
@ -71,6 +62,23 @@ export function AddProviderMappingDialog({
[fetchUnmappedProviderExchanges]
);
// Load providers on mount
useEffect(() => {
if (isOpen) {
loadProviders();
}
}, [isOpen, loadProviders]);
// Load unmapped exchanges when provider changes
useEffect(() => {
if (selectedProvider) {
loadUnmappedExchanges(selectedProvider);
} else {
setUnmappedExchanges([]);
setSelectedProviderExchange('');
}
}, [selectedProvider, loadUnmappedExchanges]);
const handleSubmit = useCallback(
async (e: React.FormEvent) => {
e.preventDefault();

View file

@ -1,6 +1,6 @@
import { DataTable } from '@/components/ui';
import { PlusIcon, TrashIcon } from '@heroicons/react/24/outline';
import type { ColumnDef } from '@tanstack/react-table';
import type { ColumnDef, Row } from '@tanstack/react-table';
import { useCallback, useMemo, useState } from 'react';
import { useExchanges } from '../hooks/useExchanges';
import type { AddProviderMappingDialogState, DeleteDialogState, EditingCell, Exchange } from '../types';
@ -70,7 +70,7 @@ export function ExchangesTable() {
);
const handleRowExpand = useCallback(
async (_row: any) => {
(_row: Row<Exchange>) => {
// Row expansion is now handled automatically by TanStack Table
// No need to fetch data since all mappings are already loaded
},
@ -319,7 +319,6 @@ export function ExchangesTable() {
handleToggleActive,
handleAddProviderMapping,
handleDeleteExchange,
handleConfirmDelete,
handleRowExpand,
]);
@ -335,7 +334,7 @@ export function ExchangesTable() {
);
}
const renderSubComponent = ({ row }: { row: any }) => {
const renderSubComponent = ({ row }: { row: Row<Exchange> }) => {
const exchange = row.original as Exchange;
const mappings = exchange.provider_mappings || [];

View file

@ -17,7 +17,7 @@ export function ProxyStatsCard({ stats }: ProxyStatsCardProps) {
: 0;
const formatDate = (dateString?: string) => {
if (!dateString) return 'Never';
if (!dateString) {return 'Never';}
const date = new Date(dateString);
return date.toLocaleString();
};

View file

@ -18,7 +18,7 @@ export interface CacheStats {
evictedKeys?: number;
expiredKeys?: number;
};
info?: Record<string, any>;
info?: Record<string, unknown>;
}
export interface QueueStats {
@ -57,7 +57,7 @@ export interface DatabaseStats {
waiting?: number;
max: number;
};
stats?: Record<string, any>;
stats?: Record<string, unknown>;
}
export interface SystemHealth {

View file

@ -8,9 +8,9 @@ export function formatUptime(ms: number): string {
const hours = Math.floor(minutes / 60);
const days = Math.floor(hours / 24);
if (days > 0) return `${days}d ${hours % 24}h`;
if (hours > 0) return `${hours}h ${minutes % 60}m`;
if (minutes > 0) return `${minutes}m ${seconds % 60}s`;
if (days > 0) {return `${days}d ${hours % 24}h`;}
if (hours > 0) {return `${hours}h ${minutes % 60}m`;}
if (minutes > 0) {return `${minutes}m ${seconds % 60}s`;}
return `${seconds}s`;
}

View file

@ -1,4 +1,4 @@
import { useState, useEffect } from 'react';
import { useState, useEffect, useCallback } from 'react';
import {
ArrowPathIcon,
CircleStackIcon,
@ -7,7 +7,7 @@ import {
CheckCircleIcon,
} from '@heroicons/react/24/outline';
import { usePipeline } from './hooks/usePipeline';
import type { PipelineOperation } from './types';
import type { PipelineOperation, ExchangeStats, ProviderMappingStats, DataClearType } from './types';
const operations: PipelineOperation[] = [
// Symbol operations
@ -93,14 +93,14 @@ export function PipelinePage() {
const [selectedProvider, setSelectedProvider] = useState('yahoo');
const [clearFirst, setClearFirst] = useState(false);
const [clearDataType, setClearDataType] = useState<'all' | 'exchanges' | 'provider_mappings'>('all');
const [stats, setStats] = useState<{ exchanges?: any; providerMappings?: any }>({});
const [stats, setStats] = useState<{ exchanges?: ExchangeStats; providerMappings?: ProviderMappingStats }>({});
// Load stats on mount
useEffect(() => {
loadStats();
}, []);
}, [loadStats]);
const loadStats = async () => {
const loadStats = useCallback(async () => {
const [exchangeStats, mappingStats] = await Promise.all([
getExchangeStats(),
getProviderMappingStats(),
@ -109,7 +109,7 @@ export function PipelinePage() {
exchanges: exchangeStats,
providerMappings: mappingStats,
});
};
}, [getExchangeStats, getProviderMappingStats]);
const handleOperation = async (op: PipelineOperation) => {
switch (op.id) {
@ -368,7 +368,7 @@ export function PipelinePage() {
<label className="block text-xs text-text-muted mb-1">Data Type</label>
<select
value={clearDataType}
onChange={e => setClearDataType(e.target.value as any)}
onChange={e => setClearDataType(e.target.value as DataClearType)}
className="w-full px-2 py-1 text-xs bg-surface border border-border rounded focus:ring-1 focus:ring-warning focus:border-warning"
>
<option value="all">All Data</option>

View file

@ -7,7 +7,7 @@ import type {
const API_BASE_URL = import.meta.env.VITE_API_BASE_URL || 'http://localhost:2003';
class PipelineApiService {
private async request<T = any>(
private async request<T = unknown>(
endpoint: string,
options?: RequestInit
): Promise<T> {

View file

@ -5,12 +5,12 @@ export interface PipelineJobResult {
jobId?: string;
message?: string;
error?: string;
data?: any;
data?: unknown;
}
export interface PipelineStatsResult {
success: boolean;
data?: any;
data?: unknown;
error?: string;
}
@ -54,5 +54,5 @@ export interface PipelineOperation {
method: 'GET' | 'POST';
category: 'sync' | 'stats' | 'maintenance';
dangerous?: boolean;
params?: Record<string, any>;
params?: Record<string, unknown>;
}

View file

@ -13,7 +13,7 @@ import {
export interface NavigationItem {
name: string;
href?: string;
icon: any;
icon: React.ComponentType<React.SVGProps<SVGSVGElement>>;
children?: NavigationItem[];
}

View file

@ -32,7 +32,7 @@ export function registerApplicationServices(
if (config.proxy && config.redis.enabled) {
container.register({
proxyManager: asFunction(({ cache, logger }) => {
if (!cache) return null;
if (!cache) {return null;}
const proxyCache = new NamespacedCache(cache, 'proxy');
const proxyManager = new ProxyManager(proxyCache, config.proxy, logger);