finished exchanges api connections
This commit is contained in:
parent
d7780e9684
commit
e8fbe76f2e
6 changed files with 306 additions and 23 deletions
|
|
@ -15,10 +15,10 @@ export function AddSourceDialog({
|
|||
isOpen,
|
||||
onClose,
|
||||
onAddSource,
|
||||
exchangeId,
|
||||
exchangeName,
|
||||
}: AddSourceDialogProps) {
|
||||
const [source, setSource] = useState('');
|
||||
const [sourceCode, setSourceCode] = useState('');
|
||||
const [id, setId] = useState('');
|
||||
const [name, setName] = useState('');
|
||||
const [code, setCode] = useState('');
|
||||
|
|
@ -27,12 +27,13 @@ export function AddSourceDialog({
|
|||
|
||||
const handleSubmit = async (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
if (!source || !id || !name || !code) return;
|
||||
if (!source || !sourceCode || !id || !name || !code) return;
|
||||
|
||||
setLoading(true);
|
||||
try {
|
||||
await onAddSource({
|
||||
source,
|
||||
source_code: sourceCode,
|
||||
mapping: {
|
||||
id,
|
||||
name,
|
||||
|
|
@ -46,6 +47,7 @@ export function AddSourceDialog({
|
|||
|
||||
// Reset form
|
||||
setSource('');
|
||||
setSourceCode('');
|
||||
setId('');
|
||||
setName('');
|
||||
setCode('');
|
||||
|
|
@ -116,6 +118,20 @@ export function AddSourceDialog({
|
|||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-text-primary mb-1">
|
||||
Source Code
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
value={sourceCode}
|
||||
onChange={e => setSourceCode(e.target.value)}
|
||||
className="w-full bg-surface border border-border rounded px-3 py-2 text-text-primary focus:ring-1 focus:ring-primary-500 focus:border-primary-500"
|
||||
placeholder="e.g., IB, ALP, POLY"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-text-primary mb-1">
|
||||
Source ID
|
||||
|
|
@ -181,7 +197,7 @@ export function AddSourceDialog({
|
|||
</button>
|
||||
<button
|
||||
type="submit"
|
||||
disabled={loading || !source || !id || !name || !code}
|
||||
disabled={loading || !source || !sourceCode || !id || !name || !code}
|
||||
className="px-4 py-2 bg-primary-500 text-white rounded hover:bg-primary-600 disabled:opacity-50 disabled:cursor-not-allowed transition-colors"
|
||||
>
|
||||
{loading ? 'Adding...' : 'Add Source'}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue