Skip to content

Commit

Permalink
🤖🎂 ↝ [SSC-13 SSM-15 SSC-26]: Adding new transit methods/input form an…
Browse files Browse the repository at this point in the history
…d three to client
  • Loading branch information
Gizmotronn committed Oct 10, 2024
1 parent 5abc5e7 commit 4e8950b
Show file tree
Hide file tree
Showing 12 changed files with 16,650 additions and 2,101 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@ docker exec -it starsailors_db psql -U postgres
\l
docker compose build flaskapp
docker compose up -d flaskapp
```
```

<!--
Add "@ducanh2912/next-pwa": "^10.2.9", back
-->
10 changes: 10 additions & 0 deletions app/api/gameplay/missions/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,16 @@ const missions: Mission[] = [
id: 2000000122,
name: 'Make your first Plankton Portal classification',
},

// Chapter 2/3 bridge - finding new (exo-)planet
{
id: 30000001,
name: "Classify and discover a new planet", // Requires classification and period/t0
},
{
id: 300000012,
name: "Visit your new planet",
},
];

export async function GET(req: NextRequest) {
Expand Down
96 changes: 4 additions & 92 deletions app/tests/page.tsx
Original file line number Diff line number Diff line change
@@ -1,103 +1,15 @@
"use client";

import React, { useEffect, useState } from "react";
import { PostCardSingle } from "@/content/Posts/PostSingle";
import { useSession, useSupabaseClient } from "@supabase/auth-helpers-react";
import StarnetLayout from "@/components/Layout/Starnet";
import { ExoplanetTransitHunter } from "@/components/Projects/Telescopes/ExoplanetC23";

export default function TestPage() {
const supabase = useSupabaseClient();
const session = useSession();

const [classifications, setClassifications] = useState<any[]>([]);
const [loading, setLoading] = useState<boolean>(true);
const [error, setError] = useState<string | null>(null);

useEffect(() => {
const fetchClassifications = async () => {
if (!session?.user) {
setError('User session not found.');
setLoading(false);
return;
}

setLoading(true);
setError(null);
try {
const { data, error } = await supabase
.from('classifications')
.select('*')
.eq('author', session.user.id);

if (error) throw error;

// Extract image URLs from media
const processedData = data.map((classification) => {
const media = classification.media;
let images: string[] = [];

if (Array.isArray(media) && media.length === 2 && typeof media[1] === 'string') {
images.push(media[1]); // Array formatted media
} else if (media && media.uploadUrl) {
images.push(media.uploadUrl); // Object formatted media
}

return { ...classification, images };
});

setClassifications(processedData);
} catch (error) {
console.error('Error fetching classifications:', error);
setError('Failed to load classifications.');
} finally {
setLoading(false);
}
};

fetchClassifications();
}, [session]);

if (loading) return <p>Loading...</p>;
if (error) return <p>{error}</p>;
if (classifications.length === 0) return <p>No classifications found for this user.</p>;

return (
<StarnetLayout>
<h2 className="text-2xl font-semibold mb-6 text-primary">Latest Community Discoveries</h2>
{classifications.map((classification, index) => (
<div key={classification.id} className="relative mb-8">
<PostCardSingle
title={classification.content || "Untitled"}
author={classification.author}
content={classification.content}
votes={0}
comments={0}
category={"General"}
tags={[]}
images={classification.images}
/>
{index < classifications.length - 1 && (
<div className="squiggly-divider">
<div
className="squiggly-shape"
style={{
left: `${Math.random() * 80 + 10}%`,
top: `${Math.random() * 60}%`,
transform: `rotate(${Math.random() * 360}deg)`,
}}
/>
<div
className="squiggly-shape"
style={{
left: `${Math.random() * 80 + 10}%`,
top: `${Math.random() * 60}%`,
transform: `rotate(${Math.random() * 360}deg)`,
}}
/>
</div>
)}
</div>
))}
<div className="1">
<ExoplanetTransitHunter />
</div>
</StarnetLayout>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import React, { useState, useEffect } from "react";
import { useSupabaseClient, useSession } from "@supabase/auth-helpers-react";
import { useActivePlanet } from "@/context/ActivePlanet";
import { useProfileContext } from "@/context/UserProfile";
import { ClassificationOutput } from "@/components/Projects/(classifications)/ClassificationResults";
import { UserAvatarNullUpload } from "@/components/Profile/Avatar";
// import { ClassificationOutput } from "@/components/Projects/(classifications)/ClassificationResults";
// import { UserAvatarNullUpload } from "@/components/Profile/Avatar";

export interface ClassificationOption {
id: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import React, { useEffect, useState } from "react";
import { useSupabaseClient, useSession } from "@supabase/auth-helpers-react";
import { useActivePlanet } from "@/context/ActivePlanet";
import { UserAvatarNullUpload } from "@/components/Profile/Avatar";
// import { UserAvatarNullUpload } from "@/components/Profile/Avatar";
import IntroduceUserToResearch from "@/components/(scenes)/chapters/(onboarding)/initialiseResearch";

interface ClassificationFormProps {
Expand Down Expand Up @@ -259,13 +259,13 @@ export const NestQuestGoClassificationForm: React.FC<ClassificationFormProps> =
<div className="flex gap-4">
<div className="flex flex-col gap-2 w-2/3">
<div className="flex gap-4 mb-4">
<UserAvatarNullUpload
{/* <UserAvatarNullUpload
url={avatar_url}
size={64}
onUpload={(filePath: string) => {
setAvatarUrl(filePath);
}}
/>
/> */}
</div>

{currentTextArea >= 1 && (
Expand Down
Loading

0 comments on commit 4e8950b

Please sign in to comment.