diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index e9f21c4..cb601b4 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -207,6 +207,7 @@ function App() { showOrbits={showOrbits} onBodySelect={handleBodySelect} resetTrigger={resetTrigger} + toast={toast} /> {/* Timeline Controller */} diff --git a/frontend/src/components/FocusInfo.tsx b/frontend/src/components/FocusInfo.tsx index 2dbff66..b27856b 100644 --- a/frontend/src/components/FocusInfo.tsx +++ b/frontend/src/components/FocusInfo.tsx @@ -3,15 +3,15 @@ import { useState } from 'react'; import { request } from '../utils/request'; import type { CelestialBody } from '../types'; import { TerminalModal } from './TerminalModal'; -import { useToast } from '../contexts/ToastContext'; +import type { ToastContextValue } from '../contexts/ToastContext'; // Import ToastContextValue type interface FocusInfoProps { body: CelestialBody | null; onClose: () => void; + toast: ToastContextValue; // Add toast prop } -export function FocusInfo({ body, onClose }: FocusInfoProps) { - const toast = useToast(); +export function FocusInfo({ body, onClose, toast }: FocusInfoProps) { const [showTerminal, setShowTerminal] = useState(false); const [terminalData, setTerminalData] = useState(''); const [loading, setLoading] = useState(false); diff --git a/frontend/src/components/Scene.tsx b/frontend/src/components/Scene.tsx index dbdf797..25a58d3 100644 --- a/frontend/src/components/Scene.tsx +++ b/frontend/src/components/Scene.tsx @@ -1,13 +1,12 @@ /** * Main 3D Scene component */ -import { Canvas } from '@react-three/fiber'; -import { OrbitControls, Stars as BackgroundStars, Html } from '@react-three/drei'; +import { Html } from '@react-three/drei'; import { useMemo, useState, useEffect } from 'react'; import { CelestialBody } from './CelestialBody'; import { Probe } from './Probe'; import { CameraController } from './CameraController'; -import { Trajectory } from './Trajectory'; +import { Trajectory } => './Trajectory'; import { OrbitRenderer } from './OrbitRenderer'; import { Stars } from './Stars'; import { Constellations } from './Constellations'; @@ -18,6 +17,7 @@ import { AsteroidBelts } from './AsteroidBelts'; import { scalePosition } from '../utils/scaleDistance'; import { calculateRenderPosition } from '../utils/renderPosition'; import type { CelestialBody as CelestialBodyType, Position } from '../types'; +import type { ToastContextValue } from '../contexts/ToastContext'; // Import ToastContextValue interface SceneProps { bodies: CelestialBodyType[]; @@ -26,9 +26,10 @@ interface SceneProps { showOrbits?: boolean; onBodySelect?: (body: CelestialBodyType | null) => void; resetTrigger?: number; + toast: ToastContextValue; // Add toast prop } -export function Scene({ bodies, selectedBody, trajectoryPositions = [], showOrbits = true, onBodySelect, resetTrigger = 0 }: SceneProps) { +export function Scene({ bodies, selectedBody, trajectoryPositions = [], showOrbits = true, onBodySelect, resetTrigger = 0, toast }: SceneProps) { // State to control info panel visibility (independent of selection) const [showInfoPanel, setShowInfoPanel] = useState(true); @@ -170,7 +171,7 @@ export function Scene({ bodies, selectedBody, trajectoryPositions = [], showOrbi {/* Dynamic Focus Info Label */} {selectedBody && showInfoPanel && ( - setShowInfoPanel(false)} /> + setShowInfoPanel(false)} toast={toast} /> )}