Skip to content

Commit 8b5117c

Browse files
committed
πŸ§πŸ€·πŸ»β€β™‚οΈ ↝ and I'm feeling good. [ SGV2-8 // FCDB-6 ]
1 parent edb7e68 commit 8b5117c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+133
-419
lines changed

β€Žcomponents/Authentication/LoginModal.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ReactNode, useEffect } from 'react';
22
// import { useHistory } from 'react-router-dom';
33
import Link from 'next/link';
4-
import Layout from '../Core/Section/Layout';
4+
import Layout from '../_Core/Section/Layout';
55
import { Auth, ThemeSupa } from '@supabase/auth-ui-react';
66
import { useSession, useSupabaseClient } from '@supabase/auth-helpers-react';
77
import { useRouter } from 'next/router';

β€Žcomponents/Content/Archive/ArchivedInventory.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from "react";
22
import { useSession, useSupabaseClient } from "@supabase/auth-helpers-react";
3-
import Layout from "../../Core/Section/Layout";
3+
import Layout from "../../_Core/Section/Layout";
44
import OwnedPlanetsList from "./UserOwnedPlanets"; // Potentially this should be in a lists component dir
55
import OwnedItemsList from "../Inventory/UserOwnedItems";
66
import MySpaceships from "./Vehicles/MySpaceships";

β€Žcomponents/Content/ClassificationFeed.tsx β€Žcomponents/Content/Classify/ClassificationFeed.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { useEffect, useState } from "react";
22
import { useSession, useSupabaseClient, SupabaseClient } from "@supabase/auth-helpers-react";
3-
import CardForum from "./DiscussCard";
3+
import CardForum from "../../_Core/ui/Content/DiscussCard";
44

55
export function ClassificationFeedForIndividualPlanet(planetId, backgroundColorSet) {
66
const supabase: SupabaseClient = useSupabaseClient();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
import { useSession, useSupabaseClient } from "@supabase/auth-helpers-react";
2+
import { Button } from "../../_Core/ui/Button";
3+
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "../../_Core/ui/Card";
4+
import { Form, FormControl, FormField, FormItem, FormMessage } from "../../_Core/ui/Form";
5+
import { Textarea } from "../../_Core/ui/TextArea";
6+
import { useToast } from "../../_Core/ui/use-toast";
7+
import { zodResolver } from "@hookform/resolvers/zod";
8+
import { VenetianMask } from "lucide-react";
9+
import React, { useContext, useEffect, useState} from "react";
10+
import { useForm } from "react-hook-form";
11+
import { UserContext } from "../../../context/UserContext";
12+
import { useRouter } from "next/router";
13+
import { Avatar, AvatarFallback } from "../../_Core/ui/Avatar";
14+
import { AvatarImage } from "@radix-ui/react-avatar";
15+
16+
// -----------
17+
import PostFormCardAnomalyTag from "./AnomalyPostFormCard"; // This is important -> this file is for post creation not specifically for (referencing components on top of anomalies instead) classifications. Anomaly is for posts as classifications
18+
import { ClimbingBoxLoader } from "react-spinners";
19+
// -----------
20+
21+
type TProps = {
22+
category_id: "1" | "2",
23+
openCreateMenu: boolean;
24+
setOpenCreateMenu: (value: React.SetStateAction<boolean>) => void;
25+
setCreatedPost: (value: React.SetStateAction<boolean>) => void;
26+
};
27+
28+
// Look into methods to engage resource gathering with the lightcurves, make it a scrollable feed with planet content, show how the curves lead into the rover.
29+
30+
export function RoverContentPostForm( { metadata, imageLink, sector } ) {
31+
const supabase = useSupabaseClient();
32+
const session = useSession();
33+
34+
const [postContent, setPostContent] = useState('');
35+
const [media, setMedia] = useState([]);
36+
37+
function createRoverClassification() {
38+
supabase
39+
.from('contentROVERIMAGES')
40+
.insert({
41+
author: session?.user?.id,
42+
metadata: metadata,
43+
imageLink: imageLink,
44+
content: postContent,
45+
media: media,
46+
sector: sector,
47+
},);
48+
};
49+
50+
const handlePostSubmit = async () => {
51+
if (postContent) {
52+
const user = session?.user?.id;
53+
if (user) {
54+
const response = await supabase.from('contentROVERIMAGES').upsert([
55+
{
56+
author: user,
57+
metadata: metadata,
58+
imageLink: imageLink,
59+
// planet: '1', // Change this when upserting in planets/[id].tsx
60+
// basePlanet: '1',
61+
content: postContent,
62+
media: null, // See slack comms
63+
sector: sector,
64+
},
65+
]);
66+
67+
if (response.error) {
68+
console.error(response.error);
69+
} else {
70+
setPostContent('');
71+
}
72+
}
73+
};
74+
}
75+
76+
return (
77+
<div className="flex gap-2">
78+
{/* <Avatar>
79+
<AvatarFallback>{session?.user?.id}</AvatarFallback>
80+
</Avatar> */}
81+
<textarea value={postContent} onChange={e => setPostContent(e.target.value)} className="grow p-3 h-24 rounded-xl" placeholder={"What do you think about this image"} />
82+
<div className="text-center">
83+
<button onClick={handlePostSubmit} className="text-black px-2 py-1 rounded-md">Share</button>
84+
</div>
85+
</div>
86+
);
87+
};

β€Žcomponents/Content/CreatePostForm.tsx

-191
This file was deleted.

β€Žcomponents/Content/Planets/Base/BasePlanetAllSectors.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { useEffect, useState } from "react";
22
import { useRouter } from "next/router";
33
import { useSupabaseClient, useSession } from "@supabase/auth-helpers-react";
4-
import Card from "../../../Core/Card";
4+
import Card from "../../../_Core/ui/Content/Card";
55

66
export default function BasePlanetSectors({ planetId }: { planetId: string }) {
77
const router = useRouter();

β€Žcomponents/Content/Planets/PlanetData/RandomRoverImage.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React, { useState, useEffect } from "react";
22
import axios from "axios";
33
import { useSession, useSupabaseClient } from "@supabase/auth-helpers-react";
4-
import Card from "../../../Core/Card";
5-
import { RoverContentPostForm } from "../../CreatePostForm";
4+
import Card from "../../../_Core/ui/Content/Card";
5+
import { RoverContentPostForm } from "../../Classify/CreatePostForm";
66

77
interface RoverImageCardProps {
88
roverImage: {

β€Žcomponents/Content/RoverData/RoverExplore.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ import { useRouter } from "next/router";
33
import React, { useEffect, useState } from "react";
44

55
// UI elements
6-
import { Button } from "../../Core/ui/Button";
7-
import { Checkbox } from "../../Core/ui/checkbox";
6+
import { Button } from "../../_Core/ui/Button";
7+
import { Checkbox } from "../../_Core/ui/checkbox";
88
// import { ResponsiveLine } from "@nivo/line";
9-
import { Input } from "../../Core/ui/input";
10-
import { Textarea } from "../../Core/ui/TextArea";
9+
import { Input } from "../../_Core/ui/input";
10+
import { Textarea } from "../../_Core/ui/TextArea";
1111

1212
export default function RoverExploreDesktop({ id }: { id: string }) {
1313
const supabase = useSupabaseClient();

0 commit comments

Comments
Β (0)