-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🪀🌼 ↝ [SGV2-10 SGV2-14 SGV2-2]: Setting up a test to automate 'mission…
…' completion
- Loading branch information
1 parent
6d1795a
commit 7e0cf70
Showing
3 changed files
with
74 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { useSession, useSupabaseClient } from "@supabase/auth-helpers-react"; | ||
import React, { useEffect, useState } from "react"; | ||
|
||
export function PickYourPlanet() { | ||
const supabase = useSupabaseClient(); | ||
const session = useSession(); | ||
|
||
const [profile, setProfile] = useState<any>(null); | ||
const [loading, setLoading] = useState(true); | ||
|
||
useEffect(() => { | ||
if (session?.user?.id) { | ||
supabase | ||
.from("profiles") | ||
.select() | ||
.eq("id", session.user.id) | ||
.then((result) => { | ||
if (result.data && result.data.length > 0) { | ||
setProfile(result.data[0]); | ||
} | ||
setLoading(false); | ||
}) | ||
} else { | ||
setLoading(false); | ||
} | ||
}, [session]); | ||
|
||
if (loading) { | ||
return <p>Loading...</p>; | ||
} | ||
|
||
if (!session) { | ||
return <p>Please sign in</p>; | ||
} | ||
|
||
if (profile) { | ||
return ( | ||
<div> | ||
<p>Name: {profile.username}</p> | ||
</div> | ||
); | ||
}; | ||
|
||
return <p>No profile found</p>; | ||
}; |
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,28 @@ | ||
import { PickYourPlanet } from "../../components/Gameplay/Chapter 1/onboarding"; | ||
import Layout from "../../components/_Core/Section/Layout"; | ||
|
||
export default function OnboardingTest() { | ||
|
||
return ( | ||
<Layout> | ||
<style jsx global> | ||
{` | ||
body { | ||
background: url('') center/cover; | ||
background-attachment: fixed; | ||
} | ||
@media only screen and (max-width: 767px) { | ||
.planet-heading { | ||
color: white; | ||
font-size: 24px; | ||
text-align: center; | ||
margin-bottom: 10px; | ||
} | ||
} | ||
`} | ||
</style> | ||
<PickYourPlanet /> | ||
</Layout> | ||
); | ||
}; |