Skip to content

Commit c721521

Browse files
committed
🎤🍟 ↝ [SSC-32 SSC-55 SSG-93 SSM-73]: Chapters are maybe optimised properly now in baseplate
1 parent 9386cfc commit c721521

File tree

12 files changed

+129
-70
lines changed

12 files changed

+129
-70
lines changed

‎components/Projects/(classifications)/FormConfigurations.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export interface ClassificationFormProps {
1818
anomalyId: string;
1919
missionNumber: number;
2020
assetMentioned: string | string[];
21-
originatingStructure?: number;
21+
// structureItemId?: number;
2222
structureItemId?: number;
2323
};
2424

‎components/Projects/(classifications)/PostForm.tsx

-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ const ClassificationForm: React.FC<ClassificationFormProps> = ({
3030
anomalyId,
3131
missionNumber,
3232
assetMentioned,
33-
originatingStructure,
3433
structureItemId,
3534
}) => {
3635
const supabase = useSupabaseClient();
@@ -231,7 +230,6 @@ const ClassificationForm: React.FC<ClassificationFormProps> = ({
231230
classificationOptions: classificationOptionsObj,
232231
additionalFields,
233232
activePlanet: activePlanet?.id,
234-
structureId: originatingStructure ?? null,
235233
createdBy: inventoryItemId ?? null,
236234
};
237235

‎components/Projects/Auto/Mars-Photos.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ export const RooverFromAppeears: React.FC = () => {
155155
anomalyType="roverImg"
156156
missionNumber={1370104}
157157
assetMentioned={rover.avatar_url}
158-
originatingStructure={rover.id}
158+
structureItemId={rover.id}
159159
/>
160160
)}
161161
</div>
@@ -284,7 +284,7 @@ export const RoverPhoto: React.FC = () => {
284284
anomalyType="roverImg"
285285
missionNumber={13714101}
286286
assetMentioned={rover.avatar_url}
287-
originatingStructure={rover.id}
287+
// structureItemId={rover.id}
288288
structureItemId={3102}
289289
/>
290290
)}

