diff --git a/src/components/ReactorStatus/index.tsx b/src/components/ReactorStatus/index.tsx index ffa8ecb..458c436 100644 --- a/src/components/ReactorStatus/index.tsx +++ b/src/components/ReactorStatus/index.tsx @@ -1,90 +1,110 @@ -import { useState, useEffect } from 'react'; -import { Activity, Power, Atom, Coffee, TrendingUp, Wallet } from 'lucide-react'; +import React, { useState, useEffect } from 'react'; +import { Activity, Power, Atom, TrendingUp, Users } from 'lucide-react'; import { LineChart, Line, XAxis, YAxis, Tooltip, ResponsiveContainer } from 'recharts'; -import type { ReactorStatusProps, TooltipProps, PriceStat } from './types'; -import { getEthereumData, formatPrice, getHighLowPrices, formatVolume } from '../../utils/api'; +import type { ReactorStatusProps } from './types'; const statusMessages = [ - 'Mining blocks... literally', - 'Consensus achieved', - 'Smart contracts cooling', - 'Tokens well-contained', - 'DAOs running smoothly', - 'Radiation levels nominal', - 'Governance protocols stable', - 'Core temperature optimal', - 'NFTs properly shielded', - 'Blockchain fully operational' + 'Consensus protocols maintaining criticality', + 'Smart contracts properly shielded', + 'DAOs operating at optimal temperature', + 'Governance tokens well-contained', + 'Web3 radiation levels nominal', + 'Blockchain fully operational', + 'Decentralized cooling systems engaged', + 'Token emissions within parameters', + 'NFT containment field stable', + 'Reactor governance optimized' ]; -const CustomTooltip = ({ active, payload, label }: TooltipProps) => { - if (active && payload && payload.length && label) { +// Simulated data for the career timeline +// Generate simulated stability data +const generateStabilityData = () => { + const points = 20; + const data = []; + for (let i = 0; i < points; i++) { + data.push({ + time: i, + value: 50 + Math.sin(i / 2) * 20 + (Math.random() * 10 - 5) + }); + } + return data; +}; + +// Generate simulated neutron flux data +const generateFluxData = () => { + const points = 20; + const data = []; + for (let i = 0; i < points; i++) { + data.push({ + time: i, + value: 70 + Math.cos(i / 3) * 15 + (Math.random() * 8 - 4) + }); + } + return data; +}; + +const generateTimelineData = () => { + const data = []; + const startYear = 2003; + const currentYear = new Date().getFullYear(); + + for (let year = startYear; year <= currentYear; year++) { + let value = 30; // Base value + + // Add significant career events + if (year === 2003) value += 20; // Started as Boilermaker + if (year === 2005) value += 15; // Red Seal certification + if (year === 2016) value += 25; // Radiation Protection certification + if (year === 2019) value += 20; // EPRI certification + if (year === 2022) value += 30; // Entered Web3 space + + data.push({ + year: year.toString(), + value: value + Math.random() * 10 + }); + } + + return data; +}; + +const CustomTooltip = ({ active, payload, label }: any) => { + if (active && payload && payload.length) { + const careerEvents: { [key: string]: string } = { + '2003': 'Started as Boilermaker', + '2005': 'Achieved Red Seal certification', + '2016': 'Obtained Radiation Protection certification', + '2019': 'Earned EPRI certification', + '2022': 'Entered Web3 space and founded DAO Masons' + }; + return ( -
-

{formatPrice(payload[0].value)}

-

- {new Date(parseInt(label)).toLocaleTimeString()} -

+
+

{label}

+

{careerEvents[label] || 'Career progression'}

); } return null; }; -export const ReactorStatus = ({ className = '' }: ReactorStatusProps) => { - const [power, setPower] = useState(0); - const [status, setStatus] = useState('Initializing...'); +export const ReactorStatus: React.FC = ({ +}) => { + const [power, setPower] = useState(85); + const [coreTemp, setCoreTemp] = useState(1350); + const [blockHeight, setBlockHeight] = useState(18_500_000); + const [radLevel, setRadLevel] = useState(5.5e7); + const [status, setStatus] = useState('Initializing systems...'); const [isAnimating, setIsAnimating] = useState(false); const [currentTime, setCurrentTime] = useState(new Date()); - const [priceData, setPriceData] = useState>([]); - const [priceStats, setPriceStats] = useState([ - { label: '24h High', value: '...' }, - { label: '24h Low', value: '...' }, - { label: '24h Volume', value: '...' } - ]); - const [loading, setLoading] = useState(true); - const [error, setError] = useState(null); + const [timelineData] = useState(generateTimelineData()); + + const careerStats = [ + { label: 'Years Experience', value: '20+' }, + { label: 'Major Projects', value: '50+' }, + { label: 'Grants Secured', value: '$197K' } + ]; useEffect(() => { - const fetchData = async () => { - try { - setLoading(true); - setError(null); - - const data = await getEthereumData(); - console.log('Received ETH data:', data); - - if (!data?.prices?.length) { - throw new Error('Invalid price data received'); - } - - const formattedPrices = data.prices.map(([timestamp, price]) => ({ - time: timestamp, - price - })); - - const { high, low } = getHighLowPrices(data.prices); - const volume = data.total_volumes[data.total_volumes.length - 1][1]; - - console.log('Formatted prices:', formattedPrices); - setPriceData(formattedPrices); - setPriceStats([ - { label: '24h High', value: formatPrice(high) }, - { label: '24h Low', value: formatPrice(low) }, - { label: '24h Volume', value: formatVolume(volume) } - ]); - } catch (err) { - console.error('Error fetching ETH data:', err); - setError(err instanceof Error ? err.message : 'Failed to fetch price data'); - } finally { - setLoading(false); - } - }; - - // Initial fetch - fetchData(); - - // Set up intervals const intervals = [ setInterval(() => setCurrentTime(new Date()), 1000), setInterval(() => { @@ -93,158 +113,181 @@ export const ReactorStatus = ({ className = '' }: ReactorStatusProps) => { return Math.min(Math.max(prev + fluctuation, 60), 100); }); }, 3000), + setInterval(() => { + setCoreTemp(() => { + const fluctuation = Math.random() * 20 - 10; + return 1300 + (fluctuation % 100); + }); + }, 2000), + setInterval(() => { + setBlockHeight(prev => prev + Math.floor(Math.random() * 3)); + }, 5000), + setInterval(() => { + setRadLevel(() => { + const base = 5e7; + const fluctuation = Math.random() * 5e7; + return base + fluctuation; + }); + }, 4000), setInterval(() => { const randomStatus = statusMessages[Math.floor(Math.random() * statusMessages.length)]; setStatus(randomStatus); setIsAnimating(true); setTimeout(() => setIsAnimating(false), 500); - }, 5000), - setInterval(fetchData, 300000) // Fetch new data every 5 minutes + }, 5000) ]; - // Cleanup return () => intervals.forEach(clearInterval); }, []); - const statusIndicators = [ - { label: 'Core Temp', value: '37.2°C' }, - { label: 'Block Height', value: '#18M' }, - { label: 'Rad Level', value: '0.12 μSv' } - ]; + const formatRadLevel = (level: number) => { + return `${(level / 1e7).toFixed(2)}E7 Gy/hr`; + }; return (
-
+
+ +

+ System Status +

+
+ +
{/* Reactor Status Panel */}
- -

Reactor Status

+ + + {currentTime.toLocaleTimeString()} +
- - - {currentTime.toLocaleTimeString()} + + + {power.toFixed(1)}% Capacity
-
- {/* Power Level */} -
-
- Power Level - + {/* Status Message */} +
+
+ {status} +
+
+ + {/* Reactor Metrics */} +
+
+
Core Temp
+
+ {coreTemp.toFixed(1)}°C
-
-
+
+
+
Block Height
+
+ #{blockHeight.toLocaleString()}
-
- {power.toFixed(1)}% Capacity +
+
+
Rad Level
+
+ {formatRadLevel(radLevel)} +
+
+
+ + {/* Systems Monitor */} +
+
+
Core Stability
+
+ + + + +
- {/* Status Message */} -
-
- Current Status - +
+
Neutron Flux
+
+ + + + +
-
- {status} -
-
- - {/* Activity Indicators */} -
- {statusIndicators.map((item, index) => ( -
-
{item.label}
-
{item.value}
-
- ))}
- {/* ETH Price Monitor */} + {/* Career Timeline Panel */}
-
-
-
- -

ETH Price Monitor

-
-
- - Live Feed -
+
+
+ +

Career Timeline

+
+
+ + Career Progression
- {priceData.length > 0 && ( -
-
Current Price
-
- {formatPrice(priceData[priceData.length - 1].price)} -
-
- )}
-
- {/* Price Chart */} -
- {loading ? ( -
-
- - Loading price data... -
-
- ) : error ? ( -
-
{error}
-
- ) : ( - - - new Date(timestamp).toLocaleTimeString()} - /> - formatPrice(value)} - /> - } /> - - - - )} -
+ {/* Career Stats */} +
+ {careerStats.map((stat, index) => ( +
+
{stat.label}
+
{stat.value}
+
+ ))} +
- {/* Price Stats */} -
- {priceStats.map((item, index) => ( -
-
{item.label}
-
{item.value}
-
- ))} -
+ {/* Timeline Chart */} +
+ + + + + } /> + + +
diff --git a/tsconfig.app.json b/tsconfig.app.json index 358ca9b..a2f072f 100644 --- a/tsconfig.app.json +++ b/tsconfig.app.json @@ -1,12 +1,12 @@ { "compilerOptions": { + "incremental": true, "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", "target": "ES2020", "useDefineForClassFields": true, "lib": ["ES2020", "DOM", "DOM.Iterable"], "module": "ESNext", "skipLibCheck": true, - /* Bundler mode */ "moduleResolution": "bundler", "allowImportingTsExtensions": true, @@ -14,13 +14,11 @@ "moduleDetection": "force", "noEmit": true, "jsx": "react-jsx", - /* Linting */ "strict": true, "noUnusedLocals": true, "noUnusedParameters": true, - "noFallthroughCasesInSwitch": true, - "noUncheckedSideEffectImports": true + "noFallthroughCasesInSwitch": true }, "include": ["src"] -} +} \ No newline at end of file