Skip to content

Commit

Permalink
🎼🥑 ↝ [SSP-24 SSM-20]: New planet/anomaly setting backgrounds
Browse files Browse the repository at this point in the history
  • Loading branch information
Gizmotronn committed Oct 9, 2024
1 parent b12f032 commit 8408b60
Show file tree
Hide file tree
Showing 20 changed files with 329 additions and 100 deletions.
Binary file modified .DS_Store
Binary file not shown.
5 changes: 2 additions & 3 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { bgImage, backgroundImages } from "@/constants/backgrounds";
import { Analytics } from "@vercel/analytics/react"
import { MissionProvider } from "@/context/MissionContext";
import TutorialPopup from "../content/Dialogue/helpButton";
import { ThemeProvider } from "@/components/themeProvider";
// import { CreateStructureWithItemRequirementinfo } from "@/components/Gameplay/Inventory/Structures/Structure";

export default function RootLayout({ children }: { children: React.ReactNode }) {
Expand Down Expand Up @@ -69,7 +68,7 @@ export default function RootLayout({ children }: { children: React.ReactNode })
</Head>
<body>
<SessionContextProvider supabaseClient={supabaseClient} initialSession={null}>
<ThemeProvider attribute="class" defaultTheme="system" enableSystem>
{/* <ThemeProviders attribute="class" defaultTheme="system" enableSystem> */}
<ActivePlanetProvider>
{/* <MissionProvider> */}
<UserAnomaliesProvider>
Expand All @@ -81,7 +80,7 @@ export default function RootLayout({ children }: { children: React.ReactNode })
</UserAnomaliesProvider>
{/* </MissionProvider> */}
</ActivePlanetProvider>
</ThemeProvider>
{/* </ThemeProviders> */}
</SessionContextProvider>
</body>
</html>
Expand Down
6 changes: 6 additions & 0 deletions app/scenes/earth/moon/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,16 @@ const MoonView: React.FC = () => {
};

return (
<div className="min-h-screen w-full flex flex-col">
<img
className="absolute inset-0 w-full h-full object-cover"
src="/assets/Backdrops/Moon.png"
/>
<div className="relative min-h-screen">
<InitialisePlanet planetId={11} />
<PlanetStructures />
</div>
</div>
);
};

Expand Down
6 changes: 6 additions & 0 deletions app/scenes/earth/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,15 @@ const EarthView: React.FC = () => {
const session = useSession();

return (
<div className="min-h-screen w-full flex flex-col">
<img
className="absolute inset-0 w-full h-full object-cover"
src="/assets/Backdrops/Mercury.png"
/>
<div className="relative min-h-screen">
<EarthStructures />
</div>
</div>
);
};

Expand Down
6 changes: 6 additions & 0 deletions app/scenes/mars/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,16 @@ const MarsView: React.FC = () => {
};

return (
<div className="min-h-screen w-full flex flex-col">
<img
className="absolute inset-0 w-full h-full object-cover"
src="/assets/Backdrops/Mars.png"
/>
<div className="relative min-h-screen">
<InitialisePlanet planetId={40} />
<MarsStructures />
</div>
</div>
);
};

Expand Down
8 changes: 7 additions & 1 deletion app/scenes/mercury/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,17 @@ const MercuryView: React.FC = () => {
};

return (
<div className="min-h-screen w-full flex flex-col">
<img
className="absolute inset-0 w-full h-full object-cover"
src="/assets/Backdrops/Mercury.png"
/>
<div className="relative min-h-screen">
<InitialisePlanet planetId={10} />
<PlanetStructures />
</div>
</div>
);
};
};

export default MercuryView;
6 changes: 6 additions & 0 deletions app/scenes/venus/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,16 @@ const VenusView: React.FC = () => {
};

return (
<div className="min-h-screen w-full flex flex-col">
<img
className="absolute inset-0 w-full h-full object-cover"
src="/assets/Backdrops/Venus.png"
/>
<div className="relative min-h-screen">
<InitialisePlanet planetId={20} />
<PlanetStructures />
</div>
</div>
);
};

Expand Down
64 changes: 57 additions & 7 deletions app/tests/page.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,65 @@
"use client";

import { DiscoveryCardsByUserAndAnomaly } from "@/components/Projects/(classifications)/Collections/ByAnomaly";
import SwitchPlanet from "@/components/(scenes)/travel/SolarSystem";
import AllClassifications from "@/content/Starnet/YourClassifications";
import React from "react";
import React, { useEffect, useState } from "react";
import { PostCardSingle } from "@/content/Posts/PostSingle";
import { useSession, useSupabaseClient } from "@supabase/auth-helpers-react";

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;

