import React from 'react'; import { motion, AnimatePresence } from 'framer-motion'; import './DataDisplay.css'; // Import the CSS file for transitions const DataDisplay = ({ data }) => { console.log("DataDisplay Data: ", data); const getIcon = (name) => { // Replace these with actual icon components or image tags if (name === 'system') return ; if (name === 'station') return ; if (name === 'buy') return ; if (name === 'sell') return ; return ''; // Default icon or empty }; if (!data) { return

Loading ...

} const handleItemClick = async (typeId) => { try { const response = await fetch(`http://localhost:8000/open_market_window/${typeId}`, { method: 'POST' }); console.log('Server Response:', response.data); // Handle response or set state as needed } catch (error) { console.error('Error posting to server:', error); // Handle error } } const containerVariants = { hidden: { opacity: 0, y: -20 }, visible: { opacity: 1, y: 0 }, exit: { opacity: 0, y: -20 } }; return (
{data.map((location, index) => (
{getIcon(location.location_type)}

{location.location}

{location.actions.length > 0 ? (
{location.actions.map((action, actionIndex) => (
{getIcon(action.action_type)}
handleItemClick(action.type_id)} className={`${index === 0 ? 'font-semibold' : ''}`} style={{ cursor: 'pointer' }}>{action.item}
{action.quantity}
{action.price ? `$${action.price.toLocaleString()}` : '-'}
))}
) : (

)}
))}
); }; export default DataDisplay;