Skip to content

Commit

Permalink
Get User information
Browse files Browse the repository at this point in the history
  • Loading branch information
rrliang committed May 4, 2024
1 parent 5e4f54f commit 84e35de
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 352 deletions.
34 changes: 0 additions & 34 deletions src/app/carousel/getGames.jsx

This file was deleted.

2 changes: 1 addition & 1 deletion src/app/components/DrawerMenu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export default function DrawerMenu({user}) {
</Box>

{user && (<Box>
<Link as={NextLink} href={`/user/?user=`+username} passHref>
<Link as={NextLink} href={`user/?username=`+username} passHref>
<Button boxSize={"full"} height={10} >
Account
</Button>
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/Navbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export default function Nav({user}) {
src={avatarUrl}
/>
</MenuButton>
<MenuList alignItems={'center'}>
<MenuList alignItems={'center'} zIndex={"999"}>
<br />
<Center>
<Avatar
Expand Down
28 changes: 25 additions & 3 deletions src/app/page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,38 @@
import { useCallback, useEffect, useState } from "react";
import Carousel from "./carousel/index"
import createClient from "@/utils/supabase/client";
import GetGames from "./carousel/getGames";
import { Box, Container, Heading } from "@chakra-ui/react";

export default function Home() {

const supabase = createClient();
const [data, setData] = useState([]);

const allGames = useCallback(async () => {
try {
const { data: allGameData, error, status} = await supabase.from("games").select("*, profiles!inner(username)");

if (error && status !== 406) {
throw error;
}

if (data) {
setData(allGameData);
}
} catch (error) {
alert("Error loading games!");
console.log(error);
}
}, [supabase]);

useEffect(() => {
allGames();
}, [allGames]);

return (
<Box padding="50px">
<Container maxW='container.xl'>
<Heading color='#8fffb2'>Featured Games</Heading>
<Carousel />
<Carousel data={data}/>
</Container>
</Box>

Expand Down
Loading

0 comments on commit 84e35de

Please sign in to comment.