Skip to content

Commit

Permalink
πŸ•ŒπŸ₯‘ ↝ [SSG-81]: Conducting final review
Browse files Browse the repository at this point in the history
  • Loading branch information
Gizmotronn committed Dec 5, 2024
1 parent e1a9874 commit ffc4c39
Show file tree
Hide file tree
Showing 3 changed files with 149 additions and 20 deletions.
14 changes: 11 additions & 3 deletions components/Projects/Auto/AI4Mars.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ export function AiForMarsProject() {
const { activePlanet } = useActivePlanet();

const [anomaly, setAnomaly] = useState<Anomaly | null>(null);
const [showTutorial, setShowTutorial] = useState<boolean>(false);
const [imageUrl, setImageUrl] = useState<string | null>(null);

const [loading, setLoading] = useState<boolean>(true);
Expand Down Expand Up @@ -234,6 +235,8 @@ export function AiForMarsProject() {
);
};

const startTutorial = () => setShowTutorial(true);

const content = !hasMission20000006
? <StarterAiForMars anomalyid={anomaly?.id || 69592674} />
: (
Expand All @@ -256,6 +259,12 @@ export function AiForMarsProject() {
)}
</>
)}
<button
onClick={startTutorial}
className="mt-4 px-4 py-2 bg-[#85DDA2] text-[#2C3A4A] rounded-md shadow-md"
>
Reopen Tutorial
</button>
</>
);

Expand All @@ -265,7 +274,6 @@ return (
</div>
);

};

// I did get conflicted between 3102 and 3103, going with 3102 until the satellite comes into play

};
// I did get conflicted between 3102 and 3103, going with 3102 until the satellite comes into play
107 changes: 107 additions & 0 deletions components/Projects/Telescopes/Transiting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,113 @@ export function StarterTelescope() {
);
};

export function StarterTelescopeTess() {
const supabase = useSupabaseClient();
const session = useSession();
const { activePlanet } = useActivePlanet();

const [anomalies, setAnomalies] = useState<Anomaly[]>([]);
const [selectedAnomaly, setSelectedAnomaly] = useState<Anomaly | null>(null);
const [imageUrl, setImageUrl] = useState<string | null>(null);
const [loading, setLoading] = useState<boolean>(true);
const [error, setError] = useState<string | null>(null);
const [hasMission3000001, setHasMission3000001] = useState<boolean | null>(null);
const [missionLoading, setMissionLoading] = useState<boolean>(true);

useEffect(() => {
const checkTutorialMission = async () => {
if (!session) return;
try {
const { data: missionData, error: missionError } = await supabase
.from('missions')
.select('id')
.eq('user', session.user.id)
.eq('mission', 3000001);
if (missionError) throw missionError;
setHasMission3000001(missionData && missionData.length > 0);
} catch (error: any) {
console.error('Error checking user mission: ', error.message || error);
setHasMission3000001(false);
} finally {
setMissionLoading(false);
}
};
checkTutorialMission();
}, [session, supabase]);

useEffect(() => {
const fetchAnomalies = async () => {
if (!session) {
setLoading(false);
return;
}
try {
const { data: anomalyData, error: anomalyError } = await supabase
.from("anomalies")
.select("*")
.eq("anomalySet", "telescope-tess"); // Hardcoded choice
if (anomalyError) throw anomalyError;

setAnomalies(anomalyData || []);
console.log("Fetched anomalies:", anomalyData);

if (anomalyData?.length > 0) {
const randomAnomaly = anomalyData[Math.floor(Math.random() * anomalyData.length)];
console.log("Random anomaly selected:", randomAnomaly);

const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL || 'https://your-default-supabase-url.com';
if (randomAnomaly?.id) {
const constructedUrl = `${supabaseUrl}/storage/v1/object/public/anomalies/${randomAnomaly.id}/Binned.png`;
console.log("Constructed image URL:", constructedUrl);
setImageUrl(constructedUrl);
} else {
console.error("Random anomaly ID is null or undefined.");
}
setSelectedAnomaly(randomAnomaly);
} else {
console.log("No anomalies found.");
setSelectedAnomaly(null);
}
} catch (error: any) {
console.error("Error fetching anomalies:", error.message || error);
} finally {
setLoading(false);
}
};
fetchAnomalies();
}, [session, supabase]);

if (error) return <div><p>{error}</p></div>;
if (missionLoading || hasMission3000001 === null) return <div>Loading...</div>;
if (!hasMission3000001) {
return (
<div>
<FirstTelescopeClassification anomalyid={"6"} />
</div>
);
}
if (loading) return <div><p>Loading...</p></div>;
if (!anomalies.length) return <div><p>No anomaly found.</p></div>;

return (
<div className="flex flex-col items-start gap-4 pb-4 relative w-full max-w-lg overflow-y-auto max-h-[90vh] rounded-lg">
<div className="p-4 rounded-md relative w-full">
{selectedAnomaly?.avatar_url && <img src={selectedAnomaly.avatar_url} alt="Anomaly Avatar" />}
{imageUrl && <img src={imageUrl} alt="Anomaly Binned Image" />}
{selectedAnomaly && (
<ClassificationForm
anomalyId={selectedAnomaly.id.toString()}
anomalyType="planet"
missionNumber={1372001}
assetMentioned={selectedAnomaly?.id.toString()}
structureItemId={3103}
/>
)}
</div>
</div>
);
};

