Skip to content

Commit 931d186

Browse files
Merge pull request #9 from Santiago13dev/fix-globe-imports-issue-8
Fix: Corregir imports duplicados y missing dependencies
2 parents f2c453f + 9e90e9e commit 931d186

File tree

2 files changed

+10
-24
lines changed

2 files changed

+10
-24
lines changed

frontend/components/Globe.tsx

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
"use client";
22

3+
import React from "react";
34
import * as THREE from "three";
4-
import { Canvas, useFrame } from "@react-three/fiber";
5+
import { Canvas, useFrame, useThree } from "@react-three/fiber";
56
import { OrbitControls, Stars, useTexture } from "@react-three/drei";
6-
import { useMemo, useRef } from "react";
7-
import { useEffect } from "react";
7+
import { useMemo, useRef, useEffect } from "react";
88

99
export type Center = { lat: number; lon: number };
1010
export type RingSet = { p?: number[]; s?: number[] };
@@ -14,14 +14,13 @@ type GlobeProps = {
1414
rings?: RingSet | null;
1515
liveMinutes?: number; // minutos transcurridos para frentes vivos
1616
liveVpKmS?: number; // velocidad P (km/s)
17-
liveVsKmS?: number;
17+
liveVsKmS?: number; // velocidad S (km/s)
1818
showAtmosphere?: boolean;
1919
showGraticule?: boolean;
2020
showEquator?: boolean;
2121
showStars?: boolean;
22-
showStand?: boolean; // velocidad S (km/s)
23-
onReadyCapture?: (fn: () => string) => void; // NUEVO: entrega una función capture()
24-
22+
showStand?: boolean;
23+
onReadyCapture?: (fn: () => string) => void; // función para capturar screenshot
2524
};
2625

2726
/* ------------------- utilidades geo ------------------- */
@@ -226,20 +225,12 @@ function World({
226225
liveMinutes,
227226
liveVpKmS,
228227
liveVsKmS,
229-
showAtmosphere = true,
230-
showGraticule = true,
231-
showEquator = true,
232228
}: {
233229
center: Center;
234230
rings?: RingSet | null;
235231
liveMinutes?: number;
236232
liveVpKmS?: number;
237233
liveVsKmS?: number;
238-
showAtmosphere?: boolean;
239-
showGraticule?: boolean;
240-
showEquator?: boolean;
241-
showStars?: boolean;
242-
showStand?: boolean;
243234
}) {
244235
const worldRef = useRef<THREE.Group>(null!);
245236

@@ -291,8 +282,6 @@ function World({
291282
);
292283
}
293284

294-
import { useThree } from "@react-three/fiber"; // ya lo tienes por Canvas/useFrame
295-
296285
function CaptureProvider({
297286
onReadyCapture,
298287
}: {
@@ -301,7 +290,7 @@ function CaptureProvider({
301290
const { gl, scene, camera } = useThree();
302291

303292
// Registramos una función que renderiza y devuelve el PNG
304-
React.useEffect(() => {
293+
useEffect(() => {
305294
if (!onReadyCapture) return;
306295
const capture = () => {
307296
gl.render(scene, camera);
@@ -312,6 +301,7 @@ function CaptureProvider({
312301

313302
return null;
314303
}
304+
315305
/* ============================ GLOBE ============================ */
316306
export default function Globe({
317307
center,
@@ -347,7 +337,7 @@ export default function Globe({
347337
<pointLight position={[-4, -3, -4]} intensity={0.5} />
348338

349339
{/* Estrellas dentro del Canvas */}
350-
<Stars radius={120} depth={50} count={4000} factor={3} fade speed={0.15} />
340+
{showStars && <Stars radius={120} depth={50} count={4000} factor={3} fade speed={0.15} />}
351341

352342
{/* Mundo */}
353343
<World
@@ -356,11 +346,6 @@ export default function Globe({
356346
liveMinutes={liveMinutes}
357347
liveVpKmS={liveVpKmS}
358348
liveVsKmS={liveVsKmS}
359-
showAtmosphere={showAtmosphere}
360-
showGraticule={showGraticule}
361-
showEquator={showEquator}
362-
showStars={showStars}
363-
showStand={showStand}
364349
/>
365350
{showStand && <Stand />}
366351

frontend/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"eslint": "^8.57.0",
2727
"eslint-config-next": "14.2.4",
2828
"postcss": "^8.4.41",
29+
"prettier": "^3.0.0",
2930
"tailwindcss": "^3.4.7",
3031
"typescript": "^5.4.3"
3132
}

0 commit comments

Comments
 (0)