‎components/Projects/Lidar/Clouds.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ export function StarterLidar() {
135135
anomalyType="cloud"
136136
missionNumber={100000034}
137137
assetMentioned={imageUrl || ""}
138-
originatingStructure={3105}
138+
structureItemId={3105}
139139
/>
140140
</div>
141141
</div>

‎components/Projects/Telescopes/DiskDetector.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ export function TelescopeDiskDetector() {
336336
anomalyType="DiskDetective"
337337
missionNumber={100000033}
338338
assetMentioned={imageUrl || ""}
339-
originatingStructure={3103}
339+
structureItemId={3103}
340340
/>
341341
</div>
342342
) : (

‎components/Projects/Telescopes/Sunspots.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ export function TelescopeSunspotDetector() {
279279
anomalyType="sunspot"
280280
missionNumber={100000032}
281281
assetMentioned={imageUrl || ""}
282-
originatingStructure={3103}
282+
structureItemId={3103}
283283
/>
284284
</div>
285285
</div>

‎components/Projects/Zoodex/burrowingOwls.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ export function BurrowingOwl() {
319319
anomalyType="zoodex-burrowingOwl"
320320
missionNumber={100000035}
321321
assetMentioned={imageUrl || ""}
322-
originatingStructure={3104}
322+
structureItemId={3104}
323323
/>
324324
</div>
325325
</div>

‎components/Projects/Zoodex/iguanasFromAbove.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ export function ZoodexIguanas() {
287287
anomalyType="zoodex-iguanasFromAbove"
288288
missionNumber={100000036}
289289
assetMentioned={imageUrl || ''}
290-
originatingStructure={3104}
290+
structureItemId={3104}
291291
/>
292292
</div>
293293
</div>

‎components/Projects/Zoodex/penguinWatch.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ export function PenguinWatch() {
264264
anomalyType="zoodex-penguinWatch"
265265
missionNumber={2000000102}
266266
assetMentioned={imageUrl || ""}
267-
originatingStructure={3104}
267+
structureItemId={3104}
268268
/>
269269
</div>
270270
</div>

‎components/Projects/Zoodex/planktonPortal.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export const PlanktonPortalTutorial: React.FC<ZoodexProps> = ({ anomalyId }) =>
118118
anomalyType="zoodex-planktonPortal"
119119
missionNumber={200000012}
120120
assetMentioned={imageUrl}
121-
originatingStructure={3104}
121+
structureItemId={3104}
122122
/>
123123
</div>
124124
</div>
@@ -251,7 +251,7 @@ export function PlanktonPortal() {
251251
anomalyType="zoodex-planktonPortal"
252252
missionNumber={200000012}
253253
assetMentioned={imageUrl || ""}
254-
originatingStructure={3104}
254+
structureItemId={3104}
255255
/>
256256
</div>
257257
</div>

‎components/Structures/Missions/Astronomers/DailyMinorPlanet/DailyMinorPlanet.tsx

+60-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useEffect, useState } from "react";
22
import { useSupabaseClient, useSession } from "@supabase/auth-helpers-react";
3-
import { RadioIcon, SpeechIcon, TelescopeIcon, VoteIcon } from "lucide-react";
3+
import { BarChartBigIcon, GlassWater, Guitar, PenBoxIcon, RadioIcon, SpeechIcon, TelescopeIcon, VoteIcon } from "lucide-react";
44
import MissionShell from "../../BasePlate";
55
import { DailyMinorPlanet } from "@/components/Projects/Telescopes/DailyMinorPlanet";
66
import VoteDMPClassifications from "./DMPVote";
@@ -59,11 +59,60 @@ const DailyMinorPlanetMissions = () => {
5959
icon: VoteIcon,
6060
points: 3,
6161
completedCount: 0,
62-
internalComponent: () => <div></div>,
62+
// internalComponent: () => <div></div>,
6363
color: "text-red-700",
6464
shadow: true,
6565
action: () => {},
6666
},
67+
{
68+
id: 5,
69+
chapter: 2,
70+
title: "Make an active asteroid classification",
71+
description:
72+
"The next step in your asteroid research involves finding asteroids with tails, helping us find clues about water on smaller objects",
73+
icon: Guitar,
74+
points: 2,
75+
completedCount: 0,
76+
// internalComponent: () => <div></div>,
77+
color: 'text-green-300',
78+
shadow: true,
79+
action: () => {},
80+
},
81+
{
82+
id: 6,
83+
chapter: 2,
84+
title: "Compare AA & DMP Classification",
85+
description:
86+
"Pick out classifications you've made from both datasets and compare the differences and potential validity",
87+
icon: BarChartBigIcon,
88+
points: 2,
89+
color: 'text-green-700',
90+
shadow: true,
91+
action: () => {},
92+
},
93+
{
94+
id: 7,
95+
chapter: 2,
96+
title: "Comment & Vote on AA candidates",
97+
description: "Work with other players to confirm classifications and provide feedback & consensus",
98+
icon: PenBoxIcon,
99+
points: 1,
100+
color: 'text-blue-300',
101+
shadow: true,
102+
action: () => [],
103+
},
104+
{
105+
id: 8,
106+
chapter: 2,
107+
title: "Propose tail, dust cloud, or null value",
108+
description:
109+
"Go through verified AA & DMP anomalies and propose what's going on specifically",
110+
icon: GlassWater,
111+
points: 1,
112+
color: 'text-blue-700',
113+
shadow: true,
114+
action: () => {},
115+
},
67116
]);
68117

69118
const [experiencePoints, setExperiencePoints] = useState(0);
@@ -126,30 +175,32 @@ const DailyMinorPlanetMissions = () => {
126175

127176
const mission3CompletedCount = mission3CommentCount + mission3VoteCount;
128177

129-
// Mission 4: Check classifications with 5+ votes
130178
const mission4CompletedCount = classificationsData?.filter(({ id: classificationId }) => {
131179
const voteCount = voteData?.filter(({ classification_id }) => classification_id === classificationId)
132180
.length;
133-
return voteCount > 4.9999; // Greater than 5 votes
181+
return voteCount > 4.9999;
134182
}).length || 0;
135183

136184
setMissions((prevMissions) =>
137185
prevMissions.map((mission) => {
138186
if (mission.id === 1) {
139-
return { ...mission, completedCount: mission1CompletedCount };
187+
return { ...mission, completedCount: mission1CompletedCount, points: mission.points || 0 };
140188
}
141189
if (mission.id === 2) {
142-
return { ...mission, completedCount: mission2CompletedCount };
190+
return { ...mission, completedCount: mission2CompletedCount, points: mission.points || 0 };
143191
}
144192
if (mission.id === 3) {
145-
return { ...mission, completedCount: mission3CompletedCount };
193+
return { ...mission, completedCount: mission3CompletedCount, points: mission.points || 0 };
146194
}
147195
if (mission.id === 4) {
148-
return { ...mission, completedCount: mission4CompletedCount };
196+
return { ...mission, completedCount: mission4CompletedCount, points: mission.points || 0 };
197+
}
198+
if (mission.id === 5) {
199+
return { ...mission, completedCount: mission4CompletedCount, points: mission.points || 0 };
149200
}
150201
return mission;
151202
})
152-
);
203+
);
153204

154205
const totalPoints =
155206
mission1CompletedCount * 2 +

‎components/Structures/Missions/BasePlate.tsx

+58-48
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ interface MissionConfig {
99
description: string;
1010
icon: React.ElementType;
1111
points: number;
12-
internalComponent: React.ElementType;
12+
internalComponent?: React.ElementType;
1313
color: string;
1414
action: () => void;
1515
completedCount?: number;
@@ -71,63 +71,73 @@ const MissionShell = ({
7171
const pointsForNextChapter = currentChapter * 9;
7272

7373
return (
74-
<div className="flex flex-col items-center bg-[#1D2833] text-white rounded-2xl shadow-lg p-6 w-full max-w-4xl mx-auto">
75-
{!selectedMission && (
74+
<div className="flex flex-col items-center bg-[#1D2833] text-white rounded-2xl shadow-lg p-6 w-full max-w-4xl mx-auto">
75+
{!selectedMission && (
76+
<>
77+
<div className="flex justify-between items-center w-full mb-6">
78+
<h1 className="text-xl font-bold">Chapter {currentChapter}</h1>
79+
<div className="flex space-x-4">
80+
<Button onClick={onPreviousChapter} disabled={currentChapter === 1}>
81+
Previous
82+
</Button>
83+
<Button
84+
onClick={onNextChapter}
85+
disabled={currentChapter === maxUnlockedChapter || experiencePoints < pointsForNextChapter}
86+
>
87+
Next
88+
</Button>
89+
</div>
90+
</div>
91+
<div className="flex-1 overflow-y-auto w-full">
92+
<div className="w-full bg-gray-700 rounded-full h-4 mb-6">
93+
<div
94+
className="bg-[#5FCBC3] h-4 rounded-full"
95+
style={{ width: `${(experiencePoints % 9) * 10.5}%` }}
96+
></div>
97+
</div>
98+
</div>
99+
<p className="text-sm text-center mb-6">
100+
Level {level} ({experiencePoints} points)
101+
</p>
102+
{/* Chapter 1: First two missions in a row, the rest in a column */}
103+
{currentChapter === 1 ? (
76104
<>
77-
<div className="flex justify-between items-center w-full mb-6">
78-
<h1 className="text-xl font-bold">Chapter {currentChapter}</h1>
79-
<div className="flex space-x-4">
80-
<Button onClick={onPreviousChapter} disabled={currentChapter === 1}>
81-
Previous
82-
</Button>
83-
<Button
84-
onClick={onNextChapter}
85-
disabled={currentChapter === maxUnlockedChapter || experiencePoints < pointsForNextChapter}
86-
>
87-
Next
88-
</Button>
89-
</div>
90-
</div>
91-
<div className="flex-1 overflow-y-auto w-full">
92-
<div className="w-full bg-gray-700 rounded-full h-4 mb-6">
93-
<div
94-
className="bg-[#5FCBC3] h-4 rounded-full"
95-
style={{ width: `${(experiencePoints % 9) * 10.5}%` }}
96-
></div>
97-
</div>
98-
</div>
99-
<p className="text-sm text-center mb-6">
100-
Level {level} ({experiencePoints} points)
101-
</p>
102105
<div className="bg-gray-700 p-6 rounded-2xl w-full mb-6">
103106
<div className="grid grid-cols-2 gap-4 w-full">
104107
{missions.slice(0, 2).map((mission) => renderMission(mission))}
105108
</div>
106109
</div>
107-
<div className="grid gap-4 w-full mt-6">
110+
<div className="grid gap-4 w-full mt-6 overflow-y-auto max-h-[calc(100vh-200px)]">
108111
{missions.slice(2).map((mission) => renderMission(mission))}
109112
</div>
110113
</>
114+
) : (
115+
// For other chapters, all missions in a single column
116+
<div className="grid gap-4 w-full mt-6 overflow-y-auto max-h-[calc(100vh-200px)]">
117+
{missions.map((mission) => renderMission(mission))}
118+
</div>
111119
)}
112-
<AnimatePresence>
113-
{selectedMission && (
114-
<motion.div
115-
className="flex flex-col bg-[#1D2833]"
116-
initial={{ opacity: 0 }}
117-
animate={{ opacity: 1 }}
118-
exit={{ opacity: 0 }}
119-
>
120-
<div className="flex justify-between items-center p-4">
121-
<h3 className="text-xl font-semibold">{selectedMission.title}</h3>
122-
<Button onClick={() => setSelectedMission(null)}>Back</Button>
123-
</div>
124-
<div className="flex-1 overflow-auto">
125-
{selectedMission.internalComponent && <selectedMission.internalComponent />}
126-
</div>
127-
</motion.div>
128-
)}
129-
</AnimatePresence>
130-
</div>
120+
</>
121+
)}
122+
<AnimatePresence>
123+
{selectedMission && (
124+
<motion.div
125+
className="flex flex-col bg-[#1D2833]"
126+
initial={{ opacity: 0 }}
127+
animate={{ opacity: 1 }}
128+
exit={{ opacity: 0 }}
129+
>
130+
<div className="flex justify-between items-center p-4">
131+
<h3 className="text-xl font-semibold">{selectedMission.title}</h3>
132+
<Button onClick={() => setSelectedMission(null)}>Back</Button>
133+
</div>
134+
<div className="flex-1 overflow-auto">
135+
{selectedMission.internalComponent && <selectedMission.internalComponent />}
136+
</div>
137+
</motion.div>
138+
)}
139+
</AnimatePresence>
140+
</div>
131141
);
132142
};
133143

0 commit comments

Comments
 (0)