Skip to content

Commit 7dc69fb

Browse files
committed
🪗〠 ↝ [SSC-45 SSC-49 SSC-50 SSM-37 SSM-68]: Fixing bugs & content, accessibility for PH project & improving flow for next mission/project sets
1 parent b5dff29 commit 7dc69fb

File tree

10 files changed

+279
-314
lines changed

10 files changed

+279
-314
lines changed

‎components/Structures/IndividualStructure.tsx

+22-16
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState } from "react";
1+
import React, { useEffect, useRef, useState } from "react";
22
import { Dialog, DialogContent, DialogTitle } from "@/components/ui/dialog";
33
import { Button } from "@/components/ui/button";
44
import { Badge } from "@/components/ui/badge";
@@ -45,8 +45,9 @@ const IndividualStructure: React.FC<IndividualStructureProps> = ({
4545
}) => {
4646
const [expanded, setExpanded] = useState(false);
4747
const [activeComponent, setActiveComponent] = useState<React.ReactNode | null>(null);
48-
const [modalSizePercentage, setModalSizePercentage] = useState(100); // Default to 100%
48+
const [modalSizePercentage, setModalSizePercentage] = useState(100);
4949
const [tooltip, setTooltip] = useState<{ visible: boolean; text: string } | null>(null);
50+
const modalRef = useRef<HTMLDivElement>(null);
5051

5152
const handleActionClick = (actionText: string, component: React.ReactNode, sizePercentage: number = 100) => {
5253
setActiveComponent(component);
@@ -75,10 +76,23 @@ const IndividualStructure: React.FC<IndividualStructureProps> = ({
7576
};
7677
};
7778

79+
useEffect(() => {
80+
const handleOutsideClick = (event: MouseEvent) => {
81+
if (modalRef.current && !modalRef.current.contains(event.target as Node)) {
82+
handleClose();
83+
setActiveComponent(null)
84+
}
85+
};
86+
87+
document.addEventListener("mousedown", handleOutsideClick);
88+
return () => {
89+
document.removeEventListener("mousedown", handleOutsideClick);
90+
};
91+
}, [handleClose]);
92+
7893
return (
7994
<Dialog defaultOpen>
8095
<div className="relative transition-all duration-500 ease-in-out">
81-
{/* Main Modal */}
8296
{!activeComponent && (
8397
<DialogContent
8498
className="p-4 rounded-3xl text-white max-w-xl mx-auto"
@@ -199,19 +213,10 @@ const IndividualStructure: React.FC<IndividualStructureProps> = ({
199213

200214
{activeComponent && (
201215
<DialogContent
202-
className="p-4 rounded-3xl text-white mx-auto"
203-
style={{
204-
background: 'linear-gradient(135deg, rgba(44, 79, 100, 0.7), rgba(95, 203, 195, 0.7))',
205-
width: '90%',
206-
height: '90%',
207-
maxWidth: '100%',
208-
maxHeight: '90%',
209-
position: 'fixed',
210-
top: '50%',
211-
left: '50%',
212-
transform: 'translate(-50%, -50%)',
213-
overflow: 'hidden',
214-
}}
216+
className={`p-4 rounded-3xl text-white mx-auto
217+
w-[90%] h-[90%] max-w-full max-h-[95%] fixed top-1/2 left-1/2
218+
transform -translate-x-1/2 -translate-y-1/2
219+
overflow-hidden bg-[#1D2833]/90`}
215220
>
216221
<DialogTitle></DialogTitle>
217222
<div className="relative flex flex-col items-center justify-center h-full">
@@ -227,6 +232,7 @@ const IndividualStructure: React.FC<IndividualStructureProps> = ({
227232
</div>
228233
</DialogContent>
229234
)}
235+
230236
</div>
231237
</Dialog>
232238
);

‎components/Structures/Missions/Astronomers/PlanetHunters/CommentForm.tsx

-94
This file was deleted.

‎app/starnet/feed/telescope/planetHunters/page.tsx ‎components/Structures/Missions/Astronomers/PlanetHunters/PHVote.tsx

+3-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ interface Classification {
1616
classificationConfiguration: any | null;
1717
};
1818

19-
export default function StarnetVotePlanetClassifictions() {
19+
export default function VotePlanetClassifictions() {
2020
const supabase = useSupabaseClient();
2121
const session = useSession();
2222

@@ -37,7 +37,7 @@ export default function StarnetVotePlanetClassifictions() {
3737
const { data, error } = await supabase
3838
.from('classifications')
3939
.select('*')
40-
.eq('author', session.user.id)
40+
// .eq('author', session.user.id)
4141
.eq('classificationtype', 'planet')
4242
.order('created_at', { ascending: false }) as { data: Classification[]; error: any };
4343

@@ -102,7 +102,6 @@ export default function StarnetVotePlanetClassifictions() {
102102
};
103103

104104
return (
105-
<StarnetLayout>
106105
<div className="space-y-8">
107106
{loading ? (
108107
<p>Loading classifications...</p>
@@ -122,12 +121,11 @@ export default function StarnetVotePlanetClassifictions() {
122121
images={classification.images || []}
123122
anomalyId={classification.anomaly}
124123
classificationConfig={classification.classificationConfiguration}
125-
classificationType={classification.classificationtype} // Pass classificationtype to child
124+
classificationType={classification.classificationtype}
126125
onVote={() => handleVote(classification.id, classification.classificationConfiguration)}
127126
/>
128127
))
129128
)}
130129
</div>
131-
</StarnetLayout>
132130
);
133131
};

0 commit comments

Comments
 (0)