interface TelescopeProps {
anomalyid: string;
};
Expand Down
48 changes: 31 additions & 17 deletions constants/Structures/Properties.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import React from "react";
import AutomatonUpgrade from "@/components/Structures/Config/AutomatonUpgradeBox";
import AllAutomatonsOnActivePlanet from "@/components/Structures/Auto/AllAutomatons";
import { StarterTelescope } from "@/components/Projects/Telescopes/Transiting";
import { StarterTelescope, StarterTelescopeTess } from "@/components/Projects/Telescopes/Transiting";
import { StarterLidar } from "@/components/Projects/Lidar/Clouds";
import { BarChart, BeanIcon, BookAIcon, BookAudioIcon, BookCopy, BookDashedIcon, BriefcaseIcon, CameraIcon, CameraOffIcon, CaravanIcon, CloudCogIcon, CogIcon, ConstructionIcon, DogIcon, DotSquare, EarthIcon, GemIcon, GlassesIcon, HeartIcon, LockIcon, LucideSalad, MehIcon, MicroscopeIcon, MoonStarIcon, PenBox, PhoneIcon, PickaxeIcon, PowerIcon, RssIcon, SaladIcon, StarIcon, SunIcon, SwitchCamera, TelescopeIcon, TestTubeDiagonal, TestTubeDiagonalIcon, TreePalmIcon, WebcamIcon } from "lucide-react";
import { BarChart, BeanIcon, BookAIcon, BookAudioIcon, BookCopy, BookDashedIcon, BriefcaseIcon, CameraIcon, CameraOffIcon, CaravanIcon, CloudCogIcon, CloudDrizzleIcon, CogIcon, ConstructionIcon, DogIcon, DotSquare, EarthIcon, GemIcon, GlassesIcon, HeartIcon, LockIcon, LucideSalad, MehIcon, MicroscopeIcon, MoonStarIcon, PenBox, PhoneIcon, PickaxeIcon, PowerIcon, RssIcon, SaladIcon, StarIcon, SunIcon, SwitchCamera, TelescopeIcon, TestTubeDiagonal, TestTubeDiagonalIcon, TreePalmIcon, WebcamIcon } from "lucide-react";
import StructureRepair from "@/components/Structures/Config/RepairStructure";
import { RoverPhoto } from "@/components/Projects/Auto/Mars-Photos";
import { AnomalyRoverPhoto } from "@/components/Structures/Auto/AutomatonClassificationShell";
Expand All @@ -27,6 +27,7 @@ import AllClassifications from "@/content/Starnet/YourClassifications";
import { BurrowingOwl } from "@/components/Projects/Zoodex/burrowingOwls";
import TutorialPopup from "@/content/Dialogue/helpButton";
import FreeformUploadData from "@/components/Projects/(classifications)/FreeForm";
import { ZoodexIguanas } from "@/components/Projects/Zoodex/iguanasFromAbove";

interface IndividualStructureProps {
name?: string;
Expand Down Expand Up @@ -105,12 +106,12 @@ export const StructuresConfig: StructureConfig = {
dynamicComponent: <AnomalyRoverPhoto />,
sizePercentage: 73,
},
{
icon: <CameraOffIcon className="w-6 h-6 text-[#5e81ac]" />,
text: 'Map the surface of planets',
dynamicComponent: <AiForMarsProject />,
sizePercentage: 50,
},
// {
// icon: <CameraOffIcon className="w-6 h-6 text-[#5e81ac]" />,
// text: 'Map the surface of planets',
// dynamicComponent: <AiForMarsProject />,
// sizePercentage: 50,
// },
// {
// icon: <BookCopy className="w-6 h-6 text-[#5e81ac]" />, text: `Tutorial`,
// dynamicComponent: <p></p>,
Expand Down Expand Up @@ -162,7 +163,8 @@ export const StructuresConfig: StructureConfig = {
{
icon: <TelescopeIcon className="w-6 h-6 text-[#5e81ac]" />,
text: "Discover planets", // Transit events, microlensing, etc
dynamicComponent: <StarterTelescope />,
// dynamicComponent: <StarterTelescope />,
dynamicComponent: <StarterTelescopeTess />,
sizePercentage: 60,
showInNoModal: true,
},
Expand Down Expand Up @@ -191,12 +193,6 @@ export const StructuresConfig: StructureConfig = {
sizePercentage: 50,
},
// {
// icon: <RssIcon className="w-6 h-6 text-[#5e81ac]" />,
// text: "Planet Four Test",
// dynamicComponent: <PlanetFourProject />,
// sizePercentage: 50,
// },
// {
// icon: <StarIcon className="w-6 h-6 text-[#5e81ac]" />,
// text: "Comets & Asteroids",
// },
Expand Down Expand Up @@ -245,6 +241,12 @@ export const StructuresConfig: StructureConfig = {
dynamicComponent: <BurrowingOwl />,
sizePercentage: 60,
},
{
icon: <SaladIcon className="w-6 h-6 text-[#5e81ac]" />,
text: "Iguanas",
dynamicComponent: <ZoodexIguanas />,
sizePercentage: 60,
}
],
},
3105: {
Expand Down Expand Up @@ -284,11 +286,23 @@ export const StructuresConfig: StructureConfig = {
sizePercentage: 60,
},
{
icon: <GlassesIcon className="w-6 h-6 text-[#5e81ac]" />,
text: "Map gaseous planets",
icon: <CloudDrizzleIcon className="w-6 h-6 text-[#5e81ac]" />,
text: "Map storms on gas planets",
dynamicComponent: <LidarJVHSatellite />,
sizePercentage: 60,
},
{
icon: <RssIcon className="w-6 h-6 text-[#5e81ac]" />,
text: "Map the surface of terrestrial planets",
dynamicComponent: <PlanetFourProject />,
sizePercentage: 50,
},
{
icon: <CameraOffIcon className="w-6 h-6 text-[#5e81ac]" />,
text: 'Map the surface of planets',
dynamicComponent: <AiForMarsProject />,
sizePercentage: 50,
},
],
},
3106: {
Expand Down

0 comments on commit ffc4c39

Please sign in to comment.