// SpaceForum.jsx import React, { useState } from "react"; import { Card, CardContent } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { ArrowUp, ArrowDown } from "lucide-react"; const initialPosts = [ { id: 1, title: "Your favorite sci-fi universe?", body: "Let's discuss our favorite sci-fi settings and why!", votes: 12, comments: ["Mass Effect has the best lore.", "I love Star Wars for the variety of planets!"], user: "astroFan01" }, { id: 2, title: "What would your space station look like?", body: "Design your dream sci-fi outpost.", votes: 7, comments: ["Lots of greenery and curved windows!", "A cyberpunk aesthetic for sure."], user: "nebulaQueen" }, ]; const nsfwWords = ["fuck", "shit", "bitch", "asshole", "dick", "pussy", "cock", "cum", "rape", "porn", "nsfw"]; function isNSFW(text) { const lowerText = text.toLowerCase(); return nsfwWords.some(word => lowerText.includes(word)); } export default function SpaceForum() { const [posts, setPosts] = useState(initialPosts); const [newPost, setNewPost] = useState({ title: "", body: "" }); const [user, setUser] = useState("guest"); const [customTheme, setCustomTheme] = useState("cyan"); const handleVote = (id, delta) => { setPosts((prev) => prev.map((post) => post.id === id ? { ...post, votes: post.votes + delta } : post ) ); }; const handlePost = () => { if (!newPost.title || !newPost.body) return; if (isNSFW(newPost.title) || isNSFW(newPost.body)) { alert("Your post contains inappropriate language and cannot be submitted."); return; } const newEntry = { id: posts.length + 1, title: newPost.title, body: newPost.body, votes: 0, comments: [], user: user }; setPosts([newEntry, ...posts]); setNewPost({ title: "", body: "" }); }; const handleLogin = () => { const input = prompt("Enter your username:"); if (input) setUser(input); }; return (

🪐 Cosmic Forum

Signed in as: {user}
setNewPost({ ...newPost, title: e.target.value })} />