import React, { useState, useEffect } from 'react'; import { supabase } from '../lib/supabaseClient'; import { tableNameMarketplace } from '../lib/const'; import { Activity, ArrowUpRight, Shield, Zap, Scale, CheckCircle, TrendingUp, Info, Dna, Cpu, Fingerprint, Users, LineChart } from 'lucide-react'; import type { StrategyPreset } from '../lib/PresetRegistry'; import { STRATEGY_PRESETS } from '../lib/PresetRegistry'; interface PresetMarketplaceProps { onSelect: (preset: StrategyPreset) => void; onClose?: () => void; } const StrategyMarketplaceCard: React.FC<{ preset: StrategyPreset, onSelect: (preset: StrategyPreset) => void, index: number }> = ({ preset, onSelect, index }) => { const isSafe = preset.riskStyleId === 'safe'; const isBalanced = preset.riskStyleId === 'balanced'; const isAggressive = preset.riskStyleId === 'aggressive'; const themeColor = isSafe ? '#00ff88' : isBalanced ? '#3498db' : '#ff3366'; // Visual metadata const performanceValue = isAggressive ? '+14.2%' : isSafe ? '+4.8%' : '+8.5%'; const volatilityRating = isAggressive ? 'High' : isSafe ? 'Low' : 'Med'; return (
{/* 1. Header Area - Perfectly Aligned */}
{isSafe ? : isBalanced ? : }
Strategy Profile {preset.riskStyleId} Strategy
V{index + 1}.4
{/* 2. Identity - Aligned Left */}

{preset.name}

Institutional Alpha {performanceValue}

{preset.description} Optimized for dominance and high-conviction momentum in volatile periods.

{/* 3. Specs Grid - Balanced Alignment */}
{[ { label: 'Growth', value: performanceValue, icon: , color: '#00ff88' }, { label: 'Latency', value: 'Low', icon: , color: '#3498db' }, { label: 'Liquidity', value: 'Prime', icon: , color: '#ffaa00' }, { label: 'Rating', value: volatilityRating, icon: , color: '#ff3366' } ].map((spec, i) => (
{spec.icon} {spec.label}
{spec.value}
))}
{/* 4. Verifications - Left Justified */}
Logical Invariant Verified
Risk-Isolated Execution
{/* 5. Action - Consistent Alignment */}
); }; export const PresetMarketplace: React.FC = ({ onSelect, onClose }) => { const [customPresets, setCustomPresets] = useState([]); useEffect(() => { const fetchCustomPresets = async () => { try { const { data, error } = await supabase .from(tableNameMarketplace) .select('*') .order('created_at', { ascending: false }); if (!error && data) { const mappedData = data.map((d: any) => ({ id: d.id, name: d.name, description: d.description, riskStyleId: d.risk_style_id, recommendedAssets: d.recommended_assets, typicalTradesPerDay: d.typical_trades_per_day, performanceTag: d.performance_tag, isPopular: d.is_popular, strategy_config: d.strategy_config })); setCustomPresets(mappedData as any); } } catch (e) { console.error('Error fetching marketplace presets:', e); } }; fetchCustomPresets(); }, []); const allPresets = [...STRATEGY_PRESETS, ...customPresets]; return (
{/* Premium Header Alignment Fix */}
{/* Removed indenting line for perfect optical left-alignment */}
QUANTITATIVE REPOSITORY

Strategy
Marketplace

Institutional-grade algorithm DNA for automated retail deployment.

Profiles {allPresets.length}
{onClose && ( )}
{/* Grid Layout - Perfectly Symmetrical */}
{allPresets.map((preset, idx) => ( ))} {/* DNA Loader Placeholder - Aligned Center */}
Analyzing DNA Verification queue currently active for new strategies.
); };