'use client'; import consola from 'consola'; import React, { useState } from 'react'; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@djangocfg/ui-core/components'; import { RJSFSchema } from '@rjsf/utils'; import { JsonSchemaForm } from '../JsonSchemaForm'; /** * Real Bot Config Schema from API * This is the actual schema returned by the backend */ const realBotConfigSchema: RJSFSchema = { type: 'object', title: 'BotConfig', $schema: 'http://json-schema.org/draft-07/schema#', required: ['name', 'exchange'], properties: { name: { type: 'string', description: 'Bot name', }, active: { type: 'boolean', description: 'Bot active', }, enabled: { type: 'boolean', description: 'Bot enabled', }, exchange: { type: 'string', description: 'Exchange name (binance, bybit, etc)', }, direction: { type: 'string', description: 'Trading direction (long, short, both)', }, amount_usdt: { type: 'number', description: 'Amount in USDT', }, market_type: { type: 'string', description: 'Market type (spot, futures, swap)', }, signal_type: { type: 'string', description: 'Signal type (listing, technical, etc)', }, allowed_quotes: { type: 'array', items: { type: 'string', }, description: 'Allowed quote currencies', }, allowed_sources: { type: 'array', items: { type: 'string', }, description: 'Allowed signal sources', }, force_market_close_timer: { type: 'integer', description: 'Force close timer in seconds', }, force_market_close_enabled: { type: 'boolean', description: 'Enable forced market close', }, }, }; /** * Real settings data from bot */ const realSettings = { version: '1.0.0', hostname: 'botserver', supported_exchanges: ['binance'], supported_strategies: ['default'], }; /** * Example component with real bot config schema */ export function RealBotConfigExample() { const [formData, setFormData] = useState(realSettings); const [submittedData, setSubmittedData] = useState(null); const handleSubmit = (data: any) => { consola.success('Form submitted:', data.formData); setSubmittedData(data.formData); }; const handleChange = (data: any) => { consola.info('Form changed:', data.formData); setFormData(data.formData); }; return (
Real Bot Configuration Form Using actual schema from API response {submittedData && ( Submitted Data The data that was submitted from the form
                {JSON.stringify(submittedData, null, 2)}
              
)} Current Form Data Real-time form data (onChange)
              {JSON.stringify(formData, null, 2)}
            
); }