From 89efbba0311693d62bb6508529f73c1a13527ac0 Mon Sep 17 00:00:00 2001 From: Liam Arbuckle Date: Sun, 16 Apr 2023 21:14:30 +0800 Subject: [PATCH 01/16] =?UTF-8?q?=3D=F0=9F=AB=80=F0=9F=A6=BE=20=E2=86=9D?= =?UTF-8?q?=20Updating=20layout=20&=20order=20of=20operations=20for=20plan?= =?UTF-8?q?et=20user=20classification=20process?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .DS_Store | Bin 14340 -> 14340 bytes components/Core/Footer.tsx | 22 ++++ components/Core/Sidebar.jsx | 113 +++++++++++++++++- components/Gameplay/Planets/PlanetCard.tsx | 60 +++++++++- .../Gameplay/Planets/PlanetGalleryCard.tsx | 6 +- components/onboarding/index.tsx | 2 +- pages/governance/vote.jsx | 2 +- pages/planets/index.tsx | 11 +- pages/planets/planet.tsx | 66 ++++------ 9 files changed, 222 insertions(+), 60 deletions(-) diff --git a/.DS_Store b/.DS_Store index 171da95c586585acc77a59bf98d93e054e3501b0..118da2471fe7a0daeaa4d83375aa30f94d3f96dd 100644 GIT binary patch delta 53 zcmZoEXepTBdGU^hRb&}JTiY_7@6rBXJ#OCMpG_#kI9w?YoGK*nZvgTL$m5M2~H delta 207 zcmZoEXepTBpKU^hRb$YvgaY%WC(h7bmS1{WYMX3%5EWk~VN$xlwo$xmWnU=Uzn zV3eJlAyur)$56?T$WX+P$DqrQ3Z#n|@_|^7AqPmOqv~Kv-+V^uGRtOeg&bO$ex7AB IyTM;}0CeIoN&o-= diff --git a/components/Core/Footer.tsx b/components/Core/Footer.tsx index dd940ef0..a748b464 100644 --- a/components/Core/Footer.tsx +++ b/components/Core/Footer.tsx @@ -14,4 +14,26 @@ export default function Footer () { ) +} + +export function FooterPlanetPage () { + function editPlanet() { + if (/planets/.test(window.location.href)) { + alert("The URL contains the string 'URL'"); +} + } + + return ( +
+ + + +
+ ) } \ No newline at end of file diff --git a/components/Core/Sidebar.jsx b/components/Core/Sidebar.jsx index e3f25b39..fca76984 100644 --- a/components/Core/Sidebar.jsx +++ b/components/Core/Sidebar.jsx @@ -51,7 +51,23 @@ const CoreSidebar = forwardRef(({ showNav }, ref) => { - + +
+
+ +
+
+

Planets

+
+
+ + {/*
{

ORCID

- +
{

Shipyard

- + */}
{ const router = useRouter(); + return ( +
+
+ + signal kinetics logo + +
+ +
+ +
+
+ +
+
+

Home

+
+
+ + +
+
+ +
+
+

Planets

+
+
+ + +
+
+ +
+
+

Vote

+
+
+ +
+
+ ); +}); + +CoreSidebar.displayName = "SideBar"; + +export const GameplaySidebarFull = forwardRef(({ showNav }, ref) => { + const router = useRouter(); + return (
@@ -204,6 +291,22 @@ export const GameplaySidebar = forwardRef(({ showNav }, ref) => {
+ +
+
+ +
+
+

Vote

+
+
+
{
); -}); - -CoreSidebar.displayName = "SideBar"; \ No newline at end of file +}); \ No newline at end of file diff --git a/components/Gameplay/Planets/PlanetCard.tsx b/components/Gameplay/Planets/PlanetCard.tsx index 3e4206be..17f1517f 100644 --- a/components/Gameplay/Planets/PlanetCard.tsx +++ b/components/Gameplay/Planets/PlanetCard.tsx @@ -14,6 +14,8 @@ export function PlanetCard ({ activeTab, planetId }) { const session = useSession(); const [planetUri, setPlanetUri] = useState(); const [planetOwner, setPlanetOwner] = useState(null); + const [username, setUsername] = useState(''); + const [playerReputation, setPlayerRepuation] = useState(); function fetchPlanet () { supabase.from('planetsss') .select("*") @@ -49,11 +51,45 @@ export function PlanetCard ({ activeTab, planetId }) { } } + const updatePlayerReputation = async () => { + let newReputation = playerReputation + 1; + setPlayerRepuation(newReputation); + + try { + const { data, error } = await supabase + .from('profiles') + .update([ + { reputation: newReputation, } + ]) + .eq('id', session?.user?.id); + + if (error) throw error; + } catch (error: any) { + console.log(error); + } + } + + const claimPlanet = async () => { + try { + const { data, error } = await supabase + .from('planetsss') + .update([ + { owner: session?.user?.id, /*userId: username*/ } + ]) + .eq('id', planetId); + updatePlayerReputation(); // Do this for posts, journals as well + + if (error) throw error; + } catch (error: any) { + console.log(error); + } + } + return (
{activeTab === 'planet' && (
- Planet Name +