setClassifications(data);
} 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 (
<div>
<SwitchPlanet />
<DiscoveryCardsByUserAndAnomaly anomalyId={40} />
{classifications.map((classification) => (
<PostCardSingle
key={classification.id}
title={classification.content || "Untitled"}
author={classification.author}
content={classification.content}
votes={0}
comments={0}
category={"General"}
tags={[]}
/>
))}
</div>
);
};
}
6 changes: 1 addition & 5 deletions components/(scenes)/planetScene/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ const PlanetViewLayout: React.FC<PlanetViewLayoutProps> = ({ children }) => {
>
Close
</button>
)}
)}
</div>
) : null}
</div>
Expand Down Expand Up @@ -162,10 +162,6 @@ export const EarthViewLayout: React.FC<PlanetViewLayoutProps> = ({

return (
<div className="min-h-screen w-full flex flex-col">
<img
className="absolute inset-0 w-full h-full object-cover"
src="/assets/Backdrops/Earth.png"
/>
<div className="relative flex flex-1">
<div className="relative flex flex-col flex-1">
{children.slice(0, 2).map((child, index) => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function DiscoveryCardsByUserAndAnomaly({ anomalyId }: DiscoveryCardsByUs
if (totalError) {
console.error('Error fetching total classifications:', totalError);
throw totalError;
}
};

setTotalClassifications(totalCount);

Expand All @@ -54,7 +54,7 @@ export function DiscoveryCardsByUserAndAnomaly({ anomalyId }: DiscoveryCardsByUs
if (userError) {
console.error('Error fetching user classifications count:', userError);
throw userError;
}
};

setUserClassificationsCount(userCount);

Expand Down
2 changes: 1 addition & 1 deletion components/Projects/(classifications)/PostForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import React, { useEffect, useState } from "react";
import { useSupabaseClient, useSession } from "@supabase/auth-helpers-react";
import { useActivePlanet } from "@/context/ActivePlanet";
import { useProfileContext } from "@/context/UserProfile";
import UserAvatar, { UserAvatarNullUpload } from "@/components/Profile/Avatar";
import { ClassificationOutput } from "./ClassificationResults";
import IntroduceUserToResearch from "../../(scenes)/chapters/(onboarding)/initialiseResearch";

Expand All @@ -22,6 +21,7 @@ import { zoodexSouthCoastFaunaRecovery,
zoodexBurrowingOwlClassificationOptions,
sunspotsConfigurationTemporary
} from '@/content/Classifications/Options';
import UserAvatar, { UserAvatarNullUpload } from "@/components/Profile/Avatar";

interface ClassificationFormProps {
anomalyType: string;
Expand Down
9 changes: 0 additions & 9 deletions components/themeProvider.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion content/(anomalies)/(planets)/PlanetStructures.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const PlanetStructures: React.FC = () => {
atmosphere: InventoryStructureItem[],
surface: InventoryStructureItem[]
) => {
setOrbitalStructures(orbital);
setOrbitalStructures(orbital);
setAtmosphereStructures(atmosphere);
setSurfaceStructures(surface);
};
Expand Down
67 changes: 67 additions & 0 deletions content/Posts/PostSingle.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
"use client";

import { useEffect, useState } from "react";
import { Card, CardContent, CardFooter, CardHeader, CardTitle } from "@/components/ui/card";
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
import { Button } from "@/components/ui/button";
import { ThumbsUp, MessageSquare, GitFork } from "lucide-react";
import { Badge } from "@/components/ui/badge";

interface PostCardSingleProps {
title: string;
author: string;
content: string;
votes: number;
comments: number;
category: string;
tags: string[];
};

export function PostCardSingle({ title, author, content, votes, comments, category, tags }: PostCardSingleProps) {
const [voteCount, setVoteCount] = useState(votes);
const handleVote = () => {
setVoteCount(prevCount => prevCount + 1);
};

return (
<Card className="w-full max-w-2xl mx-autp my-8 squiggly-connector">
<CardHeader>
<div className="flex items-center space-x-4">
<Avatar>
<AvatarImage src={`https://api.dicebear.com/6.x/initials/svg?seed=${author}`} />
<AvatarFallback>{author[0]}</AvatarFallback>
</Avatar>
<div>
<CardTitle>{title}</CardTitle>
<p className="text-sm text-muted-foreground"> by {author} </p>
</div>
</div>
</CardHeader>
<CardContent>
<div className="mb-4">
<Badge variant="secondary" className="mr-2">{category}</Badge>
{tags.map((tag, index) => (
<Badge key={index} variant="outline" className="mr-2">{tag}</Badge>
))}
</div>
<p>{content}</p>
</CardContent>
<CardFooter className="flex justify-between">
<Button variant="ghost" size="sm" onClick={handleVote}>
<ThumbsUp className="mr-2 h-4 w-4" />
{voteCount}
</Button>
<Button variant="ghost" size="sm">
<MessageSquare className="mr-2 h-4 w-4" />
{comments}
</Button>
<Button variant="ghost" size="sm">
<GitFork className="mr-2 h-4 w-4" />
Fork
</Button>
</CardFooter>
<div className="squiggly-shape" style={{ left: '-15px', top: '50%' }}></div>
<div className="squiggly-shape" style={{ right: '-15px', bottom: '-15px' }}></div>
</Card>
);
};
Loading

0 comments on commit 8408b60

Please sign in to comment.