-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🎼🥑 ↝ [SSP-24 SSM-20]: New planet/anomaly setting backgrounds
- Loading branch information
1 parent
b12f032
commit 8408b60
Showing
20 changed files
with
329 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
); | ||
}; |
Oops, something went wrong.