diff --git a/components/confirmation-history-table.tsx b/components/confirmation-history-table.tsx index 08e78c5..6c38bfa 100644 --- a/components/confirmation-history-table.tsx +++ b/components/confirmation-history-table.tsx @@ -84,7 +84,7 @@ export const ConfirmationHistoryTable: React.FC< )} -
+
diff --git a/components/donation-image-popover.tsx b/components/donation-image-popover.tsx index 6043038..b075668 100644 --- a/components/donation-image-popover.tsx +++ b/components/donation-image-popover.tsx @@ -14,8 +14,7 @@ export const DonationImagePopover = () => { variant="outline" className="bg-transparent w-full md:w-auto max-w-full select-none text-[#209ce9] border-[#209ce9] text-sm md:text-base hover:bg-transparent hover:text-green-400 hover:border-green-400 px-2 py-1 md:px-4 md:py-2 h-auto min-h-[2.5rem] whitespace-normal text-center" > - Make a small donation -
and see what happens! πŸ˜› 🌎 πŸš€ + β˜„οΈβž•πŸ¦– @@ -28,8 +27,9 @@ export const DonationImagePopover = () => {

nano_1osom16ctb773i6zi5fnepfro7bcmr5yqxb4qnmtzxkmdg88o4x6obmchzna

-

- Thank you! πŸš€ πŸŒ” +

+ Summon meteors β˜„οΈ, confuse dinos πŸ¦•!

Rockets? What rockets? + πŸš€

If you sending by mistake, please let me know at   diff --git a/components/falcon9-animation.tsx b/components/falcon9-animation.tsx index d133426..1e7f8f2 100644 --- a/components/falcon9-animation.tsx +++ b/components/falcon9-animation.tsx @@ -151,15 +151,18 @@ export const Falcon9Animation: React.FC = ({ if (distanceFromCenter < maxDistance) { let currentSpeed; if (distanceFromCenter <= 35) { + // Stage 1 currentSpeed = initialSpeed + - getRandomizedAcceleration() * (elapsedTime - launchDelay); // No power of two - } else if (distanceFromCenter > 35 && distanceFromCenter <= 200) { + getRandomizedAcceleration() * (elapsedTime - launchDelay) * 1.5; + } else if (distanceFromCenter > 35 && distanceFromCenter <= 75) { + // Stage 2 currentSpeed = initialSpeed + getRandomizedAcceleration() * Math.pow(elapsedTime - launchDelay, 1.5); // Use power of two for distance > 200 } else { + // Stage 3 currentSpeed = initialSpeed + getRandomizedAcceleration() * diff --git a/components/rocket-animation-manager.tsx b/components/rocket-animation-manager.tsx index 252e766..3b85e7e 100644 --- a/components/rocket-animation-manager.tsx +++ b/components/rocket-animation-manager.tsx @@ -21,7 +21,8 @@ interface RocketAnimationManagerProps { onRocketCountChange: (count: number) => void; isRocketView: boolean; activeRocketIndex: number | null; - setDistanceFromEarth: (distance: number) => void; // Add this prop + setActiveRocketIndex: (index: number | null) => void; + setDistanceFromEarth: (distance: number) => void; } export interface RocketAnimationManagerRef { @@ -39,7 +40,8 @@ const RocketAnimationManager = forwardRef< onRocketCountChange, isRocketView, activeRocketIndex, - setDistanceFromEarth // Destructure the prop + setActiveRocketIndex, + setDistanceFromEarth }, ref ) => { @@ -57,12 +59,32 @@ const RocketAnimationManager = forwardRef< const removeRocket = useCallback( (id: string) => { - setRockets((prevRockets) => - prevRockets.filter((rocket) => rocket.id !== id) - ); + setRockets((prevRockets) => { + const index = prevRockets.findIndex((rocket) => rocket.id === id); + if (index === -1) return prevRockets; + + const newRockets = prevRockets.filter((_, i) => i !== index); + + // Update activeRocketIndex if necessary + if (activeRocketIndex !== null) { + if (index === activeRocketIndex) { + // If the removed rocket was the active one, move to the last rocket in the array + if (newRockets.length > 0) { + setActiveRocketIndex(newRockets.length - 1); + } else { + setActiveRocketIndex(null); + } + } else if (index < activeRocketIndex) { + // If a rocket before the active one was removed, decrement the index + setActiveRocketIndex(activeRocketIndex - 1); + } + } + + return newRockets; + }); onRocketComplete(id); }, - [onRocketComplete] + [activeRocketIndex, setActiveRocketIndex, onRocketComplete] ); useEffect(() => { @@ -82,7 +104,7 @@ const RocketAnimationManager = forwardRef< onComplete={() => removeRocket(rocket.id)} isRocketView={isRocketView && index === activeRocketIndex} cameraRef={cameraRef} - setDistanceFromEarth={setDistanceFromEarth} // Pass the setter function + setDistanceFromEarth={setDistanceFromEarth} /> ))} diff --git a/components/three-scene-client-wrapper.tsx b/components/three-scene-client-wrapper.tsx index ceea434..3afc9dd 100644 --- a/components/three-scene-client-wrapper.tsx +++ b/components/three-scene-client-wrapper.tsx @@ -2,28 +2,28 @@ import React, { useState, useEffect } from 'react'; import ThreeSceneClient from './three-scene-client'; -import { IRepData } from '@/types/index'; +// import { IRepData } from '@/types/index'; import { RepsData } from '@/data/defualtMergedRepsData'; const ThreeSceneClientWrapper: React.FC = () => { - const [repsInfo, setRepsInfo] = useState(RepsData); + // const [repsInfo, setRepsInfo] = useState(RepsData); const [serverDateTime, setServerDateTime] = useState(null); - const [error, setError] = useState(null); + // const [error, setError] = useState(null); useEffect(() => { setServerDateTime(new Date()); }, []); - if (error) { - return

Error: {error}
; - } + // if (error) { + // return
Error: {error}
; + // } if (RepsData.length === 0) { return
Loading data... ΣΎ ΣΎ ΣΎ ...
; } return ( - + ); }; diff --git a/components/three-scene-client.tsx b/components/three-scene-client.tsx index b035ae4..b5aa03e 100644 --- a/components/three-scene-client.tsx +++ b/components/three-scene-client.tsx @@ -2,12 +2,7 @@ import React, { useRef, useState, useEffect, useCallback } from 'react'; import { Canvas } from '@react-three/fiber'; -import { - OrbitControls, - Stars, - PerspectiveCamera, - Html -} from '@react-three/drei'; +import { OrbitControls, Stars, PerspectiveCamera } from '@react-three/drei'; import * as THREE from 'three'; import { IRepData } from '@/types/index'; import ThreeMesh from '@/components/three-mesh'; @@ -18,7 +13,6 @@ import { useConfirmations } from '@/providers/confirmation-provider'; import { DonationAnimation } from '@/components/donation-animation'; import { NANO_LIVE_ENV } from '@/constants/nano-live-env'; import { parseNanoAmount } from '@/lib/parse-nano-amount'; -import { Falcon9Animation } from '@/components/falcon9-animation'; import { Vector3 } from 'three'; import { scaleRocketCount } from '@/lib/scale-rocket-count'; import { Button } from '@/components/ui/button'; @@ -104,7 +98,11 @@ const ThreeSceneClient: React.FC = ({ } if (isSend) { - const newRocketCount = scaleRocketCount(amount); + const newRocketCount = Math.max( + scaleRocketCount(amount), + rocketCount === 0 ? 1 : 0 + ); + for (let i = 0; i < newRocketCount; i++) { const randomPosition = getRandomPositionOnGlobe(); rocketManagerRef.current?.addRocket(randomPosition); @@ -131,6 +129,18 @@ const ThreeSceneClient: React.FC = ({ } }, [launchQueue, activeRocketIndex]); // Add activeRocketIndex to dependencies + // New function to reset to Earth view + const resetToEarthView = () => { + setIsRocketView(false); + + setTimeout(() => { + if (cameraRef.current) { + cameraRef.current.position.set(0, 0, 5); + cameraRef.current.lookAt(new THREE.Vector3(0, 0, 0)); // Look at the center of the Earth + } + }, 100); + }; + if (!serverDateTime) { return null; } @@ -146,6 +156,17 @@ const ThreeSceneClient: React.FC = ({
+ {/* New button to reset to Earth view */} + {distanceFromEarth > 10 && ( + + )}
{isRocketView && ( -
+
@@ -263,58 +285,68 @@ const ThreeSceneClient: React.FC = ({
-
+
{distanceFromEarth <= 2 && ( - "Fast, feeless, and ready for liftoff! πŸš€" + "Fast, feeless, green, and ready for liftoff! πŸš€" )} {distanceFromEarth > 2 && distanceFromEarth <= 5 && ( - "1 ΣΎNO = 1 ΣΎNO, even in space! πŸ’ŽπŸ™Œ" + "1 ΣΎNO = 1 ΣΎNO, even in space! πŸ‘©β€πŸš€ πŸ›Έ" )} - {distanceFromEarth > 5 && distanceFromEarth <= 15 && ( + {distanceFromEarth > 5 && distanceFromEarth <= 10 && ( - "BROCCOLISH πŸ₯¦ All the way to the Mars!" + "BROCCOLISH πŸ₯¦ All the way to the Mars!" )} - {distanceFromEarth > 15 && distanceFromEarth <= 25 && ( + {distanceFromEarth > 10 && distanceFromEarth <= 20 && ( - "Nano: Proof-of-work? We left that back on Earth. 🌍✨" + "Nano: Proof-of-work? We left that back on Earth 🌍" )} - {distanceFromEarth > 25 && distanceFromEarth <= 35 && ( + {distanceFromEarth > 20 && distanceFromEarth <= 30 && ( - "The further we go, the smaller our fees get. Oh wait... 😎" + "The further we go, the smaller our fees get. Oh wait... + Nano is feeless 😎" )} - {distanceFromEarth > 35 && distanceFromEarth <= 200 && ( + {distanceFromEarth > 30 && distanceFromEarth <= 100 && ( - "Warp speed initiated. Nano's block lattice is unstoppable! πŸŒ€" + "🚨 Nano speed initiated 🚨. Nano's block lattice is + unstoppable! πŸŒ€" )} {distanceFromEarth > 200 && distanceFromEarth <= 350 && ( - "Not even cosmic inflation can inflate Nano's supply! πŸ’₯" + "Not even cosmic inflation can inflate Nano's supply! + πŸ’₯" )} {distanceFromEarth > 350 && distanceFromEarth <= 500 && ( - "Zero fees across the universe, Nano is boundless. πŸ’«πŸŒŒ" + "Zero fees across the universe, Nano is boundless. πŸ’« + 🌌" + + )} + + {distanceFromEarth > 500 && distanceFromEarth <= 600 && ( + + "Nano IS Nano πŸ—Ώ" )} - {distanceFromEarth > 500 && ( - - "Nano IS Nano πŸ—Ώ" + {distanceFromEarth > 600 && ( + + "USER-35077: What if ... falls to 2k πŸ’€" )}
diff --git a/constants/nano-live-env.ts b/constants/nano-live-env.ts index 74cdd75..cecdd7d 100644 --- a/constants/nano-live-env.ts +++ b/constants/nano-live-env.ts @@ -5,8 +5,8 @@ export const NANO_LIVE_ENV = { // wsUrl: 'wss://node.somenano.com/websocket', // wsUrl: 'wss://rainstorm.city/websocket', // wsUrl: 'wss://bitrequest.app:8010/websocket', - // wsUrl: 'wss://nanoslo.0x.no/websocket', - wsUrl: 'ws://localhost:8080/websocket', + wsUrl: 'wss://nanoslo.0x.no/websocket', + // wsUrl: 'ws://localhost:8080/websocket', // wsUrl: 'wss://node.somenano.com/repeater', rpcUrl: 'https://nanoproxy.numsu.dev/proxy', diff --git a/lib/scale-rocket-count.ts b/lib/scale-rocket-count.ts index b12bc3c..05b5161 100644 --- a/lib/scale-rocket-count.ts +++ b/lib/scale-rocket-count.ts @@ -8,8 +8,10 @@ export function scaleRocketCount(amount: number): number { } else if (amount >= 10000) { return 6; } else if (amount >= 1000) { + return 4; + } else if (amount >= 100) { return 2; - } else if (amount >= 0) { + } else if (amount >= 10) { return 1; } else { return 0;