commit 2 refactor
This commit is contained in:
parent
588f666943
commit
32e43c9243
310 changed files with 33318 additions and 31189 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import { Dialog, DialogContent, DialogHeader, DialogTitle, Button } from '@/components/ui';
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
import { Button, Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui';
|
||||
import { useExchanges } from '../hooks/useExchanges';
|
||||
import type { CreateProviderMappingRequest } from '../types/index';
|
||||
import type { CreateProviderMappingRequest, ProviderExchange } from '../types/index';
|
||||
|
||||
interface AddProviderMappingDialogProps {
|
||||
isOpen: boolean;
|
||||
|
|
@ -11,13 +11,7 @@ interface AddProviderMappingDialogProps {
|
|||
onCreateMapping: (request: CreateProviderMappingRequest) => Promise<boolean | void>;
|
||||
}
|
||||
|
||||
interface UnmappedExchange {
|
||||
provider_exchange_code: string;
|
||||
provider_exchange_name: string;
|
||||
country_code?: string;
|
||||
currency?: string;
|
||||
symbol_count?: number;
|
||||
}
|
||||
type UnmappedExchange = ProviderExchange;
|
||||
|
||||
export function AddProviderMappingDialog({
|
||||
isOpen,
|
||||
|
|
@ -102,8 +96,8 @@ export function AddProviderMappingDialog({
|
|||
provider_exchange_code: selectedExchange.provider_exchange_code,
|
||||
provider_exchange_name: selectedExchange.provider_exchange_name,
|
||||
master_exchange_id: exchangeId,
|
||||
country_code: selectedExchange.country_code,
|
||||
currency: selectedExchange.currency,
|
||||
country_code: selectedExchange.country_code ?? undefined,
|
||||
currency: selectedExchange.currency ?? undefined,
|
||||
confidence: 1.0,
|
||||
active: false,
|
||||
verified: false,
|
||||
|
|
@ -181,13 +175,16 @@ export function AddProviderMappingDialog({
|
|||
{!selectedProvider
|
||||
? 'Select a provider first'
|
||||
: exchangesLoading
|
||||
? 'Loading exchanges...'
|
||||
: unmappedExchanges.length === 0
|
||||
? 'No unmapped exchanges available'
|
||||
: 'Select an exchange'}
|
||||
? 'Loading exchanges...'
|
||||
: unmappedExchanges.length === 0
|
||||
? 'No unmapped exchanges available'
|
||||
: 'Select an exchange'}
|
||||
</option>
|
||||
{unmappedExchanges.map(exchange => (
|
||||
<option key={exchange.provider_exchange_code} value={exchange.provider_exchange_code}>
|
||||
<option
|
||||
key={exchange.provider_exchange_code}
|
||||
value={exchange.provider_exchange_code}
|
||||
>
|
||||
{exchange.provider_exchange_code} - {exchange.provider_exchange_name}
|
||||
{exchange.country_code && ` (${exchange.country_code})`}
|
||||
</option>
|
||||
|
|
@ -208,7 +205,9 @@ 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">
|
||||
|
|
@ -217,7 +216,8 @@ export function AddProviderMappingDialog({
|
|||
<span className="font-mono">{exchange.provider_exchange_code}</span>
|
||||
</div>
|
||||
<div>
|
||||
<span className="text-text-muted">Name:</span> {exchange.provider_exchange_name}
|
||||
<span className="text-text-muted">Name:</span>{' '}
|
||||
{exchange.provider_exchange_name}
|
||||
</div>
|
||||
{exchange.country_code && (
|
||||
<div>
|
||||
|
|
@ -256,4 +256,4 @@ export function AddProviderMappingDialog({
|
|||
</DialogContent>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue